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.

Parents
  • 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]

Reply
  • 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]

Children
  • 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

  • Hi Carl,

    Seems like I have some misunderstanding about the device outputs. Please help me in clarifying few queries of mine.

    Expectation : I am trying to build a toy, which would measure the approximate force applied on this device from any direction.

    So my problem is to measure the change in acceleration. But this device is giving me acceleration only in range (0.0 - 1.0) and no negative values, from accelerometer. I tried to scale the values but it will be of not much help because of the range which is always positive.

    As you suggested I tried using gravity vector as well but below are my observations.

    1. Gravity vector is giving all the values in range -9.8 to 9.8. But how I measure the force/acceleration on the Z axis, gravity axis, as it is going to always a constant.

    2. Gravity vector will only help in identifying device orientation, but I need to identify the applied force to move this device.

    Please help in clarifying my queries.

    Thanks you in advance.

    Regards,

    K.Prabhakar

  • Thanks for clearing up. 

    Firstly. The documentation states that the raw data from the accelerometer is in Gs, just do make that clear. Hence, if you want m/s2 the raw data must be divided by 9.8. 

    However, the values you posted earlier does seem weird. Could you try to subtract 2 from every value and divide by 1G. It seems like the values are offset by 2G :) 

    Best regards,
    Carl Richard

Related