Accelerator data: conversion-question
Answer
3/12/18 3:00 PM

Dear community,

I've opened up the SendVirtualDataOverUsb-template and changed the variable in line 176 to:

static printToolboxData_t sensorToPrint = PRINT_LINEAR_ACCELERATION; 

so only the accelerator data will be printed.

And the values come from USB port are like:

2018-03-12T13:45:02.932205	Linear Acceleration Data in LSB
2018-03-12T13:45:02.932205	x=36
2018-03-12T13:45:02.932205	y =117
2018-03-12T13:45:02.932205	z =58

2018-03-12T13:45:02.932205	Linear Acceleration Data in M/S2
2018-03-12T13:45:02.932205	x=0.0216 m/s2
2018-03-12T13:45:02.932205	y=0.0507 m/s2
2018-03-12T13:45:02.932205	z=0.0154 m/s2 

2018-03-12T13:45:02.932205	Linear Acceleration Data in G
2018-03-12T13:45:02.932205	x=0.0042 g
2018-03-12T13:45:02.932205	y=0.0032 g 
2018-03-12T13:45:02.932205	z=-0.0004 g

2018-03-12T13:45:02.932205	Linear Acceleration Data in LSB
2018-03-12T13:45:02.932205	x=102
2018-03-12T13:45:02.932205	y =117
2018-03-12T13:45:02.933194	z =91

2018-03-12T13:45:02.933194	Linear Acceleration Data in M/S2
2018-03-12T13:45:02.933194	x=-0.0078 m/s2
2018-03-12T13:45:02.933194	y=0.0605 m/s2
2018-03-12T13:45:02.933194	z=0.0154 m/s2 

2018-03-12T13:45:02.933194	Linear Acceleration Data in G
2018-03-12T13:45:02.933194	x=-0.0008 g
2018-03-12T13:45:02.933194	y=0.0082 g 
2018-03-12T13:45:02.933194	z=0.0046 g

But how do they being converted? If I multiply the values in G with 9,81 I don't get the corresponding values in M/S2

For example: 0.0042 * 9,81 = 0.041202 and not 0.0216 as for the first value of x-axis.

Is the conversion inside the xdk wrong or do I have an error in my thoughts?

0 (0 Votes)
RE: Accelerator data: conversion-question
Answer
3/12/18 3:44 PM as a reply to Aleksandr Gorovoj.
Hello Aleksandr,

the values themselves can be assumed as correct - the issue is rather the fact that the different prints don't represent the same data.

The application first reads the current LSB values, then immediately prints them to the console. A print is a blocking function, and therefore takes up some time. This is enough time for the acceleromater values to change internally.

Then, the same is done for the m/s2 values. First, the raw values are read from the accelerometer (and converted to m/s2 by the API function) and printed to the console. Again, taking up some time during which the values are changing again.

And lastly, the same is done for the g values.

But nonetheless, the values can be used to detect movement in a certain direction, since the axes are mapped correctly. In a real application, you would ultimately only read the data once, using one specific data unit. Thus, this issue would not really occur.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Alex
0 (0 Votes)
RE: Accelerator data: conversion-question
Answer
3/12/18 3:52 PM as a reply to Alexander Sawtschuk.

Hey Alexander,

awesome, thank you! Now it's more clear to me and I can proceed with my project.

Have a nice evening!

 

0 (0 Votes)