Firmware · Nov 2026 · simulated, not yet on hardware
dún firmware
one press. is my ear tired?
The firmware for dún, the earbud that listens for the faint sound a healthy ear makes back. It turns that earbud into an ear-fatigue tracker. Save a baseline over three quiet days, then after a gig, a club or a long session in headphones press the button once, and it tells you whether your ear's echoes have dropped against your own baseline, and at which pitches.
One button, one light
Loud sound can leave the ear's echoes weaker for a while. Echoes differ a lot from one person to the next, so the useful comparison is with your own ear rather than with a chart: same person, same earbud, before and after.
The device has no screen. A short press runs a check. Holding the button for three seconds adds the last check to your baseline, which is the middle of three quiet-day checks, so one odd day doesn't set the bar. Ten seconds clears it.
The board keeps its own dated history of the last 64 checks in flash, so it can say which pitches keep dipping without a phone. Every result also goes out as a JSON line over USB and as a Bluetooth notification.
| The light | Means |
|---|---|
| Slow blink | Testing |
| One long flash | Steady: no drop from your baseline |
| Five quick flashes | Dip: your echoes are lower |
| Three quick flashes | Reseat the earbud |
| Two flashes | Retest, or baseline not finished |
| One very long flash after | A pitch keeps dipping |
| 1, 2 or 3 flashes on a hold | That baseline check saved |
How one check works
The check uses two tones rather than clicks. Each speaker plays one steady tone, and a working ear mixes them and adds a third note at 2f1 − f2 that neither speaker played. Six pairs of tones cover 1 to 6 kHz, and each pitch is measured on its own, which is what a before-and-after comparison needs. Each check goes into the history, and a pitch that dipped in three of its last five checks is flagged as one that keeps dipping.
- Check the roomThe room mic listens first. Over 60 dB SPL and the check refuses, rather than measure a noisy ear.
- Check the fitOne speaker plays a low and a mid tone together. A leak drains the low one first, so if their gap has moved more than 4 dB from your baseline days, it stops in a second and asks you to reseat.
- Calibrate in the earEach speaker plays each tone alone, starting very quiet and stepping up 10 dB, until the ear mic hears it. Now the levels are right for this fit.
- Measure six pitchesBoth tones at 65 and 55 dB SPL. Blocks spoiled by a swallow or a bump are thrown out, and averaging stops as soon as the answer is clear.
- CompareAgainst the baseline, pitch by pitch: steady, dip, or retest when the fit or the room can't be trusted.
A pitch counts as dropped when its echo falls 5 dB below the baseline, or further if that pitch varied across your three baseline days. The verdict is a dip when two or more pitches drop that far, or the average drop is 4 dB or more. An echo that has vanished counts as a drop down to the detection limit, but only if the noise floor was low enough that it would have been seen.
Noise damage usually shows first around 3 to 6 kHz, so the upper pitches matter most. The top one stops at 6 kHz because the sample rate puts the ceiling at 7.8.
| f2 Hz | f1 Hz | Echo, 2f1 − f2 |
|---|---|---|
| 1007 | 824 | 641 |
| 1495 | 1221 | 946 |
| 1999 | 1633 | 1267 |
| 3006 | 2457 | 1907 |
| 3998 | 3281 | 2564 |
| 5997 | 4913 | 3830 |
The decisions
One tone per speaker
Every tone on a bin
Quiet first, capped always
Refuse rather than guess
Stop when it is clear
A core that never sees the board
What the simulation says
With no board made yet, the honest test is a simulated ear with the noise of the real microphone. The repository runs hundreds of them and counts how often each kind of ear gets each verdict.
| Simulated situation | How often |
|---|---|
| Same ear, reseated normally, called a dip or asked to retest | 0% |
| Echoes 10 dB lower, dip found | 98% |
| 8 dB lower | 92% |
| 6 dB lower | 49% |
| 4 dB lower | 5% |
| Earbud leaking 3 to 8 dB, called a dip | 0% |
| Chewing, called a dip or retest | 0% |
| Swallowing in a noisy room, asked to retest | 16% |
| Plastic tube, a false echo at one pitch | 5% |
So dún reliably sees drops of 8 dB or more, and smaller ones mostly sink into the noise. The fit check earns its place: a leaking earbud was always stopped to reseat, where without it a 5 dB leak was wrongly called a dip 5% of the time. The plastic tube never produced enough false echoes to reach a verdict.
Where it stands
Written and merged: the full test from room and fit check to verdict, the three-check baseline, the history and trend, and the speaker guard with the hardware watchdog, with 313 host checks against the simulated ear that all pass. The Zephyr app for the XIAO nRF52840 drives the speakers over I2S, both mics over PDM, Bluetooth, the button, the light and the flash. CI builds a firmware image on every push.
Not yet done: running it on real hardware at all, because no board has been made. The bench plan comes first: confirm the pins, the speakers and the microphone's sensitivity, make a hang on purpose to see the guard and watchdog cut the sound, then ten checks in a sealed 2 cc plastic tube, which must show no echoes. Only then an ear, where real reseats set the fit threshold. The hardware itself is on the dún experiment page.
A screening experiment, not a medical device. It can't diagnose hearing loss, and it never says hearing loss: it says your echoes are lower than your baseline. A drop that keeps coming back is a reason to see an audiologist. The tone settings and pass criteria follow the University of Washington's OAEbuds work (MobiSys 2023).