After the ESP32 Radar Tower, emwstudio built another aviation gadget: a primary flight display (PFD) attitude indicator on a 2.16-inch round AMOLED screen. Tilt or turn the board and the horizon, pitch ladder, airspeed tape and altitude tape follow. Dive too hard and you hear real airliner GPWS warnings. Hold the button to talk to an "air traffic controller": the reply is written by MiniCPM5-2B and spoken with a real tower voice cloned by VoxCPM2.
The ESP32 only records, displays and plays audio. Speech recognition, MiniCPM5-2B and VoxCPM2 run in a voice service on a Mac, which the device reaches over Wi-Fi. The models do not run on the ESP32.


Full demo video with tower audio: docs/demo.mp4
The Display
Scales and readout logic follow real 737NG / A320-class standards:
- Blue sky and orange ground rotate with roll and shift with pitch; beyond ±35° pitch the view saturates to all sky or all ground, just like a real instrument.
- A fixed "W" aircraft symbol sits in the center, with the pitch ladder broken around it.
- The roll scale at the top stays fixed while a green pointer swings with bank angle.
- Airspeed tape (kt) on the left, altitude tape (ft) on the right, a half-ring compass at the bottom, and four seven-segment readout windows.
- Flat or upright holding is detected automatically. It calibrates at boot; tap the screen to recalibrate, with an "autopilot disconnect" alert first and a chime when done.
Talking to the Tower
Hold the KEY button to speak and release to send. A status dot shows red while recording, yellow while waiting and green while the reply plays. The callsign is "Diancibo 001", read back by the tower in aviation style.
The pipeline:
- The ES8311 codec records 16 kHz mono audio and sends it to the Mac over Wi-Fi TCP.
- Before the audio, the device sends a frame of live flight data: altitude, speed, heading, pitch, roll and vertical speed.
- Qwen3-ASR-1.7B (MLX int8) transcribes speech locally on the Mac.
- MiniCPM5-2B plays the controller and answers with the flight data in mind: it identifies the flight phase, points out contradictions between the request and the data (for example "you are already 1,693 m up"), and warns about steep climbs, dives or bank angles.
- Numbers are converted to aviation readouts on the server so the model never misreads them.
- VoxCPM2 synthesizes the reply in a voice cloned from a real tower recording, then a 300 Hz–3.4 kHz band-pass, soft clipping and hiss simulate a radio channel before the audio streams back to the device.
To keep a 2B model from repeating itself, the system prompt includes a whitelist of standard ATC phraseology, few-shot examples and a short per-turn "direction" hint. Wording and judgment are still left to the model.
cd voice-chat
python3 -m venv .venv && .venv/bin/pip install mlx-speech numpy
export MODELBEST_API_KEY=sk-... # ModelBest open platform
.venv/bin/python server.py # listens on :7890 for the device
Device Wi-Fi credentials and the server IP go in firmware/main/voice_secrets.h (copy from voice_secrets.example.h). For voice cloning, prepare your own 6–10 second 16 kHz mono WAV and set REF_TEXT in server.py to its transcript.
GPWS Warnings
Warnings use real GPWS recordings extracted by the flight-sim community. When several apply, only the most urgent one plays:
| Warning | Trigger |
|---|---|
| PULL UP | Sink rate above 20 m/s below 984 ft |
| OVERSPEED | Airspeed above 108 kt |
| STALL | Airspeed below 38 kt |
| SINK RATE | Sink rate above 16 m/s below 2,625 ft |
| BANK ANGLE | Roll above 45° |
During descent it also calls out altitudes from 2,500 ft down to 5 ft, with "MINIMUMS" at 200 ft.
GPWS audio is copyrighted by the original manufacturers and is not included. Alternatively, voice-pipeline/ can generate the callouts: MiniCPM5-2B writes the text and VoxCPM2 clones a voice, then the files are packed into the firmware.
Build and Flash
source ~/esp/esp-idf/export.sh # ESP-IDF v5.5.2
cd firmware
idf.py set-target esp32s3 build
idf.py -p /dev/cu.usbmodemXXXX flash monitor
Hardware: Waveshare ESP32-S3-Touch-AMOLED-2.16 (480×480 AMOLED, QMI8658 6-axis IMU, ES8311 audio codec). Firmware is built on ESP-IDF v5.5 and LVGL 9.6.
Known Trade-offs
- The board has no pitot tube or barometer, so airspeed, altitude and sink rate come from a demo model driven by pitch.
- With no magnetometer, heading is relative: it does not drift at rest, but it does not point north.
- Compass and roll readings are demo-grade (about ±1°) and not suitable for navigation.
Links
- GitHub: emwstudio/esp32-attitude
- Demo video (Douyin): v.douyin.com/Tj96V1Y7_OA
