Night Security Light with PIR sensor circuit

Night Security Light with Hacked PIR sensor

pir sensor

Security lighting is widely used as a preventive measure against intrusions on a physical piece of property. Since adequate lighting around a physical structure reduces the risk of an intrusion, security lighting can be used in residential settings to increase the feeling of safety. Presented here is a trusty security light activated by a passive infrared sensor, turning on only when a person (or other mammal) approaches. This battery operated security light provides rich illumination without harsh brightness great for kids rooms, the elderly, and for comforting your pets. An important feature of this security light is that it wakes up only at nighttime!

Described security light circuit design is centered around an inexpensive passive infrared (PIR) motion detector module, type HC-SR501. The PIR motion detector module is used here with an added ambient light detection (day/night) feature, supported by a generic photodiode. Following part is prepared to help you get started with your new HC-SR501 passive infrared motion detector module, so let’s start.

Note that imparting the ambient light detection feature involves skillfully combining one photosensitive component and the motion detector electronics with a great deal of dexterity. First of all remove the fresnel lens, and search for the “LDR” pads located near the PIR sensor element. Next, attach a 5mm/3mm (generic) silicon photodiode with its anode (A) connected to pad-A, and cathode (K) connected to pad-K. Finally, add a 120K resistor in parallel with the 1M resistor (105) mounted near the “LDR” pads at the reverse side of the circuit board. When all of the solder process is completed, take back the fresnel lens to reseat it, and make sure that everything is found in order (refer the indicators shown below).

night light pir sensor

When the modification is finished, connect HC-SR501 to the rest of the circuit built around discrete components as shown in the circuit diagram. The HC-SR501 requires an initialization time of about 60 seconds, and might become active for 0-3 times during this initialization period. Thereafter HC-SR501 enters in standby mode, and ready for motion detection. You can adjust the “delay” potmeter clockwise to increase the time delay (3s-300s). Similarly, turning the “sensitivity” pot clockwise increases the detection sensitivity (3-6 metres). Default position of the “mode selection” jumper is “L”. The author opted for common AAx4 battery unit (1.5Vx4) to generate 6V dc supply for the entire system, and the “switched” dc supply available from the battery unit is used to energize a single-white light source (generic 8mm White LED). Note that, an interesting “vibrating alert” trickery is also incorporated in the design with the help of an ordinary electromagnetic relay altered to work like a mechanical vibrator (see its strange wiring). For better results, you can replace this sugar cube relay with a standard vibrator motor (available as replacement part for mobile phones/pagers).

Night Security Light with PIR sensor circuit

A medium-size perfboard is enough for construction of the night light system. After construction it is better to enclose the finished system in an appropriate cabinet. The preferred set up suggests drilling suitable holes in the cabinet wall and attaching the system so that its sensor, light, and switch windows are aligned with the holes. The circuit described so far is intended for use as a night security light. It is, however, readily adapted for many other automatic/security lighting applications.


Parts Used

  • HC-SR501 PIR Motion Detector Module – 1
  • BS170 Mosfet – 1
  • 1N4007 Diode – 4
  • 3mm Red LED – 1
  • 8mm White LED (generic) – 1
  • 3mm/5mm Photodiode (generic) – 1 (see text)
  • 47uF/16V Electrolytic Capacitor – 2
  • Resistor 2K2 ¼ w – 1
  • Resistor 100R ¼ w – 1
  • Resistor 120K ¼ w – 1 (see text)
  • 5V/100R SPDT Relay – 2
  • On/Off Switch SPST/SPDT – 1

Hacked PIR?

It was observed that most hobbyists don’t know about the “LDR” option in HC-SR501 PIR motion sensor module. That’s why I started my (failed) experiment with a standard 5mm LDR in place of the photodiode used in the given circuit. Just after the failure, I leaped into the circuit diagram of HC-SR 501 PIR module and found that one end of the LDR pad is connected to ground (0v),where other end is connected to vcc (+3.3v) through a high-value resistor (here in my HC-SR501 PIR module, through a 1M resistor).

HC-SR501 PIR motion sensor

Technically, LDR/CDS is a “trigger disable input” (VC) of the BISS0001 IC. It is reserved for a “photosensitive” input to distinguish between day time and night time. When the input voltage at VC is high the PIR input is enabled. On the other hand, when VC is low the PIR input is disabled (VC >0.2Vdd=enable; Vc <0.2Vdd =disable). No doubt, this calls for a high-resistance LDR, normally a difficult to get component (atleast for me). So, I decided to alter the resistor value from M to K range to use a standard photodiode as the ambient light sensor. Feel free to message with any suggestions or feedback. If you found any design flaws or better design solutions then I am obliged, thank you very much for letting me know!


Join the conversation!

Error! Please fill all fields.
  • sean-van-der-smythegmail-com

    I have an HC-SR501 that I purchased from a small company called Squirrel Labs. The LDR resistor on one of my boards is actually 77 kohm and works with a cheap CdS LDR. I actually bought two though and one of them is faulty because that resistor is in fact shorted (0 ohm) which means it ignores what the LDR is doing. I guess this is what happens when multiple manufacturers are producing variants of the same thing and giving it the same name.

  • sean-van-der-smythegmail-com

    What kind of photodiodes can be used? When I search eBay there are several different types presented and I’m an electronics noob!

    • T.K.Hareendran

      First, I’d like to apologize for my too long absence. I am thankful to you for your keen interest in my article. I am happy to note your valuable feedbacks/suggestions. As you rightly stated,most hobbyists don’t know about the “thermistor” option in PIR motion sensor modules. I will soon publish an updated version of this article here.

    • sean-van-der-smythegmail-com

      Also, most hobbyists don’t seem to do anything with the thermistor interface option. It would be great to see that addressed.

      In any case, I appreciate the information that’s already here. It’s hopefully enough on its own to allow me to move forward with my project.

  • NA

    Sir I have problem of repeated triggering… I read u r article… U mentioned to use ldr for better operation in both day and night time…can u explain me if I put so the problem will clear…..

    • sean-van-der-smythegmail-com

      Your English is very difficult to understand but I think you want to disable the repeated triggering. In that case you need to change the jumper position from L to H or vice versa.

  • Gelagay

    Could u help me by giving block diagram of this security light and how i can simulate in matlab? If u have any info please attach to

  • mahmood


Looking for the latest from TI?