Introduction: Smart Street Light Using Ir Sensor With Arduino

Please SUBSCRIBEto my channel for more projects.

This project is about Smart street light, street light will turn on while vehicle is passing through it.
here we are using 4 IR sensors that senses the position of the vehicle,each IR sensor controls 3 LED's. When vehicle passes by a particular IR sensor it senses the position of vehicle and gives its signal to the arduino board and it will turn on the LED's.


If we uses this idea and implement to it in our society it will be helpful in saving enough amount of electricity and off-course money.

Step 1: Components Required

Picture of Components Required

  1. arduino uno
  2. ir sensor (4)
  3. 10mm LEDs (6)
  4. connecting wire
  5. foam board

Step 2: Upload the Program

Picture of Upload the Program

download and upload the program in arduino uno

Step 3: Connect the Circuit

Picture of Connect the Circuit

Connect all the components as given in the circuit diagram.

ir sensor 1 ---> 2

ir sensor 2 ---> 3

ir sensor 3 ---> 4

ir sensor 4 ---> 5

connect all ir sensor's to +5v and ground.

the positive pin of leds are connected to these pins of arduino.

led 1 ------> 6

led 2 ------> 7

led 3 ------> 8
led 4 ------> 9

led 5 ------> 10

led 6 ------> 11

and finally all ground pins of led connect to the ground of arduino.

Step 4: Build Suitable Structure

Picture of Build Suitable Structure

To make these poles as given in above picture, use foam board and glue.

and you may also use black chart to make a road and wooden board for the base of pole.


AhsanY1 (author)2017-12-08

Sir jab din me vehicle movement hogi to kia tab b lights on ho jayen gi kia?

vishalsoniindia (author)AhsanY12017-12-08

Han..... Ho jayegi...
Din m band krne k liye ldr lagana padega

MoniraaM (author)2017-12-01

Hi. please i have code about ir sensor interrupt which use for know traffic state and control with light signal .Excuse Compulsively

vishalsoniindia (author)MoniraaM2017-12-01

If you have have code then what can I do for you

MoniraaM (author)vishalsoniindia2017-12-02

nothing .also i face problem in write interrupt ir sensor interrupt code..can you help me in my proect??expline its

vishalsoniindia (author)MoniraaM2017-12-02

Download the code from step 2

MoniraaM (author)vishalsoniindia2017-12-03

excuse me for bothering but I want interrupt code and don't know how write it ...because my program contain alot of commends....could you write interrupt?and in your code not contain ir library is not it? ?

vishalsoniindia (author)MoniraaM2017-12-03

Copy and paste code here

Copy and paste your interrupt code here

MoniraaM (author)vishalsoniindia2017-12-04

i dont know how write interrupt and this is i want from you and ir library ...i want interrupt for ir sensor to know density state and deal it...can you help me ?.

MoniraaM (author)vishalsoniindia2017-12-04

int Lane1[] = {13,12,11}; // Lane 1 Red, Yellow and Green

int Lane2[] = {10,9,8};// Lane 2 Red, Yellow and Green

int Lane3[] = {7,6,5};// Lane 3 Red, Yellow and Green

int Lane4[] = {4,3,2};// Lane 4 Red, Yellow and Green

void setup()


for (int i = 0; i < 3; i++)


pinMode(Lane1[i], OUTPUT);

pinMode(Lane2[i], OUTPUT);

pinMode(Lane3[i], OUTPUT);

pinMode(Lane4[i], OUTPUT);


for (int i = 0; i < 3; i++)


digitalWrite(Lane1[i], LOW);

digitalWrite(Lane2[i], LOW);

digitalWrite(Lane3[i], LOW);

digitalWrite(Lane4[i], LOW);



void loop()


digitalWrite(Lane1[2], HIGH);

digitalWrite(Lane3[0], HIGH);

digitalWrite(Lane4[0], HIGH);

digitalWrite(Lane2[0], HIGH);


digitalWrite(Lane1[2], LOW);

digitalWrite(Lane3[0], LOW);

digitalWrite(Lane1[1], HIGH);

digitalWrite(Lane3[1], HIGH);


digitalWrite(Lane1[1], LOW);

digitalWrite(Lane3[1], LOW);

digitalWrite(Lane1[0], HIGH);

digitalWrite(Lane3[2], HIGH);


digitalWrite(Lane3[2], LOW);

digitalWrite(Lane4[0], LOW);

digitalWrite(Lane3[1], HIGH);

digitalWrite(Lane4[1], HIGH);


digitalWrite(Lane3[1], LOW);

digitalWrite(Lane4[1], LOW);

digitalWrite(Lane3[0], HIGH);

digitalWrite(Lane4[2], HIGH);


digitalWrite(Lane4[2], LOW);

digitalWrite(Lane2[0], LOW);

digitalWrite(Lane4[1], HIGH);

digitalWrite(Lane2[1], HIGH);


digitalWrite(Lane4[1], LOW);

digitalWrite(Lane2[1], LOW);

digitalWrite(Lane4[0], HIGH);

digitalWrite(Lane2[2], HIGH);


digitalWrite(Lane1[0], LOW);

digitalWrite(Lane2[2], LOW);

digitalWrite(Lane1[1], HIGH);

digitalWrite(Lane2[1], HIGH);


digitalWrite(Lane2[1], LOW);

digitalWrite(Lane1[1], LOW);


MadhuraL (author)2017-11-23

Sir i'm not getting how to connect to the ir-sensors and arduino

means to which terminal should all these to be connected

can u post some close pics of that connections

PLEASE SIR........

vishalsoniindia (author)MadhuraL2017-11-25

All ground are always common or together.

There is no effect of hard cardboard.

vishalsoniindia (author)MadhuraL2017-11-25

I have given all the arduino pin connection with ir in the circuit diagram that given in step 3.

Ir sensor has three pins vcc, GND, data
Connect vcc to +5v
Gnd to gnd
And data pin to as given in step 3

MadhuraL (author)2017-11-25

sir as per circuit Ir sensors gnd is connected to arduino gnd , but this is connected to led's

does Ir sensors and led negative should be together connected to arduino ground

MadhuraL (author)2017-11-25

Sir I hav kept hardcardboard placed on themacol instead of foam board, does this create any problem

BanotaA made it! (author)2017-11-14

Hi sir, can you pleas help my with the code? while I open it on the Arduino program it send this error message. So please can you tell me what I should to do.

vishalsoniindia (author)BanotaA2017-11-14

I have added a txt file below the program line so download it and try with this

BanotaA (author)vishalsoniindia2017-11-14

Thank you a lot.

vishalsoniindia (author)BanotaA2017-11-14

Please SUBSCRIBE to my YouTube channel.........

Maulik savaliya (author)2017-10-22

Hello sir, in this arduino which microcontoller used?

I want to use microcontroller AT89S52 On this same project. is it possible?

No matter which Microcontroller is used in arduino...
You can do with 89s52 but code is different....that is in Kell software...

Ok. Sir. But is it possible if i use microcontrollwr 89s52 nd coding with arduino software?

Ya may be it possible....

Just do some research on it....

pulkitsinghal (author)2017-10-07

Thank you for the amazing project!!

please tell me how can i make this more advanced or smart?
for ex connecting LDR to sense surrounding light level or controlling it with mobile (IoT)

Wellcome..... Subscribe to my YouTube channel....

If you want to connect it with your mobile via Internet then use WiFi module with arduino..

I mean what additional features we can add in it?

Use ldr to sense the night....
And as have idea like connecting the light with mobile or Internet etc

Chandan4713 (author)2017-09-17

Sir I did the same project as said but the only problem is the led's are not glowing when the ir sensor is blocked. whereas the light should glow when the ir sensor is blocked. its happening the opposite. pls tell me what do i do.

There is potentiometer on the or sensor......

Adjust the value of potentiometer...

SwastikD3 (author)2017-07-28

Sir u have written connect all leds/ir sensors to ports and ground. What does ground mean??

Ground means arduino's ground.... That is negative

SwastikD3 (author)2017-07-28

Sir is the project working perfectly with the same code??

I have Science exhibition in school (Class XI) and I want to make it

Can u plz tell me something if it is 100% correct

Yes, it is 100% correct....
Where is your school...

Tytyraa (author)2017-06-30

Sir. Can i know. Did you use a code to make this project? I'm new to this ? and can i used 4 led only, lcd,pir sensor,arduino uno, breadboard, wire and ldr?

reuben daniel (author)2017-05-29


may I know how to change the light intensity instead of turning the LED on and off?

ex: when vehicle is detected ,the LED is at full brightness.
when there is no vehicle, the LED is at lower level of light intensity.


Chang your LED output pins to PWM pins or analog pins

Then Chang "digital write to

dussarahul360hertz (author)2017-04-21

Leds are responding only when light falls on receiver of IR sensor...
Sir can you please explain how to make led work only when an obstacle comes infront of IR sensor

IR sensor consist of TRANSMITTER & RECEIVER.

The transmitter transmits infrared ray.

The receiver receives the infrared ray.

Ex: When there is a vehicle, the infrared ray transmitted gets deflected by the vehicle . These deflected rays then comes in contact with the receiver.

When there is no vehicle, the infrared ray doesn't get deflected. hence no IR is received by the receiver.

Parthapratimd2 (author)2017-04-29

sir, i have an error

Simulation is not running in real time due to excessive CPU load.

I don't understand ....what type of error is that ......just attach a photo of error.

dussarahul360hertz (author)2017-04-21

Sir, will ir sensor detect the vehicle movement only in dark..??

Ir sensor will detect any type of object .......but make sure it is away from sun light .........
It will not work in sun light , better work in room light .

SimpleG3 (author)2017-04-10

Arduino: 1.8.0 (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 1272 bytes (3%) of program storage space. Maximum is 32256 bytes.

Global variables use 17 bytes (0%) of dynamic memory, leaving 2031 bytes for local variables. Maximum is 2048 bytes.

avrdude: ser_open(): can't open device "\\.\COM5": Access is denied.

please help .... this erroer occures when i try to upload

vishalsoniindia (author)SimpleG32017-04-11

Insert the arduino in other USB port.
Than go to
Tools >> port >>

Select the port that you have connected.

If it not work then try with windows 7 because some time windows 10 not support.

dussarahul360hertz (author)2017-04-06

sir can you please explain the idea behind using green and red in code....what are they actually

I forgot to remove that Red and green led in video , that led is to test circuit for me there is no use in project .
Download the code from 2nd stape ,in that I removed red and green LEDs.

RizwanK37 (author)2017-03-28

Please go through the circuit diagram once again. I had to make a little change while implementing the circuit.

Instead of shorting the negative side of the leds, i ended up shorting the positive terminals of the led,and then connected it to the arduino Vcc. Basically,the arduino has 2 Vcc,one supplying the led and the other supplying the IR sensors.

I havnt come up with a schematic diagram yet. Do let me know what you think.

Thanks. :)

GOOD ......, This is also correct.....
One of the side will be short ,doesn't matter which one either positive or negative.

If short the positive side then change all "HIGH" into "LOW" and "LOW" into "HIGH".

Brucesmith50 (author)2017-03-20

Many outdoor lamps are metal halide, mercury vapor, low pressure sodium, etc., because they throw a lot of light with less power (still several hundred watts). They also need time to 'warm up' and fire to the on state from a very wimpy glow. We had a parking garage that presented a problem after a power failure because it went black for 30 to 45 (60?) seconds before the lights were back to burning bright. The time delay depends on the individual lamp... Age & condition.

It's a good idea, but there is a lot to think about. On a freeway, you would want a light a half mile ahead to light the road, but if pedestrians might use the area, they would need to stay on, or at least sense differently. Freeways may have enough traffic to render them only semi used. Also, costs are high for 'control boards' supplied to maintenance people by wholesalers, and it introduces another way for the lighting to 'fail', and may keep a long stretch of road completely dark while it is out of service. Not insurmountable, but needs to be thought about... Should fail to an 'on' state if possible.

About This Instructable




Bio: i am 20 year old electrical engineer from india.
More by vishalsoniindia:Wireless Charger for Any Mobile || Easy || Simple || BD135Mobile Controlled Bluetooth Car || Easy || Simple || Hc-05 || Motor Shield Hologram Screen or Display || Easy || Simple || 3D View
Add instructable to: