Swetha and Ticha-Bathroom Stall Counter
After hearing Golan’s story about the urinal timer in China, Swetha and I were inspired to do something that also involved bathrooms. Due to the awkwardness that surrounds the bathroom atmosphere and people’s acute concern for public hygiene, we decided to create a measuring device that interplays these two characteristics. Hence, the bathroom stall counter was created: this simple device tallies the number of people who have used a particular bathroom stall and displays the value on the SSD. To do this, we attached a magnet to the bathroom stall door and used a hall effect sensor to determine the magnet’s proximity, which allowed us to tell whether the stall was vacant or occupied.
This project is similar to the work of Adam Frelin ( http://adamfrelin.com/works/TapeFountains-11/ ) in which he dashes into public bathrooms and films himself creating interesting but inconvenient duck tape sculptures that change the function of the bathroom. We were inspired by his erratic but well-edited documentation and his way of interacting with this public space.
Although Swetha did a wonderful job at laser-cutting boxes for our two circuits, our devices still ended up having a ghetto-looking appearance when we secured the parts with masking tape. So, we decided to overplay the ghetto-ness by adorning the boxes with graffiti-esque typography and doodles, which turned out pretty nicely and complemented the bathroom’s atmosphere. Unfortunately, we were not able to mount both of the boxes we made because the sensor would not work for one of them unless it was connected to the laptop.
Below are the fritzing diagram and the code:
const int hallPin = 2;
const int buttonPin = 9;
int hallState = 0; // value read from the pot
int buttonState = 0;
int Value = 0;
int prevValue = 0;
// Enable one of these two #includes and comment out the other.
// Conditional #include doesn't work due to Arduino IDE shenanigans.
#include // Enable this line if using Arduino Uno, Mega, etc.
//#include // Enable this line if using Adafruit Trinket, Gemma, etc.
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_7segment matrix = Adafruit_7segment();
uint16_t counter = 0;
uint16_t countPeeps = 0;
void setup() {
#ifndef __AVR_ATtiny85__
#endif
matrix.begin(0x70);
pinMode(hallPin, INPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
hallState = digitalRead(hallPin);
buttonState = digitalRead(buttonPin);
// map it to the range of the analog out:
// change the analog out value:
if(buttonState == LOW){
counter = 0;
countPeeps = 0;
}
if (hallState == HIGH) {
Value =10;
}
else {
Value = 0;
if(prevValue == 10) {
countPeeps++;
}
}
prevValue = Value;
matrix.println(countPeeps);
if(countPeeps == 0) {
matrix.writeDigitNum(4, 0, false);
}
matrix.writeDisplay();
delay(10);
}