I’m trying to use an ESP8266 / NodeMCU with emonlib and MQTT (pubsubclient). The problem I’m having is that the wifi disconnects every 11 seconds or so, which in turn causes the mqtt client to disconnect.
I stripped all the code down and have discovered that analogRead is causing the wifi client to disconnect, which in turn causes MQTT to disconnect. The only way I can make it not disconnect is by introducing a delay into the main loop, which of course is going to mess up the measurements.
I know that people are using ESP8266s for energy monitoring, but I can’t figure out how to program around this problem.