The goal of this project is to turn a device on which is plugged into an outlet, as it gets dark outside, in our case we chose a desk fan. This is done by using a photo-resistor to detect the change in light where ever the particle is located. As the photo-resistor detects a change in the light, it's resistance changes. The darker it gets the more resistance it gains. At max darkness, its peak resistance is around 150KΩ. Using a code developed with particle IDE, one will be able to have a pin detect the change in voltage due to the change of resistance and act as a switch. This is done by reading an analog value after calibrating the voltage at the correct time of day and publishing a command "on, off, or auto" to a second photon. The second photon will receive this command and act as the trigger and turn the fan off or on through a relay switch.
The second photon is connected to the fan by a circuit relay which is shown in the picture below
Photon connected to the fan through a circuit relay
This project only turns on a desk fan but this concept is used all over the world. Most street lights use a program like this to detect the sun going down and knows when to turn on.
Street lights turning on by themselves at night
The graph below was obtained through ThingSpeak and enabled us to calibrate darkness into a voltage value.
ThingSpeak Graph of day to night and back to day