← Back

ESP8266 Hardware Watchdog for Mumbai Grid Stability

Mumbai's grid doesn't fail - it flickers. Brownouts, phase drops, substation switching transients that last 40-300ms. Enough to trip a UPS, hard-lock a desktop, or corrupt an ext4 journal.

Built a hardware watchdog around an ESP8266 and a PCF8563 RTC:

  • ESP8266 pings a health endpoint on the homelab server every 30s over WiFi
  • If 3 consecutive pings miss, it flips a MOSFET that cuts mains power to the server PDU for 15s, then restores it
  • PCF8563 tracks time-of-day and inhibits the hard reset between 10pm-6am (don't nuke an overnight build)
  • Blynk dashboard for remote status: grid voltage, last reset reason, uptime since

The critical insight: most UPS units detect the fault but don't clear it. A switching transient locks the UPS into bypass mode, and it stays there until a human walks over and cycles the input breaker. The ESP watchdog brute-forces a full power-cycle that resets the UPS state machine.

Three prototypes, two fried ESPs, one working rev3. Cost: ~₹1,200. Mumbai grid: still terrible. Server uptime since install: 23 days.