Arduino Street light with AC lights
Designing a system based on Arduino to control the street lights, turning on during the night and off during daylight.
Introduction-
We are going to design an automatic street light system that turns on during night/dark and turns off during daylight. It uses an LDR to control the switch state.
An LDR is a light-dependent resistor whose resistance changes according to the light falling upon it.
3. LDR.
4. 4.7K ohm resistor
5. AC Bulb.
Connections -
1. Connect the pin 5 of Arduino to Relay and GND to relay GND.
2. Connect 4.7K ohms resistor in series with LDR between 5V and GND.
3. Join A0 of Arduino to the middle node between LDR and resistor ( as shown in the schematic).
Circuit schematic-
Arduino Code-
int ledpin=5; int data; void setup() { pinMode(5,OUTPUT); pinMode(A0,INPUT); Serial.begin(9600); } void loop() { Serial.println("LED State-"); data = analogRead(A0); if(data<200){ digitalWrite(5,LOW); Serial.println("ON"); } else{ digitalWrite(5,HIGH); Serial.println("OFF"); } }
No comments