Nodemcu with blynk constantly keeps connecting and disconnecting

For anyone who reads this in the future, a few comments that you may have missed if you didn’t study the rest of the topic…

  1. this is a Blynk Legacy project and will not work with Blynk IoT without modification. Blynk Legacy is now discontinued and unsupported, and will cease to function at some point in the future when the legacy cloud servers are decommissioned.

  2. this project uses digital pins rather than virtual pins to control the relays. This is a bad approach, and one that I would strongly recommend avoiding.

  3. this project has no code to synchronise the device with the app, or the app with the device. This means that when the device restarts (which it will do once every 24 hours) the relays will be turned off by the digitalWrite commands in the void setup, but the app will not reflect this change, so the user will not know if relays are on or off by looking at the app.

  4. it should not be necessary to restart a device one per day. This is a clunky workaround to an issue that appears to be caused by the router or ISP.

  5. some of the GPIO pins used in this sketch are not ideal pins to use with a NodeMCU. In reality, using a NodeMCU to control an 8-way relay board is asking too much. It would be far better to use an ESP32 board, or an ESP8266 with a multiplexer board like the MCP23017 or 74HC595, as described here:

and here:

Pete.

2 Likes