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:
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.
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
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.