This project was part of the Lane Tech HS Physical Computing Lab course. I created this project as part of the Home Automation / IoT project.
I decided to create a system that will automatically turn on the room light when my dog enters the room at night and there is no other light present in the room. It's purpose is to ensure my dog has enough light to move around the room safely, especially when no one else is home and it’s dark outside or in the house.
SetupI began by testing each of my components to ensure they functioned properly. I tested each individual component by spinning the servo to check if they were working correctly. First, I tested the motion sensor. If it returned a HIGH signal, I would spin the servo. Next, I tested the LDR sensor. After researching and testing the range of values it returns, I determined that, for the conditions of my project, a value less than 450 would signify no light present in the room. Finally, I used the Particle Time class, which requires you to set your time zone (Time Zone Documentation), to ensure the system would only operate after 4 PM (when Time.hour() returns 16). Once I confirmed that each of my components worked as intended, I moved on to the next step.
CompletionI combined all the components into one circuit and then determined that it would be best to use external power. As for the code, I created a single if statement that checked three conditions: if there was no light in the room, if the time was between 4 PM and midnight, and if motion was detected. If all three conditions were true, the servo would spin to flick the light switch.
Installation
For the installation, I used tape and cardboard. I attached the motion sensor to the wall at the height of my dog and the servo to the light switch. Final Product.
Comments
Please log in or sign up to comment.