The overall requirements of this project were very broad. I tried to think of something that may be useful to me in the future beyond the scope of project. Pretty quickly the idea of controlling the light in my room came to me. I have a bad habit of leaving lights on, doors open, etc.. I figured it'd be great and useful to have the ability to control my light switch with a servo motor, and be able to do it from anywhere anytime in addition to being able to know if it was on or off using another medium. I have almost no experience with programing so this project was definitely a challenge for me. The ultimate goal was to take the servo motor I had, which was capable of 180 degree rotation, and and be able to call it to two positions (which would be on, or off) with the particle app.
Initially I did research on how to connect a servo motor. I quickly learned that servos were relatively easy to connect. They have three wires (power, ground, and pulse). Power goes to the Vin pin, ground goes to the GND pin, and pulse goes to any of the pins that could give output (in my case was pin A5). Then I researched the characteristics of a photocell, which I already knew from previous experience, however it was verified that with more light, the resistance goes down, and vice versa. In the tinker application already available to me, I set pins on HIGH to one position and pins on LOW to another positions. This effectively turned the switch on and off.
The photocell I used had a resistance of 10k in the dark and 1k in the light. I used this information to read the resistance of the photocell to send me an analog value of 1 or -1, 1 meaning the light was on and -1 meaning the light was off. I tested this away from my room.
This feature is less essential, however, if the servo motor was to fail for any reason, and i was away from my room, I would be able to know quickly. It also provides peace of mind in knowing that the light is actually off.
There is always error possible in the resistors, however in this application, the variance in resistance isn't all that critical. The servo motor could fail as well if it's torque rating is exceeded.
I've learned a lot about basic programming and using instruments to control things. I learned how to use and wire a servo motor, as well as reading a sensor. I used the particle build interface to make this project work. However, I plan on using mobicle.io as well as utilizing IFTTT in future projects. I've just scratched the surface of what is capable with the photon, and I plan on delving deeper into it on my own time and in junior design next semester.
This could be applicable in large plants that are difficult to shut down. If all the switches in a plant could be controlled remotely, it would save a lot of time for the company. I'm sure this is already being done today.