Ensuring consistent cleaning in shared office environments is essential, but manual tracking is inefficient. That’s why I built a smart tracker using Raspberry Pi, motion sensors, and Google Sheets to monitor real-time cleaning activity.
This post explains how I used simple hardware, Python, and IoT logic to develop a low-cost system — and how it complements reliable cleaning services teams to optimize performance and frequency.
Why Monitor Cleaning Activity?
It’s not about surveillance — it’s about:
- Verifying cleaning is happening at the right time
 - Adjusting frequency based on data
 - Avoiding over-cleaning low-traffic zones
 - Ensuring compliance in sensitive environments (like shared restrooms or breakrooms)
 
🔧 Hardware Setup
| Component | Function | 
|---|---|
| Raspberry Pi 4 | Core controller | 
| PIR motion sensor | Detect presence | 
| Magnetic door sensor | Detect entry/exit | 
| Buzzer (optional) | Alerts/notifications | 
| NFC reader (RC522) | Cleaner check-in | 
Wiring Overview
PIR sensor → GPIO 17
Door sensor → GPIO 27
Buzzer → GPIO 22
NFC → SPI (GPIO 10, 9, 11, etc.)
You’ll also need pull-up resistors or GPIO’s internal pull-ups enabled for door sensors.
Python Code – Basic Motion + Door Detection
import RPi.GPIO as GPIO
import time
MOTION_PIN = 17
DOOR_PIN = 27
BUZZER_PIN = 22
GPIO.setmode(GPIO.BCM)
GPIO.setup(MOTION_PIN, GPIO.IN)
GPIO.setup(DOOR_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUZZER_PIN, GPIO.OUT)
def alert(message):
    print(f"ALERT: {message}")
    GPIO.output(BUZZER_PIN, True)
    time.sleep(0.3)
    GPIO.output(BUZZER_PIN, False)
try:
    while True:
        if GPIO.input(DOOR_PIN) == GPIO.LOW:
            alert("Door opened")
        if GPIO.input(MOTION_PIN):
            alert("Motion detected")
        time.sleep(1)
except KeyboardInterrupt:
    GPIO.cleanup()
Google Sheets Integration (via gspread)
This logs events to a shared spreadsheet, which can be accessed remotely for performance review.
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import time
def connect_sheet():
    scope = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
    creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
    client = gspread.authorize(creds)
    return client.open("Cleaning Tracker").sheet1
sheet = connect_sheet()
def log_event(event):
    timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
    sheet.append_row([timestamp, event])
    print(f"Logged to sheet: {timestamp} - {event}")
Optional: NFC Authentication for Cleaners
Use an RC522 reader to confirm cleaner identity with NFC tags:
import MFRC522
import signal
reader = MFRC522.MFRC522()
def read_nfc():
    print("Place your card")
    while True:
        (status, TagType) = reader.MFRC522_Request(reader.PICC_REQIDL)
        if status == reader.MI_OK:
            (status, uid) = reader.MFRC522_Anticoll()
            if status == reader.MI_OK:
                uid_str = "-".join(str(i) for i in uid)
                print(f"Card read: {uid_str}")
                log_event(f"NFC Auth: {uid_str}")
                break
Practical Application
After deploying this system, we observed:
- Reduction in redundant cleaning by 40%
 - Clear records of entry/exit per zone
 - Better coordination with cleaning services
 - Integration with Slack alerts via Zapier for real-time monitoring
 
Privacy Considerations
No cameras are involved. All data logged is limited to motion, door activity, and optional NFC check-ins for internal use.
Final Thoughts
If you manage any kind of workspace where cleanliness matters, building a simple IoT solution like this gives you transparency, efficiency, and data-driven control.
And when paired with organized cleaning services Avondale, it can drastically improve both hygiene and service accountability.
Let me know in the comments if you want:
- Full repo on GitHub
 - Schematic wiring diagram (Fritzing)
 - A live dashboard template
 


    
Top comments (0)