Adding A PIR Motion Sensor To A Project

Adding a motion sensor to a project can be quick, cheap, and simple but there are a few gotchas to watch out for.

This is a companion discussion topic for the original entry at

Great job of figuring out how to get the HC-SR501 to work.

Hopefully the brain transplant was successful, and Clyde will be ready for his yearly duty.

I don’t have any of the HC-SR501 PIR sensors, but from what I have read, they don’t work very reliably with less than 5V without some hacks. And two AA batteries are probably giving you less than 3V, and possibly less when the two 8x8 LED matrix displays come on. It would be interesting to measure the input voltage on the 3V input rail when the LEDS are off vs when they are on. You would notice the difference most when the batteries are starting to go flat, since the internal resistance in the AA cells will increase.

reference: Battery Internal Resistance

Here is a link to a TechGurka blog post Cheap Pyroelectric Infrared PIR Motion Sensor on 3.3v about using the HC-SR501 with 3.3V by bypassing the voltage regulator and polarity protecion diode. If you use this method, be sure you have the positive and negative correct, and don’t apply more than 3.3V, because this essentially removes the blade guards.

If you do this, and still need to have the equivalent of a jumper to the H pin, you will need to run two separate jumpers from 3.3V (or battery voltage <= 3.3 V) to the H pin and the middle pin of JP1. Be sure you don’t apply more than 3.3V to the middle pin or you will probably damage at least the HC-SR501 PIR sensor. In the blog post, they were tying the middle pin to GND (L) and put a jumper to the H pin to power the sensor, which is similar to what you are doing with the Pico by applying power to the pins

Whether the HC-SR501 will work with the 3 volts or less you get with two Alkaline AA cells, only testing will tell.

Doing it how you did with another voltage source going through the voltage regulator on the PIR sensor is the “safe” approach, but requires extra batteries.

Have you ever tried using Eneloop rechargeable batteries? Depending on the load, the rechargables can be better or worse. For items that use very little current the Alkaline will probably last longer, but there is also a larger chance of chemicals leaking out and corroding the battery holder contacts. The rechargeable batteries are definitely cheaper in the long run. I use them for anything that will work with them, for example Amazon Fire remote, bluetooth mouse, flashlights/torches.