<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23562"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=222234917-06072020><FONT color=#0000ff
size=2 face=Arial>I've used the circuit in Figure 6 in lots of places, in my own
experiments and in commercial circuits. It works very
well.</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Synth-diy
[mailto:synth-diy-bounces@synth-diy.org] <B>On Behalf Of </B>Spiros
Makris<BR><B>Sent:</B> Monday, July 06, 2020 7:01 AM<BR><B>To:</B> synth-diy
mailing list<BR><B>Subject:</B> Re: [sdiy] [SDIY] Measuring the sound levels
from a microphone using an ESP32 board<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>I have been studying some of the circuits there. I'm leaning
towards those on figure 6-6A, but I will use the lm324 opamp instead (to get an
output down to 0V), followed by a simple LPF (so basically increase C1 on the
schematic shown below), making a very simple envelope follower. Taking the
average of that is an easy task and doesn't need much speed.
<DIV>The peak detection circuit will catch sudden noises better, though. Perhaps
I could employ both, for sustained and impulsive noises, respectively.<BR>
<DIV><IMG alt=image.png src="cid:222234917@06072020-1FF1" width=563
height=210><BR></DIV></DIV></DIV><BR>
<DIV class=gmail_quote>
<DIV dir=ltr class=gmail_attr>On Mon, Jul 6, 2020 at 2:58 PM Richie Burnett
<<A
href="mailto:rburnett@richieburnett.co.uk">rburnett@richieburnett.co.uk</A>>
wrote:<BR></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>Do the calculations digitally on the audio data as Tom said,
if your micro is up to the job.<BR><BR>If you have to use an analogue circuit
approach because the micro isn't fast enough or draws too much current, then
take a look here... <BR><BR><A href="https://sound-au.com/appnotes/an001.htm"
rel=noreferrer
target=_blank>https://sound-au.com/appnotes/an001.htm</A><BR><BR>This
excellent web page shows many precision rectifier circuits that go a long way
towards eliminating the dead band that you otherwise get using just a single
rectifier diode.<BR><BR>Good luck with your project!
<BR><BR>-Richie,<BR><BR><BR>Sent from my Xperia SP on O2<BR><BR>---- Tom
Wiltshire wrote ----<BR><BR>>I’d sample the incoming audio directly at a
good rate (48KHz maybe) and then do any processing on the data. Much easier to
do math inside the uP, rather than outside in analog
circuitry.<BR>><BR>>As to what algorithm you use to measure sound level,
there are an absolute ton of them, as I discovered when I looked into VU
meters.<BR>><BR>>Tom<BR>><BR>>==================<BR>>
Electric Druid<BR>>Synth & Stompbox
DIY<BR>>==================<BR>><BR>><BR>><BR>>> On 6 Jul
2020, at 09:18, Spiros Makris <<A href="mailto:spirosmakris92@gmail.com"
target=_blank>spirosmakris92@gmail.com</A>> wrote:<BR>>> <BR>>>
Hello list,<BR>>> I have to develop a small metering application for a
university project. The idea behind it is to demonstrate the internet of
things and how it can be used to monitor the (audio) noise levels in a room,
to be used in places like studios, production facilities or even bars.
<BR>>> The sensor used is a common electret type microphone, which is
preamplified using a current to voltage opamp stage, based on the OPA172
amplifier. The supply voltage is 3V (same as the microcontroller), but I have
the option of 5, 9 or even 12V if needed (only unipolar, though.) Then, this
amplified signal needs to be converted to a measurement that will somehow
relate to "how loud" the sounds are. Accurate SPL measurements are not
required (although they would sure be nice if this was a commercial
application). I may have access to a measuring microphone in order to
calibrate this when I'm done. I'm using an ESP32 board and its onboard
ADC.<BR>>> <BR>>> I first tried to use the RMS Arduino library,
which measures an AC signal coming into any analogue pin (no external
processing, other than prequalification). I couldn't get it to show any
coherent readings - I'm not sure if this is due to the sample number or
sampling period I'm using. Making an RMS calculation method from scratch
wasn't much better either - the variations I could detect were (or seemed to
be) minuscule - definitely not enough to be meaningful in this
application.<BR>>> I'm now trying a more analogue approach: the preamp
signal is passed through a Schottky diode, connected to a large capacitor. A
transistor is placed parallel to the capacitor, to be used as a reset switch
(controlled by the processor).<BR>>> <image.png><BR>>> I
have tried AC coupling and DC coupling the input - both methods work (DC
coupled version is shown). When the input goes over the threshold of the
diode, the capacitor is charged (with a pretty large current), and the droop
rate is small enough to measure it with the controller, then reset it, to take
another measurement. So far so good, but I need some way of eliminating that
0.3V threshold.<BR>>> <image.png><BR>>> The graph is taken
from the AC coupled version (but is identical to the DC-coupled one, save for
some DC offset). The X-axis shows the input amplitude and the Y-axis shows the
capacitor's final voltage.<BR>>> The ESP32 has adjustable attenuation
for the ADC - the maximum range can be adjusted to ~1.3V, ~2.5V and ~3.3V
(approximate values). The resolution is 12bits.<BR>>> <BR>>> I
thought of using a rail to rail opamp to make an ideal diode - however, I only
have a SOIC8 version of an OPA172 and no time to print a PCB. Perhaps I can
source adapters quickly though - is there a single opamp circuit that could
help me?<BR>>> I can also mess around with the preamplifier stage,
adjusting the dc bias or gain. <BR>>> I'm kinda stuck. Any
ideas?<BR>>> <BR>>> <BR>>> <BR>>>
_______________________________________________<BR>>> Synth-diy mailing
list<BR>>> <A href="mailto:Synth-diy@synth-diy.org"
target=_blank>Synth-diy@synth-diy.org</A><BR>>> <A
href="http://synth-diy.org/mailman/listinfo/synth-diy" rel=noreferrer
target=_blank>http://synth-diy.org/mailman/listinfo/synth-diy</A><BR>><BR>><BR>>_______________________________________________<BR>>Synth-diy
mailing list<BR>><A href="mailto:Synth-diy@synth-diy.org"
target=_blank>Synth-diy@synth-diy.org</A><BR>><A
href="http://synth-diy.org/mailman/listinfo/synth-diy" rel=noreferrer
target=_blank>http://synth-diy.org/mailman/listinfo/synth-diy</A><BR></BLOCKQUOTE></DIV></BODY></HTML>