ESP8266 Arduino sketch to monitor Computer reachability
The Arduino sketch is intended to run on a ESP8266 based ESP-12E board.
There are 3 components in this project -
- Computer that we want to monitor
- ESP-12E board
- IFTTT enabled smart switch (Eg. D-Link Smart Plug) that is used to power both the computer and the ESP-12E board.
All the three components are connected to internet.
The ESP-12E is used to monitor the computer. When the computer is switched off, the ESP-12E switches off the power to the computer and to itself via the IFTTT enabled smart switch.
The ESP-12E uses periodic ICMP pings to determine if the computer is up. On startup, the ESP-12E periodically polls the computer and once the computer is found to be reachable, it considers itself as armed. In armed state, the ESP-12E will continue to periodically poll the computer and if the computer goes down, it will switch off the power supply by sending a command to a DLink Smart Plug via a IFTTT Webhook.
- ESP8266 Arduino Core - Install in Arduino IDE by going to
Preferences
and addinghttp://arduino.esp8266.com/stable/package_esp8266com_index.json
inAdditional Board Manager URLs
field and then installing the pacakge by going toSketch -> Include Library -> Manage Library
. More details here. - TaskScheduler - Install in Arduino IDE by going to
Sketch -> Include Library -> Manage Library
. - ESP8266Ping - Download the ZIP file and install in Arduino IDE by going to
Sketch -> Include Library -> Add .ZIP Library
.
Configure the sketch to suit the run environment. Parameters that must be configured by editing the sketch file -
SSID
PASSWORD
MONITOR_IP
MONITOR_DURATION_MS
FAIL_THRESHOLD
CONTROL_SERVER
OFF_URL
- https://www.arduino.cc/en/Reference/HomePage
- http://esp8266.github.io/Arduino/versions/2.3.0/doc/libraries.html
- CP2102 USB driver for ESP-12E is available here.