When I was on my way on a desert road I found lot of lamps switched on in the morning and some of these lamps are out of service and some of lamps remain on for a long time at night with nobody passing in the street. But how can we put off the light at morning and put it on at night and if the weather is cloudy during day time when anybody pass near this lamp?
Also how can we check all these lamp periodically, if a man checked these lamps each time it would be very hard task and will have high cost.
So in my project I used photo resistor (light dependent resistance) that change it's resistance value depending on the light falling on it and a PIR sensor to detect whether there is anyone in the street or not .
I used one LDR sensor on top of the lamp post to detect the light intensity falling on road if the light intensity is low (at night or at cloudy weather ) then light the lamp turn on else turn it off.
And I fixed another LDR sensor beside the lamp so it can detect the light intensity emitted by the lamp first when the lamp is new we will save the LDR reading and if this reading drop down by a value more than accepted then we can know that this lamp need to be changed and if it turn off the LDR will read very low or no intensity and we know that the lamp is out of service.
And the PIR sensor detect any body emitting infrared (ex : car , animal , person ) in a range of about 7 meters.
I took these readings on an arduino nano board or any other board with same pins and connect it to a raspberry pi 3 in order to upload these data to artik cloud and also I use a small led connected to the raspberry pi that can be turned on or off by using actions sent from android app to the cloud so the person who is going to fix the lamp can know which one is the lamp he want however if he go to fix the lamp at morning
For the circuit simulation click here: https://circuits.io/circuits/2761527-smart-light/embed#breadboard
The code I used is from:
All the code for Arduino, Raspberry Pi and Android are attached. Here is a video of the project working:
Attention: In this video I have used a button instead of PIR sensor for testing purpose as the PIR would detect me at all situations , the PIR is tested and works exactly the same as it prints 1 on the Arduino like the button.
If you need any help building this project leave me a comment.