Spark Core Shower Room Door Sensor

UPDATE: I’ve got a newer post on an improved version of this project with lots of LEDs and 11 times more awesome. You might want to read that after this.

If you liked this then why not follow me on twitter, so you hear about new articles.


We’re a healthy and environmental bunch where I work and a lot of us cycle in. However, there is only one shower in the building and if you don’t sit near it then it’s a bit of a pain to turn up and find it engaged. So I decided to use my spark core to push the occupancy status to a web page.

spark core occupancy status animation

This seems to be a common problem and there are lots of similar hacks about. A distinguishing feature of this project is that it detects the bolt of the door lock so it is more accurate than just seeing if the door is shut. There was no easy visual indication that this particular door was locked before this. It also uses web socket push notifications to almost instantly show a change in status.

Time to prototype. Paper-clips, post-it notes, breadboards and gaffer tape are your friends here. The prototype was battery powered to avoid having to run cables but it has since been wired in. At this stage the core was programmed to switch off it’s wireless when no state change was occurring to save power.

2
3
4

This was then “productionised” with a JTAG programming board, some choc-block screw terminals and a small “enclosure” from a famous Swedish manufacturer.

5
6
7
8

All the code is on Github if you want to play with it. You’ll need to flash the firmware to the spark and add the core ID and OAuth token to the web page.

This all works really well but there are some improvements I could make. Even though the web page is not online, having the security token in it is not ideal and it expires occasionally. So the plan is to use a Raspberry Pi to receive the notifications and forward them on. This also means that I can connect my Blinky Tape to it and have another visual indicator as the LED that changes colour on the core is not that obvious.


UPDATE: I’ve got a newer post on an improved version of this project with lots of LEDs and 11 times more awesome. You might want to read that after this.

If you liked this then why not follow me on twitter, so you hear about new articles.

Submit / Comment on Hacker News