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.

34 comments:

  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? :-)

    ReplyDelete
    Replies
    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.

      Chip

      Delete
  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... :-)

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

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

    ReplyDelete
  12. 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 - http://www.mberka.com/contact-me

    ReplyDelete
  13. This comment has been removed by a blog administrator.

    ReplyDelete
  14. This comment has been removed by a blog administrator.

    ReplyDelete
  15. 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.

    ReplyDelete
  16. 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.

    ReplyDelete
    Replies
    1. This comment has been removed by a blog administrator.

      Delete
  17. 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

    ReplyDelete
  18. This comment has been removed by a blog administrator.

    ReplyDelete
  19. This comment has been removed by a blog administrator.

    ReplyDelete
  20. Thanks for sharing the blog! "I am just happy to be free I was also looking for information that my friend advised me about Digital hearing aids which is a complete marvel of real hearing aids technology. My father is using MEDca CIC mini hearing amplifier which is practically invisible.

    ReplyDelete
  21. I chose Hearing Aids for Seniors And Adults – Left Ear because it delivered the best of every complete-in-canal hearing aids in the market at a fraction of the cost! It was amazed to hear the sounds that I haven’t heard in years. I only have MEDca Hearing and my ENT specialist to thank for bestowing this gift upon me.

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete

  23. Hearing aids are wonderful devices that can help improve your quality of life. If you are having difficulty hearing, I highly recommend considering getting a Carismedic hearing aid. They can make a world of difference!

    ReplyDelete
  24. Thanks for sharing such a great information.. It really helpful to me..I always search to read the quality content and finally i found this in you post. keep it up! Vestibular testing center in howrah

    ReplyDelete
  25. I recently got a hearing aid, and I'm really glad I did. It's made a huge difference in my life because I can now hear better and participate in conversations more easily. I'm sure others out there are considering hearing aids, so if you're thinking about it, I highly recommend Adelaide Hearing to get perfect hearing aids.
    Hearing Aids And Tinnitus Treatment
    Hearing Clinic Near Me
    Hearing Service Program
    Ear Wax Removal Adelaide
    Hearing Aids Adelaide
    Hearing Test Adelaide

    ReplyDelete
  26. The Hearing Centre has been a pioneer in providing the best hearing aids in Singapore for more than 20 years.. If you want to now more about hearing aids so you can also contact us

    ReplyDelete
  27. I loved reading your blog about open-source audio processing. Your experimentation with the Teensy hearing aid is fascinating and I appreciate your thorough explanation of the necessary components. Keep up the great work with open software and sharing your findings with others! restorehearingnow.com

    ReplyDelete