My Brain Cells

Easiest (and best) learning materials for anyone with a curiosity for machine learning and artificial intelligence, Deep learning, Programming, and other fun life hacks.

Automatic Street Light

Automatic Street Light Controller using Arduino



Needs no manual operation for switching ON and OFF. When there is a need of light it automatically switches ON. When darkness rises to a certain level then sensor circuit gets activated and switches ON and when there is other source of light i.e. daytime, the street light gets OFF. 

Components Used:

  1. Arduino UNO
  2. LDR (Light Dependent Resistor)
  3. LED (Light Emitting Diode)
  4. Resistor
  5. Breadboard
  6. Connecting Wires


  1. Arduino IDE


  1. Arduino 3rd pin connected to LED +ve
  2. Arduino GND connected to LED -ve through 4.7k
  3. Arduino +5v is connected to LDR One End.
  4. Arduino A0 pin is connected to LDR other end
  5. Arduino GND is connected to LDR other end with 4.7k

Circuit Diagram:

Software Installation:

Arduino IDE:

  1. Install and Launch Arduino IDE 1.8.15
  2. Link->
  3. Go to Tools->Board->Boards Manager 
  4. Select Arduino UNO Board.
  5. Select suitable Port number.



int sensorPin=A0;

int sensorValue = 0;

int led = 3;

void setup() 


 pinMode(led, OUTPUT);


 // put your setup code here, to run once


void loop() 


 sensorValue = analogRead(sensorPin);


 if(sensorValue < 100)


   Serial.println(“LED light on”);






 // put your main code here, to run repeatedly




  1. When there is low amount of light the light automatically glows and when there is sufficient amount of light it automatically turns off the light.
  2. Here based on our room condition the threshold value we took is 100 for the LDR sensor. 
  3. When we place a hand on LDR(Not allowing any light on LDR) arduino automatically turns on the LED. 
  4. When we remove our hand on LDR. Arduino automatically Turns Off LED.



Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top