").appendTo(b);c.set("href","#");c.addClass("iconthumbsdown")});a.all(".xdkabtn").each(function(){this.on("click",function(c){c.halt();var b=document.createElement("form");b.setAttribute("method","POST");b.setAttribute("action",this.getAttribute("href"));document.body.appendChild(b);b.submit();return false})})});
Choi Goeun Rank: Padawan  Hello, I want to Know calcuation method to XDK BSP_Mic_AKU340_Connet() BCP_Mic_AKU340_Enable()
Above, two function is the Initialize method. And reeding the Acoustic data is raw. How can I changed the data calculation method? DB uinit? 
0 (0 Votes) 
Mathias Bruendel Rank: Padawan  Hello Goeun, The reading of the acoustic sensor is in mV. There is no API for accessing the sensor directly since we cannot provide a reliable conversion to dB at the moment. A user can calibrate and implement the conversion at their own responsibility.
Mathias 
0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello Choi, As Mathias already mentioned, the acoustic sensor API you are currently using only offers the functionality to initialize the acoustic sensor and to read raw data from it and it does not offer the functionality to get sound pressure or the sound pressure level. Both would need to be implemented manually. Please note that you require for a calculation of the sound pressure level the sound pressure as well. Below, I will summarize some useful hints about how a implementation could be done. For calculating the sound pressure, you would need to calculate it you would need the conversion ratio of the ADC and the sensitivity of the AKU340. The conversion ratio for the ADC would be 2.5/4096. The 2.5 represent the reference voltage used to digitize the output voltage of the AKU340 and the 4096 represent the 12bit resolution of the ADC. The sensitivity value is typically defined in the data sheet of the AKU340 as 38 dBV/Pa. Before you use this value, you would need to convert it from the logarithmic representation into a linear value. Please note that this value is not constant over the complete frequency spectrum of the AKU340 and has an deviation of +2dB. For more information about the sensitivity, please refer to the data sheet of the AKU340 . Furthermore, for the sound pressure level, you would need to calculate the root mean square for the sound pressure. Afterwards, you can calculate the sound pressure level with the root mean square value for the sound pressure and the reference sound pressure, which is the smallest sound pressure a human ear can hear of 20µPa. The clue here is about the number of samples you use to calculate the root mean square value. Please note, that this would also require a manual calibration of the sensor itself, as Mathias already mentioned and that the responsibility would lie with you for implementing this functionality and to take care that it is appropriate tested. Please let me know if this was helpful and feel free to ask if you have further questions. Kind regards, Franjo 
0 (0 Votes) 
K Ming L Rank: Youngling  Hi Franjo, Is there a conversion ratio chart to get the value for ADC? Could you explain more about how to obtain the sound pressure? I don't quite understand the relationship between conversion ratio of the DC and the sensitivity.
What's the reason behind using 50 sample for RMS based on your other post? Will using the RMS value of the raw data in milliV will obtain RMS value of the Sound Pressure? Thank you! 
0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello K Ming, The conversion ratio for the ADC depends mainly on the used resolution and reference voltage and as such, it can be calculated. For example, 2.5 V as reference voltage and 4096 as resolution in bits results in a conversion ratio of 2.5/4096. For more details on this behavior, I would recommend taking a look at the refernce manual of the EFM32GG390 . The sound pressure itself needs to be calculated using the output voltage of the AKU340 and the sensitivity value as provided by the datasheet , which defines the conversion ratio between output voltage and the magnitude of the sound pressure wave. Please note that this is not a static value since it ranges from 36 to 40 dBV/Pa for frequencies between 60 Hz and 12.5 kHz. Also please note that this value needs to be converted into the linear unit V/Pa from the logarithmic unit of dBV/Pa before you can use it appropriately. Both, the conversion ratio of the ADC and the conversion ratio of the AKU340 need to be taken into account to calculate the correct sound pressure. Here I recommend to assume that the transfer ratio of the AKU340 is a static value of 36 dBV/Pa for all frequencies to get first results. The root mean square value on the other hand, is necessary for calculating the sound pressure level. The sound pressure level is defined as follows: SPL = 20*log10 (pRMS/p0) p0 is the least hearable sound pressure of 20 µPa. Using the sensitivity value, you can convert p0 to an output voltage of the AKU340. Then, you can use that value to calculate the sound pressure level via the output voltage of the AKU340. Otherwise, an additional conversion with the ADC transfer ratio could also be done into bits, and then the sound pressure level can be calculated. Regarding the recommendation of calculating the root mean square value, using fifty samples when measuring the ambient noise can produce first results quickly. You can alter this value to suit your use case. Kind regards, Franjo 
0 (0 Votes) 
K Ming L Rank: Youngling  Hi Franjo, Thank you for your explanation again, it have helped me understand better. I have also successfully calculated the SPL. In my For loop of 50, I have received many 0 values which will end up in undefined answer as log0 is undefined. Is this normal or how should I go about it? 
0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello K Ming L, I am glad to hear that my explanation helped you gain more knowledge about the sound pressure level. In regards to the zero values, since only the positive half of the sound pressure wave is measured and the negative half is clipped off and therefore zero. However, the zero values should not cause an issue within the calculation of the sound pressure level, since these are already taken into account in the calculation of the root mean square value. Otherwise, if you have periods of time where nearly no sound pressure is measured at all, I recommend that you don't calculate the sound pressure level and simply return 0. Please let me know if this was helpful and feel free to ask if you have further questions. Kind regards, Franjo 
0 (0 Votes) 
K Ming L Rank: Youngling  Hi Franjo, Thanks for the explanation and recomendation. I still do have some period that I'm receving 0 value, and it doesn't looks nice when I plot it out. How fast is the acoustic sensor sampling at for 50 readings in a loop which it's called every second? Could it be possible if I'm sampling the acoustic sensor too fast that it will return a 0 value instead? What's the possible solution for me to have a more stable results?? Thank you, K Ming

0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello K Ming L, sampling the acoustic sensor too quickly is prevented by the implementation. Since reading the acoustic sensor is essentially done in a blocking fashion, you can be sure that a valid value is returned. There simply is no sound pressure during some periods of time. As such, rather than sampling less, it would be more benificial to sample more often to capture all noise. Please let me know if that was helpful and feel free to ask if you have further questions. Kind regards, Franjo 
0 (0 Votes) 
K Ming L Rank: Youngling  Hi Franjo, Good to know that the data is valid. Thanks for the info. Regards, KMing

0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello K Ming L, I am always glad to help. Please feel free to ask if you have any kind of further questions or concerns. Kind regards, Franjo 
0 (0 Votes) 
K Ming L Rank: Youngling  Hi Franjo, According to my calculation the range could go up to about 130 dB SPL if I'm not wrong. Unfortunately, I 'm seeing some saturated data that looks like its clipped off at about 120dB SPL.
I have tried calibrating my data with 30db referencing to my phone acoustic sensor to get a more appropriate reading around 4050db in the room. Hence, the final calibrated value is saturated around 90db SPL. 
0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello K Ming L, Could you go more into detail about how you calculated the maximal range of 130dB for the Sound Pressure Level? The 120dB saturation, you mentioned, is currently the limit for the acoustic sensor AKU340 on the XDK. That is caused because the voltage values the AKU340 produces are receiving an additional gain factor of 10. As such, the output voltage for 20 Pa is at 2.518V, which is exactly what the ADC on the XDKs MCU can sample as maximal input voltage. Regarding the 90 dB saturation, you reduced the maximal Sound Pressure Level from 120 dB down to 90 dB, because you subtracted 30 dB. That is the main reason the saturation occurs now at around 90dB Sound Pressure Level. For a better accuracy, I only recommend making a calibration of 20 dB, which is equal to the gain factor of 10. Otherwise, you are only shifting the Sound pressure level range around, when you are subtracting constant offsets from it. Please let me know if that was helpful and feel free to ask if you have further questions. Kind regards, Franjo 
0 (0 Votes) 
K Ming L Rank: Youngling  Hi Franjo, Thanks for the explanation. I'm wrong on the maximum value. Where can I find the datasheet stating that it has a gain factor of 10? I am unaware of it. For knowledge purposes, how did you calculate that 20db = gain factor of 10? In addition, how would you recommend me to decide on which sensitivity value should I use? After reducing the SPL by 20, can I say the limit of the sensor reaches a maximum of 100dB SPL only? 
0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello K Ming L, I am always glad to help. The additional gain is not listed in the datasheet of the AKU340 since it comes after its output in the signal path to the XDKs MCU. Furthermore, I got to this value by calculating the actual voltage value, which is provided by the AKU340, for an input sound pressure of 20 Pa. That results in 0.2518 V, but to get to the upper limit of the ADC, the voltage would have to be 2.5V. As such, I deducted a gain factor of 10. Otherwise, you would not observe a saturation at 120 dB, but at 140 dB, because then the maximal voltage of 2.5V is reached first. That makes sense because the ADC is with a 12 Bit resolution only able to measure voltages about 610.35µV, which would result in 67.69 dB. Amplifying the value would allow going further down to 47.69 dB, which gets in the range to record a conversation, or to set a null value for a quite flat for example. On the other hand, the amplifying sets indeed a maximal upper limit of 100 dB. In regards to the calculation, I used the following equation: GdB = 20*log10(V/V0) In that case, the inner term V/V0 was set to the amplifying ratio of 10 and that results in 20 dB as result. Please let me know if that was helpful and feel free to ask if you have further questions. Kind regards, Franjo 
0 (0 Votes) 
K Ming L Rank: Youngling  Hi Franjo, I have understood what you have mentioned. Thank you !! However, I dont quite understand why did you choose 20Pa and how did it results to 0.2518V? Another question is, how do I determine which sensitivity value(36,38,40) should I use for my calculation?
Thank you, K Ming 
0 (0 Votes) 
Franjo Stjepandic Rank: Yoda  Hello K Ming L, I always happy to help. Regarding the 20 Pa sound pressure value, I calculated the value of 120 dB back into its linear representation by using 20µPa as reference sound pressure and 20 Pa was the result of that calculation. Then I calculated the linear value of 38 dBV/Pa, which is 12.59 mV and then I multiplied it with 20 Pa to get the output voltage value. The result of that calculation was 0.2518V. Afterwards, I did the deductions I mentioned in my last post. Regarding the correct sensitivity value, that is completely up to you. Since all explanations in this thread regarding the sound pressure level are highly academic and not tested in the field (e.g. possible errors produced by the RMS calculation and so on), you need to decide which one suits your use case best. Please let me know if this is helpful and feel free to ask if you have further questions. Kind regards, Franjo 
0 (0 Votes) 