Logging Accelerometer and Gyro simultaneously

Hi,
I am able to log accelerometer data and download it latter.
I would also like to log gyro data with the accelerometer data.
Is this possible? If so how should i do this? Is this related to the Splitter?

Thanks,
Oren

Comments

  • Yes, all you need to do is setup a data route for the gyro data.
  • Hi Eric,

    It would be really useful if you could give more detail here, maybe some sample code (I've looked everywhere on your github for this, but all examples seem to show sensors working in isolation)? I'm sure this is a very common problem for users. I'm easily able to separately stream and/or log data from the gyroscope and accelerometer, but what is the best way to make sure I am capturing them together for time-series analysis? 

    Some ideas I'm mulling over:

    - timestamp the readings and then compare the times from the two sensors (seems very clunky)
    - take the logs in the order they appear (presumably this won't work well if the sensors have different sampling frequencies - could be wrong...)
    - graphing/outputting the stream to a graph or text element, then using that to rebuild a dataframe object (kind of like what you do with your example app)

    Would appreciate any advice on this.

    Thanks,

    Chris
  • The accelerometer and gyro send data at a fixed rate.  If you set the ODR to 25Hz, then the sensor will produce data approximately every 40ms.  Knowing this, you can store the data you received in order, and use the sensor's ODR and the data's list index to compute approximately when said data was received relative to T0.
  • Thanks Eric, that makes sense. 

    I've had a go at logging the two together: does this look good to you?


    You can see on lines 299 and 300 I'm committing routes for the accelerometer and gyroscope separately.

    Just want to check that there's no way to route data from two sensors on the same route? Trying to see if I can begin streaming/logging at the same time.


    1. Your code looks fine as is
    2. No, one route to one sensor
    3. Simultaneously streaming and logging data is not a recommended use case.  If you have a stable BTLE connection, you do not need logging.  On the flip side, if you are only intermittently connected, then streaming is not appropriate in that scenario.
This discussion has been closed.