Pages: [1] 2   Go Down
Author Topic: Arduino dB meter / noise-level meter - circuit?  (Read 8340 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

See http://wiring.org.co/learning/basics/microphone.html.

I have this up on a breadboard, with a 1N4001 diode, according to the diagram, not the drawing (misplaced diode).
I have omitted the 1000uF cap across Vin/GND, didn't have one.

I'm getting a nice amplified signal on my scope from pin 5 of the LM386, but nothing after the diode.

Ideas? Have anyone tried this? Which diode did the designer actually have in mind? Do I need to change the values of the caps/resistors?

Do you have an alternate design? I have LM386's available + a few handfuls of transistors. And there's a bit of urgency, so waiting for delivery of components is undesirable.

If we can't get the circuit to work, do you have an idea to do the integration/envelope in SW on the Arduino?

The application is "how loud is it, on an arbitrary scale, right now". I need to catch peaks of ~100ms duration.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Give a try with IN4148 instead of IN4001
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...but nothing after the diode.

What is nothing ? Is the voltage 0V ? Is your diode the other way around ?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 632
Posts: 34510
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That type of diode is fine, no need to try another type. Is the diode good? Test it with a meter. Then disconnect the arduino and check the voltage level again. As for the 1000uF cap any cap here is better than nothing, use the biggest value you have.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The input capacitor 0.001uf is rather small, use 1uF instead. The best diode for that peak detector is schottky or 1N34. The peak detector  has a time constant (t=k*R*C after the diode) where it keeps the voltage peek (you may calculate the t) so if you wait too long the 10uF capacitor discharges through the 2.2k resistor (if no input signal).
« Last Edit: August 16, 2012, 04:08:22 am by pito » Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are interested in db, have a look at the AD8307 (Analog Devices) - it is a logarithmic amplifier which gives you 0.0-2.5V DC output (for your ADC) when the input signal is -80..+12dB (90dB range). It is a DIL8 chip, you need 1 resistor and ~3 capacitors and you get a calibrated db voltmeter.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, guys.

Update:
* The "nothing after the diode" means the scope registers nada here. I haven't actually attached the Arduino yet.
* The diode is the right way around, and looks good according to my multimeter.

What I hear is that the design is basically sound, and that we need some bug-fixing/tweaking. That's progress, too.

What I'll try, according to your suggestions is:
1) Add a 100uF across Vin/GND, that's the largest I have (actually I tried this, but it dampened the output signal from the LM386, so I removed it). But it goes back in.
2) Change the input cap to 1uF
3) Replace the diode, just in case

Pito: Could I bother you with a further expansion of t=k*R*C? I assume that R is resistance in Ohms, the C capacitance in F, and t the time in s? But k?

Thanks in advance.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

..pls mind your signal at pin 5 must be bigger than ~0.6Vpp to see something on the R2. The 1n4148 takes 0.6V off the signal, schottky 0.35V, and 1n34 0.2V. Do you have the gnds of the R2 and C2 connected to common gnd? Is the R2 really 2200ohm? Is the C2 really 10uF and polarised properly? Try to connect anode of the diode to 5V (and do disconnect the diode from the lm386 first) - you must read about 4.4V dc on the C2 and R2.
t=kRC - google "rc time constant"
« Last Edit: August 16, 2012, 07:13:17 am by pito » Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...
The "nothing after the diode" means the scope registers nada here.
...
Same question : What is nada ?
Do you mean it is 0V, both AC and DC ?
Place a radio or so in front of the microphone and measure the DC voltage after the diode.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

[Place a radio or so in front of the microphone and measure the DC voltage after the diode.
..calculate the time constant first, it shall be k times bigger then 1/(lowest frequency in your signal) otherwise no big luck with DC..
« Last Edit: August 16, 2012, 07:42:59 am by pito » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are interested in db, have a look at the AD8307 (Analog Devices) - it is a logarithmic amplifier which gives you 0.0-2.5V DC output (for your ADC) when the input signal is -80..+12dB (90dB range). It is a DIL8 chip, you need 1 resistor and ~3 capacitors and you get a calibrated db voltmeter.

Something like this is highly recommended. I've used that chip and it's very impressive in both it's dynamic range and frequency response. The arduino analog input is a simple linear scale of voltage. Sound level is generally stated in logarithmic scales as practical sound level measurements covers such a wide dynamic range. So unless your desired measurement range is very small, I think you will be very disappointed in the results unless you have an external logarithmic amplification stage.

Lefty
Logged

Offline Offline
Edison Member
*
Karma: 36
Posts: leet
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Update:
* The "nothing after the diode" means the scope registers nada here. I haven't actually attached the Arduino yet.
How about the other end of the diode (the output from the op-amp)?

Another suggestion - A Precision Peak Detector puts the diode inside a feedback loop, and that will totally compensate for the ~0.7V diode-drop, allowing you to "detect" voltages below 0.7V.

You can proabably skip the 2nd buffer op-amp, but when I built a similar circuit I just used a dual op-amp.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 632
Posts: 34510
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm getting a nice amplified signal on my scope from pin 5 of the LM386, but nothing after the diode.
How big is this signal, it has to be greater than 0.7V before anything comes out of the other side of the diode.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

Thanks so far. I've added a 100uF across Vin/GND, changed the input cap to 1uF and replaced the diode.

My multimeter says about "2V" is coming out of LM386 leg 5. My "scope" is a soundcard probe with Zeitnitz Scope, and I'm not confident about it's Vpp metering. However, I temporarily replaced the diode with a LED, and got light according to soundlevel, so we're not totally off scale.

I tried connecting the anode of the diode to 5,4V (having disconnected the diode from the lm386 first), and got 4.9V dc on C2 and R2.

I'm still roughly getting the same results.

I get to play with this again on Sunday. Will rip everything apart and build from scratch then, by now I'm seeing ghost in broad daylight. Thanks, guys.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello

I am searching for a solution about make an decibel meter based on arduino, and I found the circuit of Philips- NXT: AN 1991, that is an Audio decibel level detector with meter driver. I would like your opinion about it.

Link:
http://ics.nxp.com/support/documents/interface/pdf/an1991.pdf
Logged

Pages: [1] 2   Go Up
Jump to: