This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thingy 52: Motion sensor (accelerometer) raw data in IOS is giving unit vector, I was expecting more of a m/s2 values. Is my assumption wrong?

Hi, 

I am using Thingy 52 to measure the acceleration from accelerometer. I was expecting values like m/s2 but I am seeing values in unit vector, ie, values between (0 - 1.0), I can't see negative values as well. How do I get actual values, ie, > 1? Please hep if my understanding is wrong.

  • Hello!

    How are you reading out the value? In the Thingy IOs app raw data is converted into m/s2 in this section of code.

    Best regards,
    Carl Richard

  • peripheral.beginRawDataUpdates(withCompletoinHandler: { (success) -> (Void) in

                    NSLog("Raw data update")

                }) { (arr1, arr2, arr3) -> (Void) in

                   NSLog("Raw values  \(arr1)")

              }

    Using the above method when I am printing out the accelerometer values if It is giving me unit vector values. The sample output at console

    2020-08-26 16:27:43.657397+0530 TestThingy[3278:594688] Raw values [1.999939, 1.9993896, 0.030792236]

    2020-08-26 16:27:43.773514+0530 TestThingy[3278:594688] Raw values [1.9995422, 1.9995422, 0.030883789]

    2020-08-26 16:27:43.863515+0530 TestThingy[3278:594688] Raw values [1.9999084, 1.9994812, 0.029724121]

    2020-08-26 16:27:43.953406+0530 TestThingy[3278:594688] Raw values [1.9997864, 1.9995117, 0.031066895]

    2020-08-26 16:27:44.073561+0530 TestThingy[3278:594688] Raw values [3.0517578e-05, 1.9992981, 0.030792236]

    2020-08-26 16:27:44.163526+0530 TestThingy[3278:594688] Raw values [1.9998474, 1.9996643, 0.031036377]

    2020-08-26 16:27:44.255128+0530 TestThingy[3278:594688] Raw values [1.9997559, 1.9992981, 0.030822754]

    2020-08-26 16:27:44.373524+0530 TestThingy[3278:594688] Raw values [1.9996643, 1.9992981, 0.030670166]

    2020-08-26 16:27:44.463550+0530 TestThingy[3278:594688] Raw values [1.9997253, 1.9994202, 0.03112793]

    2020-08-26 16:27:44.553452+0530 TestThingy[3278:594688] Raw values [1.9997864, 1.9995117, 0.03125]

    2020-08-26 16:27:44.673466+0530 TestThingy[3278:594688] Raw values [1.9998474, 1.9996338, 0.031280518]

    2020-08-26 16:27:44.763441+0530 TestThingy[3278:594688] Raw values [1.9997253, 1.9994507, 0.030883789]

    2020-08-26 16:27:44.853481+0530 TestThingy[3278:594688] Raw values [1.9997253, 1.999939, 0.028198242]

    2020-08-26 16:27:44.973456+0530 TestThingy[3278:594688] Raw values [1.9999695, 1.9994507, 0.031097412]

    2020-08-26 16:27:45.063600+0530 TestThingy[3278:594688] Raw values [1.9997253, 1.9996033, 0.030975342]

    2020-08-26 16:27:45.153845+0530 TestThingy[3278:594688] Raw values [1.9996338, 1.9993896, 0.030883789]

    2020-08-26 16:27:45.273472+0530 TestThingy[3278:594688] Raw values [1.9998169, 1.9997864, 0.030883789]

    2020-08-26 16:27:45.363565+0530 TestThingy[3278:594688] Raw values [1.9999695, 1.9994812, 0.031188965]

    2020-08-26 16:27:45.483496+0530 TestThingy[3278:594688] Raw values [1.9998779, 1.9995728, 0.031433105]

    2020-08-26 16:27:45.573569+0530 TestThingy[3278:594688] Raw values [1.9996643, 1.9993591, 0.031951904]

    2020-08-26 16:27:45.664374+0530 TestThingy[3278:594688] Raw values [9.1552734e-05, 1.9993286, 0.0317688]

    2020-08-26 16:27:45.753466+0530 TestThingy[3278:594688] Raw values [0.0, 1.9996338, 0.030700684]

    2020-08-26 16:27:45.873450+0530 TestThingy[3278:594688] Raw values [0.00024414062, 1.9993286, 0.030639648]

    2020-08-26 16:27:45.963469+0530 TestThingy[3278:594688] Raw values [1.9994812, 1.9995117, 0.030914307]

    2020-08-26 16:27:46.083952+0530 TestThingy[3278:594688] Raw values [1.9997253, 1.9992981, 0.030975342]

    2020-08-26 16:27:46.173524+0530 TestThingy[3278:594688] Raw values [1.9998169, 1.9991455, 0.03112793]

  • Hi,

    The raw data from the motion characteristic must sampled and converted correctly to obtain the m/s2 accelerometer data. The reason for this is that the measurements from all three motion sensors(accelerometer, gyroscope and compass) are sent as one. The link I previously posted points to how this is done in the app and I recommend following it as an example. Could you try that? Here is the link again.

    Best regards,
    Carl Richard

  • Hi Carl,

    Thanks for the quick response. I understood that three motion sensor data is been passed to the notification handler. I have handled in my code. Below is my code to handle it, if u notice I am trying to print only the first, ie accelerometer data itself.

    peripheral.beginRawDataUpdates(withCompletoinHandler: { (success) -> (Void) in

                    NSLog("Raw data update")

                }) { (accelerometerData, gyroscopeData, compassData) -> (Void) in

                   NSLog("Raw values  \(accelerometerData)")

              }

  • Hello, again!

    Then I misunderstood. My apologies. I spoke with one of the Thingy iOS app developers and he suggested that you should try to sample the values from the gravity vector instead as that is indeed given in m/s^2 from the accelerometer. It's this function from the Thingy app. 

    Hope this helps you.

    Best regards,
    Carl Richard

Related