The street lights take up a lot of electricity consumption which is incurred by the government. Mostly, the street lights have Mercury or Halogen bulbs so their electricity consumption is quite higher. The street lights are already automated and start glowing only after the sunset. This project is an improvement to the existing automatic street light system. The project controls the voltage supply to the street lights based on the intensity of sunlight. Therefore, when there is not completely dark, the project supplies lower voltage to the lights and as the darkness increases with the sunset, the voltage supplied to the lights is gradually increased to full.
The street lights run on AC voltage and they should be treated as AC load. The voltage supply to any AC load cannot be directly controlled. An alternating voltage changes its sign periodically. The alternating voltage normally supplied is a sine wave. An alternating voltage can be another form of the wave also. Irrespective of the waveform, an alternating voltage in the first half of every cycle flows in one direction reaching to a peak voltage and then drops down to zero level. Then in the next half of each cycle, it flows in alternate direction reaching to a peak voltage and then drops down to zero level.
The rise and drop of voltage in alternate direction is graphically shown with a negative sign of voltage and voltage curve. The cycles are repeated throughout the voltage supply. For controlling any AC load operationally, the peak voltage of both the halves of a cycle needs to be chopped off. For this, it is important to detect when voltage alternates its direction. The point on voltage curve where it alternates direction is called zero voltage crossing.
The zero voltage crossing of AC voltage can be detected by first rectifying it using full wave rectifier and then using an optoisolator which switches OFF and ON upon zero voltage crossings and past zero voltage crossings respectively. The output of optoisolator can then be passed to the microcontroller to indicate zero voltage crossings to it.
For controlling AC voltage to a load, TRIAC needs to be used. TRIAC (Triode for AC) is commonly used for power control and switching applications. The TRIAC can be feed control using an optocoupler which itself would be driven by a microcontroller pin.
The project is built upon Arduino UNO and 4N25 optoisolator with a full bridge rectifier is used for zero voltage crossing detection. The 3021 optocoupler and BT136 TRIAC are used for chopping off AC voltage to the load. The tasks of zero voltage crossing detection and switching of 3021 IC are programmatically controlled by the Arduino board. The Arduino sketch is written on Arduino IDE and burnt to the board using AVR Dude.
Components Required –
• Arduino UNO
• 16×2 LCD
• EL3021
• 4N25
• ON-OFF Switch
• Voltage regulator -7805
• BT136
• Wire to carry 2A,230v AC
• 12-0, 1amp Transformer
• Two pin plug.
• Bulb holder
• 1N4007 diode
• Terminal block – PBT-2
• 6-pin IC base-2pcs
• Resistors-10k, 3k3, 330 and 120 ohm
• Bread Board for connection
Block Diagram –
Fig. 1: Block Diagram of Arduino based Automatic Street Light System
Circuit Connections –
The circuit is built on Arduino UNO. It has specific blocks that are interfaced to the board for different functions. In the project, following circuit sections are assembled together –
Power Supply –
The Arduino and LCD module need 5V DC supply. The required DC voltage is supplied by a battery. The supply from the battery is regulated to 5V DC using 7805 IC. The IC has three pins – pin 1 should be connected to the anode of the battery, pin 2 and 3 with the cathode (common ground). The 5V DC should be drawn from the pin 3 of the IC. An LED along with a 10K Ω pull-up resistor can also be connected between common ground and output pin to get a visual hint of supply continuity.
Fig. 2: Prototype of Arduino based Automatic Street Light System
LCD Display –
The LCD display is used to show the supplied voltage reading. When the project is powered ON, it first flashes initial messages showing the application name. Once the Arduino sketch initializes the circuit, the voltage supplied to the street light is displayed on the LCD screen. The 16X2 LCD display is connected to the Arduino board by connecting its data pins to pins 3 to 6 of the Arduino board. The RS and E pins of the LCD are connected to pins 13 and 12 of the Arduino UNO respectively. The RW pin of the LCD is grounded.
Fig. 3: Table listing circuit connections between Arduino Uno and Character LCD
The standard open-source library for interfacing LCD with Arduino UNO is used in the project. The library works as expected and needs no changes or modifications.
LDR –
The LDR is used to sense the intensity of sunlight in the circuit. The voltage supplied through the LDR sensor determines the change in firing angle. It is connected to the A0 pin of Arduino UNO in resistive voltage divider circuit. The LDR provides an analog voltage which is converted to digital reading by the inbuilt ADC. The opto-coupler 3021 is operated accordingly to control the firing angle.
Fig. 4: Graph showing sensitivity curve of LDR
The resistance of the LDR sensor drops down with more light it receives. The sensor is connected in a voltage divider circuit to the Arduino. Therefore when light intensity falls, the resistance of LDR sensor increases and more voltage is provided by the sensor at the Arduino pin.
Zero Voltage Crossing Detection Circuit –
Note: The Zero Voltage Crossing detection circuit can be found under the “Circuit Diagram 2” tab.
First, the AC voltage from the main supply is stepped down using a transformer to 12V. The stepped down AC voltage is feed to full bridge rectifier circuit built using 1N4007 diodes. The rectified voltage is supplied to pins 1 and 2 of the 4N25 optocoupler. The 4N25 is a phototransistor type optocoupler. At pin 1, there is an anode of inbuilt LED and at Pin 2 is the cathode of it. The 4N25 optocoupler has the following pin configuration –
Fig. 5: Table listing pin configuration of 4N25 Optocoupler
Functional Block Diagram
Fig. 6: Pin Diagram of 4N25 Optocoupler
The base of the inbuilt phototransistor is grounded while the output is drawn from the Collector of the photo-transistor. This way, the photo-transistor actually operates like an LED which gets forward biased when photo-diode glows. The collector pin is connected to pin 2 of the Arduino.
Opto-Isolator EL3021 –
EL3021 is a photo-TRIAC type optocoupler. It should be noted that photo-transistor and photo-Darlington type optocouplers are used for controlling DC devices while photo-SCR and photo-triac type optocouplers are used for controlling AC devices. The EL3021 has the following pin configuration –
Fig. 7: Table listing pin configuration of EL3021 photo-TRIAC optocoupler
Fig. 8: Pin Diagram of EL3021 photo-TRIAC optocoupler
The pin 2 of EL3021 is connected to ground and pin 1 is connected to pin 10 of the Arduino. The Main Terminal pins of photo-TRIAC, pins 4 and 6 of EL3021 are connected to pins 3 (Base) and 2 (Main Terminal 2) of BT136. The pin 2 of BT136 and pin 6 of EL3021 are connected to a junction with phase wire of main supplies. The pin 5 of the EL3021 is not connected so the photo-TRIAC actually operates like a photo-DIAC. The load is connected between pin 1 of BT136 and neutral wire. The phase voltage is controlled by the BT136 which itself is controlled by the photo-TRIAC operating as photo-DIAC of EL3021.
TRIAC BT136 –
A TRIAC has three terminals – Main Terminal 1, Main Terminal 2 and Gate. TRIAC is equivalent to two SCRs connected in inverse parallel with the gates connected together. Therefore TRIAC works as a bi-directional switch which is triggered by the pulse on the base. The Main Terminal 1 and Main Terminal 2 of the TRIAC are used for connecting phase and neutral wire and the triggering pulse is supplied to Gate terminal from the photo-TRIAC of EL3021. The Gate terminal can be triggered either by a positive or negative voltage. There are four possible modes in the operation of a TRIAC –
a) Main Terminal 2 has a positive voltage compared to Main Terminal 1 and there is positive pulse at Gate
b) Main Terminal 2 has a positive voltage compared to Main Terminal 1 and there is negative pulse at Gate
c) Main Terminal 1 has a positive voltage compared to Main Terminal 2 and there is positive pulse at Gate
d) Main Terminal 1 has a positive voltage compared to Main Terminal 2 and there is negative pulse at Gate
The TRIAC conducts current when either Main Terminal 2 gets a positive voltage with respect to the Main Terminal 1 and the Gate gets a positive trigger or Main Terminal 1 has a positive voltage compared to Main Terminal 2 and there is a negative pulse at Gate. When the Gate current is removed, the TRIAC switches off. BT136 is the TRIAC used in the circuit and has following pin configuration –
Fig. 9: Table listing pin configuration of BT136 TRIAC
Fig. 10: Circuit Diagram of Zero Voltage Crossing Detector
How the Project Works
Fig. 11: Prototype of Arduino based Automatic Street Light System under test
The voltage supplied to the street lights is controlled by chopping off firing angle on both sides of the AC waveform. For this the Arduino sends pulses to the Gate pin of BT136 TRIAC. When the circuit is powered ON, the Arduino sketch initializes the circuit and start reading analog voltage provided by the LDR sensor at A0 pin. The zero voltage crossing is detected by the 4N25 circuit. The AC voltage from main supplies is stepped down to 12V AC by the transformer and rectified by the 1N4007 diode full-wave rectifier.
The AC voltage once converted to DC voltage drives the IR diode of 4N25 forward biasing it for voltage levels greater than 1.1 Volt. When voltage level of the rectified wave is above zero voltage crossing, photo-transistor of 4N25 remains in forward biased condition, short circuiting the VCC supply at pin 2 of Arduino to ground. Therefore, for majority of the waveform, a LOW logic is received at pin 2 of Arduino. When voltage level approaches zero voltage crossing, the IR diode of 4N25 does not get the required voltage for forward biasing. So, the photo-transistor of 4N25 switches to unbiased condition and the pin 2 of Arduino get a HIGH pulse upon zero voltage crossing.
The Arduino detects the zero voltage crossing and determines a firing angle based on voltage supplied through variable resistance at pin A0. The analog voltage at A0 pin is read by the Arduino and converted to a digital reading using in-built ADC channel. A time interval based on digitized voltage reading is calculated in the Arduino Sketch.
An interrupt routine shooting a HIGH pulse for 50 micro-seconds after delay of the resultant time interval is activated at pin 10 of the Arduino. The HIGH pulse drives the IR diode of EL3021 opto-coupler with same delay of the calculated time interval. This in turn, drive the triggering pulse at the Gate terminal of BT136 TRIAC with the same delay equivalent to the calculated time interval.
In power control application using TRIAC, the voltage pulse before the emergence of triggering pulse at Gate terminal of TRIAC gets chopped off while the part of AC voltage wave after the emergence of triggering pulse at Gate terminal of TRIAC remains available for supply to the street lights.
Check out the Arduino program which is detecting zero voltage crossing based on digital logic at pin 2, calculating a time delay for triggering pulse by digitizing analog voltage through LDR sensor at A0 pin and generating a triggering pulse at pin 10 in an interrupt routine.
Programming Guide –
First of all, the standard library for LCD needs to be imported. An object of LCD class is declared with pins interfaced to LCD mapped with the object. A constant TPulse is declared and mapped to pin 10 of the Arduino where the triggering pulse to the Gate terminal of TRIAC has to be generated. Similarly, a variable SW is declared and mapped to pin 7 of Arduino where the toggle switch is connected. A counter variable is declared and initialized to 0.
Fig. 12: Screenshot of Initialization in Arduino Code for Automatic Street Light System
A setup() function is called in which the baud rate for serial transmission of data to the LCD is set to 9600 bits per second using Serial.begin() function and the LCD is initialized using lcd.begin() function. The pin 2 where zero voltage crossing is detected by digital logics is configured to digital input using pinMode() function and is pulled up by writing a HIGH logic to it using digitalWrite() function. Similarly, the pin where triggering pulse is to be generated is set digital output and pin where toggle switch is connected is set digital input. Some initial messages are displayed on the LCD screen showing the application name.
Fig. 13: Screenshot of Setup Function in Arduino Code for Automatic Street Light System
The loop function is called where the initial messages are replaced on the LCD. The Arduino reads analog voltage at pin connecting LDR sensor using analogRead() function and calls an interrupt routine. The analog reading is digitized to proper format and displayed on LCD screen. The interrupt routine is detached at pin 10 using detachInterrupt() function if digitized analog reading is greater than 6000. otherwise the interrupt routine is invoked at pin 10 by calling attachInterrupt() function which runs the acon() ISR.
Fig. 14: Screenshot of Loop Function in Arduino Code for Automatic Street Light System
The interrupt routine in the loop() function calls an acon() function. In the acon() function, a time interval is calculated according to the analog reading at pin A0. The reading digitized to 10-bit value is passed as argument to delayMicroseconds() function generating a time delay of equivalent interval. During this interval, a LOW pulse remains on the pin 10 of Arduino. After the calculated delay, a HIGH pulse for 50 micro seconds is generated at pin 10 of Arduino.
Note: The complete Arduino sketch for the Automatic Street Lights with Light Intensity Control Function can be found in the source code tab.
Project Source Code
###
//Program to #include <LiquidCrystal.h>//import the LCD library LiquidCrystal lcd(13, 12, 6, 5, 4, 3);// Pins used for RS,E,D4,D5,D6,D7 #define TPulse 10 #define SW 7 int x; void setup() { Serial.begin(9600); lcd.begin(16,2);//LCD 16x2 initialization pinMode(2, INPUT); digitalWrite(2, HIGH); // pull up pinMode(TPulse, OUTPUT); pinMode(SW, INPUT); digitalWrite(SW, HIGH); lcd.setCursor(0,0); //Initially set the cursor position of LCD to 1st Columb 1st row. lcd.print("Engineers Garage");//After initialising print data lcd.setCursor(0,1); //Initially set the cursor position of LCD to 1st Columb 2nd row. lcd.print(" "); //print blank to clear all the data on LCD delay(3000); lcd.setCursor(0,0); lcd.print("AUTOMATIC STREET"); lcd.setCursor(0,1); lcd.print(" LIGHT CONTROL "); delay(3000); lcd.setCursor(0,1); lcd.print(" "); } void loop() { lcd.setCursor(0,0); lcd.print("STREET LIGHT "); x=analogRead(A0) * 7 + 200; if ( x>=6000) { detachInterrupt(0); // disable power lcd.setCursor(13,0); lcd.print("OFF "); lcd.setCursor(0,1); lcd.print(" "); } // else else{ // enable power attachInterrupt(0, acon, FALLING); lcd.setCursor(13,0); lcd.print("ON "); lcd.setCursor(6,1); lcd.print((analogRead(A0) * 7) + 200); } } // end loop void acon() { delayMicroseconds((analogRead(A0) * 7) + 200); // read AD1 digitalWrite(TPulse, HIGH); delayMicroseconds(50); // delay 50 uSec on output pulse to turn on triac digitalWrite(TPulse, LOW); }
###
Circuit Diagrams
Circuit-Diagram-Zero-Voltage-Crossing-Detector | |
Circuit-Diagram-Arduino-Automatic-Street-Light-System |
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.