How to make automatic Street light

auto street light control

Welcome to the Quanta project, we are here to help you gain to make this awesome project. with this project, you can not need to press switch manually. the light will turn off and on according to the situation. it is a technical era and everything is going automatic and smart day by day and we also did the same with the street light. you can put many other things like a solar panel and water purifier along with the automatic street light system. this will be very beneficial to all of us. we will share the whole procedure of making the project and you will learn a lot from this project so read the full article for better understanding.

When there is a low measure of light the light consequently sparkles and when there is an adequate measure of light it naturally kills the light.Here dependent on our room condition the limit esteem we took is 100 for the LDR sensor.At the point when we place a hand on LDR(Not permitting any light on LDR), Arduino naturally turns on the LED.At the point when we evacuate our hands-on LDR. Arduino naturally Turns Off LED.

In the circuit two LEDs are additionally utilized, one is Green and the other is Red. The Red LED demonstrates the night and the Green Led shows 12 PM time 12AM. The Arduino isn’t modified for the ongoing, in light of the fact that we can’t watch the progressions in life. Thusly, the time delay is extremely low (1hr is equivalent to 3 seconds). You can change the time delay as per your utilization. You can make numerous adjustments in the venture as indicated by your utilization, you can likewise utilize RTC (Real Time Clock) right now.

Required components:-

  • Arduino uno
  • LDR sensor
  • LED
  • Resistor

Circuit Diagram for automatic Street light:-

Code for automatic Street light:-

#include “Arduino.h”

#include “LDR.h”

#include “Adafruit_NeoPixel.h”// Pin Definitions

#define LDR_PIN_SIGA3

#define LEDRGB_1_PIN_DIN2

// Global variables and defines

#define THRESHOLD_ldr   100

int ldrAverageLight;

#define LedRGB_1_NUMOFLEDS 4

// object initialization


Adafruit_NeoPixel LedRGB_1(LEDRGB_1_PIN_DIN);

// define vars for testing menu

const int timeout = 10000;       //define timeout of 10 sec

char menuOption = 0;

long time0;

// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with


void setup()


// Setup Serial which is useful for debugging

// Use the Serial Monitor to view printed messages


while (!Serial) ; // wait for serial port to connect. Needed for native USB



ldrAverageLight = ldr.readAverage();

LedRGB_1.begin(); // This initializes the NeoPixel library.; // Initialize all leds to ‘off’

menuOption = menu();


}// Main logic of your circuit. It defines the interaction between the components you selected. After s

etup, it runs over and over again, in an eternal loop.

void loop()



if(menuOption == ‘1’) {

// LDR (Mini Photocell) – Test Code

// Get current light reading, substract the ambient value to detect light changes

int ldrSample =;

int ldrDiff = abs(ldrAverageLight – ldrSample);

Serial.print(F(“Light Diff: “)); Serial.println(ldrDiff);


else if(menuOption == ‘2’) {

// LED – RGB Addressable, PTH, 5mm Diffused (5 Pack) #1 – Test Code

for(int i=0 ; i <= LedRGB_1_NUMOFLEDS ; i++){

for (int k = 0 ; k <= 255 ; k++) {

// set leds Color to RGB values, from 0,0,0 up to 255,255,255

LedRGB_1.setPixelColor(i, LedRGB_1.Color(255-k,k,100)); // turn on green color on led #i.

if (i > 0)

LedRGB_1.setPixelColor(i-1, LedRGB_1.Color(0,0,0)); // turn off last led; //update led color to the hardware.


}    }    }       if (millis() – time0 > timeout)    {        menuOption = menu();    }   }// Menu function for selecting the components to be tested// Follow serial monitor for instrcutionschar menu(){

Serial.println(F(“nWhich component would you like to test?”));

Serial.println(F(“(1) LDR (Mini Photocell)”));

Serial.println(F(“(2) LED – RGB Addressable, PTH, 5mm Diffused (5 Pack) #1”));

Serial.println(F(“(menu) send anything else or press on board reset buttonn”));

while (!Serial.available());

// Read data from serial monitor if received

while (Serial.available())


char c =;

if (isAlphaNumeric(c))



if(c == ‘1’)

Serial.println(F(“Now Testing LDR (Mini Photocell)”));

else if(c == ‘2’)

Serial.println(F(“Now Testing LED – RGB Addressable, PTH, 5mm Diffused (5 Pack) #1”));



Serial.println(F(“illegal input!”));

return 0;

}            time0 = millis();            return c;        }    }}

What do you think?

3 points
Upvote Downvote

Written by shahid

Leave a Reply

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

Metal detector with Arduino