Slow sampling rate on OS X

Posting this in iOS, since there is no OSX/macOS category...

I've been using the MetaWear SDK on iOS and Android and it's been working great, but on OS X, using the same client code as on iOS, I'm seeing very low sampling rates of the accelerometer & gyroscope data.  (I'm setting the sampling rate to 50 Hz, but on OS X I'm getting data at less than 10 Hz.)

Is this a known issue?  Is there any way around it?  I didn't see any sample code for OS X in the repo...

thanks
-steve

Comments

  • To understand whats going on, we have to understand a bit about the BLE connection itself.  When a BLE device is connected, both sides agree on a time to sleep between sending packets of data.  The exact time is "negotiated" during connection and depends on a bunch of parameters and is dependent on the BLE implementation.

    The issue is that iOS negotiates to go as fast as possible, whereas OS X negotiates to go as slow as possible.  The link over OSX spends so much time sleeping that it can't actually transmit 50 samples per second.

    You can tweak some of the parameters in an attempt to force OSX to go faster, this is a good place to start.  Note you may have to disconnect, then reconnect for the parameters to take effect.

    device.settings?.maximumConnectionInterval = 20

    device.settings?.applyConnectionParametersAsync()

  • Thanks - that worked!
This discussion has been closed.