Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Sound Sensor


  • Please log in to reply
2 replies to this topic

#1 selljamhere

selljamhere

    New Member

  • Members
  • Pip
  • 6 posts

Posted 29 July 2012 - 10:43 PM

I'm trying to build a sound sensor that measures volume. I found one online with a pretty good schematic: ZX-Sound. I also found a video of a homemade sensor using this schematic found here. The schematic is fairly complicated, and, to be honest, I don't know enough about op-amps to understand the reasons behind all the resistors and capacitors.

I have, however, built the circuit myself, but it only outputs a constant reading, no matter what volume is present in the room. One possible reason I can think of is that the mic I used isn't identical. It's from Radio Shack, and has a schematic on the back to differentiate the voltage and signal lines (mic datasheet is attached). I don't know how to incorporate this mic into the ZX-Sound schematic.

Has anyone had experience with a similar project, or electret mic's? I would appreciate any insight.

Attached Files



#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 30 July 2012 - 04:39 AM

Hello Salljamhere.
The circuit is needed because you need to convert a small signal -which is generated by the microphone- to an higher-level signal, which is used by the *duino.
An operational-amplifier (OPAMP) is a Lego-brick-like amplifier: no easier way to combine a series of amplifiers together, so that you could perform "operations" on analog signals. As for "Operation", I mean addition, subtraction, etc.

However, you are not to deal with design, but you must consider some basic considerations for making the circuit working.

First of all, the circuit takes the "sound" captured by the microphone -which is a sine wave, for simplicity- then amplifies several times. I mean that if the wave's amplitude is 1 mV, the first OPAMP in the circuit outputs the same wave shape, but scaled of a factor 101. Why 101? Because the factor is given by the R4 / R3 ration, plus one.
BTW, that only scales the wave: it does not change the shape, which is still a sine. So, if you're whistling near the microphone, the sine wave could be -let's say- around 1kHz.

Secondly, there's another OPAMP (IC1/2), which amplifies *a lot* the pre-amplifies signal, so that it's output (going to the *duino) is almost a square wave. That's because the resulting sine-wave would be so huge that is cut: the supply of the OPAMP is limited. Try to draw a very-tall sine wave, and cut its edges horizontally: the result is much like a square wave.

Some personal consideration to the circuit.
  • I don't understand why they put a capacitor right to the second OPAMP output: it has no sense, and stresses a lot the OPAMP, due the current flowing. I mean the desired goal, but that's not the right way.
  • The circuit takes a sine wave and outputs a square wave: it's still a wave, and the Netduino isn't fast enough to process an analog signal. I'd change the circuit so that it reveals the "peak" of the sine wave.

You say that your circuit is not working. Well, some questions:
  • have you used the same OPAMP model? Not all are the same.
  • the microphone has to be an "electret", which is an active component.
  • I would supply the circuit with +5V, not +3.3V. That's because the OPAMP works better, with a wider margin. Also the Netduino won't have problems with a +5V signal.
  • There's "C2", which aim is to "decouple" the DC-offset of the microphone output. That's fine: try to detach the microphone, and the rest of the circuit should behave as a total silence. In such a context, try to test the voltage respect to the ground (using a voltmeter) in various points of the circuit. That's really useful. Without microphone (i.e. total silence) the last OPAMP output should be +5V.

About the last OPAMP output...
I'd cut the C3 from the output, and I'd try to read the output voltage by whistling near the microphone. You should have a floating value ranging from 0 to +5V. As soon there's no sound, the output should rise to +5V back.
If that's going right, I'd use a diode (e.g. 1N4148) from the OPAMP output to the Netduino input. The diode strip has to be toward the OPAMP.
The "old" C3 is still useful, and I'd place it across the Netduino input and ground, that is *after* the diode.
A resistor could be also useful, but its value is rather hard to calculate in advance. The better and easier way to select it, is to try to make some sounds and tune the resistor for the best performance respect the Netduino detector program. The resistor has to be placed from the Netduino input and +5V. Due the embedded pull-up of the Netduino, that resistor might be missing. Just try it...
What after this small modification? This modification is a "peak detector": as soon the signal goes low, the diode takes the voltage low also on the Netduino/C3 side. As soon the OPAMP returns high, the diode won't have effect, and the voltage on the Netduino/C3 side will raise "very-slowly" (*). So that the Netduino can read it without pain.

(*) "very-slowly" has to be meant "compared to the input signal. When you whistle, the 1kHz wave changes its value every 500us. With this peak-detector, the signal should keep its low-state for several hundreds of millisecs, or even more.

Hope it helps.
Cheers
Biggest fault of Netduino? It runs by electricity.

#3 nadia

nadia

    New Member

  • Members
  • Pip
  • 1 posts

Posted 03 September 2013 - 07:18 AM

Hey selljamhere,

We are also  working on the project quite similar to yours, so I need  your schematic of interfacing   microhphone with netduino, so that we may get an  idea about this , we really need it. Yours consideration is highly appreciated. 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.