Close

Seeing red over infra-red

A project log for Over-engineered LED strip controller

Way too much stuff to light my garage MY way.

wjcarpenterWJCarpenter 07/30/2017 at 03:210 Comments

Today was a pretty frustrating day. It took me way too long to get my passive IR motion detector working correctly, though I was victorious in the end.

I think the most common module is HC-SR501 or something that looks like it. I got a handful of them to use in this project. My main reason for selecting that component specifically is because of the abundance of sample wire-ups and code fragments. I set about doing the same thing ... read the PIR and show what I got on an LED.

Here's the thing about these: I guess a lot of different places produce them, and the specs vary a little bit. Most commonly, there is a variation on what operating voltage they will accept (though, luckily, they all seem to put out ~3.3v for the signal). The ones I have didn't come with a spec sheet. I have what it said in the description on eBay, but that's not always accurate.

Let me cut to the chase: I spent hours trying to get rid of spurious triggerings. I tried decoupling the input voltage, I tried pull-up and pull-down resistors on the signal, I even wrapped the entire sensor component in aluminum foil. No matter what I did, every 15 seconds or so I'd get a few seconds of high signal indicating motion detected. These things have two pots and one jumper setting. I tried all kinds of combinations. I tried swapping around the Vcc, ground, and signal wires just in case the silk screen was wrong.

Finally, the thing that worked was turning the sensitivity pot all the way down. That seemed to do it. No decoupling caps, no resistors, just the board and some wires. I don't know if I just got a bad batch of if they are all like this.(I did have one that was from another source [another source for me; could have been assembled in the same factory line], and it was the same.) What's the point of having a sensitivity pot if it only works when it's turned all the way counter-clockwise?

Along the way, I found some badly translated operating instructions and some other instructions that were just plain wrong. Here is what I deduced from a lot of pondering.The jumper controls repeatable or non-repeatable triggering. I found those terms a little confusing. "Repeatable" means the signal stays high as long as motion is detected; when motion is no longer detected, the signal goes low after a short time. "Non-repeatable" means the signal is made high for a short, fixed duration. After that the signal goes low and won't go high again until there is a period of no motion and then motion is seen again. Even with non-repeatable, it's not just a single pulse; or rather, it's a single pulse of a couple of seconds.

I'm a little leery about the lack of precision (or something like precision) with the HC-SR501. I've ordered a different type of PIR that goes by the designation "AM312". The specs and form factor are somewhat different. We'll see.

Discussions