There are a number of sound sensors available for the Arduino, some of them fairly cheap so when I needed one, I thought that building one myself was lunacy and I set out to buy one.
First thought of course was to check out Dealextreme.com as they always have a hoist of goodies available at reasonable quality and pretty good price and they do not charge for postage.
Unfortunately the sound module there (with an LM393) did not get many good reviews (note, they do have a new one now) and when I checked Sparkfun, it seemed that their original sound BreakOutBoard, the BOB-08669 (with an OPA344) had a bit of a rocky start with lots of complaints and they replaced it with the BOB-09964, the difference between the two being some changes in resistor and capacitor values. Also the new BOB apparently did not make many users happy, + at USD 7.95 +S&H it wasn't really altogether a great deal either.
So my hunt went on. Well there really are a lot of circuits available: with 1 transistor, with many transistors with 1 op-amp with 2 op-amps.
However, I came upon a ready build board that had users enthusiastic: The zx-soundboard from Inex. They are a Thai company under a Singaporean mother company and have many distributors in Europe. Sadly however, none of these distributors seemed to have any information about this board. Fortunately they provide a clear circuit so that had to be the one. (In the mean time I found out it costs 7.57 euro in France.)
So why provide an instructable on such a simple thing. Well, 2 reasons:
- The Circuit Inex provides in my opinion is wrong
- If I design a PCB I best provide that to other would be builders
At first glance the circuit I designed is identical to the Inex schedule:
IC1a is used as a non-inverting amplifier. It offers a higher impedance than the inverting amplifier. The gain of the non-inverting amplifier is determined by 1+R4/R3 and is 40dB (100x).
In most cases it is possible to DC couple the circuit. However in this case it is necessary to ensure that the non-inverting has a DC path to earth for the very small input current that is needed. This can be achieved by resistor, R2 in the diagram. The value of this may typically be 100 kΩ or more. If this resistor is not inserted the output of the operational amplifier will be driven into one of the voltage rails.
When adding a resistor in this manner the capacitor-resistor combination forms a high pass filter with a cut-off frequency. The cut off point occurs at a frequency where the capacitive reactance is equal to the resistance. This is expressed in the Formula 1/2πRC. For the used combination it is =16Hz.
It is around IC1b where the Inex circuit goes wrong: The output from IC1a in the Inex circuit goes to the inverting entrance, labelled as 'pin 5'. However, the TLC272 has its inverting input on pin 6 and it's non-inverting input on pin 5.
So.. which was wrong the entrance or the pin number? I presumed the entrance was wrong as it seemed very unlogical to use the inverting input and I came across some people who had build the board succesfully and I presumed they just had followed the pin numbering and did not bother to question the design and thus unknowingly used the right entrance.
Anyway, why is Op-amp 1b even necessary? Wel, if the output of IC1a is fed directly to an ADC (as in the Arduino) there will be very strong fluctuations in the reading and as such the signal is not really representing the total sound pressure. We do that with op-amp IC1b that is used as a comparator with a reference voltage on the inverting entrance (pin 6). When fed with 5Volt, the Voltage on the inverting entrance will be 72mV ((5000/69)*1)
As long as V+ < V-, Vo will be low, but when the sound level rises above 72mV, IC1b will make the output go high.
With a gain of 100 in IC1a, a voltage of 720uV from the microphone would be enough. The Voltage build up over C3 is depending on the number of times the Output goes high and thus is an indication for the sound pressure. The delay in the RC filter at the SPL output is 3.3ms 150Ω*22uF in which 150Ω is the internall pull up of the TLC272.
Bill of materials.
1x TLC 272 dual op-amp: €0.35
1x 8 pin IC holder. €0.15
1x electret microphone: €0.75
1x 22kΩ €0.10
2x 100kΩ €0.20
2x 1kΩ €0.20
1x 68kΩ €0.10
1x 12Ω €0.10
1x 100nF €0.15
1x 470uF €0.10
1x 22uF €0.10
Furthermore: piece of Circuitboard 3 pieces of wire, solder, solderingiron
A copy of the fritzingfile for the PCB is found here
For those who do not want to build and can't find the ZX board, there is always the Freetronics board, that also has proper sound level detection >71 mV.
You may also want to build this one, that is somewhat similar to the Freetronics board to the extend it has a sound pressure output and an audio output.
Step 1: Sound Pressure Sensor for Arduino Based on ZX-sound Board: the PCB
I have added a print design that can be used for direct toner transfer. Placement of the components can be found in the figure.
The picture I have provided of the finished circuit deviates only slightly as initially I had made some provisions on the board to easily exchange the connections on pin 5 and 6 (in case I had made the wrong assumption.