While I’ve used a Laptop with a ping script I made in the past, I needed something more portable.
So I build:
- Scan for wifi networks
- Connect
- Enter IP to ping
- Buzzer beeps when ICMP packet received
- Gateway not reachable ? Sound alarm note
This way I can use both hands, hanging upside-down in a hard-to-reach place, without turning my head to a screen or my phone.
CODE (Below code is for D6)
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
#include <ESP8266Ping.h>
ESP8266WebServer server(80);
String pingHost = "";
bool startPinging = false;
unsigned long lastPingTime = 0;
bool gpioState = false;
void setup() {
Serial.begin(115200);
pinMode(D6, OUTPUT);
// WiFiManager captive portal
WiFiManager wm;
if (!wm.autoConnect("ESP_SetupAP")) {
Serial.println("Failed to connect, restarting...");
ESP.restart();
}
Serial.println("WiFi connected. IP:");
Serial.println(WiFi.localIP());
// Web UI
server.on("/", HTTP_GET, []() {
String html = "<html><body><h2>ESP Continuous Ping</h2>"
"<form action='/start'>"
"Host/IP to ping: <input name='host' type='text'>"
"<input type='submit' value='Start Pinging'>"
"</form></body></html>";
server.send(200, "text/html", html);
});
server.on("/start", HTTP_GET, []() {
if (!server.hasArg("host")) {
server.send(400, "text/plain", "Missing 'host' parameter.");
return;
}
pingHost = server.arg("host");
startPinging = true;
server.send(200, "text/plain", "Started pinging " + pingHost);
});
server.begin();
}
void loop() {
server.handleClient();
if (startPinging && millis() - lastPingTime > 2000) {
lastPingTime = millis();
bool success = Ping.ping(pingHost.c_str(), 1);
if (success) {
gpioState = !gpioState;
digitalWrite(D6, HIGH);
delay(500);
digitalWrite(D6, LOW);
delay(500);
Serial.println("Ping success, toggled D6.");
} else {
Serial.println("Ping failed.");
digitalWrite(D6, LOW);
}
}
}
Further ideas
- Ping gateway at start with other sound
- Change frequency beeps when TTL gets high/low
- Access Point DB beeper?
see:
https://www.henriaanstoot.nl/2025/05/06/found-a-rogue-ap-in-my-house/








