Skip to main content

KNIFE-019 – NightJar audio hardware: troubleshooting and migration to micro:bit V2

📅 2026-11-18 · stav: hotové · priorita: vysoká · ✍️ Aymeric

The question: the modular ESP32-S3 audio prototype detected real whistles, then its microphone stopped delivering usable audio. Where exactly is the fault, and is replacing one module enough?

Short answer:

  • The machine-learning pipeline works: it detected real whistles while the microphone still delivered valid data.
  • The fault sits in the INMP441 acquisition subsystem: a minimal raw I²S test returned 0 / 512 non-zero samples, even after rewiring, soldering and fixing a wrong resistor.
  • The modular chain itself is the wider problem: two I²S interfaces, several modules and many hand-made connections, each a separate point of failure.
  • The audio moves to the BBC micro:bit V2: integrated microphone and speaker, about €19 instead of €25. The signal-processing approach and the DS-CNN are kept.

1. Objective​

The NightJar project adds real-time audio interaction to the existing bird. The target behaviour is:

Human whistle → audio acquisition → whistle detection → NightJar audio response

The first prototype used a modular embedded audio architecture:

  • Seeed Studio XIAO ESP32-S3 as the processing unit;
  • INMP441 MEMS microphone for digital audio acquisition;
  • MAX98357A Class-D I²S amplifier for audio output;
  • an external speaker;
  • the NightJar push button;
  • breadboard, jumper wires and power connections.

The ESP32-S3 was selected because it has enough computational resources for the complete signal-processing and neural-network pipeline. The initial architecture:

Human whistle
↓
INMP441 microphone
↓ I²S
XIAO ESP32-S3
↓
Signal processing + DS-CNN
↓ I²S
MAX98357A
↓
Speaker

2. Hardware design​

The hardware architecture was first modelled in Fritzing and then built on a breadboard.

Input path​

Sound → INMP441 → (I²S) → ESP32-S3

The INMP441 is a digital MEMS microphone: analog-to-digital conversion happens inside it, and the samples go to the ESP32 over I²S. Its pins:

PinFunction
VDDpower supply
GNDground
SCK / BCLKI²S bit clock
WS / LRCLKword-select clock
SDdigital audio data
L/Rchannel selection

Wiring used for the isolated microphone tests:

INMP441XIAO ESP32-S3
VDD3V3
GNDGND
SCKD0 / GPIO1
WSD1 / GPIO2
SDD3 / GPIO4
L/RGND

Output path​

ESP32-S3 → (I²S) → MAX98357A → Speaker

The MAX98357A receives the digital audio stream from the ESP32 and drives the speaker. The complete system therefore relied on several independent modules and two digital audio interfaces.

3. Initial functional validation​

The prototype first reached a working state. Over several test sessions the INMP441 produced valid audio data, and the whole whistle-detection chain ran on real input:

Real human whistle
↓
INMP441
↓
ESP32 audio samples
↓
Signal preprocessing
↓
Trained classifier
↓
Whistle detected

The prototype detected real whistles successfully, so the signal-processing and machine-learning pipeline can work on real microphone input. The problems that followed came from the reliability of the acquisition subsystem. The classifier's ability to detect a whistle was never in doubt.

4. Progressive instability​

After the first successful tests, the microphone grew more and more unstable. The system alternated between:

  • valid audio acquisition;
  • intermittent acquisition;
  • unusable acquisition;
  • complete loss of meaningful microphone data.

Several reconnections and hardware modifications were made during this period:

  • Mechanically unstable connections. Some connections around the INMP441 and the MAX98357A were loose on the breadboard; moving a module or a wire could break the contact. Several connections had to be soldered to get stable electrical and mechanical contact. This added an integration step and made it harder to modify or replace individual modules.
  • Wrong resistor. A 10 Ω resistor had been fitted instead of the intended 10 kΩ. The resulting excessive current damaged it, and it was replaced with the correct value. The microphone problem remained after the fix, so this is recorded as a prototyping incident. It was not the root cause.

5. Diagnostic methodology​

Once the behaviour turned unstable, testing the complete NightJar application stopped being an efficient diagnostic. The full system has many interacting blocks:

  • button management;
  • microphone acquisition;
  • I²S configuration;
  • preprocessing;
  • neural-network inference;
  • audio generation;
  • amplifier control.

Debugging was therefore reorganised around fault isolation: the system was split into independent subsystems, and each suspected cause got a minimal test that shrinks the fault domain.

Complete NightJar system
↓
Subsystem isolation
↓
├── ESP32 + button
├── ESP32 + microphone
└── ESP32 + amplifier + speaker

6. Diagnostic summary​

Suspected causeTest performedObservationStatus
ESP32 malfunctionGPIO / button test and firmware executionController operated correctly❌ Excluded
Machine-learning pipelineReal whistle tests during valid acquisitionSuccessful whistle detection✅ Validated
Incorrect resistor value10 Ω component found and replaced by 10 kΩMicrophone issue remainedNot root cause
Unstable module connectionsMicrophone / amplifier connections stabilised and soldered where requiredAcquisition issue remainedNot root cause
Breadboard / jumper connectionCircuit rebuilt and simplifiedFailure persistedUnlikely main cause
Full application interferenceMinimal raw I²S acquisition programNo usable samplesFailure located before ML
INMP441 acquisition subsystemIndependent microphone testRaw buffer remained zero⚠️ Primary remaining fault domain

Each test removed plausible failure sources until only the microphone subsystem was left.

7. Controller verification​

The NightJar push button was tested on its own, without the audio chain. The ESP32 detected every button state change and kept running the firmware normally. That confirms:

  • the ESP32-S3;
  • firmware flashing;
  • GPIO input;
  • serial debugging;
  • basic program execution.

The controller was therefore not responsible for the loss of audio acquisition.

8. Independent microphone test​

The INMP441 was then isolated: the amplifier, speaker, classifier and NightJar behaviour were all removed. A minimal program:

  1. initialises the I²S interface;
  2. acquires a block of microphone samples;
  3. inspects the raw sample values;
  4. calculates the RMS;
  5. calculates the peak amplitude;
  6. counts the non-zero samples.

The diagnostic chain was reduced to the following, with no neural-network processing involved:

Human sound → INMP441 → I²S → ESP32 acquisition buffer

9. Raw acquisition result​

In the final microphone tests, speaking and whistling directly into the microphone gave results equivalent to:

RMS       = 0
PEAK = 0
NONZERO = 0 / 512

RAW:
0, 0, 0, 0, 0, 0, ...

The acquisition subsystem was not producing a degraded signal. It produced no usable digital audio at all. The failure therefore happens before any of these steps:

  • STFT computation;
  • Mel filtering;
  • normalisation;
  • neural-network inference;
  • detection thresholding.

That rules the machine-learning pipeline out of the current failure.

10. Breadboard, wiring and mechanical connection verification​

Breadboard contacts and jumper wires were still plausible causes, so they were checked separately. The microphone circuit was rebuilt without the amplifier or speaker, and the following were reviewed:

  • the 3.3 V supply;
  • the common ground;
  • the bit-clock line;
  • the word-select line;
  • the I²S data line;
  • the L/R channel selection;
  • the ESP32 GPIO mapping;
  • whether the firmware configuration matches the physical wiring.

Jumper wires and breadboard connections were swapped during testing. Where loose contacts could not give reliable continuity, the microphone and amplifier connections were soldered before testing again.

The acquisition failure persisted after all of these changes. Rebuilding the external connections or making them mechanically stable did not bring the microphone back.

11. Failure localisation​

The investigation went through this sequence:

Working microphone
↓
Successful real-whistle detection
↓
Intermittent acquisition
↓
Increasingly unstable behaviour
↓
Mechanical connections stabilised / soldered
↓
Loss of usable audio
↓
Independent raw I²S test
↓
0 / 512 non-zero samples
↓
Rewiring / breadboard verification
↓
No recovery

At the end of the investigation:

  • the ESP32 was still operational;
  • the classifier had already been validated on real microphone input;
  • the resistor error had been corrected;
  • the unstable mechanical connections had been stabilised;
  • the circuit had been simplified;
  • the external wiring had been checked and rebuilt;
  • raw microphone acquisition still produced no usable signal.

The remaining fault domain is the INMP441 acquisition subsystem and its immediate interface. The exact internal failure mechanism was not identified. The operational conclusion:

The INMP441 subsystem was no longer providing reliable audio acquisition.

12. Architecture reassessment​

Replacing the microphone module might restore the original prototype. The debugging phase, however, also exposed a broader system-level issue. The original architecture needed:

INMP441
+ I²S input interface
+ ESP32-S3
+ I²S output interface
+ MAX98357A
+ external speaker
+ multiple breadboard / soldered connections

Each additional module brought:

  • another physical interface;
  • another configuration dependency;
  • another assembly point;
  • another possible source of hardware variation;
  • another failure mode to diagnose;
  • more mechanical stabilisation or soldering.

The architecture had already gone from functional → intermittent → unreliable → non-functional. The question was no longer just which microphone to buy next:

How can the NightJar audio architecture be made more reproducible and less dependent on multiple external interfaces?

13. Migration to BBC micro:bit V2​

The selected replacement platform is the BBC micro:bit V2. It integrates:

  • the microcontroller;
  • a MEMS microphone;
  • the microphone acquisition electronics;
  • audio output;
  • an integrated speaker;
  • programmable GPIO;
  • power-management functions.
Before: modular ESP32-S3After: BBC micro:bit V2
Human whistleHuman whistle
↓ INMP441↓ integrated micro:bit microphone
↓ I²S↓ signal processing
↓ ESP32-S3↓ whistle detection
↓ I²S↓ integrated micro:bit speaker
↓ MAX98357A
↓ external speaker

This significantly reduces the number of independent audio interfaces and external modules.

14. Cost comparison​

ArchitectureApproximate electronics cost
ESP32-S3 + INMP441 + MAX98357A + speaker€25
BBC micro:bit V2€19

The migration reduces:

  • direct component cost;
  • component count;
  • wiring complexity;
  • assembly variability;
  • the number of independent failure points;
  • integration effort.

The system becomes more robust, reproducible and reliable to integrate, and it costs less.

15. Impact on the machine-learning pipeline​

The hardware migration does not invalidate the earlier signal-processing work: the classifier already detected real whistles whenever the microphone delivered valid data. The general pipeline stays:

Audio → acquisition model → STFT → Mel representation → DS-CNN → whistle probability

What changes is the acquisition domain. The previous training pipeline simulated an INMP441-based acquisition chain, while the micro:bit V2 has a different microphone and front-end. The next development stage:

micro:bit microphone specifications
↓
micro:bit acquisition simulation
↓
Dataset transformation
↓
Feature extraction
↓
Training / validation / testing

The neural-network architecture stays as it is unless measurements or deployment constraints later require a change.

16. Engineering outcome​

The first hardware iteration produced two distinct results:

  1. A successful functional validation: real whistle → real microphone acquisition → embedded processing → successful detection.
  2. Evidence that the modular acquisition architecture was not reliable enough.

The full development path:

Fritzing design
↓
Modular ESP32 prototype
↓
Working microphone acquisition
↓
Successful real-whistle detection
↓
Intermittent microphone behaviour
↓
Mechanical connection issues
↓
Soldering of microphone / amplifier connections
↓
Progressive loss of acquisition
↓
Subsystem isolation
↓
Raw I²S microphone test
↓
0 / 512 non-zero samples
↓
Breadboard and wiring verification
↓
Persistent acquisition failure
↓
Fault domain reduced to microphone subsystem
↓
System-level architecture reassessment
↓
Migration to BBC micro:bit V2

Debugging narrowed the fault domain from the complete NightJar system down to the microphone acquisition subsystem. Instead of continuing to tune an unreliable modular chain, the architecture was redesigned around a more integrated and reproducible platform. The migration keeps the validated signal-processing approach and reduces both hardware complexity and integration uncertainty.

The next KNIFE documents how the audio acquisition simulation and the training pipeline are adapted to the micro:bit V2.


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