Tuesday, 29 January 2013

bathroom availability sensor


one to many relationship

The bathroom at work is a high traffic zone. Over 20 gentlemen use its services daily, and understandably experience regular delays. I whipped together a little gizmo (using an arduino, bluetooth serial module, photo sensor, bash, php, memcache, netcat, and ssh) that lets us see the bathroom's status in real time. 




run down

  1. Open browser to secret bathroom website
  2. Observe real time bathroom status

The arduino gets the photo sensor's ambient light reading and when it detects the light has been turned on or off, the bathroom status is updated to occupied or vacant accordingly. At this time, it writes the status to the serial port which is read by the bluetooth module. The module is paired with a workstation that pipes the bluetooth data through a series of scripts to a website that shows the bathroom's status in real time. The script updates a value stored on the server's memcache. Each client polls the server frequently and the server responds with cheap cached results. 

tldr if light is on, your browser shows: 

otherwise:


side note

If you actually look at the sensor, it's a terrible job. I had to switch the bluetooth's 4-pin connector around to fit in the box, but the transmit solder was bad so I ran a jumper cable. I have no idea what the resistor and LED are even doing there tbh. Once it was working, that was good enough for this project so I boxed it up and went with it.

No comments:

Post a Comment

Post a Comment