Back to Parent

Outcome


Problem Statement

One of my housemate's bedroom is at the first level of the house we live in. Unfortunately for him the bathroom is located at the second level. Every morning when he wakes up he has to walk up the stairs to check if the bathroom is vacant. If occupied, he has no choice but to wait outside or make his way back down. An IoT device that can tell him the occupancy status of the bathroom in the comfort of his bedroom which will help him time his trek to the bathroom every morning accordingly.

Goal

I will use a Hall effect sensor to detect if the bathroom door is open or closed. A push notification will be sent to his phone using IFTTT telling him that the bathroom is occupied when the door closes and vacant when the door opens again. He can now check the status of the bathroom in his bed without having to go up all the way to the second level. In edition an LED will indicate the occupancy status outside the bathroom for anyone else who passes by.

Parts

  • Hall effect sensor x 1
  • Photon x 1
  • Breadboard x 1
  • Jumper wires x 13
  • Resistors x 4

  • RGB LED x 1

  • Magnet x 1

  • Phone for IFTTT notifications

Show Advanced Options
Sketch 1 bb
Show Advanced Options

Process

Initially I set up the circuit and code to test the Hall Effect Sensor and make sure the output LED displayed the correct color.  After successfully accomplishing that task I modified the code for publishing and integration with IFTTT. During this process I realized that just publishing the event in the if-else loop was telling the photon to continuously publish 'Vacant' and 'Occupied' when the LED was green and red respectively. But I wanted the photon to publish the event just once in each case. I had to create two more variables to store and change the state of the hall effect sensor in order to publish the event just once. 

After publishing to the particle cloud I integrated the hack with IFTTT to send push notifications on my phone. This was relatively straightforward. I used the following tutorial : https://community.particle.io/t/beginner-tutorial-ifttt-monitor-a-device-status-trigger/9406?redirected=true

After getting the notifications to work the next step was to test it to see if it will actually work in the context it was made for. I hooked up the circuit board to the door frame and attached a magnet to the door and tested it. It actually worked!

Show Advanced Options
Show Advanced Options
Show Advanced Options
Particle console
Show Advanced Options
Show Advanced Options
Image uploaded from ios
Show Advanced Options
Image uploaded from ios %281%29
Show Advanced Options
Image uploaded from ios %282%29
Show Advanced Options

Reflections

With no prior coding experience, I found writing code very challenging. But once I got a hang of the logic and the syntax of certain functions it became relatively easier. The most fun and interesting part for me was coming up with the logic and flow of how this homehack would work. My original idea was to pair up the hall effect sensor with a motion detector to detect the presence of someone in the bathroom. At present, this hack works on the assumption that if there is no one in the bathroom the door must be left open. Integrating the motion detector will enable the hack to tell if the bathroom is vacant even if the door is closed. But a conversation with Daragh about my limited understanding of coding kept my ambitions in check. But I will definitely try to integrate the above mentioned functionality in the future.

Drop files here or click to select

You can upload files of up to 20MB using this form.