KNIFE-021 – micro:bit V2 setup: flash and test the NightJar firmware
📅 2026-11-23 · stav: rozpracované (softvér overený, test na hardvéri čaká) · priorita: vysoká · ✍️ Aymeric
The question: the NightJar audio-interaction project is finished on the software side (KNIFE-020 describes the earlier stage). How do you get it running on a micro:bit V2?
Short answer:
- Flash the ready-made
NightJar_Microbit.hex, hold button A and whistle. - Nothing has to be built or retrained for the first hardware test.
- Still open: how it behaves on the physical board. See what to check.
1. What you need
- a BBC micro:bit V2 (the firmware is built for V2, which has the microphone and speaker on board);
- a micro-USB cable that carries data, not only power;
- a computer;
NightJar_Audio_Interaction.zip, the project hand-over package, unpacked.
The package contains the final source code, the trained model, the exported INT8 model, the firmware, the validation outputs and the compiled micro:bit firmware.
2. Flash the firmware
-
Connect the micro:bit to the computer over USB. It appears as a drive named
MICROBIT. -
Copy this file from the unpacked package onto the drive:
firmware/build/NightJar_Microbit.hex -
Wait until the copy finishes. The micro:bit restarts by itself and runs the new firmware.
If a FAIL.TXT file appears on the MICROBIT drive, flashing failed. Open it to read the reason.
3. Test the behaviour
- Hold button A: the micro:bit listens.
- Whistle toward the microphone.
- Whistle detected: listening stops and the bird answers.
- Keep holding A: after a short cooldown, it starts listening again.
- Release A: the system returns to idle.
idle → hold A → listening → whistle detected → bird answers → cooldown
↑ │
└────────────── A still held ────────────────┘
release A → idle
4. Check on the physical board
The software side is reported as validated:
| Item | Reported result |
|---|---|
| Audio window | 1.25 s (the model in KNIFE-020 used 2 s) |
| Held-out test set | 100 % for clean, nominal simulated micro:bit and stress simulated micro:bit conditions |
| INT8 export | verified against the FP32 model |
| C++ frontend and model runtime | verified with golden tests |
| Firmware | compiled successfully for micro:bit V2 |
| Memory layout | audited |
The micro:bit conditions in that test are simulated. These points still have to be checked on the real board:
| To check | Suggested test |
|---|---|
| Actual microphone behaviour | whistle at different distances and volumes |
| Real execution latency | time from the whistle to the bird's answer |
| False detections from environmental noise | hold A without whistling: speech, fan, keyboard, music |
| Final whistle threshold | compare missed whistles with false detections |
| Long-running stability | repeat the listen / answer cycle over a long session |
5. Rebuild the firmware (optional)
Only needed after changing the model or the firmware. The neural network does not have to be retrained for the first hardware test.
Run everything from the root of the unpacked project. The scripts are PowerShell (.ps1).
-
Export the model for the micro:bit:
python -m scripts.export_microbit --clean -
Then run the firmware scripts in this order:
.\firmware\sync_generated.ps1
.\firmware\test_host.ps1
.\firmware\build.ps1
.\scripts\audit_firmware_memory.ps1 -
Flash the rebuilt
firmware/build/NightJar_Microbit.hexas in step 2.