A tiny companion that lives on your Raspberry Pi.
A pixel-art face that reacts to how the machine is doing, plus four status
screens, on a 128×64 OLED and three buttons.
PiPal is a small, self-contained Python service for a Raspberry Pi with an SSD1306 I²C OLED. It blinks, gets sleepy when ignored, and pulls a face when the CPU gets hot — and in between it shows you CPU, temperature, memory, disk, network, Docker containers and systemd units.
It is built to be lived with: no busy-loop, no constant redraws, about 2 % of one core. Everything you would want to change — pins, timings, thresholds, which services to watch, which face means what — is configuration, not code.
- A companion, not a screensaver. Blinks at random intervals, glances around,
drifts into
sleepyafter 5 minutes andsleepingafter 10, wakes on a button. - Reacts to the machine. Hot CPU, lost Wi-Fi, a failed unit or a stopped container each pull a different face — edge-triggered with a cooldown, so it stays calm instead of twitching.
- Five screens on a rotation. Companion 30 s, then System, Network, Docker and Services for 10 s each. All timings configurable.
- Slow auto-scroll for lists longer than the panel, with a scrollbar and a pause button. Your service list is not limited to what fits.
- Degrades, never crashes. No Docker, no such unit, Wi-Fi down, OLED unplugged — each failure costs you one screen, not the process.
- Develop without hardware. A simulator renders the real 1-bit framebuffer to your terminal or a window, with keyboard buttons.
- Own your artwork. Faces are an external PNG sheet plus a JSON manifest. Swap them without touching Python.
| Part | Notes |
|---|---|
| Raspberry Pi | Developed on a Pi 5 / Raspberry Pi OS Bookworm; a Pi 4 or Zero 2 W should work |
| 128×64 OLED | SSD1306 controller, I²C, address 0x3C |
| 3 × momentary buttons | Wired straight to ground; the internal pull-ups do the rest |
| Signal | Pi pin | GPIO |
|---|---|---|
| OLED VCC | 1 (3.3 V) | — |
| OLED GND | 6 | — |
| OLED SDA | 3 | GPIO2 |
| OLED SCL | 5 | GPIO3 |
| BTN1 — previous screen | 11 → GND | GPIO17 |
| BTN2 — next screen | 16 → GND | GPIO23 |
| BTN3 — hold / auto | 15 → GND | GPIO22 |
Pins are set in config/config.json; the validator refuses GPIO2 and GPIO3
because they belong to I²C. A hardware power button on the Pi 5's J2 header is
handled by firmware and needs nothing from PiPal.
On your workstation:
git clone https://github.com/<you>/pipal.git && cd pipal
cp .env.example .env # set PI_HOST and PI_DIR
make deploymake deploy rsyncs the source to the Pi and runs deploy/install.sh there,
which apt-installs the compiled dependencies, enables I²C, adds your user to
i2c/gpio/spi/docker, builds a venv, probes the bus, validates the config,
then renders and installs a systemd unit and starts it. It is idempotent — re-run
it whenever you like.
make logs # journalctl -u pipal -f
make status
make push # rsync + restart only, no apt/pip — use this while iteratingIf the installer says REBOOT REQUIRED, it had to switch I²C on; reboot once and the service comes back by itself.
Installing directly on the Pi instead
git clone https://github.com/<you>/pipal.git ~/pipal
cd ~/pipal && ./deploy/install.shCompanion — the face, full-bleed. Event-driven: it redraws when the expression changes and not otherwise, roughly three times every ten seconds when idle.
System — clock, CPU, temperature, RAM, disk with bars, uptime and load. A long BTN3 shows absolute figures instead of percentages.
Network — link state, SSID, IPv4 and live throughput. A long SSID scrolls.
Docker — ● running, ○ stopped, ◐ unhealthy, with an n / m running
summary. Reads the Docker socket directly (no SDK dependency) and falls back to
the docker CLI.
Services — ● running, ○ stopped, ✕ failed for every unit in your watch
list, with an n / m OK summary.
| Press | Action |
|---|---|
| BTN1 | previous screen |
| BTN2 | next screen |
| BTN3 | toggle HOLD — pin the current screen, press again for auto-rotation |
| BTN3 held | the screen's own action: System detail view, Docker/Services scroll pause, Network re-sample |
BTN1/BTN2 suspend auto-rotation for 20 seconds so a screen you chose does not slide away while you read it. HOLD suspends it indefinitely; a small block in the bottom-right corner tells you it is on.
Anything taller than the panel scrolls itself, slowly: dwell at the top, creep down at 8 px/s, dwell at the bottom, creep back. It never jumps — at 64 pixels tall, a jump is much harder to follow than a crawl.
Everything lives in config/config.json. Keys beginning
with $ are inline documentation and are stripped on load.
| Section | What it controls |
|---|---|
display |
I²C bus and address, size, rotation, contrast, backend |
buttons |
GPIOs, debounce, long-press threshold |
screens |
order, which is default, dwell times, manual hold |
refresh |
per-monitor poll intervals and redraw rates |
companion |
blink and idle timing, drowsiness thresholds, idle expressions |
reactions |
device state → face, with priorities and thresholds |
scroll |
auto-scroll speed and dwell |
services |
the units to watch |
docker |
socket path, CLI fallback, row limits |
Drop a config/config.local.json next to it to override values without editing
the tracked file — it is gitignored. PIPAL_CONFIG, PIPAL_BACKEND and
PIPAL_LOG_LEVEL override from the environment.
The config is validated at startup: unknown screens, button GPIOs that clash with I²C or with each other, and missing dwell times are all reported by name.
"services": {
"monitored": [
{ "label": "SSH", "unit": "ssh.service" },
{ "label": "Docker", "unit": "docker.service" },
{ "label": "Mosquitto", "unit": "mosquitto.service" }
]
}label is what appears on screen, unit is what systemctl is-active is asked
about. Then make push. No code change.
{ "when": "cpu_temp_above", "value": 75.0, "emotion": "angry", "priority": 70 }Discrete events — boot, shutdown, wifi_lost, wifi_restored,
service_failed, container_exited — and thresholds on cpu_temp,
cpu_percent, ram_percent, disk_percent. Thresholds fire on the crossing,
not continuously, and a 60-second cooldown sits between any two reactions.
A face pack is a PNG sprite sheet plus a JSON manifest describing the grid, the emotion → frame mapping, aliases and multi-frame sequences. To use your own:
- Drop the sheet in
assets/faces/. - Copy
retro-mecha.pack.jsonbeside it and editimage,gridandemotions. - Point
companion.sprite_sheetat your pack. make faces— renders every frame as ASCII plus a labelled contact sheet, so you can check the labels landed on the art you meant.
Conversion to one bit is a hard alpha/luma threshold and any scaling is nearest-neighbour, so pixel art stays exactly as drawn — never dithered, never blurred.
No Raspberry Pi required. The simulator renders the same 1-bit framebuffer the OLED would receive, and maps the buttons to keys.
make dev # venv + dev requirements
make run # the whole app, against the simulator
make check # validate config, assets and screens
make test # 67 unit tests
make sim # optional: a live pixel-accurate window (pygame-ce)simulator.mode in the config picks how it renders: terminal (ANSI half-blocks,
no extra dependencies), pygame (a scaled window) or png (a file per frame).
Keys: ←/a, →/d, space/s, shift for a long press, q to quit.
dashboard.py entry point: args, logging, config
pipal/
├── app.py application + ScreenManager + main loop
├── config.py load, merge, validate
├── context.py what screens are allowed to see
├── display/
│ ├── manager.py framebuffer, dirty tracking, backend choice
│ ├── theme.py Canvas: text, bars, viewports, scrollbars
│ ├── font5x7.py bundled 5x7 bitmap font - no font file, no AA
│ └── backends/ ssd1306.py (luma) · simulator.py
├── sprites/manager.py pack loading, cropping, 1-bit conversion
├── companion/ manager.py · emotions.py · reactions.py
├── input/ buttons.py (gpiozero + simulator) · events.py
├── monitors/ system · network · docker · services
└── screens/ base.py (Screen, ListScreen) · scroller.py · five screens
The loop never spins. Each pass takes the earliest of: the active screen's next redraw, the rotation deadline, and every monitor's next poll — then sleeps until then, capped at 50 ms so button events are picked up promptly. The framebuffer is hashed before every write, so an unchanged frame costs no I²C traffic at all.
Every monitor traps its own exceptions and exposes .data / .error / .stale.
A failed docker ps degrades exactly one screen.
python3 tools/preview_sheet.py --ascii # inspect a face pack (stdlib only)
python3 tools/render_screens.py # render every screen to a PNG
python3 tools/render_demo.py # regenerate the README images
python3 tools/check_buttons.py # button diagnostic — run this on the Pimake gpio-log # what the service logged about GPIO, buttons and the OLED
make buttons # live button diagnostic on the Pi
make i2c # i2cdetect -y 1 — the OLED should appear at 3c
make logs| Symptom | Cause |
|---|---|
Failed to initialize OLED |
I²C not enabled, wrong address, or the user is not in the i2c group. Re-run deploy/install.sh, then reboot. |
Nothing at 3c in i2cdetect |
Wiring. SDA on pin 3, SCL on pin 5, VCC on 3.3 V pin 1 — not 5 V. |
Buttons work under make buttons but not as a service |
lgpio creates a .lgd-nfy-N FIFO in its working directory. The unit sets LG_WD=/tmp and deliberately does not set ProtectHome, which would make that directory read-only. |
GPIO buttons UNAVAILABLE |
sudo apt install python3-lgpio, and check the user is in the gpio group. |
Docker unavailable |
Daemon not running, or the user is not in the docker group — log out and back in after adding. |
226/NAMESPACE from systemd |
A path in ReadWritePaths does not exist. |
rsync: unrecognized option |
macOS ships openrsync; the scripts stick to flags both accept. |
Run it by hand to watch it closely:
make stop && make shell
.venv/bin/python dashboard.py --log-level DEBUG--check, --screen <name>, --no-rotate and --backend simulator are all
available.
Built with luma.oled,
gpiozero, psutil
and Pillow. The 5×7 font is bundled and
hand-drawn; the face pack in assets/faces/ ships with the project.



