Ambient Cleanliness Meter

Made by Harshine Varuna Visvanathan, mspettel and Shithe Al-Hasan

An ambient device that detects and tracks a room’s usage as well as visually displaying this information.

Created: September 27th, 2019




Many rooms that need maintenance have to be periodically checked manually for cleaning. Cleaners can either come too early and waste time or too late, indicating that many people had to deal with a dirty room.




Our solution is to have a sensor that detects the usage of a room and is able to visually notify people of how many people have gone in and out. The ambient cleanliness meter can do that exactly.


Conceptual Design (What is does/How it works):


We created an ambient device that senses when people enter and exit a room and displays that information visually. It uses an infrared motion sensor and neopixel lighting. Whenever the IR sensor detects a person walking past it, a count goes up which is mapped to the neopixel lighting. Every time the count goes up by two, i.e, a person enters and leaves the room, one light out of sixteen turns on. As the count continues to increase, the amount of lights on increase and the color of all of the light goes from green to red. A button can be pushed to reset the count. The setting in which this device would work is a room with only one entrance. It counts the amount of people by a person going in and out. 




Imagine the device mounted at the side of a door, able to detect any movement through the door. The device would track the amount of people who have used the bathroom and cleaners could be notified by the red light that the bathroom may need to be cleaned. They can then push the button, resetting the count so that they can be notified again in the future. Instead of manually checking the bathroom, they would be able to see the light from afar, making their job more efficient.

Another usage could be to allow a group such as a university or company to track room usage. This information could allow them to be able to tell how useful a certain room is to people through the amount of people detected going into and out of a room. This could be a powerful tool in addition to user feedback, allowing a university or company to invest money and time into the most useful places.





// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>

// This #include statement was automatically added by the Particle IDE.
#include <SharpIR.h>
#include <math.h>
#define PIXEL_PIN D2
#define PIXEL_COUNT 20
#define PIXEL_TYPE WS2812B 

Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

//int led = D2
int IR = A0;
int button = D3;

float value = 0.0;
bool seeingPerson = false;

long lastCount = millis();

int passCount = 0;

void setup() {
    //pinMode(led, OUTPUT);
    pinMode(IR, INPUT);
    pinMode(button, INPUT_PULLDOWN);

void loop() {
    float volts = float(analogRead(IR))*0.0048828125;  
    int distance = 13 * pow(volts, -1); 
    value = (value * 0.7) + (distance * 0.3);
    if (digitalRead(D3)) {
        passCount = 0;
        for(int i = 0; i < strip.numPixels(); i++){
            strip.setPixelColor(i, 0, 0, 0);
    if (value <= 2){
        if(!seeingPerson && (millis() - lastCount > 2000)){
            lastCount = millis();
            if (passCount < 40) {
                if((passCount == 6) || (passCount == 16) || (passCount == 26) || (passCount == 36)){
                    passCount += 2;
            for(int i = 0; ((i < (passCount / 2)) && (i < PIXEL_COUNT)); i++){
                int fade = min(passCount * 6, 255);
                strip.setPixelColor(i, fade, 255- fade, 0);
            seeingPerson = true;
        seeingPerson = false;
Click to Expand



* The LED here represents the NeoPixel Strip




We ran into a few challenges that required some changes in the design.
-- The sensor originally detected random values which would affect our count.

-- The time between detections was too slow and people could pass by the sensor without being detected.
-- Detected gaps, such as the space between an arm and a body, would be counted as multiple people being counted from a 

     single person.

-- Some of the lights were not visible in the board, causing the no new light to be seen as the count went in sometimes.

We were able to fix these problems by changing the times between detections, stopping the count from increasing for the same person being detected continuously, and smoothing out the count, while skipping some light indexes in our code.

Bill of Parts:


IR Proximity Sensor: $ 9.00

Particle Argon: $ 27.00

NeoPixels Strip: $ 10.98

Switch: $ 1.35

Total: $ 48.33

Share this Project


49313 Designing for the Internet of Things

· 11 members

Thermostats, locks, power sockets, and lights are all being imbued with smarts making them increasingly aware and responsive to their environment and users. This course will chart the emergence of ...more


An ambient device that detects and tracks a room’s usage as well as visually displaying this information.