Community news, upcoming events and general discussions
Threads: 36 Posts: 88
Get technical support from the community
Threads: 1427 Posts: 7608
Threads: 18 Posts: 64
Tell us how to make XDK better!
Threads: 36 Posts: 119
Share and discuss community member projects
Threads: 81 Posts: 350
we received our XDKs last week. According to the spec ist has an Acoustic noise sensor (AKU340) included.
But how to access it? There are no handles provided in XdkSensorHandle.h or anywhere else.
I only found some GPIO port definitions for it. Is there any usable example providing some data?
Thanks in advanve.
welcome to the XDK community. Unfortunately there is no single interface for the acoustic sensor implemented in the SDK of the XDK yet. But this thread offers a detailed description about how the acoustic sensor can be implemented via the ADC.
I hope, this helps you for the moment.
Please do not hesitate to ask if you have further questions.
Kind regards, Franjo
Hello Franjo, thanks for the answer.
I tried the source code you pointed me to, and it reads "some" data. However I couldn't get any useful things out of it.
The value is always very low (~3mV).
Our usecase is that we would like to have some sort of "background noise level detection". I tried putting my headset on the XDK with some music on. Nothing changed on the value.
Only if I really scratch on the surface of the XDK I get values of around 200mV.
I will later look into this issue.
I analysed the behaviour of the acoustic sensor more detailed and came to a suitable conclusion. I used a setup with a timer task which accesses the data of the ADC every 2 ms. Additionally I implemented an estimation of the root mean spare value over 50 samples and displayed it in the workbench console. Thus I was able to detect all kind of ambient noise with average voltage peaks of 500-700 mV. Therefore I conclude that it highly depends in which time intervals you access the data of the ADC to receive analysable data.
Further I hope this helps you in your analysis.
can you share your example code?
I guess you have all example code that is needed to reproduce my result. The only thing you have do is to put the second code snippet in the linked thread in a timer task which runs repeatedly after 2 ms. Note that you can feel free to alter this time. Please take a look at section 2.4 of the freeRTOS guide to get familiar with timer tasks.
Initializing the ADC can be included in an external function or at the beginning of appInitSystem(). Additionally you have to adapt receiving the sensor values of the ADC to store the measured data in an array of 50 elements and and insert a condition which estimates every 50 samples the root mean square value. Furthermore you can use the following code snippet to estimate the root mean square value.
for(unsigned int i = 0; i < 50; i+=1)
averageVoltage += pow(voltageLevels[i],2);
averageVoltage /= 50;
averageVoltage = sqrt(averageVoltage);
The variable voltageLevels is used as the particular array of 50 elements to store the measured data from the ADC and averageVoltage stores the estimated root mean square value.
Pleas tell me if this is helpful.
I used your idea of the mean square route to get aggregated some data.
We currently try to meassure data in our offices. We can already see that in an empty meeting room the voltage is lower than in our office. So I think this will be enough for our usecase.
I am glad to hear that my hints lead to a sufficient solution for you.