Zero-terminal network management for Raspberry Pi Zero W2
PiTail is a lightweight web app that lets you manage WiFi, Tailscale, and optionally a PiSugar battery on a Pi Zero W2 — entirely from a browser. No keyboard, no monitor, no terminal required after the one-time install.
- 🔐 Login page — username/password auth, change credentials in UI
- 📡 WiFi management — scan, connect, forget networks from the browser
- 🌐 Tailscale — install, authenticate, connect/disconnect, advertise routes, view peers
- 🔁 Auto-hotspot fallback — if no WiFi after boot, Pi creates
PiTail-Setuphotspot automatically - 🔌 USB OTG — plug a USB cable into your PC, access UI at
192.168.7.2:5000with no WiFi - 🔋 PiSugar battery (optional, off by default) — battery gauge, charge protection, auto-shutdown, RTC sync, button mapping
- ⚙️ Settings — toggle hardware integrations, change credentials, hotspot SSID, reboot/shutdown
| Method | URL | When to use |
|---|---|---|
| WiFi | http://<pi-ip>:5000 or http://pitail.local:5000 |
Normal operation |
| USB Cable | http://192.168.7.2:5000 |
Always works, no WiFi needed |
| Auto-Hotspot | http://192.168.50.1:5000 |
Auto-activates ~2 min after boot if no WiFi |
Connect the Pi's data USB port (middle port on Zero W2) to your PC. Pi appears as a USB ethernet adapter — no drivers needed on Windows 10+, macOS, or Linux.
A background watchdog monitors WiFi. If no connection after ~2 minutes it creates:
- SSID:
PiTail-SetupPassword:pitail123
Connect and browse to http://192.168.50.1:5000. Once you configure WiFi, the hotspot stops automatically.
git clone https://github.com/SuperAngryMonkey/pitail.git
cd pitail
sudo bash install.sh
sudo reboot # required for USB OTGRequirements: Raspberry Pi OS Lite (Bookworm), Pi Zero 2 W, internet access for Tailscale.
| Field | Default |
|---|---|
| Username | admin |
| Password | pitail |
Change immediately after first login via Settings.
PiSugar support is disabled by default — it only activates if you turn it on in Settings. This keeps the app lightweight for everyone who doesn't have a PiSugar.
- Go to Settings → Hardware Integrations
- Toggle PiSugar Battery on
- A 🔋 Battery link appears in the navigation
| Feature | Description |
|---|---|
| Live battery gauge | % charge with color-coded bar |
| Voltage display | Real-time battery voltage |
| Charging status | Plugged / charging / full / discharging |
| Auto-shutdown | Set low battery % threshold to trigger clean shutdown |
| Charge protection | Limit charge to 80% to extend battery lifespan |
| RTC sync | Sync Pi clock ↔ RTC or from internet |
| Button mapping | Map single/long press to shutdown, reboot, etc. |
If not already installed, the Battery page has an Install button that downloads and runs the official PiSugar installer. Requires internet access.
Manual install:
wget https://cdn.pisugar.com/release/pisugar-power-manager.sh
bash pisugar-power-manager.sh -c releasePiSugar communicates over I2C. Enable it on first boot:
sudo raspi-config
# Interface Options → I2C → Yes
sudo reboot- PiSugar 3 (1200mAh)
- PiSugar 3 Plus (5000mAh)
pitail/
├── app.py # Flask app — all routes and backend logic
├── install.sh # One-time installer
├── pitail.conf # Auto-generated config (credentials, settings)
├── templates/
│ ├── base.html # Shared nav + CSS
│ ├── login.html # Login page
│ ├── index.html # Dashboard
│ ├── wifi.html # WiFi management
│ ├── tailscale.html # Tailscale management
│ ├── battery.html # PiSugar battery management (shown when enabled)
│ └── settings.html # Settings + hardware toggles + power controls
└── static/ # Static assets
sudo systemctl status pitail
sudo journalctl -u pitail -f
sudo systemctl status pitail-wifi-watch
sudo journalctl -u pitail-wifi-watch -fGet an auth key from: https://login.tailscale.com/admin/settings/keys
Paste into Tailscale → Auth Key and click Connect.
Windows: If adapter doesn't appear, install RNDIS driver:
https://modclouddownloadprod.blob.core.windows.net/shared/mod-rndis-driver-windows.zip
macOS / Linux: Works automatically.
- E-paper install hardened —
install_epaper.shrewritten to be resilient (no hard-exit on best-effort steps), venv now created with--system-site-packagesso apt-installed lgpio/gpiozero are visible, added rpi-lgpio shim, explicit per-module verification. Addedfix_epaper.shfor existing installs. - USB OTG fixed — installer now sets
dtoverlay=dwc2,dr_mode=peripheraland strips the stock image's conflicting host-mode lines (the real reason USB gadget mode wouldn't enumerate on the Pi Zero 2 W). Addedfix_usb.shfor existing installs. - Hotspot rewritten using hostapd + dnsmasq — NetworkManager's hotspot does not reliably enter AP mode on the Pi Zero 2 W (brcmfmac chip); hostapd talks to the driver directly and works
- Watchdog now hands wlan0 between NetworkManager (client) and hostapd (AP) cleanly
- Manual hotspot start/stop in the web UI uses the same hostapd path
- Added
fix_hotspot.shto convert an existing install without a full reinstall
- Added PiSugar 3 battery integration (disabled by default)
- Battery page: gauge, voltage, charge state, auto-shutdown, charge protection, RTC sync, button mapping
- Settings: hardware integration toggle (PiSugar on/off)
- Dashboard: battery card when PiSugar enabled
- Navigation: Battery link appears only when PiSugar enabled
- Initial release: WiFi management, Tailscale, auto-hotspot, USB OTG
- Python 3 / Flask — web framework
- NetworkManager (
nmcli) — WiFi management - Tailscale — secure remote access
- PiSugar Power Manager — battery management (optional)
- systemd — service management
- USB OTG (
g_ether/dwc2) — USB ethernet gadget
MIT — see LICENSE.