Cheap Sound Sensor for AVR
I searched the web for a cheap method to let the ATmega respond to sound. My knowledge in analog circuits is very limited, but what I do remember, is that you can not attach a electret mircophone to a controller pin. The signal of the microphone is just too small and has to be amplified. There is much of information out there, especially on diy amplifiers. I stumbled upon this little circuit here. It consists only of a handful of components:
- 2 resistors 10k
- 1 resistor 100k
- transistor 2N3904
- 2 capacitors 0.1u
- electret microphone
Prototyping the amplifier
Putting things together on a breadboard.
Actually I had no 2N3904 around, so I replaced it with a BC337. The circuit is a emitter circuit with voltage degeneration (I dont know if that exists in english). I dropped the couple capacitor and took the signal right away at the collector.
Prototyping with the ATmega
The sound sensing is done with the ADC of the ATmega. A simple program reads the analog value of the amplifier over and over. If the value (loudness) exeeds a specific level, an LED is lit.

The code can be found here mic_sensor.c. It is just hacked together and has lots of room for improvements.
Video
Here is a video that I made. Has lousy quality, for both, video and audio.
Conclusion
It was easy and worked pretty well. I enjoyed looking at the LED responding to the music. I haven’t recorded anything with this amplifier, it might sound awfull. Next steps could be playing the sound back or be able to analyze the sound (FFT). And (re-)learning more on analog circuit design.
Links




August 22nd, 2007 at 00:05
Nice job, it seems to follow the music quite well!
October 23rd, 2007 at 14:23
30 years ago I built something like that… it was all analog and involved lighting a 115v bulb.
Funny thing is that it probably cost more to build at the time.
November 12th, 2007 at 05:29
Thank you so much for the link to the schematic for the mic and LED, I have made a 4X4X4 RGB LED cube that is going to go to sound but I had no way to read it, I just got the parts and it works great. I have to code the LEDs though. Thanks a lot,
Justin
January 10th, 2008 at 17:30
I need small sound sensor can sense high noise, working by battery, working in open area(high limitation). the output of this sensor is a sound also as handset or small speaker without display screen or indication lamp.
for example: i use hanset in my ears to say to me how the noise level is.
January 24th, 2008 at 18:09
I put this circuit together too and am happy to say that it works just fine, however, “how” does it work? What is the capacitor for? Why is there a resistor in parallel with the base and collector of the transistor? I am used to using transistors in switching applications, however I am interested in why this circuit can do what it does.
January 24th, 2008 at 20:08
Hi odiernod,
cool that it worked for you!
The capacitor is used to decouple the mic from the transistor. It is used to transmit only the changes in voltage. I am quite sure that the resistor is used to adjust the amplification, but my knowledge in analog circuits is quite limited.
You can also take a look at
http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/ for a more integrated amplifier.
Cheers,
Alex
January 25th, 2008 at 06:54
I made a colorful lamp out of my sound sensor circuit. No singing faces or anything, but it still looks cool. I’ll post a vid sometime next week or so.
Dom
January 26th, 2008 at 17:30
hi, i am interested in building this for a school project and i am wondering if this simple circuit will work as it is on its own?
January 26th, 2008 at 20:00
Hi Azda,
what do you mean by “work as it is on its own”?
It can be powered by batteries, then it will work on its own.
If you mean, if it could work without the microcontroller, yes, I think it would work. You have to attach another transistor to the collector of the first one and use it as a switch to control the LED. I haven’t tested that, but it could work.
Cheers,
Alex
January 26th, 2008 at 21:09
thanks for the help alex
January 28th, 2008 at 16:56
would a MIC1 work with this circuit, and could you possibly post/send images of this circuit bread boared on its own- as on the top image without the microcontroller using a battery.
March 18th, 2008 at 17:16
Alex,
I know this is a little off topic, but I’m not finding answers elsewhere. Can you help me figure out how I could use a setup like this with a 12V neon car light? (4 ft, and I think probably 2.5 amps?) I know this is possible, I just am unsure of what to change.
Thanks for the off topic help.
March 18th, 2008 at 23:32
Hi Michael,
hmm, not sure about a 12V setup. You will need really powerful transistor to switch 2.5 amps at 12V. I am not into analog electronics, more microcontrollers. But I am sure you wont need the microcontroller for your purpose.
Cheers,
Alex
March 23rd, 2008 at 08:33
is this circuit can be used to detect alarms without any false indications
March 23rd, 2008 at 08:43
Hi karim,
yes, I think it can be used as sensor for an alarm.
Without any false indications? That depends on your environment.
Cheers,
Alex
March 23rd, 2008 at 08:56
Thank you very much
i’m really amazed of your fast response
April 20th, 2008 at 23:02
THANK YOU! This little circuit, with a few minor changes, is just what I was looking for to add bidirectional hearing to my oobug robot. Was looking for something for weeks.
Ted
Savage Innovations
www.oobug.com
April 21st, 2008 at 00:28
Ted, great to hear that. I am waiting to see the final result.
April 21st, 2008 at 04:29
Alex,
Could you share the part number for the electret you used in this project?
Have you done any experimenting with the sensitivity of the circuit?
Ted
April 21st, 2008 at 07:42
Ted,
here is the link for the mic http://www.reichelt.de/?;ACTION=3;LA=4;GROUP=IA2;GROUPID=3604;ARTICLE=11357;
The id is “MCE 100″.
No, I haven’t done anything with the sensitivity.
Cheers,
Alex
June 10th, 2008 at 16:42
Wait a minute…In the instructions it says ‘electret microphone’, but in the schematics there are only TWO connections to the microphone shown. Is it an electret or a condenser mic? I’m confused…
June 10th, 2008 at 18:57
Hi Reece,
following Wikipedia http://en.wikipedia.org/wiki/Electret_microphone it is an electret microphone which is a subtype of a condenser microphone. The one that I used has only two connections.
Cheers,
Alex
June 26th, 2008 at 04:47
Ok. So I THINK I found the right microphone element in my box of goodies (old circuit boards from random stuff). I got it from an old cordless phone. I built the circuit for a project I’m doing. I haven’t tested it yet, though…
Here is a pic of the completed circuit:
http://www.flickr.com/photos/7507189@N04/2612530416/
June 26th, 2008 at 16:01
Yup. It works great. The butter zone trigger value is ~150 from the ADC. Great circuit; it’s so simple and I didn’t even need to make a complex op-amp one with all those capacitors and resistors. Great for a simple electronic ‘ear’ that can recognize simple handclaps. Thanks for the simple design!
June 26th, 2008 at 20:35
Great to hear that it works.
Kudos for the design goes to Andrew, who posted the design on Reconn’s world.
http://www.reconnsworld.com/forum/read.php?9,10