
Hi there!
It sometimes happens that we build something out of necessity, to help us with little day-to-day tasks, and this is the case for today’s project.
The boiler’s room in my basement is a very cramped place that I need to access frequently because I keep in there a freezer for groceries. It turns out that I often have my hands full when I come back from taking something from the freezer, and it is difficult to reach for the light switch.
To obviate to this problem, I decided to build an automatic light switch, so I don’t have to maneuver it manually anymore. And, since I was at that, I decided to make one that not just turns off when I leave the room, but also turns on the light automatically when I enter the room.

The core of this device, technically called an Occupancy Sensor, is a PIR, or Passive Infrared sensor. I have a version of it called HC-SR501 that puts together a Pyroelectric Infrared Detector, or PID, with a bunch of other electronic components that make the sensor useable with very few external components. The PID is concealed underneath that white little dome, which is nothing more than a Fresnel lens that concentrates the light on the actual sensor, thus increasing its sensitivity.

The PID used in this device is called LHI 778, and is capable of detecting infrared emissions over a background noise of up to 85 degrees Celsius. You can see from its data sheet that it is like a small metallic cylinder with 4 pins coming out of it. This PID actually contains two infrared sensors connected in series, to increase its sensitivity.

This one is the schematic I made to use the PIR motion detector. The Detector is connected through the pin header J1 on the left. The header provides the power supply for the detector on pins 1 and 3, and captures the output signal on pin 2.
The signal from the detector goes to the base of transistor Q1 which pilots a relay that is used to control the lights of the room where the device is located.
The 5V power supply for the transistor and the relay comes from an old USB charger, so I didn’t have to build a power supply just for this application. LED1 and R1 provide a visual indication that tells us when the gadget is turned on.
The actual power supply for the whole thing comes directly from a 120V socket, goes through a 1A fuse, and through a power switch.
When the switch is set to on, both the USB charger and the common terminal of the relay receive the 120V. Power socket J3 receives the 120V only when the switch is on and, simultaneously, the PIR detects the presence of a person.
The following archive contains all the files you will need if you decided to build this device for yourself, and more.
You can also watch this video for further details on the construction of this device.
Important note: this device involves the use of potentially deadly voltages and you should not try to replicate it if you have no experience with high voltages. Build it at your own risk.






