Skip to content
Ranbo-codezPublic

About

A pocket chess computer: Stockfish 19 on a Raspberry Pi Zero 2 W, with a 2.8" screen, a joystick and six buttons. Try the OS in your browser.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

ChAIpi: a brown handheld with a joystick on the left, a 2.8-inch screen showing the home menu, and Confirm and Undo buttons on the right

ChAIpi

A pocket chess computer: Stockfish 19 on a Raspberry Pi Zero 2 W, with a 2.8" colour screen, a joystick and six buttons.

⬇ Download the latest release

Try the emulator · Flash the SD card · Build one · Parts list · Docs

Status: not yet tested on hardware Engine: Stockfish 19 License: GPL-3.0

ChAIpi plays chess against you at any level from 400 to 3190 Elo, sits next to a real board and suggests moves, keeps a clock for two players, and reviews your games afterwards. Every game is saved as its own PGN .txt file. It also has a tab of extras: games, a graphing calculator, an equation solver, puzzles, and your own Python apps. It shares files with any phone over its own Wi-Fi, with no app to install.

It's designed to run the official Stockfish 19 build at the Pi's full speed on all four cores, off a battery.

Important

Status: not yet tested on hardware. The software is written and tested on a computer: the whole OS runs in the emulator below, and the automated tests pass. The SD-card image builds automatically on GitHub. It has not yet booted on a real ChAIpi, and the hardware is still being assembled. Expect fixes after the first real boot. docs/13 lists exactly what has been tested.

Screen recording of the ChAIpi OS: boot animation, home menu, a game in progress, Helper mode with move arrows, game review, the Extras tab, Rickshaw Rush and the graphing calculator
The device's real 320×240 screen, recorded from the emulator

What it does

Play Against Stockfish 19 from 400 to 3190 Elo, with think times of 1, 4 or 12 seconds, a chess clock, hints and takebacks.
Helper For a game on a real board: enter the moves as they're played, and see the engine's top three moves as arrows.
Two player A shared board with a chess clock.
History and review Every game saved as a PGN .txt. A review screen steps through it with accuracy, an evaluation graph and the best move at each turn.
Extras Games: Dhoom, Rickshaw Rush, Blocks, Snake, 2048, Breakout, Flappy Chai, Minesweeper. Tools: scientific calculator, graphing, equation solver, chess clock, coin and dice, Life. Chess: mate-in-one puzzles (import Lichess packs) and coordinate training. Media: YouTube Shorts.1
Your own apps Write a game in Python with the small chaipi SDK (device/sdk) and send it over.
Other engines Add any ARM64 UCI engine. Uploads are checked before they're installed.
Transfer ChAIpi starts its own Wi-Fi network. Your phone joins, types a 4-digit PIN, and gets a page to download games, upload engines, apps and puzzle packs, and back up or restore. A USB-C drive mode and the screen's microSD slot do the same without Wi-Fi.
Made for a pocket Sleep, screen dimming, battery percentage and warnings, a real-time clock for correct game dates, a vibration motor, light and dark themes. Every move is saved as it's played, so switching off never loses a game.
Home menu: Play, Helper, Two player, Extras, History, Settings A game in progress with move list and clocks Helper mode showing the engine's top three moves as arrows
HomePlayHelper: the top three moves as arrows
Game review with accuracy and an evaluation graph The Extras tab with games Graphing calculator plotting two curves
Game reviewExtrasGraphing

Try it in your browser

The emulator is the real ChAIpi OS. The same code runs on the device (see How it works), so what you click through here is what the device shows. Moves come from a small demo engine built into the page. The device uses Stockfish 19.

  • Online: https://ranbo-codez.github.io/chaipi/
  • Offline: download chaipi-emulator.html from the latest release and double-click it. It's a single file with everything inside.
  • From this repository: python3 tools/build_emulator.py chaipi-emulator.html --inline-fonts

Click the device, then use the keyboard:

Key Button Key Button
Arrow keys Joystick Esc Esc (back)
J Joystick press Tab Tab (switch view; hold for full screen)
Enter Confirm M Menu (hold for the quick panel)
Backspace Undo F Fn

The page also has a phone that's linked to the device, so you can try Transfer from both sides.

The Transfer page on a phone: your games, ready to download as PGN files

Flash the SD card

  1. Download …-chaipi.img.xz from the latest release. It's about 880 MB. Don't unzip it.

  2. Open Raspberry Pi Imager: Choose Device → Raspberry Pi Zero 2 W · Choose OS → Use Custom → the .img.xz · Choose Storage → your microSD card (8 GB or more) → Next → No to OS customisation → Yes to write.

  3. Optional, before the first boot: take the card out and back in. A drive called bootfs appears. Put either of these plain-text files on it:

    • chaipi-wifi.txt, to join your Wi-Fi without using the buttons:
      ssid = Home WiFi
      password = your-wifi-password
      country = IN
      timezone = Asia/Kolkata
      
      country is your two-letter country code and timezone your time zone name. Leave out what you don't need.
    • chaipi-ssh.txt, with your SSH public key (for example, the contents of ~/.ssh/id_ed25519.pub), if you want to log in over SSH.

    ChAIpi reads them at boot, applies them and deletes them.

  4. Put the card in the Pi and switch on. The first boot takes a minute or two longer than later ones.

SSH, if you added a key: ssh pi@chaipi.local. Passwords don't work over SSH, and sudo needs none. Without buttons wired yet, chaipi-keys drives the UI from your keyboard over SSH. More in image/README.md.

Build one

Part Notes
Raspberry Pi Zero 2 W + heatsink Runs at stock speed. Stockfish uses all four cores
2.8" ILI9341 SPI TFT, 320×240 The screen. Its microSD slot is optional
PS2 joystick + ADS1115 ADC The joystick is analog. The ADC also measures the battery
6 tactile buttons Confirm, Undo, Esc, Tab, Menu, Fn
LiPo battery with BMS + TP4056 USB-C charger + MT3608 boost (set to 5.1 V) Plus a 470–1000 µF capacitor and a rocker switch
DS3231 RTC + CR2032 Correct dates on saved games
Optional 5 V vibration motor, MAX98357A I2S amplifier and a small speaker, USB-C breakout with data lines

The full parts list has quantities, what to look for, and the tools you need. The pitfalls of each part are in docs/12. The wiring guide, docs/03, goes step by step, with a test after each step, so a mistake shows up before the next part goes on:

Raspberry Pi header map showing which GPIO pin goes to each ChAIpi part

The complete circuit shows every part and every wire on one page.

The case comes in three shapes. Pick the one you like: the parts inside, the wiring and the OS are the same, and all three are held together with screws from a laptop screw kit. Each has print files, assembly steps and a Tinkercad guide. None has been printed yet. A 3D-printable logo badge is in enclosure/logo-badge.

The clamshell case open: screen in the lid, joystick and six buttons in the base The portrait case: screen at the top, joystick and keys below The landscape case: screen in the middle, joystick left, keys right
Clamshell
Folds shut. 89 × 60.5 × 36 mm closed
Portrait
Game Boy style. 100 × 148 × 26 mm
Landscape
Held in both hands. 180 × 76 × 26 mm

How it works

The OS is a single web page, mockup/chaipi-os.html. Its script runs unchanged in two places:

In a browser (the emulator) On ChAIpi
Runs in any browser Node.js + @napi-rs/canvas, through device/ui/host.js
Screen a <canvas> the ILI9341 framebuffer
Engine a small demo engine Stockfish 19 over UCI
Buttons keyboard and mouse GPIO and the ADS1115, through chaipi-input
Wi-Fi, Transfer, USB, SD simulated NetworkManager, the transfer server, the USB gadget, the SD slot

When the page finds window.CHAIPI_HOST (the device), a few dozen hooks call it. When it doesn't (a browser), they simulate. So a change made in the emulator shows up on the device with no porting. The SD card is Raspberry Pi OS Lite 64-bit (Debian 13), built with pi-gen and image/install.sh. docs/13 covers the processes, hooks, folders and the bring-up plan.

Repository

Folder What
mockup/ the OS (one HTML file), which is also the emulator
device/ what runs on the Pi: UI host (Node.js), input daemon, transfer server and phone page, Python SDK, boot scripts, fonts
image/ the SD-card image: installer, pi-gen stage, system files
config/ every pin and setting in one file
docs/ hardware, wiring, software, and the design history
enclosure/ the logo badge (STL, GLB, SVG) and the scripts that make it
tools/ build the emulator page, capture the README pictures
tests/ Python tests for the input daemon and Transfer
legacy/ the first desktop prototype (OLED + voice). Not used on the device

Development

No Pi needed:

python3 -m pytest tests/test_input.py tests/test_transfer.py -q    # needs pytest, chess, pillow
# on macOS (JavaScriptCore is built in)
/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc device/ui/test/os-smoke.js -- mockup/chaipi-os.html device/ui/lib
/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc device/ui/test/lib-test.js -- device/ui/lib config/chaipi.example.toml

GitHub Actions runs these on every push. The ChAIpi image workflow builds the SD card and publishes a release. tools/capture_screens.py regenerates the pictures in this README from the emulator with headless Chrome. CONTRIBUTING.md has the conventions.

Fair play

ChAIpi is for casual games, training and playing against the device itself. Using it during rated or tournament games breaks FIDE and club rules.

Credits and licence

Created by Ranbir Dhall. Copyright © 2026 Ranbir Dhall.

ChAIpi is free software under the GNU General Public License v3.0 or later. The SD-card image includes Stockfish 19 (GPL-3.0) by the Stockfish developers. The fonts are under the SIL Open Font License. Everything else ChAIpi uses, with its licence, is listed in THIRD_PARTY.md.

ChAIpi isn't affiliated with Raspberry Pi Ltd, the Stockfish project, Lichess or YouTube.

Footnotes

  1. Shorts uses yt-dlp. YouTube's terms of service don't allow third-party players, and it breaks whenever YouTube changes. It's off unless you open it. ↩

About

A pocket chess computer: Stockfish 19 on a Raspberry Pi Zero 2 W, with a 2.8" screen, a joystick and six buttons. Try the OS in your browser.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages