v0.1 Open-source gesture wand · ESP32-S3

Malfoid

A gesture wand with a platinum attitude.

Draw a spell in the air. She tracks the tip 208 times a second, names the shape on the wand itself in about a millisecond, and has your home obey: lights, music, scenes. A haptic flourish and a glowing tip are included. Elegant, cunning, and only slightly dramatic.

Sensing
208 Hz
Recognition
~1 ms
Asleep*
~50 µA
Licence
MIT
Original Malfoid artwork: a platinum-haired young aristocrat in profile, carved like an ivory cameo on emerald inside a beaded silver frame.
Malfoidoriginal artwork · CC BY 4.0
  • ESP32-S3
  • LSM6DSOX IMU
  • Madgwick AHRS
  • Dynamic time warping
  • DRV2605L haptics
  • MAX17048 fuel gauge
  • SK6812 tip
  • MQTT
  • Home Assistant
  • Web Serial
  • ESP Web Tools
  • FreeRTOS

I Meet Malfoid

Meet Malfoid

She reads your wrist like a ledger, and judges it accordingly.

Malfoid is a complete, open hardware project: firmware, circuit design, a 3D-printable body and this site. Underneath the attitude it's an embedded systems project done properly, with interrupt-driven sensing, sensor fusion, an on-device recognizer tested against thousands of simulated casts, and a power design that sleeps on microamps.

99.6%Top-1 accuracyon 2,700 deliberately sloppy synthetic casts; 0.1% accepted as the wrong spell.
70°Wrist roll, ignoredThe AHRS tracks where the tip points, so a rolled wrist draws the same shape.
One castTo teach a spellName it in the console, cast once, and it's stored on the wand.

Draws in the air

Madgwick sensor fusion at 208 Hz, with the accelerometer ignored mid-flick and gyro drift relearned whenever she rests.

Thinks on the wand

Dynamic time warping against spell templates on the ESP32-S3 itself. No cloud and no training set.

Commands your home

MQTT with Home Assistant discovery: every spell arrives as a device trigger, ready for automations.

Feels alive

An LRA haptic signature per spell, a light-piped tip, and deep sleep until an IMU interrupt notices you've picked her up.

II The spellbook

Go on. Impress her.

Draw a spell with your mouse or finger. This is the same recognizer that runs on the wand, ported line for line to JavaScript and checked against the firmware's unit tests.

Your turn. Press, draw, release.
Tap a card below to see how a spell is drawn.
Verdict
Awaiting

Cast something worthy of her attention.

confidence0%
Go on, then. Impress me.Malfoid

The mark on the meter is her acceptance threshold. She also refuses when the runner-up is within 5%, because ambiguity is beneath her.

III Anatomy

Everything has its place.

About 360 mm of wand. The electronics live in the handle, a 3 mm optical fibre carries the light to the tip, and the motion sensor sits close to your wrist, where flicks distort it least.

Hover a part to find it. Toggle X-ray to see inside.

Side view of the Malfoid wand with eight numbered parts: USB-C pommel, IMU, emerald thumb pad, haptic actuator, ESP32-S3, battery cell, light fibre and frosted tip. 14500 · 800 mAh 1 2 3 4 5 6 7 8
  1. 1
    USB-C pommelCharging, flashing and the web console over one cable.
  2. 2
    IMU at the wrist pivotLSM6DSOX, placed where flicks add the least centripetal error.
  3. 3
    Emerald thumb padA capacitive pad under the gem. Rest your thumb to cast.
  4. 4
    Haptic actuatorAn 8 mm LRA on a TI DRV2605L plays each spell's signature.
  5. 5
    ESP32-S3 + antennaDual-core MCU with Wi-Fi; the antenna overhangs into plastic.
  6. 6
    14500 Li-ion cell800 mAh, metered by a MAX17048 fuel gauge.
  7. 7
    Light fibre3 mm PMMA carries the tip LED's glow up the shaft.
  8. 8
    Frosted tipEmerald while idle, the spell's colour on a cast.

IV Under the hood

From flick to "lights on."

Sensing runs in its own FreeRTOS task, woken by the IMU's data-ready interrupt. Everything else, from recognition to Wi-Fi and haptics, waits its turn.

  1. i

    Sense

    Gyro and accelerometer are read over I²C on every data-ready pulse.

    208 Hz · ±2000 dps · ±8 g
  2. ii

    Fuse

    Madgwick AHRS. Gyro bias is relearned at rest; the accelerometer is ignored mid-flick.

    β 0.08 · 0.85–1.15 g gate
  3. iii

    Project

    Tip direction becomes azimuth and elevation relative to where the cast began. Wrist roll cancels out.

    104 points / s
  4. iv

    Resample

    32 equidistant points. Lines keep their aspect ratio; shapes are squared up by principal axes.

    32 × (x, y)
  5. v

    Match

    Dynamic time warping in a Sakoe–Chiba band against every template. The winner must beat the runner-up.

    ≈1 ms on the ESP32-S3
  6. vi

    Act

    Tip light, a haptic signature, and an MQTT message that Home Assistant can turn into anything.

    MQTT · device triggers
# every cast, as your broker sees it
$ mosquitto_sub -t 'malfoid/#' -v
malfoid/a1b2c3/status  online
malfoid/a1b2c3/spell   lumen
malfoid/a1b2c3/state   {"battery":76, "voltage":3.93,
                        "charging":false, "last_spell":"lumen",
                        "rssi":-58}
malfoid/a1b2c3/spell   malfoid   # her signature, obviously

Every spell is also announced to Home Assistant as a device trigger, so no YAML is needed.

V Build her

Two paths, one firmware.

Start with breakout boards on a free afternoon, or go all the way with the Malfoid Core, an 18 × 92 mm four-layer board designed to live inside the handle.

Specification Path ABreakout buildStart here Path BMalfoid Core rev A
BrainSeeed Studio XIAO ESP32S3ESP32-S3-MINI-1-N8 on the Core board
Sensors & outputLSM6DSOX, DRV2605L + LRA and MAX17048 on STEMMA QT breakouts, one SK6812The same parts placed for a wand: IMU at the wrist pivot, power-gated LED behind a level shifter
PowerXIAO's onboard charger, 1S LiPo 400–500 mAhUSB-C, MCP73831 with load sharing, TPS63802 buck-boost, 14500 Li-ion 800 mAh
Asleep~1–3 mA (about 0.3 mA with breakout LEDs cut)~40–60 µA estimated, about 9 weeks of typical use
SolderingA few wires; everything else plugs inFine-pitch SMD, or a PCB assembly service
Firmwarepio run -e xiaopio run -e core
Block diagram: USB-C, charger, cell and buck-boost power an ESP32-S3, which talks to the IMU, haptics, fuel gauge, tip LED and thumb pad, and reaches Home Assistant over Wi-Fi. USB-C5 V · data · ESD MCP73831Li-ion charger, 400 mA 14500 cell800 mAh + MAX17048 TPS63802buck-boost → 3.3 V 3V3 USB D± ESP32-S3 2 × 240 MHz FreeRTOS · FPU Wi-Fi · BLE 5 LSM6DSOX6-axis IMU · 0x6A DRV2605L → LRAhaptics · 0x5A MAX17048fuel gauge · 0x36 SK6812 tiplight pipe · gated Thumb padcapacitive · gem I²C + INT1 RMT TOUCH Home AssistantMQTT discovery Wi-Fi

VI Wand console

Talk to her over USB.

Plug in the wand and connect from this page. You can watch the tip move live, inspect every cast, set up Wi-Fi and MQTT, and teach her new spells. Everything travels over the cable; nothing leaves your browser.

Wand consoleNo wand connected.
USB Wi-Fi MQTT Battery
not connected

            

VII Flash from the browser

No toolchain. One click.

Every push to main is built by GitHub Actions and published right here, ready to install.

  1. ConnectPlug in the XIAO or Core board with a data-capable USB-C cable.
  2. InstallChoose your board, press install and pick the serial port.
  3. ConfigureOpen the console above to set Wi-Fi and MQTT. Then cast.

Checking for published firmware…

Browser flashing needs Chrome or Edge on a desktop. Browser flashing needs this page to be served over HTTPS.

VIII Patronage

Keep her in silver.

Malfoid is free and open: firmware, hardware and this site. Sponsorship pays for PCB revisions, actuator samples and the measurement gear that turns estimates into real numbers. She has expensive taste, and so does good hardware.

Tier one

Hawthorn

$3 / month

Your name in SPONSORS.md, and her grudging respect.

Tier two

Sterling

$10 / month

Vote on the next spell and get early firmware builds.

Tier four

The Manor

$100 / month

Your logo on this page and a say in the hardware roadmap.

PCB revisionsEach Core spin means fabrication, assembly and a weekend of bring-up.
Actuators & sensorsSampling LRAs and IMUs for the crispest haptics and the lowest drift.
MeasurementA current profiler, so the sleep figures on this page become measurements.

IX Credits

Credit where it's due.

Original artwork. The Malfoid cameo, the wand illustrations, the crest and the icons were drawn for this project. No film imagery or fan art is used.

Free to reuse with credit under CC BY 4.0. PNG and SVG files are in docs/assets.

Typefaces
Cormorant Garamond by Christian Thalmann · Inter by Rasmus Andersson · JetBrains Mono by JetBrains. All SIL OFL 1.1, served by Google Fonts.
Algorithms
Madgwick AHRS (S. Madgwick, 2010) · $1 Unistroke resampling (Wobbrock, Wilson & Li, UIST 2007) · DTW with a Sakoe–Chiba band (Sakoe & Chiba, 1978).
Firmware libraries
Arduino-ESP32 (Espressif, LGPL-2.1) · ArduinoJson (B. Blanchon, MIT) · PubSubClient (N. O'Leary, MIT) · Adafruit NeoPixel (LGPL-3.0) · Adafruit DRV2605 (BSD).
On this page
ESP Web Tools by the ESPHome project (Apache-2.0) for browser flashing, and the Web Serial API for the console.
Hardware
Datasheets and reference designs from STMicroelectronics, Texas Instruments, Analog Devices (Maxim), Microchip and Espressif.
Fan-inspired
Unofficial and independent: not affiliated with or endorsed by Warner Bros. Entertainment or the Wizarding World franchise. Spell names are original.