Close

Microphone and speaker testing

A project log for First Year Honors Project

My completed first year honors project at the University of Arizona

Noah ThurstonNoah Thurston 03/20/2017 at 07:250 Comments

Recently I've been working on the audio side of the project. This includes making a working microphone for audio input and a speaker for audio output. After receiving some electret microphones, low power speakers, and LM386 low voltage audio amplifiers I started to build a simple circuit to see if I could get the microphones to work. This meant wiring an electret microphone to an LM386 amplifier, and then wiring the Vout to a 3.5mm audio jack so I could hear what the audio quality is like without worrying about back feed. A picture of the breadboarded circuit is below:

The trickiest part about building this circuit was wiring the 8 pin LM386, but the TI datasheet for it was a lot of help as well as this blog (https://lowvoltage.wordpress.com/2011/05/15/lm386-mic-amp/) which went into some detail explaining the possible audio gain this chip can supply.

In the top of the picture is a power supply board that attaches to both sides power rails, then below that is a electret microphone. These microphones aren't super high quality, but they are dirt cheap ($0.30 a piece) and will do for the audio quality that we're going aiming for. Any nicer of a mic would be waste considering our wireless bandwidth is limiting the audio quality anyway since we'll be sampling 8-bit audio at only 24kHz.

From the electret mic the voltage goes to the input pin (pin 3) of the LM386 audio amplifier. This amplifier defaults to 20 gain, but can be set to 200 gain by adding a 10uF capacitor connecting pin 1 to pin 8. Also on the LM386, two pins are grounded and another is powered. Then the output voltage can be sent to the analog in of an arduino, or in this case the headphones. When I first built this circuit without the amplifier the mic was too quiet to hear, but with the LM386 set to 20 gain it was pretty loud, and then when it was set to 200 gain it was very loud.

The sound quality continued to be good until I wired it to the arduino and nRF circuit for transmission (that circuit isn't pictured here but it will be shown in a later post). When the power supplied to the arduino was also used for the microphone, there was a steady hum in the background of the microphone audio output. At first I thought this could be filtered out with some bypass capacitors, but nothing seemed to stop it. After some googling I found out this hum was most likely due to the arduino and/or the nRF oscillating the power source voltage as it drew from it. More capacitors near the LM33 voltage regulator still wasn't able to stop it. From many tests, adding and removing capacitors or different values in different places, it seems like those capacitors (usually ranging from 0.1uF to 100uF) are good enough to keep power steady so the microcontroller will have a robust power supply, but not good enough to filter all oscillations detectable by the human ear.

To stop this hum I added another LM33 that is powered by the battery pack and is the sole power source for the microphone. This stopped the power hum, but at the inevitable cost of more drawing more current from the batteries. I considering trying to make an audio filter, like the one in this schematic here http://www.electroschematics.com/5877/audio-noise-filter/ , but that seemed like a far more complicated and pricey solution. So for now I'm sticking with the extra voltage regulator.

With the power hum problem solved, I was able to transmit and receive audio from one arduino to the other with decent sound quality using the simple getting started RF24 Audio sketch. Next I want to modify the circuit to use the LM386 for both microphone amplification and speaker amplification, since each device will be both transmitting and receiving. This will also mean writing code to allow users to "push-to-talk," as well as allowing them to possibly change channels and multicast.

Discussions