python using pymetawear to stream accelerometer data

Hi All,

I am running Ubuntu 16.04 on Mac Mini and try to use python script to stream accelerometer data to desktop.
I found that the streaming data would stop unexpectly after a few thousand data points.
How can I solve it? Thanks a lot.

My testing python code:
    from pymetawear.client import MetaWearClient

    c = MetaWearClient(METAWEAR_ID)
    # Set data rate to 200 Hz and measureing range to +/- 8g
    c.accelerometer.set_settings(data_rate=DATA_RATE, data_range=DATA_RANGE)
    def testing_fun(acc_data):
        print("Original Epoch time: [{0}] - X: {1}, Y: {2}, Z: {3}".format(acc_data[0], *acc_data[1]))



  • You need to use the high frequency stream for streaming at 200Hz.
  • edited January 2017

    I have turn on the debug mode by setting: c = MetaWearClient(METAWEAR_ID, debug = True)
    Below is the debugging message I got just before the streaming of accelerometer data stopped.
    Hope it can help. Thanks.

    2017-01-30 19:42:25,774 DEBUG Subscribing to Accelerometer changes. (Sig#: 140506298349296)
    2017-01-30 19:42:25,774 DEBUG Write  0x001d: 03 04 01
    2017-01-30 19:42:25,825 DEBUG Write  0x001d: 03 02 01 00
    2017-01-30 19:42:25,876 DEBUG Write  0x001d: 03 01 01

  • Did you switch to using high frequency stream?
  • edited January 2017
    Thanks for your help!
    Could you please kindly tell me how to switch to high frequency stream?
    Is turning on high frequency stream a function in Ubuntu? or Python? or pymetawear?

    Thanks again.
  • The pymetawear is a community provided library, not an official MbientLab one.  You can checkout the accelerometer example code to see if that can answer your question, or if not, leave a question with the pymetawear author.

This discussion has been closed.