Auto Intensity Control Of Street Light Using Arduino
In this project, I am going to show you how to control the intensity of LED lights according to the time and the light intensity of outer atmosphere.
This is an amazing and very useful project because it prevents the wastage of electricity.
This project automatically turns on the streetlight at evening and turns off in the morning. It also controls the intensity of light. Light intensity is automatically adjusted according to the time and traffic. The number of vehicles is very low after 12AM. Â For example, the intensity of light is low in the evening and it starts increasing until 8PM After 8PM the light glows at full intensity and this intensity will not change. It glows on full intensity until 12AM and intensity starts decreasing after 12AM, and the lights are fully turned off after 6AM. This approach saves about 30 percentage energy.
In the circuit two LEDs are also used, one is Green and other is Red. The Red LED indicates the evening and the Green Led indicates midnight time 12AM. The Arduino is not programmed for the real time, because we cannot observe the changes in live. Therefore, time delay is very low (1hr is equal to 3 second). You can change the time delay according to your use.Â You can make many modifications in the project according to your use, you can also use RTC (Real Time Clock) in this project.
In the circuit a LDR (Light Dependent Resistor) is used, which detect the intensity of the lights, when the intensity of light comes under a fixed values the led Light is turn ON.Â But at the starting intensity of the light is low because the time is 5PM. Now the intensity is increasing with the time and light glows on full intensity at 8 PM.
Intensity of the light is controlled by using PWM (pulse width modulation). The Arduino and other digital devices cannot give analog output; they can only give the digital output (High or Low). Means they can only turn OFF and turn ON the device, but sometimes we need the voltage between Vcc and GND. PWM can fulfill this requirement. PWM simply Turn On and Turn Off the output device at the high frequency. In this way the output voltage becomes under Vcc. Value of the output voltage depends upon â€œTurn Onâ€ time and â€œTurn Offâ€ time, which can be calculated by the given function below
Duty Cycle = Ton / (Ton + Toff) Vout = Duty Cycle * Vcc
The Arduino Nano have six PWM pins, they all are 8 bit. In other words, we can change the output value from 0 to 255 where 0 is low and 255 is High.
Two LEDs are also used on Circuit, they indicates the time, RED LED turns on when LDR cross the threshold value, in my case I suppose time is 5 PM, at this time our street light (power LED) also switched on but the intensity is low. The intensity is gradually increasing and it will works on full intensity at 8 PM. Now the intensity is not changed until 12 am.
After 12 AM, the Green LED is turned on and the power LED’s intensity become low this intensity is not changed until 4 AM. After 4AM, the intensity of the light starts gradually decreasing. In addition, it becomes fully turn off at 6 AM.
|Power Source||DC Adapter 12 volt||1|
|LDR (Light Dependent Resistor)||1|
|Power LED||12 Volt||1|
The circuit is very simple, you can make this circuit on breaboard or ZERO PCB using the circuit below.
If you are good in the PCB Etching use the images given below.
In the circuit Arduino Nano is used, PWM pin D9 is connected to the base pin of the transistor (2N2222) emitter pin is connected to the GND. Power LED’s Cathode pin is connected to the Collector pin of the transistor and the anode pin is connected to 12-volt, A diode is connected parallel to the Power LED in the reverse bias.
The LDR is connected to the Vcc and the GND through a resistance of 10k ohm, junction point of LDR and Resistance is connected to the A5 pin of the Arduino.
Two LEDs are connected to the A4 and A3 pin of the Arduino through 330 ohm Resistance. Circuit is powered by 12 volt adapter and 12 volt line is also connected to the Vin pin of the Arduino through a Switch.
Auto Intensity Control of Street Light – Video
In the code some integers are declared, integer “sensor” is used for the LDR pin, LED1 and LED2 are used for the â€œREDâ€, and “GREEN” LED, And the integer â€œOUTâ€ is declared for the Power LED. Integer “del” is used for giving the delay of 1 hr (3 sec).
In the â€œvoid setup ()â€ sensor is declared as INPUT and LED1, LED2 and OUT are declared as OUTPUT, using â€œpinModeâ€ function.
In the â€œvoid loop()â€ first an “if condition” is used for comparing the value for the LDR sensor, when â€œanalogReadâ€ value of LDR sensor is less than 50 â€œif conditionâ€ become true.
Next â€œanalogWrite(LED1,100)â€ switch on the Power LED at low the intensity. LED1 is also switched on using â€œdigitalwrite(LED1, HIGH)â€ and delay is given for “del” time.
After it, some functions are used for changing the intensity of Power LED after every one hr (delay of 3000ms). At 12AM the LED2 (Green LED) is also switched on, at the ending of the code LED1 and LED2 are switched off.
Calibration: calibration is used for turn of the light at right time, in the line 20 change the value compared â€œanalogRead(sensor)â€, in the given code it is 50, you can read the value using “AnalogReadSerial” in the example.