Having a large backyard was a big plus when I moved into my house. It is great for the dog and the back deck allows us to have cookouts and socialize with friends. The drawback is that our exterior lighting is very poor. This was fixed when a floodlight was installed and brightened the entire back yard. The person who installed the switch however thought it was a good idea to put the backyard flood light switch in the garage which is all the way on the other side of the house. This was a great inconvenience but a problem we thought we could fix. This project explores the use of 3 particle photons, a motion sensor, photoresistor, a servo, and IFTTT to make the flood light an automatic, motion sensitive light.
This is the light we wanted to control. It is located in the back yard, but the switch is on the complete other side of the house which makes it a pain to go turn this light on when we need it. To expedite this process we put in a motion sensor near by to be the first step in the project.
To detect the motion of something passing by we used a particle photon connected to a PIR sensor to detect the motion of a person, pet, or intruder. The whole configuration was placed inside a weather resistant container to keep the outside out of all our electronics. Placement for this sensor as we wanted it to be in a location where there would be high foot traffic so then we would not have to go trigger the sensor after it automatically resets. This particle communicates with the second particle in the system when motion is detected.
When the PIR particle sends the message to the second particle verifying that motion was detected. This particle follows up by sampling the intensity of the light from outside and determines is the sun is out or not depending on the value it reads from the photoresistor. The value is high enough that inside light will not interfere with the reading by the particle. Placement for this sensor was also important because you must have it either outside, or next to a window so that it is reading the light outside.
Depending on how much light is out the particle will publish one of two commands, that the sun is out or that the sun is down. These will be used by the servo and IFTTT to make the last step in the control.The Servo
The only time we want the servo to activate the switch is when the PIR detects motion and when the sun is down. To do this we subscribed the particle to the event where the photoresistor reads that the sun is down. This is to prevent unintended triggers and will save money on power. The particle and servo are mounted on the wall and we created a face plate for the light switch to prevent the servo from slipping.
The servo arms are placed on either side of the light switch to allow for the control of the light. We encountered a lot of trouble with the switch as pushing it up was harder for the servo than pushing it down, so we established a lower mechanical limit for the switch. This could also be accomplished easier by either purchasing another switch which flips smoother than this one.IFTTT Integration
Like it was said before the photoresistor publishes two different strings depending on the state of the sun. Only one of them goes to the servo, but both of them are sent to IFTTT. We used IFTTT to send us push notifications when motion was detected in day or night. This acts like a security feature so that if you are away or not expecting someone in your yard that you will receive a notification that tells you motion was detected. This can also be turned off in the event that you are expecting a lot of motion in this area so that your phone is not bombarded with push notifications.