Your Cart

Automatic Street Light using Light Sensor and Arduino

Hey folks,

This time, we return with an incredibly useful project that can be implemented in various locations such as our homes, streets, or any place that requires illumination during the night. I hope you all are aware of the solar enabled automatic street light. These lights are charged for a full day by the solar and automatically turn on during the nighttime.

Automatic Street Light using Light Sensor

These lights prove to be extremely beneficial for everyday use, and we can certainly utilize them as well. Purchasing these lights from the market might be costly, but we’re going to guide you on how to create your own light at a significantly lower price. All you need to do is procure a few components and follow our step-by-step instructions to assemble this light.

How Automatic Street Light Works with Arduino

Automatic street lights are designed to turn on automatically in the absence of light, eliminating the need for manual operation. They are programmed to light up as needed, specifically when darkness reaches a certain threshold. The sensor then communicates this data to the Arduino, which we are utilizing to manage all inputs and outputs. In this project, we will be using the LDR sensor to serve as the light sensor.

Automatic Street Light using Light Sensor pp1

LDR sensor is a light dependent resistor that varies the resistance when it comes in contact with the light. The light dependent resistor is a kind of variable resistor. So, whenever the light will incident on the LDR. The resistance of the LDR will decrease, and it allows more current to flow by the LDR path. We get this value at the Arduino, and we process and compare in coding & programming.

Components Required to Automate Street Light with Arduino:

Arduino UNO R3

LDR Sensor module

Relay module or relay

BC547 Transistor



Resistor 220 ohm & 1k ohm

Circuit Diagram:

Automatic Street Light using Light Sensor dig 1

If you can’t find the relay module, you can make this basic circuit using bc547 with a simple relay. Only you have to add a resistor and transistor. But if you have a relay module single channel the circuit will be easier for you. The relay module can directly connect to the Arduino without the transistor and resistor.

In case, you have a relay module connecting the VCC and ground of the relay module to the Arduino respectively, and pin 2 to the relay module input. And in output, you can follow the same pattern.

Now we are going to give you a code. Which you need to upload in the Arduino.

You can connect one led too with the pin 9.

The Code to Automate the Street Light:

#define relay 2

int LED = 9;

int LDR = A0;

void setup()



pinMode(LED, OUTPUT);

pinMode(relay, OUTPUT);

pinMode(LDR, INPUT);


void loop() {

int LDRValue = analogRead(LDR);

Serial.print(“sensor = “);


if (LDRValue <=700)


digitalWrite(LED, HIGH);

digitalWrite(relay, HIGH);

Serial.println(“It’s Dark Outside; Lights status: ON”);




digitalWrite(LED, LOW);

digitalWrite(relay, LOW);

Serial.println(“It’s Bright Outside; Lights status: OFF”);



Here, we have given all the required steps to make this awesome project.

Check out our other projects: