Inconsistent accelerometer data rate

edited September 26 in C#

Hello,

As I told in the previous post, we have two MetaMotionR devices and we want to receive accelerometer data from them in our application. The application connects to one MetaMotionR device and stays connected until the user manually disconnects.

One problem that we're dealing with is that, even though the accelerometer's output data rate is set to 100 Hz, there are some situation is which we receive between 2 and 40 samples per second. So, the number of samples received in this scenario varies by a large margin and is much lower than 100.

I am reading the board configuration parameters periodically using the method below, but the values I receive are correct.

    public float Odr { get; set; } = -1;
    public float Range { get; set; } = -1;
    public async Task GetCurrentDataRate(IMetaWearBoard device)
    {
        var acc = device.GetModule<IAccelerometer>();

    // Get connection params
        var con_params = await device.GetModule<ISettings>().ReadBleConnParamsAsync();

    // Get accelerometer params
        await acc.PullConfigAsync();
        Odr = acc.Odr;
        Range = acc.Range;

    // Accelerometer params
        System.Diagnostics.Debug.WriteLine("Current Odr: " + Odr.ToString());
        System.Diagnostics.Debug.WriteLine("Current Range: " + Range.ToString());

    // Device params
        System.Diagnostics.Debug.WriteLine("Min Con Interval: " + con_params.MinConnectionInterval);
        System.Diagnostics.Debug.WriteLine("Max Con Interval: " + con_params.MaxConnectionInterval);
        System.Diagnostics.Debug.WriteLine("Slave Latency: " + con_params.SlaveLatency);
        System.Diagnostics.Debug.WriteLine("Supervisor timeout: " + con_params.SupervisorTimeout);
    }

Output:

Current Odr: 100
Current Range: 2
Min Con Interval: 7.5
Max Con Interval: 7.5
Slave Latency: 0
Supervisor timeout: 6000

The observations are the following:

  1. The number of received samples is still wrong, regardless of the distance (between 0 and 1 meter).
  2. This behavior remains as long as the connection is maintained (the functionality does no recover even after 5 minutes)
  3. Charging the device during this scenario did not make any difference (battery charged from 50% to 77%)
  4. The number of samples received is 2 to 40 per second, instead of 100.
  5. The problem is resolved by connecting again to the meta motion device (usually after the first connect, but not always)

Board Information:
Hardware revision: 0.4
Firmware revision: 1.4.4
Model number: 5
Host Device Information: Laptop with Windows 10 x64, version 1903
SDK: I am using Visual Studio 2017, version 15.9.14

Can you tell me what can be the cause?

Thank you,
Florin

Comments

  • There can be any number of things that are wrong.

    Do you get 100hz streaming with the accelerometer tutorial?
    https://mbientlab.com/tutorials/WCS.html#stream-accelerometer

  • edited October 1

    @Eric said:
    There can be any number of things that are wrong.

    Do you get 100hz streaming with the accelerometer tutorial?
    https://mbientlab.com/tutorials/WCS.html#stream-accelerometer

    When I tested that implementation I got 100Hz. Also, I get 100Hz using the MetaBase application for Windows 10. What I noticed is that, when the scenario occurs, disabling Bluetooth from settings on my laptop for a few seconds and then connecting again to the device solves the problem.

    Does this give you any relevant information? We have a workaround for this issue, but we would like to understand it if possible.

  • edited October 1

    If you write "bad code" and the sensor goes into a bad state, it is good to reset it. You can reset it using our APIs, MetaBase App, or even the manual approach featured here: www.mbientlab.com/troubleshooting.

    When I tested that implementation I got 100Hz. Also, I get 100Hz using the MetaBase application for Windows 10. What I noticed is that, when the scenario occurs, disabling Bluetooth from settings on my laptop for a few seconds and then connecting again to the device solves the problem.

    Does this give you any relevant information? We have a workaround for this issue, but we would like to understand it if possible.

    I suggest that every time you try to program the device with your Windows App, that you occasionally reset it to make sure it is not in a compromised state.

    Also, reset the bluetooth drivers on Windows.
    These are precautions that should be in any App you intend to publish anyways.

  • @FloNas said:

    @Eric said:
    There can be any number of things that are wrong.

    Do you get 100hz streaming with the accelerometer tutorial?
    https://mbientlab.com/tutorials/WCS.html#stream-accelerometer

    When I tested that implementation I got 100Hz. Also, I get 100Hz using the MetaBase application for Windows 10. What I noticed is that, when the scenario occurs, disabling Bluetooth from settings on my laptop for a few seconds and then connecting again to the device solves the problem.

    Does this give you any relevant information? We have a workaround for this issue, but we would like to understand it if possible.

    It suggests an issue either with your BT adapter or your code.

    We can possibly eliminate the BT adapter if you don't have to reset it while using the tutorial code or the MetaBase app. If that is the case, then it's most likely some quirk in your code.

Sign In or Register to comment.