Retrive Noise sensor value using mita
응답
19. 1. 21 오후 1:09

Hi,

I'm using Bosch XDK 110 and Mita.

Data of the Environment, gyroscope and magnetometer are taken correctly.Couldn't retrive noise data.

Here is noise sensor related part of code.

 

var myNoise : float = 0;
 

setup noise_sensor{
    samplingFrequency = 25600;
    timeout = 10;
}

-------

every 10 milliseconds {
    myNoise = noise_sensor.noise.read();
}

0 (0 투표)
RE: Retrive Noise sensor value using mita
응답
19. 1. 21 오후 5:05 as a reply to Karen Simonyan.
Dear Rachel,

First, I would like to welcome you to the XDK community. Unfortunately, it is currently only possible to sample the noise sensor without sampling the other sensors and vice versa.

Otherwise, if you intend sampling the noise sensor with the other sensors, an exception is thrown by the read function of the noise sensor.

Nevertheless, there would be a workaround available to integrate the noise sensor. Here it depends on how much your use case relies on it since it would require great effort to be integrated. Is it crucial to integrate the noise sensor into your use case?

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 투표)
RE: Retrive Noise sensor value using mita
응답
19. 1. 22 오전 5:49 as a reply to Franjo Stjepandic.

Dear Franjo,

Thanks for relply.

It would be much more better if  I could integrate noise sensor too.

Is there any way?

KInd regards,

Karen

0 (0 투표)
RE: Retrive Noise sensor value using mita
응답
19. 1. 22 오후 3:42 as a reply to Karen Simonyan.
Hello Karen,

Indeed it is, but you would need to make some C implementation too, to establish that.

Please note this implementation is bypassing the current implementation of the noise sensor and is using the low level API beneath it and deprecated parts. Furthermore, you will loose the benefit to sample the noise sensor at rates higher than your your hardware is operating at, which is around 1khz, and do not receive an calculated root mean square value.

But on the other hand, you will get a momentaneous value depending on the time interval you choose to sample the acoustic sensor.

For that, please install a secondary instance of the XDK-Workbench version 3.3.1 on your laptop/pc. You will just need the SDK of this XDK-Workbench version and can afterwards remove the instance.There go to the implementation file BSP_Mic_AKU340.c . You can find the implementation file by navigating to it over the following folderpath:

SDK > xdk110 > Platform > BSP > source

There copy the content of the function BSP_Mic_AKU340_Sense() . Open up the XDK-Workbench 3.5.0 and go to the same file, remove the implementation there with the copied implementation. Go to the header file BCDS_BSP_Mic_AKU340.h and remove the DECRECATED wrapping from the function prototype BSP_Mic_AKU340_Sense() . Save the changes and close both files.

Generate a new header and implementation file called NoiseSensorWrapper . Go into the header file NoiseSensorWrapper.h and generate two function prototypes as following:

 

void setupNoiseSensor(void);
int32_t readNoiseSensor(void);


Go into the implementation file NoiseSensorWrapper.c and include the interface BCDS_BSP_Mic_AKU340.h and add the following implementation to it:

 

void setupNoiseSensor(void) {
BSP_Mic_AKU340_Connect();
BSP_Mic_AKU340_Enable();
}

int32_t readNoiseSensor(void) {
return BSP_Mic_AKU340_Sense();
}


Save the changes and go into your mita file and add the following declarations to include the C functions into Mita over the Foreign Function Interface :

 

native unchecked fn setupNoiseSensor(): void header "NoiseSensorWrapper.h";
native unchecked fn readNoiseSensor(): int32 header "NoiseSensorWrapper.h";


This will allow you to use the C functions in your Mita source code as they were mita functions.

The function readNoiseSensor() can then be used in the same manner as the read functions of the other sensors. The setup function should be called as following in Mita:

 

every XDK110.startup {
setupNoiseSensor();
}


This will ensure that the initialization is made at the system startup and then you can start building up your application.

Please note currently the function readNoiseSensor() provides the data in bits representation. If you want a representation in millivolts, simply multiply it with 2500/2048.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
+1 (1 투표)
RE: Retrive Noise sensor value using mita
응답
19. 1. 23 오후 2:43 as a reply to Franjo Stjepandic.

Hello Franjo,

Thank you for your time!

It's works for me.

Best Regards,

Karen

0 (0 투표)
RE: Retrive Noise sensor value using mita
응답
19. 6. 12 오전 9:24 as a reply to Karen Simonyan.

Hi Franjo,

 

Are there any plans to make the accoustics/noise sensor an equivalent member of the sensor family in Mita? I am currently working on a use-case where I absolutely have to measure noise and light, nice-to-have is adding temperature and humidity.

Appreciate any update you might have on the matter.

Thanks

Oliver

0 (0 투표)