Development of a Noise-Level Monitor for privacy minded parents

Wed 14 February 2024

electronics

Translations: DE

General

When many children are in one room, a high sound level can quickly establish itself. The goal of this project is to develop an electronic loudness monitor that determines the decibel (dB(A)) sound pressure level for automatic evaluation, but is technically set up so that the built-in microphone is not suitable for listening to the room.

Also, the circuit should be easy to build and have a reasonably large dynamic range. Furthermore, the system should be protected against use as an eavesdropping device by having all signal processing performed in analog technology.

Conceptual Overview

Blockschaltbild des Noise-Monitors

Initially, room sound is captured using a simple electrostatic microphone. The signal is amplified and filtered according to need using a multi-stage amplifier.

Now the signal is equalized and averaged, an RMS filter in an integrated circuit may also be thinkable as an option. From this signal, no usable audio data remains.

The resulting analog signal is then digitized and converted into a dB value by a microcontroller.

To capture a reasonably large range of values, the amplifier stage is controlled by the controller, and the switch intervals are found using a comparator in the analog signal path.

Details of the stages

Microphone

The electrostatic microphone is driven via a transistor in emitter follower configuration with approximately 5V supply voltage. The reference voltage is obtained from a voltage divider that is AC wise shorted to ground using an electrolytic capacitor. This results in a nearly noise-free DC level at the base.

The trick here is called “capacitance multiplication,” viewed from the microphone’s perspective, there is a resuting capacitiy of approximately the value of the capacitor multipyed by the amplification factor of the transistor (greater than 100). The voltage drop across the transistor was chosen as large as possible to enable optimal “decoupling” of the noise coupled through the supply voltage.

The second capacitor between emitter and GND serves more for reassurance than for actual stability of the microphone’s voltage. It should block the shot-noise, i.e., the low-frequency dominated background noise of the transistor that decays with 1/f.

Microphone input schematic

Amplifier

To prepare the signal for further processing and to provide a suitable input level for the following stages, several amplification stages are connected in series.

In each stage, the gain can be switched between 0dB and 20dB. There are four amplification stages available, allowing a large amplitude range of a few microvolts up to about 2V to be processed. The goal is to supply the equalizers/mean value filters in the optimal amplitude range between 100mV and 6V.

Simulated gain of a 20dB amplifier stage

Bandpass filters are present between the stages to pass useful signals between 43 Hz and 28 kHz.

The amplification is connected from the microphone end, so that the usable signal is amplified as early as possible. This should be beneficial for reducing signal noise.

Amplifier stage schematic

A-Filter

A-Weighting filter schematic

DIN EN ISO 9612 describes a supposedly more perceptionally correct weighting of the sound pressure level. One has to consider that the so called A-Weighting curve is meant for slow level noise. For higher noise levels the C-weighting is more appropriate while not being used in real world applications.

The filter itself was published by Rod Elliott (https://sound-au.com) as project 17. In his article he describes the circuit and a very informative discussion on the way these weighting factors do not make sense in mostcases while being the industry standard.

Averaging stage

Averaging stage

In order to keep cost and complexity of the project on a manageable level, we’re using a quite simple averaging circuit is used. Technically using a true RMS conversion is more appropriate. Both approches can yield differences of upto 30%, e.g. when comparing the results of sinusoidal and white noise. In our application we expect more of a colored noise of dozens of playing kids leading to an expected deviation of maximum 1..2 dB.

This is acceptable for hobby use, in a proper measurement equipment one would need to use a proper true RMS solution.

Again Rod Elliott’s App-Note #12 (Peak, RMS and averaging circuit) comes with a lot of valueable information and facts beside presenting ciruit ideas. See https://sound-au.com for details.

Between 20mV and about 4V the circuit exhibited nearly perfect linearity when built on perfboard. The frequency response was also measured, which showed a small overshoot up to about 100 Hz and a slight downward slope starting at around 10kHz, but in the end both effects did not cause more than 2dB non-linearity, again good enough for the intendet prurpose.

The following graph shows the DC output voltage over a varying input voltage using a 1kHz sine wave.

Output linearity

One can clearly see a saturation effect above 4 Vac, before that point we can fit an linear function with sufficently describes the measurements:

gnuplot> f(x)=a*b + b
gnuplot> fit [:3900] f(x) 'Rectifier_volt.csv'  using 1:4 via a,b

After 4 iterations the fit converged.
final sum of squares of residuals : 3.16777e-05
rel. change during last iteration : -2.15086e-09

degrees of freedom    (FIT_NDF)                        : 10
rms of residuals      (FIT_STDFIT) = sqrt(WSSR/ndf)    : 0.00177982
variance of residuals (reduced chisquare) = WSSR/ndf   : 3.16777e-06

Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = 0.000900225      +/- 7.447e-07    (0.08273%)
b               = 0.00223587       +/- 0.0006067    (27.14%)

The nonlinearity of the output vs. input voltasge is below one percent, one can easily spont this in the parameter a having an error estimate of well below 0.1%.

The offset-error given by the b parameter results in 2mV +/- 0.6mV, therefore voltages above 20mV will not suffer from significant errors. A chopper-opamp in the output section might help, but as we have a variable gain amplifier in circuit before this part, we simply avoid using this area of operation and therefore increasing prefer to amplify the signal and therfore make it more immune to circuit noise.

Another interesting circuit parameter is the AC-feedthrough over the frequency range.

A 1Vrms was coupled directly into the circuit and the resulting AC component was measured.

AC feedthrough of the averaging stage

This diagram shows the AC-feedthrough in dBV, as we fed 1Vrms wich is exactly 0dBV, one can directly read the attenuation here.

A reasonable AC suppression is starting at bout 20Hz, there the attenuation is already better than -60dB. If AC attenuation above 60dB would be desired, one could simple double up the RC stage in the output section.

Comparator/Autoranging

The initial plan included a comparator to help the processor auto-ranging in order to make measurements providing as high a dynamic range as possible.

This works by proving two switchover points using a voltage divider and two comparators monitoring the output of the averaging stage.

Comparator stage schematic

During development the autoranging was built into software using the A/D converter output with thresholds. This provided a sufficent response time and made waiting for the output to settle after range switching even easier.

Prototyping

Measurements on perfboard

All sections of the system were built from perfboard as individual modules, which where in turn soldered to a copper clad board. This base board was also used to provide a solid ground plane beneath the modules. These were connected using jumper wires. Therefore each module could be tested and tuned individually.

Prototype modules with wiring

Finally, a HP8903A audio analyzer was used as a signal source to measure the linearity of the complete signal path using the A/D converter IC on the board.

Measurement deviation over the input range of 1mV to 1V

Note that the 5% error shown here leads to a 0.5dB deviation which is still acceptable. The finished system should yield less than 5%, as the following factors contributed to deviations in the prototype:

  1. The individual switchable amplification stage factors where not the same on every module due to experimentation and rework. The first three stages have had amplification factors of about -3dB and +15dB. While the fourth has approximately 0dB and +20dB, making it more predictable.
  2. In the lowest measurement range the circuit noise and coupled in stray fields become dominant as the rather large loop area of the jumper wires provide a rather large coupling.

Now we compare the noise floor and distortion of the perfboard prototype on the lower end of the input range. The tone ist 1kHz generated by the HP8903A and sent through a diy audio attenuator.

Signal level at 10µV input level

Signal level at 100µV input level

This clearly shows that in the highest gain, a respectable 65dB, the noise floor with a 10µV of input level is not too far from the test tone. Also the first harmonic is nearly at the same level as the amplified tone itself, leading to signifcant deviation in the measured value. Note that at 100µV, the signal to noise ratio is much better.

“Real” PCB version

After validating the circuit using the modular prototype a “real” PCB was designed.

The first sample was hand placed and soldered in order to bring up the board section by section. Except for a wrong footprint for the DC/DC converter all parts did fit their footprint and no boding was needed. Also the signal to noise was much better compared to the prototype.

First assembly

Calibration of the dB value to sound pressure level was done using a commercial microphone calibrator. This neat device has a cavity in which the microphone is inserted and is subjected to either 95dB or 105dB SPL at 1kHz. The voltage logarithm to the base 10 is simply multiplied by 20 and a microphone sensitivity specific constant is added.

Microphone mouted inside a plug shroud

An RCA-Jack was used as a microphone input, the microphone itself was placed strategically inside a plug, making it easy to swap out or inject test signals.

Software

At the heart of the system there is an ESP32 with micropython running the show, enabling a really quick board bringup and allowing for quicker iteration cycles during development. The interactive command line (also called REPL) makes flexible manipulation of all digital subsystems a breeze.

A small downside is the, as the time of writing, lack of interactive debugging.

Using the built-in asyncio library, a cooperative multitasking was setup, implementing three sepearate tasks:

  1. “NoiseTask”: Takes readings from the A/D converter, calculate dB SPL and takes care of auto-ranging the input amplifier.
  2. “DisplayTask”: Shows a bargraph using addressable RGB LEDs, having also a peak-hold that slowly drops back down over time.
  3. “NetworkTask”: Tries to connect to a WIFI network and publishes the measurements to a MQTT broker.