Sunday, November 20, 2016

A Teensy Hearing Aid

Hearing aids are totally closed devices -- their inner workings are hidden.  Access is limited to only those who work for the hearing aid companies.  But if innovation is to accelerate, we need more ideas iterated more quickly.  We need more people to participate in hearing aid development.  But if the devices are closed, there is no way to try new ideas.  So, let's consider the alternative.  Let's try to build an open-source hearing aid.  Yes, at first, an open-source hearing aid will be absurdly big and ugly.  But, you have to start somewhere.  I'm going to start here: take one Teensy microcontroller, add some supporting electronics, and VOILA! A Teensy Hearing Aid!

Basic Hearing Aid Elements:  While it is unfortunate that they are closed devices, real hearing aids are absolutely amazing pieces of technology.  Their minuscule packages are absolutely stuffed with functionality.  I, though, am going to start more simply.  I will start with some microphones, analog and digital converts, a digital audio processor, some speakers, and a battery.  Once this works, I can always add more features later.

Choosing a Processor:  For me, the biggest challenge is always with the software.  Therefore, I need to choose a digital audio processor that it is easy to program.  For me, that means choosing a processor that can be programmed from the hobbyist-friendly Arduino programming environment.  Within that universe of processors, I've chosen to use the Teensy 3.6 because it's fast and because it has a nice audio processing library to make it even easier to program for audio.

Supporting Elements:  To get audio signals into and out of the processor, the Teensy folks offer an inexpensive Audio Adapter Board that mates directly to the Teensy 3.6.  It has the audio ADC and DAC that I need.  For the microphones, I'm using a pair of mic breakout boards from Adafruit.  For speakers, I'm using whatever headphones or earbuds that I might have on-hand.  Finally, for the battery, I'm using a Li-Po battery and Li-Po charger from Adafruit.

Wiring It Up:  The figure above gives an overview of how everything was connected together.  As you can see, the Audio Board is at the center with everything else connecting to it.  The only tricky part of this setup is connecting the battery and charger into the Teensy system.  As indicated on the Teensy pinout diagram, you have to cut a trace on the backside of the Teensy so that you can insert the battery connections.  Once cut, the Teensy's 5V USB voltage goes to the battery charger and the battery's output goes back to the Teensy's "5V" input pin.  Not too bad.

Initial Software:  While this post is primarily about the hardware, I did write some basic software in order to see if the hardware is working (see my GitHub repo).  I used the Teensy Audio Library to configure the Audio Board to pass the "I2S" inputs (ie, my microphones) to the "I2S" outputs (ie, my headphones).  In between, I wrote a simple routine that applies a user-controllable amount of gain to make things louder.  I use the blue potentiometer on the Audio Board to set the amount of gain.

First Audio:  Of course, the first time that I tried to compile the code, my software didn't work.  Does anyone's code ever work the first time?  After some iteration, I finally got it to compile and upload.  Putting on my headphones, I could hear the audio being picked up by the microphones.  Turning the blue pot, I could control its volume.  Hardware knobs are so satisfying.  My favorite part, though, is being able to use the on-board battery so that I can move around freely.  Very fun.

Limitations:  Sure, my home-brewed "hearing aid" is ridiculously large -- no one (including me) would ever wear this around in everyday life.  But, unlike commercially-available hearing aids, my device is open.  Anyone can modify it to make it better.  Anyone can try out their own audio processing algorithms to try to improve one's hearing.  Will any of us beat the professional hearing aid algorithm designers?  Probably not.  But, for me at least, I will surely learn a lot by trying a few of the standard approaches.  And, I'll get to look really cool sharing pictures of myself with this (not so) Teensy Hearing Aid.  Happy hacking!

Follow-Up:  I measured the power consumption of my Teensy Hearing Aid.  Using the "WFI" command, I found a super-easy way to increase the battery life by 50%.  Wow!  See my post here.

Follow-Up:  I measured how the volume control affects the headphone ouput.  See here.


  1. Good idea to experiment with open software!
    Do you need the audio-board with a teensy 3.6?
    Is it needed for amplification or for the processing power too?
    Maybe some added internet-radio too? :-)

    1. The audio board is needed to convert the microphone signal into a digital signal that can be processed by the Teensy 3.6 (this is the ADC portion of the audio board). Once the processing is completed, the audio board coverts the digital signal back to an analog signal that drives the headphones (this is the DAC portion of the audio board).

      The Teensy 3.6 does have its own ADCs and DACs, but they are much inferior to the ones on the audio board. So, in a strict sense, you do NOT need the audio board. But, to make it sound acceptable, you will want the audio board.


  2. Thanks Chip!
    I'm trying to create a 'microphone to bone conducting' system for only one ear (long story). My biggest problem is latency. I need to boost some frequencies but don't want to loose time... :-)

  3. Anyone interested on a collaboration to make a open source hearing. Seen my fathers $6000 set in action . Its dissapointing

  4. Hi Paul! I just got a version of this working with Bluetooth and four adjustable frequency bands, for equalizing audio from digital devices. Would love to improve on the design -

  5. My 12 year old daughter and I are working on a project similar to one above. Currently we are getting parts but are looking to use a mic+ amp chip for input and use the on-bone transducers for speakers. .... ummmm that’s as far as we got :). She’s into it, do I’ve already won. Would love to drive this through to a working prototype.

  6. My 12 year old daughter and I are working on a project similar to one above. Currently we are getting parts but are looking to use a mic+ amp chip for input and use the on-bone transducers for speakers. .... ummmm that’s as far as we got :). She’s into it, do I’ve already won. Would love to drive this through to a working prototype.

  7. Kudos for a great project! Not long ago I built (for my own use) an all-analog hearing aid. It's bulky and requires closed headphones to avoid feeback.

    This digital version is much more interesting. A few ideas:

    - it could be made small enough to fit in a pocket or at the waist. There could be two external contacts so you could leave the thing on its base for recharging overnight

    - it would be nice to have some sort of equalizer maybe combined with auto volume control. Something like the band limiters they have in FM broadcasting, where all frequencies are heard at close to equal volume so no sound is annoyingly louder than another