Network Watchdog

Novamostra Network Watchdog In general a watchdog is a piece of equipment that supervises other systems and resets them in case it detects that those systems are failing, automating the process and increasing the reliability of the system. Network Watchdog is a simple watchdog for monitoring network connectivity and power cycle a device based on ICMP ping replies. With it’s minimal power requirements, Network Watchdog can use the controlled device’s DC Power source (between 5 and 12 volts) to function, avoiding any additional power requirements. The following is an example setup:

Functionality

  • Powered from the controlled Device (usually a wifi repeater or access point)
  • Can be used both in local and public networks.
  • Ping is working both for IP Addresses and URLs.
  • Redundancy functionality using secondary address.
  • Manual restart of the controlled Device using the Web Interface or the built-in button.
  • Configuration Reset Switch (Keep Restart button pressed for 3 seconds)

Bill of Materials

1) ESP8266-01 2) AMS1117 3.3V 3) IRLZ44N N-Channel Mosfet 4) 10μF Capacitor (2 pcs) 5) 100nF Capacitor 6) 1k Resistor 7) 10k Resistor 8) 220k Resistor 9) Push Button 10) DC Barrel Power Jack/Connector (Input) 11) DC Barrel Power Jack Plug (Output) 12) An ESP Programmer or another way (i.e using Arduino UNO), to program your ESP-01 Board

Programming

  1. Launch Arduino IDE and add support for the Espressif boards by navigating to File > Preferences and adding http://arduino.esp8266.com/stable/package_esp8266com_index.json to the Additional Boards Manager URLs:
Arduino IDE - Preferences
  1. Go to Tools > Boards Manager and open the Boards Manager.
Arduino IDE - Boards Manager
  1. Search for ESP, and install the latest available esp8266 library by clicking Install, at the bottom right of the corresponding library/
Arduino IDE - Boards Manager - Espressif
  1. Wait for the installation to complete and then select the Generic ESP8266 Board for the Board Type by navigating to Tools > Board > ESP8266 Boards (3.0.2) > Generic ESP8266 Module
Arduino IDE - Generic ESP8266 Module
  1. Network Watchdog uses SPIFFS (an SPI File System), to host the files of the web interface, thus is required to share the total memory between code and those files. From the Tools > Flash Size menu select the option 1MB (FS:512KB OTA:~246KB)
Arduino IDE - Flash Size
  1. Download the ESP8266FS Plugin from the last version(0.5.0 as of writing) from official page
  2. Unzip it and copy the esp6266fs.jar to your Arduino sketchbook tools directory. (Create tools directory if it doesn’t exist yet). You can find the location of your sketchbook directory in the Arduino IDE at File > Preferences > Sketchbook location (visible in the first picture of the programming procedure)
esp8266fs.jar tool
  1. Close and Restart Arduino IDE. You should now have the ESP8266 Sketch Data Upload Command available, under the Tools menu.
ESP8266 Data Upload
  1. You need to install the additional libraries required for NetworkManager. From the Tools Menu select Manage Libraries and install all the following libraries:
    • ESPAsyncTCP (v 1.2.2)
    • ESPAsyncWebSrv (v 1.2.3)
    • ESPping (v 1.0.1)
    • NTPClient (v 3.2.1)
  2. Connect your ESP Programmer to your computer, and select the appropriate COM Port.
Arduino IDE - Board Port Selection
  1. Clone or download the repository as a zip from https://github.com/novamostra/network_watchdog and open the NetworkWatchdog_1_0_0.ino
  2. Upload the Web UI Data files by navigating to Tools > ESP8266 Sketch Data Upload.
ESP8266 Sketch Data Upload And when complete, the SPIFFS Image Uploaded message will appear. SPIFFS Image Uploaded
  1. Upload the code by clicking the Upload Button.
Upload Button And wait for the Done uploading message. Done uploading
  1. You ESP8266 device is now ready! Attach it to the schematic, power it up using any source between 5 and 12 volts and your ready to go.

Schematic

Network Watchdog Schematic

Configuration

Soon after the initial boot or if the Network Watchdog was reset, the device creates an Access Point with the following settings:
SSID: nm_watchdog
Password: [no password]
Web UI Interface: http://192.168.1.1 or http://nm-wd.local
nm_watchdog wifi network Connect to the nm_watchdog wifi network, navigate to http://nm-wd.local or http://192.168.1.1 set your local WiFi Settings and change the preconfigured default behavior, if you want to ping a different server or device. After the initial configuration you have to restart your Watchdog in order to connect to your WiFi network as a client Watchdog Access Point By default WiFi watchdog, pings example.com and if no reply is received then it turns the controlled device off and then back on. You can also set a secondary ping IP/URL for redundancy.

Web Interface

When the Watchdog acts as a client in your Wifi network it will deploy a webserver with information and more functionality (http://nm-wd.local or the device’s IP in your local network) Network Watchdog Web Interface

Security Concerns

  • Due to hardware limitations, it’s impossible to implement secure http (https) on the ESP-8266. To avoid the possiblity of password sniffing during WiFi configuration, the connectivity setup is only possible when Network Watchdog is acting as an Access Point with the additional restriction of only one active client connected to the device during configuration.

Credits

For the Web User Interface, Network Watchdog uses Pure.css
0 0 votes
Article Rating
Subscribe
Notify of
guest

5 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
TKV

Hello!
When compiling, it gives the following error:

In function ‘String processor(const String&)’:
Network Watchdog_1_0_0:451: error: control reaches end of non-void function [-Error=return-type]
cc1plus.exe: some warnings being treated as errors
exit status 1
control reaches end of non-void function [-Error=return-type]

Tried it in different versions
In 2.2.1:
C:\Arduino\NetworkWatchdog_1_0_0\NetworkWatchdog_1_0_0.ino: In function ‘String processor(const String&)’:
C:\Arduino\NetworkWatchdog_1_0_0\NetworkWatchdog_1_0_0.ino:451:1: error: control reaches end of non-void function [-Error=return-type]
 451 | }
    | ^
cc1plus.exe: some warnings being treated as errors

exit status 1

Compilation error: control reaches end of non-void function [-Error=return-type]

What could be the problem?

John C

Thanks for sharing this! Do I need to make any changes to your sketch to connect to my WiFi network. After uploading the sketch the AP network doesn’t show up and therefore I cannot connect to it. Thanks

бнанс бонус за рефералв

Your article helped me a lot, is there any more related content? Thanks!