How to write raw accelerometer data in a FIT file

Former Member
Former Member
Hi all,

I have read the infos about sensor and the pitch counter app but it's not very clear how to write raw accelerator data (x, y z for example at a regular time intervals) in a fit file so that I can see these data in connectIQ (one graph for each data)..

Of course the recording should be short since it will generate a lot of data.... My goal is to see how the accelerometer data look like for a specific movement in order may be to prepare a filter to detec easily the interesting movement.


Do you have any hint, sample code to share or link...

Thanks in advance
  • Wphantom

    If you look in PitchCounter sample app, in the initialize() function of PitchCounterProcess class you will see the code for initializing the logger and options for the accelerometer data.

    try {
    mLogger = new SensorLogging.SensorLogger({:enableAccelerometer => true});
    mSession = Fit.createSession({:name=>"PitchCounter", :sport=>Fit.SPORT_GENERIC, :sensorLogger => mLogger});
    }
    catch(e) {
    System.println(e.getErrorMessage());
    }


    Since sensor logger writes the data to fit files, you have to use fit session to start writing the data to a fit file. Also you can replay the accelerometer data stream from the FIT file to you app through fit simulation in simulator. By default the accelerometer data is written to fit file at 25hz.

    Note: logging to fit file generate a lot of data so it is recommended to use the logging for collecting the accelerometer samples, to be used in app development.
  • Former Member
    Former Member over 7 years ago
    Thanks for your answer...

    I now understand my problem was not to have the accelerometer data in the fit file which PitchCounter did fine... but to read that content from the FIT file... I succed with FIT SDK... and the data was here.... thanks !