Arduino Projects

Smart Street Light Project using Arduino, LDR, and IR Sensors

Smart Street light project using Arduino:

Smart Street Light Project using Arduino, LDR, and IR Sensors- LDR “Light dependent resistor” and IR “Infrared Sensor” are among the most widely used electronics components. In this article we are going to use these sensors with the Arduino to build an amazing Smart Street light project. With smart street light system we can greatly reduce the energy cost and moreover smart street lights more efficiently manage electricity with lower chances of the automatic street light system overheating and risk of accidents is also minimized. Instead of turning ON the street lights for the entire night, we can design a low cost and efficient smart street light system using the Arduino, IR sensors or Ultrasonic Sensors, and some other basic electronics components. In this tutorial, we will learn to design a smart street light that will be turned on and off whenever there is some vehicle or object.

Components Required:

In order to complete this project we will require the following components:

  • Two IR sensors
  • Two 220Ω resistors
  • IR sensor module
  • Light depending resistor LDR
  • One 1 KΩ resistor
  • Arduino Uno
  • Two LEDs

Amazon Links:

Arduino Nano USB-C Type (Recommended)

12v Adaptor:

IR Sensor:

LDR “light dependent resistor”:

Other Tools and Components:

ESP32 WiFi + Bluetooth Module (Recommended)

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

IR sensor Module:

Smart Street light

The light sensor module have strong adaptable to the environment, having a pair of infrared transmitter and receiver, transmitter launch a certain frequency infrared, when meet obstacle in the detection direction, the infrared receiver is reflected back by the receiver tube, after processing through the comparator circuit, the green indicator light will illuminate while the signal output interface output digital signal (a low-level signal) can be adjusted via potentiometer knob detection.

  • The effective distance range 2 ~ 30cm
  • Working voltage is 3.3V-5V.

The detection range of the sensor can be adjusted by the potentiometer, with little interference, easy to assemble, easy to use features, can be widely used robot obstacle avoidance, obstacle avoidance car assembly line count and black-and-white line tracking and many other occasions.


  1. When the module detects an obstacle in front of the signal, the circuit board green indicator light levels while continuing output low signal OUT port, the module detects the distance 2 ~ 30cm, detection angle 35 °, the distance can detect potential control to adjust, adjust potentiometer clockwise, the detection distance increases; counterclockwise adjustment potentiometer, detection distance decreases.
  2. The sensor active infrared reflection detection, target reflectivity and shape of the detection distance of the key. The minimum detection distance which black and white max; small area of the object distance is small, a large area from the Grand.
  3. The sensor module output port OUT can be directly connected with the microcontroller IO port can also be driven directly to a 5V relay; Connection: VCC-VCC; GND-GND; OUT-IO
  4. The comparator using LM393 can compare the values of the sensor
  5. 3-5V DC power supply for the module. When the power is turned on, the red power indicator light up.

Light dependent Resistor (LDR):

Technical Details:

  • Maximum Voltage (V-dc): 150
  • Maximum power consumption (mW): 100
  • Temperature (degree C): – 30 – – +70
  • Peak Spectrum (nm): 560
  • Bright Resistor (10Lux) (K_): 5-10
  • Dark resistance (M_): 0.8

Smart Street light

Interfacing the components with Arduino:

First of all we will interface the IR sensor with the Arduino such that:

  • Connect the VCC of both sensors with the 5V of the Arduino
  • Connect the ground of both sensors with the ground of the Arduino
  • Connect the output of the first IR sensor to the digital pin number 2 of the Arduino
  • Connect the output of the second IR sensor to the digital pin number 3 of the Arduino. You can use any digital pin according to the programming.

Now we will connect the LEDs

  • Connect the first led with the digital pin number 5 of the arduino
  • Connect the second led with the digital pin number 6 of the Arduino

Now to control the LEDs during day and night we will use LDR. LDR is light dependent resistor whose resistance changes with the intensity of light. LDR gives us analog output and we will give it to the A3 pin of the Arduino. You can use any analog pin from the Arduino. When the light intensity will be change the resistance of the LDR will be change and according to that we will take the decision whether to turn on or off the LED. We will connect the one terminal of the LDR with the 5V and other terminal will be connected with the A3. The same terminal will be connected with the ground through 5 KΩ resistor. This will create a voltage divider.

Smart Street light

Arduino Smart Street Light Project, Complete Code:

After uploading the code to the Arduino when the object is in front of the sensor the led will light up or when there is darkness the led will turn on.

Arduino Smart Street Light Project Code Explanation:

This command will define the IR sensor which is connected with the digital pin 2 and digital pin 3 of the arduino.

This command will define the LEDs which are connected with the digital pin 5 and digital pin 6 of the arduino.

This command will be to define the analog pin which is connect the with the A3.

Now in the setup function, we will define the pins which will be used to define the input and output.

The leds connected will be used as output which will be turned on and off according to the light intensity.

The IR sensor will be define as input which will give the input to the arduino when it detect object in front of the sensor.

The LDR is defined as input which will be used to read the intensity of the light.

This command will be used to read the data of the LDR.

In the start both the led will be off.

Now we will define the condition that when the LDR value will be less then 100 and object is in front of the sensor we will turn on the led.

Similar condition will be define for the second sensor that when its value is less than 100 and IR sensor is high the led will be turn on.

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

One Comment

  1. Hie Shahazda, am trying to run this code on Arduino IDE but getting a compilation error ‘intLDRValue was not declared in this scope’

Leave a Reply

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

Back to top button