cancel
Showing results for 
Search instead for 
Did you mean: 

decibel - microphone - st32f4 discorvery board

sojaewoo
Associate II
Posted on May 27, 2013 at 16:50

 I test the microphone[MP45DT02] of stm32f4 discorvery board.  

 I use 1.024Mhz Clock input microphone with i2s signal.

Pmd fiter of  library is applied and get pcm data from pdm data.

Is it corret pcm data that no sound is about 0 or 65535, loud sound is about 65535/2 ???

if  I know to get sound db, how can i know db(decibel)?????

6 REPLIES 6
zzdz2
Associate II
Posted on May 27, 2013 at 18:13

It looks like you get signed 16-bit samples (65535 = -1)

In such case you should use 16bit signed type to handle this, int16_t

sojaewoo
Associate II
Posted on May 28, 2013 at 08:18

zzdz2
Associate II
Posted on May 28, 2013 at 09:53

You need to calculate signal level and divide it by some reference value(0dB).

If you need to update the dB meter 5 times per second you take samplerate/5 number of samples and calculate peak value of those samples. Thus you will have 5 values per second.

Then you can calculate decibel:

dB = 20*log10(l1/l0);

l1 is the current signal level

l0 is the reference level

sojaewoo
Associate II
Posted on May 31, 2013 at 03:25

zzdz2
Associate II
Posted on May 31, 2013 at 08:12

if l1 is -2000 and +2000,  does peak value be +2000 or 4000??

 

 does db calculation is 10*log10(l1/l0) not 20*log10(l1/l0)????

 

It's +2000, get the absolute value,  -2000 would count as +2000.

10*log10(P1/P0) is the power formula, here you have amplitude so you use 20*log10

On a second thought you don't really need to divide by l0,

20*log10(l1/l0) equals to 20*log10(l1)-20*log10(l0) and 20*log10(l0) is constant.

You can simplify it to 20*log10(l1) + const.

sojaewoo
Associate II
Posted on May 31, 2013 at 10:57