Skip to main content

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​

  1. Connect the micro:bit to the computer over USB. It appears as a drive named MICROBIT.

  2. Copy this file from the unpacked package onto the drive:

    firmware/build/NightJar_Microbit.hex
  3. Wait until the copy finishes. The micro:bit restarts by itself and runs the new firmware.

tip

If a FAIL.TXT file appears on the MICROBIT drive, flashing failed. Open it to read the reason.

3. Test the behaviour​

  1. Hold button A: the micro:bit listens.
  2. Whistle toward the microphone.
  3. Whistle detected: listening stops and the bird answers.
  4. Keep holding A: after a short cooldown, it starts listening again.
  5. 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:

ItemReported result
Audio window1.25 s (the model in KNIFE-020 used 2 s)
Held-out test set100 % for clean, nominal simulated micro:bit and stress simulated micro:bit conditions
INT8 exportverified against the FP32 model
C++ frontend and model runtimeverified with golden tests
Firmwarecompiled successfully for micro:bit V2
Memory layoutaudited

The micro:bit conditions in that test are simulated. These points still have to be checked on the real board:

To checkSuggested test
Actual microphone behaviourwhistle at different distances and volumes
Real execution latencytime from the whistle to the bird's answer
False detections from environmental noisehold A without whistling: speech, fan, keyboard, music
Final whistle thresholdcompare missed whistles with false detections
Long-running stabilityrepeat 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).

  1. Export the model for the micro:bit:

    python -m scripts.export_microbit --clean
  2. Then run the firmware scripts in this order:

    .\firmware\sync_generated.ps1
    .\firmware\test_host.ps1
    .\firmware\build.ps1
    .\scripts\audit_firmware_memory.ps1
  3. Flash the rebuilt firmware/build/NightJar_Microbit.hex as in step 2.


← KNIFE-020 · ↩️ Všetky KNIFE príspevky