Inaccurate sampling rate on barometer MetawearC
I am using the Mbientant lab METAWEARC board and the MetaWear-SampleApp-Android mobile application. The barometer sample freq in the code is set to 26.32 Hz (as per GitHub repository code).
However, when I carry out a three minute recording instead of the final time stamp being around 180s it is around 164s. The number of samples is 3848 instead of the expected value around 4738.
I repeated this test at 10Hz and 50Hz and the final timestamp was 386.7s and 78.44s respectively when both should have been 180s. The number of samples are 3869 and 3964 for 10Hz and 50Hz instead of expected value around 1800 and 9000.
The 'real' frequency seems to be permanently set at around 21.4Hz. When I did a recording at 21.4Hz the final timestamp and number of samples was as expected. For my application I would like to set the frequency to 10Hz or 50Hz. Any ideas or suggestions to how we can change the frequency?
Comments
https://mbientlab.com/androiddocs/3/barometer.html
Hi Eric,
Thanks for your quick response. I ran a test using the parameters from first row in table 15 (hand held device) in datasheet for BMP280. I expected an output data rate of 10Hz as the oversampling was set to Ultra high resolution, IIF filter coefficient was set to 4 and timing was set to 62.5ms.
However, when I carried out a 180s recording the output file had 1656 values instead of the expected 1800. This suggests the output data rate was 9.2Hz instead of 10Hz. How did this happen?
P.S. note the datasheet link is https://cdn-shop.adafruit.com/datasheets/BST-BMP280-DS001-11.pdf the link in https://mbientlab.com/androiddocs/3/barometer.html no longer works.
Data rates aren't always exact from the sensor. You can more finely control the data rate through the firmware by using the buffer data processor and timer.
https://mbientlab.com/androiddocs/latest/data_route.html#buffer
https://mbientlab.com/androiddocs/latest/timer.html
Thanks for pointing out the broken link.
Thanks for sending through the links above.
I'm keen to avoid making firmware changes. Is there anyway to get the time vector to represent the actual time that the sample was taken?
When I change the value of "BAROMETER_SAMPLE_FREQ" (from BAROMETER_FRAGEMENT) the time vector in the output has this
frequency regardless of the actual sample rate. For example when I set BAROMETER_SAMPLE_FREQ = 50.0f and set baroBosch.configure() with values
.pressureOversampling(OversamplingMode.HIGH)
.standyTime(0.5f)
.filterCoeff(FilterCoeff.OFF)
I expect the samplerate to be 50Hz. However, the output data sample rate is 40.8Hz and the time vector is in 50Hz. I'd like the output data sample rate and the time vector to have the same sample rate.
I didn't ask you to make firmware changes. I simply pointed you to existing firmware features that could be used to address your problem.
This is all in the documentation.
https://mbientlab.com/androiddocs/3/data_route.html#account