With online school, I have trouble waking up on time as I do not have to wake up as early. Usually, I would wake up around 06:00, but now I wake up at 08:00 or 08:01, despite class starting at 08:00. My parents, on the other hand, wake up much earlier, so I thought about how I could use this to my benefit.
Routinely, my mom always first to use the bathroom to get ready, which is where this comes in handy. What if I could create a device that would indicate every time someone entered the bathroom? And thus, the idea of a laser tripwire was birthed.Other Uses
Not only can it be used to know if someone has been into the bathroom, but it can also be used as a minimalistic security system for one's room or perhaps even one's house (on a larger scale of course). Perhaps you would like to know when someone is entering your room, or every time a pet passes through.
The tripwire is quite simple. The photoresistor is set up so that it's always facing the laser emitter, and when it's in this neutral state, the led light connected to the circuit is turned off. However, when something or someone obstructs the light being emitted on the photoresistor, or when the resistor does not pick any light or minimal light, the led pin flashes.
When originally designing the circuit and putting the parts together, there was an error in the serial monitor. While the code ran perfectly, and all the parts were working, the serial monitor was projecting abnormal numbers that made the project virtually unworkable. The numbers were sporadic, regardless of whether or not the photoresistor was receiving light. As a result, the tripwire wouldn't work.
To fix this, the circuit needed a rearrangement of parts and the addition of a resistor, which ultimately ended up doing the trick.
Another issue that arose was surrounding the photoresistor. Because it's so tiny and there was so much ambient light, it made it hard for it not to detect light. To fix this, I added a toilet paper roll whenever experimenting so that there was always a dark place for the photoresistor to go so that the LED could flash.
Once the tripwire is set off, an email is sent to my school email to alert me that I have to wake up or that there is an intruder alert. This is done by inserting Particle.publish("Alert", "now"); in the program, which basically acts as a cue for IFTT to act on, as seen in the picture below.
This chain of commands leads to the emails below being sent.