Vibration Detector via Electret Mic. using Arduino Uno

Hi there!

I’m trying to build a vibration detector by using an electet mic.

The circuit as well as the microphone is set within a wooden box. When someone hits the box, an alarm-sound should play.
So when the Voltage provided by the circuit exceeds a certain value in volts a variable for further dealing should be set.

The alarm sound with speaker and such is already done. The only thing missing is the mic. circuit.

My biggest fear is, that i destroy the Arduino Uno, since this is my first try creating a circuit with an electret mic. & an Op-amp.
So my Problem is the correct dimensions of the elements which are used.

unfortunately i don’t own an oscilloscope for proper testing :frowning:

The circuit so far:
http://img4host.net/upload/0611204652ca837ed67ac.png

EM-5SB: The electret Mic.
NE5534AP: OP-AMP, inverting mode
R1, R2: Gain Modulation
Diode: rectification of the signal
R3: limits the current going into the Arduino Uno

Datasheets:
Mic:
http://img4host.net/upload/0611505652ca8a9001143.jpg
OP-Amp:
http://pdf1.alldatasheet.com/datasheet-pdf/view/95835/TI/NE5534AP.html

So can anybody tell me:

  • if the circuit is correct
  • how the resistors (in ohm) and the diode need to be like, that i definitely DO NOT HARM the uno

greetings Max

Everything looks safe...

The +5V supply to the op-amp will insure that nothing higher than +5V can go into the Arduino, and the diode will block any negative voltages.

...But,

1. Electret mics need power. The datasheet shows RL (2.2K) going to ....something. It should go to +5V. Then, you need the capacitor to block the DC power from the op-amp. (The capacitor value depends on the input impedance of your op-amp (R1).

2. Since the output impedance of the mic is 2K, and you already have 2.2K with the power-bias resistor, I'd recommend increasing the resistor values in the op-amp circuit. I'd suggest 10K for R1.

3. You'll probably need more gain from the op-amp circuit. We don't know how loud of a signal will be hitting the mic, so you'll have to experiment. I'd guess you'll need an R2 value of 100k - 1M (for a gain of 10 -100, with 10K for R1). Or try a 1M pot for R2, at least for experimental/development purposes.

4.You'll need a "load" resistor from "analog in" to ground. This is because the diode allows to the Arduino to go positive, but it cannot be "pulled down" through the diode.

Note - Regular silicon diodes don't "turn on" until you get about 0.5-0.7V across them. So, for small signals you won't read anything. So you should read about zero from the ADC until the signal is strong-enough to turn-on the diode. Then, the reading should suddenly jump to around 120. If you are reading around zero when you hit the box, your gain is too low. If you are "easily" getting readings of 1023 (the ADC maximum), your gain is too high. (That's assuming everything is functioning. ;) )

I'm also not sure how well you'll be able to detect vibration while not triggering with sound. In fact, it's possible that your alarm sound will re-trigger the thing, putting it into a constant alarm state! (You could write the code so that it ignores noise/vibration while the alarm is sounding.)

Why not use an op-amp that will work with a single supply?
This will then not require the diode or a negative supply.
The LM358 works down to 3V, is cheap and easily available.

Attached is a modified schematic from the datasheet at http://www.ti.com/lit/ds/symlink/lm158-n.pdf
It’s a non-inverting AC coupled preamp, but since you are only amplifying audio with no regard for phase, an inverting preamp would work as well.

Thank you very much, so my schematic looks like this:

further testing will happen tomorrow..

http://dduino.blogspot.ca/2011/12/arduino-tap-back.html

@Max_9

Your schematic is wrong. You have the mic connected directly to the 5V supply, this will not work as it will "short" out the audio signals. Decouple the mic from the supply with a resistor of around 2 - 10K. Have a look at the schematic I posted earlier.

You need a resistor in the connection between the mic and the +5V, to feed the mic with about 0.5 mA or thereabouts.

In that figure 37, how is it useful to have an audio output centred at 0 ? How would you usefully read this, with the arduino.

And also in figure 37, how does a gain of 11, give you 3 V peak to peak signal from the small mV produced by the electret mic ?

michinyon: In that figure 37, how is it useful to have an audio output centred at 0 ?

Actually it's not centered around 0V but rather Vcc/2, see the voltage divider network on the non-inverting input?

How would you usefully read this, with the arduino.

No split supply required and no diode needed on the output.

And also in figure 37, how does a gain of 11, give you 3 V peak to peak signal from the small mV produced by the electret mic ?

The 3V p-p signal indicates the approximate maximum output of the opamp with a supply of 5V and a bias of 2.5V Therefore the maximum input is 3/11 or 270mV p-p. Your statement that electrect mic only gives out a few mV is not correct for the models that require a bias and have a built-in FET amp. Some give out as much as 50 - 70mV.

Funny that with a datasheet in it's 13th edition, nobody has noticed the erroneous 0 next to that little sine wave.

True, attached is the updated schematic.