NodeMCU (ESP8266) Automatic Router Restart Watchdog

This is yet another implementation of an automatic router restart/reboot watchdog that for some reason has lost connection (i.e. from ISP or misbehaving WiFi) with the help of esp8266.

In my case I used a NodeMCU board since I am more comfortable with their platform and modified code already available online from other developers.

What I used:

    • NodeMCU board
    • 1 channel 5V relay module High/Low Level Trigger (if you find a 3V one better..)
    • 5.5×2.1mm DC power female and male cables (check what your router needs!)

There is no need to use the relay to cycle power in 220V line you can do this instead to the DC input power of the router. Take extra care to find and note the DC polarity of your router’s power supply

With the relay we are interrupting DC (+) of input. At the relay connect the wires you chose for DC (+) to COM (common) and NC (normally closed) pins so that power won’t be interrupted if something goes wrong with our circuit.

The schematic diagram and an image showing what was connected where:

Powering the 5V relay from Vin of NodeMCU was not ideal but it works. If you find a 3V relay use it and power it from the 3.3V pins of the board.