Automatic Room Lights using PIR Sensor and Relay

This automatic staircase light circuit switch on the staircase lights automatically when someone enters on the stairs and gets off after some time. There are two important components in this circuit, first is PIR Sensor (Passive Infrared Sensor) and second is Relay.


PIR Sensor

PIR sensor is used here to detect the Human body movement, whenever there is any body movement the voltage at output pin changes. Basically it detects the Change in Heat, and produce output whenever such detection occurs. You can learn more about PIR sensor here, there are some useful features in PIR sensor like how to change the distance range, how to set the duration for which the light should be ON etc.

Also check: Automatic Staircase light using AVR Microcontroller



Relay is an electromagnetic switch, which is controlled by small current, and used to switch ON and OFF relatively much larger current. Means by applying small current we can switch ON the relay which allow much larger current to flow. Relay is the good example of controlling the AC (alternate current) devices, using a much smaller DC current.  Commonly used Relay is Single Pole Double Throw (SPDT) Relay, it has five terminals as below:

SPDT Relay Working

When there is no voltage applied to the coil, COM (common) is connected to NC (normally closed contact). When there is some voltage applied to the coil, the electromagnetic field produced. Which attract the Armature (lever connected to spring), and COM and NO (normally open contact) gets connected, which allow larger current to flow. Relays are available in many ratings, here we used 6V operating voltage relay, which allow 7A-250VAC current to flow.


Relay is configured by using a small Driver circuit which consist a Transistor, Diode and a resistor. Transistor is used to amplify the current so that full current (from the DC source – 9v battery) can flow through coil to fully energies it. Resistor is used to provide biasing to transistor. And Diode is used to prevent reverse current flow, when the transistor is switched OFF. Every Inductor coil produces equal and opposite EMF when switched OFF suddenly, this may cause permanent damage to components, so Diode must be used to prevent reverse current. A Relay module is easily available in the market with all its Driver circuit on the board or you can create it by using above components. Here we have used 6V Relay module.

Relay Module


Circuit Explanation

Circuit Diagram for Automatic Room Lights using PIR Sensor and Relay

This automatic staircase light circuit can be easily explained. Whenever PIR sensor detects any body movement, its OUTPUT pin becomes HIGH, which applies the triggering voltage to the base of the transistor, transistor get  ON, and current started flowing through the coil. Coil in Relay gets energies and create electromagnetic field, which attracts the lever and COM and NO get connected. This allows a much larger current (220v AC) to flow, which turns ON the BULB. You can increase or decrease the Bulb ON duration by setting up PIR sensor.


Comments (58)

  • agentX44's picture

    do you have any tutorial for this project from the start ?Sorry I'm beginner. Thanks in advance

    Aug 17, 2015
  • VEERESH's picture

    sir,may i know what kind of bulb u have used is it led bulb or regular zero watt bulb.
    What happens if i use a zero watt bulb ?
    Sir, I kindly request u to send me the clear picture of the connection because i am not understanding the PIR and the relay module connection from the above picture...THANK YOU..

    Mar 16, 2016
  • Jayant's picture

    Yes, you can use zero watt bulb. You can use any AC mains home appliances. Circuit diagram is already very clear, further you can check its Image at the top and Video at the end.

    Mar 28, 2016
  • Bala Murugan's picture
    Bala Murugan

    Ya you can use any kind of bulb for this project.Because you are using a 220v supply to the relay so no problem

    Mar 30, 2017
  • NITYA $'s picture
    NITYA $

    Hey, I like this project but
    what type of relay module u r using ,
    And if we use it in real it will work, or it will fuse after using for days
    Please reply,

    Mar 25, 2016
  • Jayant's picture

    This is a simple Relay module, if you dont have it, you can use simple Relay with resistors and diode, as shown in Circuit Diagram. Yes, it can work for long time.

    Mar 28, 2016
  • NITYA $'s picture
    NITYA $

    Can we use 5 v of relay module?

    Mar 25, 2016
  • Jayant's picture

    yes, you can.

    Mar 28, 2016
  • parveen's picture

    can i use 12v relay ?

    Apr 17, 2016
  • MrTiger's picture

    Great content! I'm new to this world of electronics so I hope my questions are not too annoying. This circuit scares me a bit because I'm used to working with 9v, 6v, and less. This circuit diagram shows to hook up a 220v ac in series with a 9v dc battery. Clearly I am not understanding this correctly. Please advise what I need to read to correct my understanding.

    Apr 17, 2016
  • Maddy's picture

    No, its not in series, please look carefully. Wires joints are represented by Dots. Please be extra careful while working with AC mains, it can be lethal.

    Apr 18, 2016
  • AlexG's picture

    @Mr Tiger - you are mistaking the intersection points of the line going from B1 to VCC are connected to the 220v.
    There's no easy way to draw it where the lines cross. As a check, if you imagine that the B1 to VCC line was removed, you can clearly see the DC side is separate fron the AC side.

    Apr 18, 2016
  • MrTiger's picture

    Ok, ya I see this now. Thank you.

    Apr 23, 2016
  • MrTiger's picture

    I made this circuit this morning using components I already own. It was pretty cool to see it work. Thank you for sharing. For the sensor, and circuit I used 5.12 dc v(atm, my only steady power supply), and for the light source I used (9v battery, 330 Ohm, LED) because I fear an early death.

    Apr 23, 2016
  • Tom's picture

    Where did you purchase the relay module?

    Apr 24, 2016
  • MrTiger's picture

    I got the relay module from an Arduino starter kit by Seeed Studio. TIANBO HJR 4102E

    Apr 25, 2016
  • Awes's picture

    will this project work if we use 6v relay,instead of 12v

    May 20, 2016
  • Abhishek's picture

    its already a 6v Relay

    May 28, 2016
  • Naved Alam's picture
    Naved Alam

    Can we use this for office light in retriggering mode,if person is in its area would it continue working or switch it On/off continuously?

    Jun 04, 2016
  • Maddy's picture

    Yes, it can be used in Re-triggering mode to keep the Light ON, until some movement is there. Check this to learn more about  PIR sensor.

    Jun 11, 2016
  • arief's picture

    may i ask this one using coding or not? like arduino or PLC ?

    Jun 14, 2016
  • Abhishek's picture

    No coding, it is just a simple circuit without any micro controller.

    Jul 09, 2016
  • Sharojalhasan's picture

    i have made this And Not Working :( please Anyone Help me

    Jun 18, 2016
  • Kishore Relangi's picture
    Kishore Relangi


    Is it possible to add more delay to this ?

    Because it will look very odd to switch the lights immediately.


    Jun 26, 2016
  • Abhishek's picture

    Then you need to use Microcontroller to add some delay after PIR detect any motion.

    Jul 09, 2016
  • Stephen Buadee's picture
    Stephen Buadee

    Where can I get pir sensor
    Are they sold or they are built

    Aug 30, 2016
  • Jony Hossain's picture
    Jony Hossain

    I want to build a transformerless power suply.Please help me and some suggestion

    Sep 07, 2016
  • S.M. Bakhtiar's picture
    S.M. Bakhtiar

    Dear Concern,
    I am working your project. which you have show is very much interesting. But my question is when one object is detected the how can i set long time as long as the object is present of that room then when the object is not in room then sensor will stop the supply.
    Thank in advanced

    Sep 08, 2016
  • Deepti's picture

    hi. how did u make it glow as long as there is a person and switch off when the person goes out of the room?
    Please send me the circuit diagram and the working.

    Apr 15, 2017
  • S.M. Bakhtiar's picture
    S.M. Bakhtiar

    Dear Concern,

    I have got the delay answer what i mention in my previous post.

    Now my question is , how do i connect LDR with the above circuit so that when there is dark on the room the light glow.

    Thanks in advanced

    Sep 14, 2016
  • Aazan's picture

    hi i dont know why but my project is not working i tried my best
    i saw all the connection
    i just did not put the relay module because i was not able to find it so i made the circuit as it was made in the digram still it does not work my light gets on but does not get closed wat do you thing wat will be the problem plz let me know plz help me sir plz and reply me as soon as possible plz some one help me i need help

    Sep 19, 2016
  • Nazeer's picture

    I purchased PIR Motion Sensor switch to fix in a room containing 9 small lights each 6 watt. So total load comes 54 watt. Motion switch indicates that it works up to maximum 1000 Watt. Please let me know if one switch will be enough to work for all nine lights. Moreover can we fix on/off switches to control individually.

    Nov 18, 2016
  • Maddy's picture

    yes you can trigger many devices with one PIR, and power depends upon relay's rating. To control individual lights, use some microcontroller.

    Dec 10, 2016
  • shahid's picture

    You don't mention R 2 on circuit diagram and also not to mention green colour tuning at your circuit diagram but I have see clearly those item (R2&green colour tuning) soldering at your Relay module and you have to use Relay module to complete your project not to flow your mention circuit diagram so please clear my confusing since I'm not a professional electronic person or stodent.

    Oct 10, 2016
  • nassir's picture

    instead of 6V Relay which one can I use?
    Please help me

    Oct 10, 2016
  • Gokul MR's picture
    Gokul MR

    does this circuit keeps the light 'ON' whenever there is a human presence at its range? or does it turns off after some time?? I've made a motion detector which turns of after some time (obviously!). also, i want to use a PIR based circuit for automatic light for my room. by that, when ever i enter my room, the light should turn on automatically and it will be on till i leave my room. so can i use this circuit for the same?? please advice. thanks in advance. :)

    Jan 22, 2017
  • Ignis's picture

    Starter here, i wanna ask how long does the bulb will lit up after a movement. Or it will turn off immediately if there's no more movement. Thank you in advance.

    Jan 26, 2017
  • ujwal chavhan's picture
    ujwal chavhan

    i make as all connection as per given above circuit diagram but my project not work properly . The light is continiously blow

    Feb 04, 2017
  • noah's picture

    I couldnt find 6v relay. what can I integrate 12 v relay into the circuit

    Feb 11, 2017
  • Abhishek's picture


    Jul 06, 2017
  • Furqan Ali's picture
    Furqan Ali

    This circuit incomplete because not show R 2 on circuit diagram

    Mar 09, 2017
  • moses's picture

    i can't find PIR sensor how can i have it

    Mar 17, 2017
  • opare's picture

    can i use tsop1738 sensor to replace ur own and use a tv remote

    Mar 21, 2017
  • Deepti's picture

    Hello Sir/Madam,
    I really liked the project. My professor asked me a question: Why are u using relays when transistors are much faster and long lasting? Relays are also electromagnetic sensitive.
    I could not answer this question. I am definitely missing something. Please clarify my question.


    Apr 14, 2017
  • Abhishek's picture

    Relay is used to control AC appliances.

    Jul 06, 2017
  • Deepti's picture

    does the light remain on 'as long as' the person is there or does it switch off after a 'certain time' on its 'own'?

    Apr 15, 2017
  • vural's picture

    So helpful...

    May 06, 2017
  • Manish 's picture

    I wacth the video, in this video the light should automatically OFF after some seconds , when i used this CKT. In bathroom my the CKT. Dectet the motion and its ON (so, it will OFF in some seconds or it should ON till where should i was in bathroom ? ).

    May 13, 2017
  • Abhishek's picture

    In this circuit, light will remain On if there is continuous motion, otherwise it will switch off after some duration. you can control this duration,  You can learn more about PIR sensor here,

    Jul 06, 2017
  • Dharm patel's picture
    Dharm patel

    Dear sir ,
    I done this project as per diagram (as without relay module ,i connect relay switch)but my relay switch is countinuslly switching so plz solve it

    Thank u.

    Jun 29, 2017
  • NEEL SHAH's picture

    PLS SEND THE PCB LAYOUT ............
    I WANT PCB LAYOUT OF Automatic Staircase Lights using PIR Sensor and Relay

    Aug 04, 2017
  • Dave's picture

    Was very helpful

    Aug 22, 2017
  • Ayan samanta's picture
    Ayan samanta

    sir , please tell me that can i use 5or 12v relay for ths project?

    Sep 06, 2017
  • B.Aswinth Raj's picture
    B.Aswinth Raj

    Yes you can use either 5V or 12V relay for this project.

    Sep 07, 2017
  • Haziq's picture

    Sir, i already follow the circuit diagram but my pir sensor does not working. Please I need your help.

    Sep 08, 2017

Leave a comment