Power cuts are common across India, and unexpected shutdowns corrupt SD cards. The Waveshare UPS HAT provides battery backup for graceful operation and shutdown.
Variants
- UPS HAT (B): 2x 18650, 5V/3A, I2C fuel gauge, on-board charger
- UPS HAT (C): Single 18650, compact, 5V/2A
- UPS HAT (D): LiPo connector, ultra-slim
All support pass-through charging — Pi runs uninterrupted during switchover.
Hardware Setup
- Insert 18650 batteries (observe polarity).
- Mount HAT on GPIO header.
- Connect USB-C power to HAT (not to Pi directly).
Battery Selection
- Use Samsung 25R/30Q, LG HG2, or Sony VTC6 cells. Avoid unbranded cells.
- 2500-3500 mAh per cell. Two 3000 mAh cells give 4-5 hours backup.
- Unprotected cells recommended — HAT has its own protection.
Runtime: Pi 4 idle ~3W. Two 3000 mAh cells = ~6 hours idle, 3-4 hours under load.
Battery Monitoring
import smbus2
bus = smbus2.SMBus(1)
def read_voltage():
raw = bus.read_word_data(0x43, 0x02)
return ((raw >> 8) | (raw <> 3) * 0.004
print(f"Battery: {read_voltage():.2f}V")
Safe Shutdown Script
Monitor battery voltage, initiate shutdown when below 3.2V per cell. Create a systemd service to run at boot.
#!/usr/bin/env python3
import smbus2, subprocess, time, logging
logging.basicConfig(filename='/var/log/ups-monitor.log', level=logging.INFO)
bus = smbus2.SMBus(1)
while True:
v = read_voltage()
if 0.5 < v < 3.2:
logging.warning(f"Low battery {v:.2f}V")
subprocess.run(["sudo", "shutdown", "-h", "now"])
time.sleep(30)
Use Cases
- Home server (NAS, Pi-hole, Home Assistant)
- Security cameras — continuous recording during outages
- Weather stations — uninterrupted data logging
- Industrial monitoring — no data gaps
Frequently Asked Questions
Charge and run simultaneously?
Yes, all variants support pass-through charging.
Battery lifespan?
500-1000 cycles. At daily power cuts, expect 2-3 years.
Auto-boot on power return?
No auto-power-on after shutdown. Configure HAT’s wake-on-power if available.
Works with Pi 5?
Yes, but Pi 5 draws more. Use UPS HAT (B) with high-drain cells.
Conclusion
The Waveshare UPS HAT is essential for any Pi deployment where uptime matters. Battery backup prevents SD card corruption and service interruption during India’s frequent power cuts.
Browse the full Waveshare collection at Zbotic.in with fast shipping across India.
Add comment