Router reboot when the internet dies

Pings a few addresses and, if the connection is really gone, power-cycles the router through a relay, with limits so it never reboot-loops.

Server / Home Assistant Board: ESP32-C3 SuperMini Level: ●●○ ⏱ 1–2 h

⚠ Caution

Switch only low-voltage loads yourself. For mains loads use a certified isolated module in a box or call an electrician.

Let the box restart the router for you

Routers hang more often than they should, and the usual cure is to unplug them for ten seconds. An ESP32 can do that automatically: it pings two or three reliable addresses, and if all of them fail for several minutes, a relay cuts the router’s power for ten seconds and restores it.

Do not make it worse

  • Test more than one address, otherwise one server being down restarts your router for nothing.
  • Wait a few minutes before acting, and wait longer after each restart, so a provider outage does not become a reboot loop.
  • Limit the number of restarts per day, and send a message when you hit the limit.
  • Use the relay’s normally closed contact, so the router stays powered if the ESP32 itself dies.

The relay switches the router’s low-voltage adapter or its mains plug. For mains, use a proper enclosed relay module, and keep the wiring clear of the low-voltage side.

Components

  • ESP32-C3 SuperMini
  • Relay module 1-channel 5V (opto-isolated)
  • USB charger 5V 2A
  • Plastic project enclosure

What you need

Buy the parts kit · Estimated total: $11.00

ESP32-C3 SuperMini × 1
$2.50
Buy at AliExpress Buy at Amazon.com
Relay module 1-channel 5V (opto-isolated) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
USB charger 5V 2A × 1
$4.00
Buy at AliExpress Buy at Amazon.com
Plastic project enclosure × 1
$3.00
Buy at AliExpress Buy at Amazon.com
🇺🇦 Ukraine🌍 Other countries

Ukraine: we buy and sell these parts ourselves, order them on this site.

Some links are affiliate links: we may earn a commission at no extra cost to you.

Related ideas

⛔ High risk

Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.

Zigbee load control on mini-PC

ESP32-C6 and a Zigbee dongle on a mini-PC switch loads through Home Assistant with local rules.

  • Board ESP32-C6 DevKitC-1
  • Level ●●● Advanced
  • Build time 3–5 h
Pick parts / kit
⚠ Caution

Switch only low-voltage loads yourself. For mains loads use a certified isolated module in a box or call an electrician.

Router and Starlink watchdog

Pings the internet and power-cycles the router or ONU through a relay when the connection hangs, with a Telegram notice.

  • Board ESP32-C3 SuperMini
  • Level ●○○ Beginner
  • Build time 1 h
Pick parts / kit
⚠ Caution

Switch only low-voltage loads yourself. For mains loads use a certified isolated module in a box or call an electrician.

Gate and garage door status with remote pulse

Two reed switches report open and closed, a relay gives the opener a pulse, and a message tells you when the gate was left open.

  • Board ESP32-C3 SuperMini
  • Level ●○○ Beginner
  • Build time 1–2 h
Pick parts / kit

← All module ideas →

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.