Skip to content

The Capsule

Quacky's duck button: hold it until it beeps, talk, let go. The note stays on the microSD and sends itself as soon as it finds your home WiFi. Firmware and shell are open: you build it yourself.

  1. 1The duck goes in through the mouth of the shell and stops in its hole.
  2. 2The Capsule slides inside, with its button under the duck.
  3. 3The cap closes the USB end and snaps onto the two latches.
  4. 4Done. No screws, no glue: it opens with a fingernail.

One button. Try it.

Hold the duck down until it beeps. Then it is up to you: talk while holding it and let go at the end, like a walkie-talkie, or let go straight away and press it again when you are done.

The Capsule gestures
GestureWhat happens
Hold it down until the beepThe note starts: red light
Let go straight away, then press againIt stops at the second press
Talk while holding itIt stops when you let go
Stop it within a second and a halfChange of mind: the note is cancelled
A short tapNothing
Put it on chargeFor ten minutes the app can set it up
OffHold the duck down until it beeps.

The firmware: off almost always, ready in under a second.

The Capsule spends almost the whole day switched off, drawing about 35 µA according to M5Stack. It wakes up for three reasons: the duck being pressed, the internal clock (a send to retry, the check-in with the server, an agenda reminder) and power when it is charging. When the job is done, it schedules its next wake-up and switches off.

A day in the life of the Capsule: off almost all the time, it wakes for a few seconds for each note, for the night-time check-in with the server and for an agenda reminder.0:006:0012:0018:0024:00Check-in with the serverBreakfast noteDentist beepLunch noteSymptom noteDinner note

Notes don’t get lost

Each note is a 16 kHz WAV file on the microSD, with its record written before the audio and saved every two seconds. If the battery comes loose halfway through, the note is recovered on restart. It is deleted only once the server confirms it has received it, and it keeps the same ID on every attempt: no duplicates.

It sends by itself

After each note it looks for the saved WiFi networks (up to five, on 2.4 GHz) and sends. If it finds none, it tries again on its own after 2, 5, 10, 20 and then every 30 minutes, as long as notes are queued. With no notes it wakes once a day to tell the server its battery level, and picks up the agenda reminders to beep.

Set up only with the duck in hand

Bluetooth turns on only while charging, for ten minutes. The session is encrypted (ECDH P-256, HKDF-SHA256, AES-256-GCM) and every change asks you to press the duck: someone nearby cannot reconfigure it. WiFi passwords and tokens go in and never come out.

Updates without a cable

New firmware is activated only if its SHA-256 fingerprint matches the one given by the app. If it fails to boot, the previous one comes back on restart.

How it’s built

main/The program: when to record, send, sleep. WiFi, Bluetooth, USB, updates.
qk_coreThe logic, without ESP-IDF: note queue, recovery, sending rules, protocol, button gestures. Tested on a PC.
qk_boardThe hardware: pins, power, clock, LED, microphone, microSD. For another ESP32-S3 board, only this gets rewritten.

ESP-IDF 6.1, built with PlatformIO. The logic in qk_core has 51 tests that run on a PC in a few seconds, and the app client has 10 tests against a model of the Capsule with real cryptography.

Where it stands. The firmware builds with no warnings and passes all the PC tests, but it has not yet been tested at length on a real Capsule: the things to check at first power-on are listed in the repository.

Installing the firmware.

All you need is a computer and a cable: no soldering, the Capsule already has everything inside. The first build downloads ESP-IDF and the compiler (about 2 GB) and takes a few minutes.

What you need

  • An M5Stack Capsule v1.1, the one with the StampS3A
  • A microSD card formatted as FAT32
  • A USB-C cable that carries data, not just charging
  • Python 3.10 or newer
  1. Get the code

    git clone https://github.com/CosimoZingaropoli/quacky-capsule.git
    cd quacky-capsule
  2. Set up the environment

    A Python environment just for this project, with PlatformIO inside.

    python -m venv .venv
    source .venv/bin/activate
    pip install platformio

    On Windows, instead of the second line: .venv\Scripts\activate

  3. Build

    pio run

    The result is .pio/build/capsule/firmware.bin. If pio does not start, python -m platformio run does the same.

  4. Flash the Capsule

    The first time, with the Capsule out of its shell and the microSD inserted. Connect it to the computer and run:

    pio run -t upload

    If it is not found: unplug the cable, hold down the small G0 button on the Stamp, plug the cable back in, release the button and run the command again. Then unplug and replug the cable to restart it.

  5. Check that it responds

    While it runs, talk near the Capsule: the diagnostics test the microSD, clock, battery, microphone and cryptography.

    python strumenti/capsule.py diagnosi
Testing the firmware without a Capsule

The logic (note queue, recovery, sending rules, protocol, reminders) is tested on a PC. You need a C++17 compiler: g++ or clang++, or Zig installed with pip.

pip install ziglang
python test/host/run.py

The client the app uses to talk to the Capsule has its own tests, in Node 22:

npm test --prefix client

Connecting it to the app.

You do it once, with the Capsule charging near your phone. For now it connects from the web app, with Chrome on Android or on a computer, over Bluetooth or with the cable. On iPhone it will come with the native app.

  1. Put it on charge

    The light-blue light pulses: for ten minutes the Capsule waits for the app.

  2. Open "Your Capsule"

    In the app (currently in Italian): Profile (Profilo), Your Capsule (La tua Capsule), Connect the Capsule (Collega la Capsule). Your phone’s list opens: pick the one called "Quacky".

  3. Press the duck

    When the light flashes white, press it: that way the Capsule knows it is in your hand.

  4. Give it the WiFi

    Choose your home network, on 2.4 GHz, and if you like your phone’s hotspot ("Maximise Compatibility" on iPhone).

  5. Link it to your diary and try it

    One tap, and the app hands it its access. Record a test note: within a minute you find it in your diary.

Prefer a computer?

The same, with the cable and the tool in the repository. It asks for the password without showing it.

python strumenti/capsule.py rete-aggiungi "NetworkName"
python strumenti/capsule.py collega-account --supabase https://<project>.supabase.co --chiave <public key>
python strumenti/capsule.py prova

Inside the Capsule.

There is nothing to solder: microphone, microSD, clock, battery, buzzer and button are already on the board. These are the connections the firmware uses, handy if you want to port it to another ESP32-S3 board. Hover over an item to see where it sits.

The Capsule board seen from above, with the USB-C port at the topUSB-CESP32-S3StampS3AG0WAKE
Approximate layout, not to scale. Battery and buzzer sit under the board.

The shell, ready to print.

Three parts with no screws, about 14 grams of plastic: 28.8 × 55.5 × 21.5 mm including the cap and the lanyard loop. Any online printing service accepts them as they are.

  • Shell

    The light-blue sleeve the Capsule slides into from the USB end. From above you only see the LED, through a small round window.

    Matte PLA, 100% infill, standing on its mouth, no supports inside.

  • Duck

    The button. Its rim is wider than the hole, so it goes in from the inside and presses the Capsule’s tab.

    Matte yellow PLA, upside down on its flat face, no supports.

  • Cap

    Closes the USB end and only lets the plug through. Two side latches snap into the shell’s small windows.

    PETG if you can find a similar light blue, otherwise PLA; 100% infill, with the latches vertical.

The STL and STEP files Before assembling it: the microSD goes into the Capsule.

The code is open.

Firmware, protocol, tools and shell are on GitHub: you can read them, build your own Capsule and suggest improvements. The Quacky name and the duck are not covered by the licence.

Open the repository

And to keep the diary, you need the app: