Forum Sensor.Community

Some reflections about the sonometer (DNMS)

For further reference, I would like to publish here some of the questions asked about the DNMS and their answers by the developer himself.

https://github.com/hbitter/DNMS

About the Teensy boards:

In the beginning we looked for a microcontroler which exsit as a board with pins headers and which has some good audio libraries.

We have started with the Teensy 3.6 and then the producer released the Teensy 4.0 which is more powerful ans cheaper.

The Teensy 4.0 is based on an Arm Cortex M7 processor with floating point HW for 32 Bit und 64 Bit. The clock frequency is 600 Mhz which is a lot.

A question about the components:

here are the changes we’d like to try :

-changing the MEMS microphone for a cheaper one : SPH0645. According to the datasheet, this is basically the same device, but on the 24 bits transmitted, only 18 are filled with significant values.It is also a lot cheaper. only 3-4 €.

-concerning the bit depth, we wanted to know if the choice of 24 bits was driven by measurement need, or if you adapted the dsp to the microphone because it was available ?
And then would it be acceptable to lower the bit depth to for example 16 bits ? more ? less ?

-About the choice of a teensy : as I understand it, it was used for its high clock frequency, and for the ease to develop audio processing, particularly with those 24bits depth datas which are memory consuming. But the teensy is an expensive board. If we can reduce the bit depth, do you think it is worth trying to carry the program for example on a 2d node mcu working as slave (2€ instead of 30€) ?

If we manage those changes, the sensor could be around 35 € less expensive, meaning an overall cost of 55 €. What do you think of all this ?

The answer

MEMS microphone SPH0645LM4H compared to ICS-43434

Both microphones are in the same class - they really have very comparable technical specs.

When we started the development about 1 1/2 years ago, I had orderd beside the ICS-43434 also the SPH0645LM4H on a beakout board from Adafruit. I found that the I²S Interface of the SPH0645LM4H was not compatible (at least at that time) with some Audio Libs around the Arudino IDE. At that time we choose the safe route and continued with the ICS-43434. Some time ago I found this nice description of a Sound Level Meter with Arduino IDE, ESP32 and I2S MEMS microphone on hackaday.io where the developer also described some problems with the SPH0645LM4H.

Price comparison (Prices shown for the raw microphone - without a breakout board - Distributor Mouser). Both microphones are in the same price range!

SPH0645LM4H

Qty. Unit Price Ext. Price
Cut Tape / MouseReel™
1 2,24 € 2,24 €
10 1,93 € 19,30 €
25 1,52 € 38,00 €
100 1,47 € 147,00 €
250 1,45 € 362,50 €
500 1,34 € 670,00 €
1.000 1,32 € 1.320,00 €
2.500 1,17 € 2.925,00 €

ICS-43434

Qty. Unit Price Ext. Price
1 2,44 € 2,44 €
10 2,02 € 20,20 €
25 1,74 € 43,50 €
100 1,64 € 164,00 €
250 1,54 € 385,00 €
500 1,41 € 705,00 €
1.000 1,39 € 1.390,00 €
2.500 1,27 € 3.175,00 €

Your Link to the AliExpress offer of an SPH0645LM4H on a breakout board is really attractive from the pricing point of view especially compared to the Tindie offer of a ICS-43434 breakout board. Why is that huge difference? I think it depends on quantity. I will come back to this on a later point but before I will go into more details about our development.

Two important points how to achieve the necessary accuracy.

If you compare the frequency reponse of different microphones based on the datasheets, you will see, that the frequency response differ from one type to the other a lot. Together with the A-filter you have to individually correct the frequensy reponse. This was one of the most time consuming tasks. We couldn’ t have done it without the support of the HFT Stuttgart (University of Applied Sciences) in their acoustic laboratory. By using a different microphone (SPH0645LM4H) all this has to be done again.

It not only the microphone that has an impact on the frequency response of the system but also the housing. This is especially important for getting replicable results. The difference from one housing to the other can be much more than from one micro to the other of the same type. Our measurements in the acoustic laboratory included these aspects. The AliExpress SPH0645LM4H breakout board would definitly not fit into a 1/2" tube (size is 15,6mm x 11,2mm).

To make the building of the microphone system easier and also lowering the costs we designed a small round breakout board with the ICS-43434:

This will fit smoothly in a 1/2" tube. We have build a lot of 10 of these and done measurements with very good results. The price would depend on the quantity. For a lot of 10 the single price would be around 12 € each, for a lot of 200 the price could be below 5 €. Quantity matters! Maybe there is a way that we reach together such numbers.

The microphone in the 1/2" tube could look like this:

16-bit - 24-bit?

First of all both microphones are transmitting 24-bit according to the I²S standard. But the resolution of both microphones do not reach 24-bit. As you noted it is not more than 18-bit. If you view the given figures from the datasheets the dynamic range is around 91 dB derived from EIN (Equivalent Input Noise) and AOP (Acoustic Overload Point, which is dB Full Scale). This can be expressed in the 16-bit range (96 dB). In DNMS the Teensy Audio Lib is used, which is a 16-bit integer Lib, the lower 8 bits of the I²S transmission are truncated.

Overall this results in a measurement range (based on the ICS-43434 and Teensy4.0) for the LAeq from 36 dBA to nearly 120 dBA. Not to bad - but it would be good to measure down to about 30 dBA. How can we achieve this?

The 16-bit integer math is not sufficient, there are limitations in the accuracy of the filters but even in calculating the RMS of the signal. We plan to do floating point math right from the beginning, that means converting the 24-bit I²S signal into 32-bit floating point and doing all further calculation in floating point. There is a version of the Teensy Lib for floating point calculation for most of the tasks available, still some things have to be adapted.

Power supply is always a big source of noise. Perhaps it can be improved with relative simple filters in the power supply connection of the microphone.

Can the system be based on the ESP8266 instead of the Teensy4.0?

First the signal flow. The following nice overview picture is from the ESP32 sound level meter project I mentioned earlier:

It shows that there is quite some amount of calculations to be done. And it is a continous job. There are even more calculations to do because in our approach we don’ t have a fixed time intervall for the LAeq. We calculate the LAeq further up to the moment, when an other microcontroller asks the DNMS to get the result of the last intervall. The intervall may be a second, the 150 seconds intervall of Sensor.Community or maybe even one hour.

In my opinion an ESP8266 is not the right choice for such a task. It doesn’ t have HW floating point and also doesn’ t have HW support for the I²S Interface (the ESP32 has I²S interface suppport).

Reading the article Sound Level Meter with Arduino IDE, ESP32 and I2S MEMS microphone on hackaday.io, the one I mentioned before, I got the impression, that the author sees some limitations in using the ESP32 as well, because it has 32-bit floating point in HW but not 64-bit. Especially looking for further extensions in the area of frequency analysis by FFT there have to be enough computing recources for this additional task. I would not feel comfortable with an ESP32. We started with the Teensy3.6 based on the Arm Cortex-M4 architecture with 32-bit floating point in HW and now using the Teensy4.0 based on the Arm Cortex-M7 with 600Mhz and 64-bit floating point in HW. Whereby the Teensy4.0 is not only more powerful but it is much cheaper compared to the Teensy3.6.

The following picture is from the Teensy’s developer website:

Teensy4.0 is 20,59 € in single quantities in Germany, 10+ would be around 19,30 €. Last year we orded 50 Teensy3.6 together with the HFT Stuttgart (University of Applied Sciences) and got a further reduction. Sure it will cost more than an ESP32.

I think overall cost of 55 € could be achieved by producing microphone boards (in china) and buying other components in an appropriate volume (200+). It also eliminates the high overhead cost of shipping for single quantities. The question is, is there an organisation who can afford it and is willing to organize it?

1 Like