My first WLED project. Using ESP-WROOM-32, with a WS2812B 5V LED strip (5m, 30 LEDs/m), and two HC-SR501 PIR sensors. ESP powered over USB (2A wall socket).
LED strip powered from the ESP board’s 5V output, with GPIO 14 for WLED control
PIRs powered from the ESP board’s 3V output, on GPIOs 5,2. Set up as PIR switches in WLED interface, broadcasting over MQTT to homeassistant. (i.e. NOT setup to switch any wled-presets).
If the LED strip is switched off, the PIRs work fine. I can adjust their sensitivity/timing and get them triggering on/off as normal binary sensors in homeassistant.
However, the moment I turn the LED strip on (even at <5% brightness, drawing <300mA), the PIRs start being very erratic - they trigger every 1-2 seconds. Even if I (out of desperation) hide a PIR in a box, completely covered up with no light getting through, it triggers constantly. The moment I turn LEDs off again, the PIRs work normally once more.
Any idea what is going on? My Dupont wiring/crimping skills are still a work in progress, but after a few attempts I think all the wiring is solid/stable…
thanks for any suggestions on how to work out what’s going wrong!
Thanks for the quick reply. Slightly dumb question - what should I be checking for on the sensor output pins - e.g. that the voltage on the PIR sensor middle pin is fluctuating weirdly?
With LEDs off, the PIR is at 0.1V when ‘clear’ and 2.3V when ‘detected’. And it’s the same when the LEDs are on (except that the PIR is flipping randomly “detects” every second or so). I’m measuring those voltages from very close to the PIR sensor (one of the PIRs has short wiring - 10cm or so, the other has 2.5m wiring. The one with short wiring is more erratic than the long wiring one).
Not sure I’m doing the right thing here to diagnose EMI problems though? Please do educate me!
I have similar problem. When it is daylight PIR will trigger erratically about 30 times pe minute. At night it triggers normally.
Perhaps you have a faulty PIR as do I.
I tried one last thing here - I changed the wiring for the 2 PIR sensors so they are powered from a separate USB brick (downconverted to 3.3V), while keeping the data line on the ESP32.
This seems to have solved the problem.
Unclear to me exactly what was going wrong, but somehow the ESP board was unhappy simultaneously powering the 5V LED strip and the two 3.3V PIRs from its two different V-out lines, even when the current draw was tiny.
Sounds like a classic poor power supply/wiring issue.
Best practice is to wire power to your LEDs directly from the power supply, not through the ESP.
In addition, your 2A supply may not be up to the task of powering 150 LEDs and the ESP at the same time for all effects and/or brightness levels.
Indeed - lesson learned! I had read those best practices, but figured to get this project going, a single supply ought to be fine to test that everything worked at very low brightness levels. I fully expected I might run into problems at higher brightness levels/special effects, but not that there would be a problem at 3%!
Still unclear to me if it is the power supply or the ESP board that causes the problem, but that doesn’t matter now - have a good solution, and new learnings for the next project