ESP with BME280 and HFS-DC06 microwave motion detector running ESPHome - electronics related issues

I have a zigbee sensor outside that provides one of my external temperatures and motion detection on the porch. My lights are normally at 20% at night and brighten to 100% when motion is detected. The batteries keep draining fast and the sensor often falls off the network even though I installed a Zigbee outlet one wall away. I decided I would opt for a powered ESP32 based sensor instead that will provide temperature, humidity, pressure, and motion detection using an HFS-DC06 microwave sensor.

This is where issues start…

If I power the sensor at just above 5V using a benchtop power supply (both transformer and switching based) it works as desired. If I power it via a LM2596 buck converter (see image below) that reduces 12V to 5.2V it works as intended as long as the NodeMCU ESP32 is NOT installed.

I know most will say it is WIFI but I am not sure that is the case. If I place the sensor right next to the ESP32 but power it via the benchtop power supply it works just fine so it is something that is coming through the common 5V but it is not the buck converter itself.

Please excuse the terrible picture (courtesy of the terrible camera on the S20 ultra). The diode you see on the bottom takes the output from the buck converter and connects it to the NodeMCU. I also added a ferrite core with 4 loops (totally random, this is where I am looking for help) and placed it between the diode and the ESP32. There is also a tantalum 104 cap between 5V and GND very close to the ESP32 pins. None of this helped… except when I changed where I get power of the sensor… before I was getting it AFTER the diode, but when I take it BEFORE the diode it is way better if not actually working. It is hard to verify when I am in the room as it picks any movement I make up so I will test it overnight.

The diode introduces a voltage drop of 0.7V so by getting power before the diode the sensor is receiving just under 6V. I have tested this voltage with bench top power supplies and it is fine for the sensor. I would exclude a voltage related issue.

Assuming the diode fixed the issue, can any electronics guru tell me why? I do have a scope (200MHz max) so if I can use it in any test please let me know, I have lost a bit of practice with it so details would help.

Unrelated, but some may wonder, the BME280 is housed in a modified cable gland:

There are two layers of foam between the inside of the enclosure and the sensor. To keep out bug I used a thin nylon net.

Back to the issue - what could be causing the sensor to give nearly rhythmic false positives when both the ESP32 and the sensor are powered taking voltage after the diode? Why does it appear to improve or solve the issue if the sensor is powered prior to the diode and the ESP32 after the diode? I think I have already excluded wireless interference and voltage.

Again sorry for the terrible picture… but this is where the contraption will be mounted:

I have 12V there and will screw it in the 3/4 inch hole on the side of the box.

Update: Last night the sensor reported motion way less frequently but it was a huge amount of false positives. So… we are not there yet. While it seemed like the sensor was only suffering from Conducted EMI, once I moved everything back to a breadboard to test some filters, I started experiencing Radiated EMI too. I then tried to replace the ESP32 and go back to the 8266 and… it appears to work. WTF. I was futureproofing by using the ESP32, but if I confirm it is actually working well, I may have to go back to the 8266.

If anyone has experience with filtering EMI on ESP32 based systems please share :slight_smile:

Looks like WEMO D1 8266 is the way to go. With the NodeMCU ESP32 I was suffering from both Conducted EMI and Radiated EMI depending on how I arranged things. I could not figure out how to build a proper LP filter for the VIN of the NodeMCU which must be spewing out a lot of EMI that keeps triggering the HFS-DC06. When I moved back to the 8266 all the problems went away.

The black thing under the sensor is an inductance that I recovered from a PCB. It was filtering USB power so while I have no idea if it is helping, I figured it would not hurt so I put it between Wemo’s VIN and the diode just before the LM2596 buck converter. Just FYI, the voltage getting to the sensor and Wemo is set to 5.2V (obviously measured after the diode).

I need to add a restraint for the 12V wires so they don’t get torn out of the connector next to the buck converter. Other than that, I think I will install it after a final verification it does indeed work.

Below is the modified cable gland I used to house the BME280 which I conformally coated as well (not the hole on the BME280 chip). There is plenty of foam to separate the inside of the enclosure from the BME280 (it is inside the cable gland, and wires pass through it).

EDIT:

When I increased the sensitivity of the sensor to about 3m, from minimum which was under 1m, it started detecting false motion again. I figured it was interference again… so I made a few changes. I added 10uF tantalum caps between 5V and GND before and after the inductance (black cylinder) to create a Pi filter (CLC) but keep in mind I have no idea what the inductance H value is and no idea how to calculate the proper filter given I don’t even know the frequency of the interference. I also moved where I take power for the sensor. Instead of taking it after the Pi filter, where the VIN of the 8266 is also connected, I connected it before the diode, therefore immediately at the the buck converter’s output. I put it all back together and left it alone for the night. No false reports!! In the morning when I walked in, it detected me perfectly. Maybe I did fix it this time!

The pictures do not show the tantalum caps. Due to GND availability I could only place them right next to the 220uF 35V cap of the buck converter, and next to the pin header I use for the sensor. This means that the Pi filter has an added diode in the circuit that is typically not there… but it seems to work.

EDIT: I purchased a set of inductors and used an online calculator to see what combination of inductor and caps I needed to filter in the low hundreds of Hz. I am not certain but I believe the values were 4.7mH and 100uF for the cap (2nd order Pi filter). I added 100uF caps before and after to make it a 3rd order Pi Filter but I am not sure whether the cap value was supposed to change when doing so… either way, it appears to work way better now. I actually added 2 of these filters… one is on the ESP’s VIN (3rd order) and the other on the mmWave sensor VIN (2nd order):

(sorry for the fuzzy picture)

1 Like

Update: The mmWave sensor appears to be reporting correctly. All the false reports (I compared the PIR to mmWave) that I inspected turned out NOT to be reports but rather instances where the ESP goes “unavailable”. I am now trying to figure out why this is happening. Interestingly, the issue affects several ESPs I have and they all happen within seconds of each other, and many times during the 24hrs.

This is what it looks like installed.

I also found that the BME280 is not a great choice for temperature. Even Bosch says it is just a reference for the Humidity sensor in the BME280 and may report high due to self heating of the sensor. I am evaluating other sensors to install in its place. I am also wondering whether measuring the outdoor temperature in that spot is getting skewed by heat released by the structure or the fact it is up close to the ceiling with less air circulation.

The IP Camera is turned off while I test as it generates a lot of heat. Soon I will turn it back on as colder weather approaches to see if it affects the readings.

1 Like

Thanks for the detailed report.

1 Like