ESP8266 keeps rebooting randomly when wifi connection gets poorer

I have defined a sensor with 2 Photoresistors measuring two LEDs on my Washingmachine. The ESP is running fine, but as soon as i start the washing machine, the ESP keeps rebooting randomly:

...
INFO esphome_washingmachine.local: Ping timed out!
INFO Disconnected from ESPHome API for esphome_washingmachine.local
WARNING Disconnected from API
INFO Successfully connected to esphome_washingmachine.local
....
[10:34:52][V][sensor:074]: 'Uptime Seconds': Received new state 35.516998
[10:34:52][D][sensor:124]: 'Uptime Seconds': Sending state 35.51700 s with 0 decimals of accuracy

As you can see, the device actually reboots (itā€™s not only the device losing wifi connection). I am logging the WiFi strength aswell to home assistant and what i found interessting is that the wifi quality slightly gets poorer when the washingmachine is actually washing. This might be due to the heavy load of the washing machine:

Might that be a reason for the esp to reboot randomly? How can i avoid that (besides trying to improve the wifi connection. ~ -68dbm is not the best, i knowā€¦).

As you can see here, the disconnects / reboot only happen during the washing state:

Just for information: Iā€™m using GPIO Pins D3 and D5 for both voltage dividers / photoresistors.

Itā€™s not the best but it should be sufficient for an ESP32 being used as an IoT device. Though this is the power received by your ESP device. The power received by your wifi access point might be lower due to the radiating efficiency of the small PCB antenna.

Thatā€™s more of a worry. It could be interference.

Can you reposition the ESP further away from the washing machine?

Iā€™ll give it a try, later that day. Maybe iā€™ll even try to move it to the next room in the basement (thereā€™s already a small hole in the wall which i could use to run the cables through), so the esp will be further away from the washing machine, even being separated by a massive concrete wall and the esp will be even closer to the wifi access point.

Hmā€¦ i have devices with -85dBm and working perfectly, so that definitely canā€™t be an issue. I think that -68 is actually quite good signal. But, on the other hand i have two ESP32 around 10cm away from my rouer. Signal is in the range of -8dBm, also working perfectly.

Yeah for IoT it should be fine, but as I said that is the received signal strength at the ESP. What is it at the router?

The router antenna may be more efficient at radiating than the ESP PCB antenna.

How is powered your ESP ?

Via regular USB power adaptor, the ESP is on a development board.

I checked a few my iot devices and all have signal at the router better than at esp. I think that the point is that routerā€™s receiver is far more sensitive than esp oneā€™sā€¦ but, i have pretty good router (asus rt-ax88).
I should also mention that i have esp boards with external antenna on locations far away from router, not the ones with pcb antenna.

Iā€™ve now moved the ESP slightly away from the washing machine (as far as the cables allowed me to) and i get slightly better results - ā€œonlyā€ 3 reboots instead of like 20+ during the washing cycle, although my wifi quality now dropped to ~72-74 dbm. So it really looks like that there were some interferences occuring during the washing cycle. iā€™ve now ordered a longer cable with connectors, so that i can move the esp out of the room, closer to the wifi & some concrete wall in between. i guess the issue will be solved then. Will keep you updated

ESP, poor WLAN, and reboot immediately make me think of power supply issues. Even if the USB power supply is good (and many arenā€™t!), there are lots of poor USB cables out there with very thin conductors. As current draw goes up, the voltage drop over the cables means the ESP may not be seeing 5V, and hence ā€˜brown outā€™.
This means that longer PSU cables could make things worse, and longer sensor cables can act as aerials, picking up interference. Sadly there is always a tradeoff between adding metal interference shielding, and allowing WiFi signals through.

A dev board like a Wemos D1 mini clone seems to be less sensitive to PSU issues than some others (just getting a bare ESP12-F module to boot used to be a challenge!), but Iā€™d suggest adding smoothing / decoupling capacitors.

Apologies, but I as donā€™t know your electronics knowledge, smoothing capacitors act like tiny batteries, smoothing out spikes and filtering out noise. Stick something like a 47uF - 200uF electrolytic capacitor across 5V and G pins and see if it helps.
Iā€™d use a multimeter on the ESP board to check the 5V and 3V3 power supply voltages, and shield the light sensor (LDR or photodiode?) cables with foil connected to 0V / GND as a quick test - shorter sensor cables are usually better.

The washing machine motor will be emitting large amounts of RF interference, despite what standards say - an old AM radio tuned between stations can be used to trace radio noise. Again, short cables, and a different mains socket from the washing machine might help.

ESPHome will reboot if it has not had a HomeAssistant connected to its API for 15 minutes.
You may want to disable that feature, given that the WiFi link may be failing to deliver.
See:
Native API reboot_timeout

1 Like

Iā€™ll double check, good idea, thanks!

Awesome idea, why didnā€™t i come up with that one. Iā€™ll definitely give it a try.

Unfortunatelly, thatā€™s not the case. Iā€™ve seen frequently api calls but then the esp suddenly reboots. Never the less - thanks for your input!

Just a guess, but if your washing machine creates a huge load on the mains power (after all, they have a motor!) it may deprive the usb power adaptor enough grunt to power the esp, just long enough to cause a reboot.

Pure speculation on my part.

Thought so aswell, but i double checked: They are connected to two completely different fuses.

Replaced the power supply today and havnā€™t got a reboot on 3 different runs on the washing machine. Looks promising, thanks everyone for the input!