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







40 responses so far ↓
1 Alan // Aug 22, 2007 at 00:05
Nice job, it seems to follow the music quite well!
2 Philippe // Oct 23, 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.
3 Justin // Nov 12, 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
4 alaa // Jan 10, 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.
5 odiernod // Jan 24, 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.
6 Alex // Jan 24, 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
7 odiernod // Jan 25, 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
8 Azda // Jan 26, 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?
9 Alex // Jan 26, 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
10 Azda // Jan 26, 2008 at 21:09
thanks for the help alex
11 Azda // Jan 28, 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.
12 Michael H // Mar 18, 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.
13 Alex // Mar 18, 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
14 karim // Mar 23, 2008 at 08:33
is this circuit can be used to detect alarms without any false indications
15 Alex // Mar 23, 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
16 karim // Mar 23, 2008 at 08:56
Thank you very much
i’m really amazed of your fast response
17 BIGBUG // Apr 20, 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
http://www.oobug.com
18 Alex // Apr 21, 2008 at 00:28
Ted, great to hear that. I am waiting to see the final result.
19 BIGBUG // Apr 21, 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
20 Alex // Apr 21, 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
21 Reece // Jun 10, 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…
22 Alex // Jun 10, 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
23 Reece // Jun 26, 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/
24 Reece // Jun 26, 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!
25 Alex // Jun 26, 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
26 Reece // Aug 21, 2008 at 03:10
I’m making another one of these, but this time I need it to be more sensitive. What can I do to increase the sensitivity? Thanks in advance.
27 Alex // Aug 22, 2008 at 07:56
Reece,
the amplification is dependent on the transistor. You can try to find others with a higher gain. Another option is to use two transistors or start with op-amps.
28 Reece // Aug 22, 2008 at 18:15
I know of some op-amp circuits, but I want to keep this simple. Will adding a second transistor essentially double the sensitivity? How do I modify the circuit to accept another 2N3904 transistor? OR what other transistor can I use that is easily attainable (aka via radioshack). A 2N222?
29 ì•„ë‘ì´ë…¸ë¥¼ 위한 ì´ˆì €ë ´ 사운드 센서 - Suapapa’s Blog // Sep 16, 2008 at 02:19
[...] 찾기 힘들었는ë°- 위 ê¸°ì‚¬ì˜ ë„움으로 드디어 찾았습니다. 만세! ê·¸ 블로그 í¬ìŠ¤íŒ…ì˜ íšŒë¡œë„ ì¤‘ 사운드 센서 ë¶€ë¶„ë§Œì„ ë‹¤ì‹œ ì •ë¦¬í•˜ë©´ 아래 회로ë„와 [...]
30 Justin // Mar 26, 2009 at 13:46
Hello,
Was just wondering if this circuit would work with an arduino board?
31 Alex // Mar 26, 2009 at 19:22
Hi Justin,
yes, that should work.
Cheers,
Alex
32 QuantumKate // Apr 3, 2009 at 19:10
Ok folk. New problem. Does anyone have any idea how to make this, only a lot smaller. (Small enough to fit inside 3/4″ pvc pipe). Any suggestions?
33 Bogdan // Apr 22, 2009 at 13:34
I want to measure the output of the microphone. What does the input read on the ADC represents? Decibels? A digital representation of the analog input with no measuring unit? I need to measure it in a international sistem unit, for example decibels, or something else. Can u please explain how can i do that? What to do with the ADC input?
34 Alex // Apr 22, 2009 at 15:19
The ADC measures the voltage on the pin and converts it to a digital value. The range is 10 bit, 0 to 1023 for 0 V to 5 V, if you use 5 Volt VCC. If you want to measure decibels, that would depend on your microphone, how much voltage it puts out for a given decibel value.
35 Bogdan // Apr 23, 2009 at 19:25
i am using the MCE-100 microphone…
36 Lee // Jul 22, 2009 at 22:00
I was looking at your code and was curious on how the .h file look like (avr/io, util/delay, and inttypes)
37 Alex // Jul 22, 2009 at 22:36
These are part of the avr-gcc toolchain.
38 Josh // Sep 26, 2009 at 00:08
Hi,
I just built a copy of this circuit and whilst it appears to amplify the mic, it doesn’t give anywhere near the kind of response yours does in the video.
I’m using the 2N3904 and it gives me an ADC value of around 800 (using 10-bit mode). If i blow on the mic the value changes (so it’s definitely recieving input) but that implies it’s only responding to massive levels of noise.
Reckon the microphone is narked or have i just built the circuit incorrectly..?
What kind of ADC result do you get from your mic if you talk into it?
39 Alex // Sep 26, 2009 at 08:09
Hi Josh,
this is a very limitted amplifier.
If I remember it correctly, I had values around 150, so maybe there is an error in your circuit.
If you want a circuit, that is more sensitive, you have to look for a more complete amplifier circuit, e.g. this one, using a piezo: http://www.nerdkits.com/videos/sound_meter/
Cheers,
Alex
40 James // Oct 13, 2009 at 14:16
Hi, I bought a sound sensor which was attached to 2 neon light tubes. There is a transformer circuit just before the input to the lights. I think I had somehow damaged part of the circuit when I was trying to replace the neon light with LEDs. Is there anyway I am able to remove the transformer circuit?
Leave a Comment