Search code examples
iphonearduinoaccelerometerknncore-motion

Convert Iphone accelerometer dataset from G unit to bytes to be used with Arduino 101


I'm trying to convert the accelerometer values provided by the following dataset to train the intel curie KNN chip of an Arduino 101 to recognize walking and running actions:

https://github.com/mmalekzadeh/motion-sense

This dataset is collected by using an Iphone 6s accelerometer. Since I want the arduino to be able to recognize walking and running by using its own accelerometer (not the iphone one), I need to convert the dataset to the same data rapresentation used by arduino 101 (bytes). How this can be done?

This is what I did:

1) Found Iphone 6s accelerometer datasheet. The Iphone 6s (just like the Iphone 6) has two different chips, but probably this is the one used in the dataset.

2) Found Curie chip acceletometer datasheet. Available here

3) Iphone data is expressed in both gravity and userAcceleration per axis, while Curie chip only return a 4 bytes values per axis. Here is written that Iphone total acceleration is the sum of gravity and userAcceleration...but which is the unit used to represent this value? I think G units...but I'm not sure...

Update: The dataset is expressed in G units with sensitivity range of ±8g. To convert data from Gs, the formula below posted by L. Putvin can be used.


Solution

  • If you want to recognize walking and running you will need to use the 8g or 16g range if you want to be safe (the max needed will also depend on where the sensor is worn, as the accelerations are greater for certain parts of the body than others). You must decide which one first, and then you will multiply the G rating from the phone by the LSB number.

    Sensitivity (calibrated)

    — (A): ±2g: 16384 LSB/g

    — ±4g: 8192 LSB/g

    — ±8g: 4096 LSB/g

    — ±16g: 2048 LSB/g

    When you setup the arduino you will need to change the sensitivity from the default value when you switch to the internal sensor.