Automatic Urban lamp control

In this project, you will learn how to control an Urban lamp to turn ON automatically during NIghts and to turn OFF automatically on Day time.


We daily turn ON urban lamp during night time and we forgot to switch it OFF most of the time’s and wasting lots of power.


Here we have a simple economical solution in order to control the light automatically. It monitors the intensity of sunlight and when the intensity is low during night time it turns on automatically.


5v power adapter
Arduino nano (or) Arduino Uno
connecting wires/jumper wires
LDR (Photoresistor) and 10 k resistor
a single channel relay module


NOTE:  Common pin and NO/NC pins may vary according to the type of relay manufacturer

Make sure that LDR is placed to detect sunlight but not Lamp light.


Here we monitor the intensity of the sunlight and control the urban lamp accordingly. With LDR we measure the intensity of sunlight and when it reduces we activate the relay to turn on the lamp when it increases it turn off the lamp using Relay.



int sensorPin= A0; //read anolog value from sensor
int sensorValue = 0; //initialize sensor value to 0
int LAMP = 3; //relay to pin 3
void setup() {
pinMode(LAMP, OUTPUT);
void loop() {
sensorValue = analogRead(sensorPin);
Serial.print('sensor value - ');

if (sensorValue > 200){ // if intensity of sunlight is high turn off lamp
Serial.println("LAMP light OFF");
digitalWrite(LAMP, LOW);
if(sensorValue < 100)
Serial.println("LAMP light ON"); // if intensity of sunlight is high turn on lamp
Serial.print('Monitoring sun light');

Share this post

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on whatsapp