<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Spiros,<div class=""><br class=""></div><div class="">Do you have to use an analog electret microphone? If not, you could look at one of those mems-based microphones (used in e.g. cell phones), which often have a digital output. It is usually PDM based I think, but you should be able to interface it to an ESP32 and decode it.</div><div class=""><br class=""></div><div class="">For example: <a href="https://www.st.com/content/st_com/en/products/mems-and-sensors/mems-microphones/imp34dt05.html" class="">https://www.st.com/content/st_com/en/products/mems-and-sensors/mems-microphones/imp34dt05.html</a></div><div class=""><br class=""></div><div class="">About your analog solution, do you have any idea what the sample rate is of the library that you used?</div><div class=""><br class=""></div><div class="">Ben</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 6 Jul 2020, at 10:18, Spiros Makris <<a href="mailto:spirosmakris92@gmail.com" class="">spirosmakris92@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello list,<br class=""><div class="">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. </div><div class="">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.</div><div class=""><br class=""></div><div class="">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.</div><div class="">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).</div><div class=""><div class=""><span id="cid:ii_kca7uw4v0"><image.png></span><br class=""></div></div><div class="">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.</div><div class=""><div class=""><span id="cid:ii_kca81mqb1"><image.png></span><br class=""></div></div><div class="">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.</div><div class="">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.</div><div class=""><br class=""></div><div class="">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?</div><div class="">I can also mess around with the preamplifier stage, adjusting the dc bias or gain. </div><div class="">I'm kinda stuck. Any ideas?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div>
_______________________________________________<br class="">Synth-diy mailing list<br class=""><a href="mailto:Synth-diy@synth-diy.org" class="">Synth-diy@synth-diy.org</a><br class="">http://synth-diy.org/mailman/listinfo/synth-diy<br class=""></div></blockquote></div><br class=""></div></body></html>