Accelerometer returned values... #3682
Replies: 4 comments
-
Posted at 2021-03-09 by Stoaty Yo @Maby - I've tried subtracting the offsets from zero but they're not super consistent, I'm at a bit of a loss trying to figure out how to normalise the values myself. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-10 by @gfwilliams Hi - there's a bit of info on: http://www.espruino.com/Reference#l_Puck_accel Basically If you run this code with the Puck.js flat on the table, you should expect x and y to be pretty much 0, and
However in your example you're detecting movement. This configures the accelerometer to sit there looking at x/y/z values to see if they vary by a lot, and to then flag up any movement. The acceleration reported is just the current acceleration at the time movement is reported, so if you're moving slow it's more or less the angle of the Puck, but if you're moving fast it's not really a useful value. One thing to add here is So basically |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-10 by maby I think the light may be dawning - is it the case that whichever axis is vertical will always show a background value in the region of 16000 which is the acceleration due to gravity? I was assuming that the values are instantaneous acceleration as in change in velocity rather than "static" acceleration which shows gravity... In my tests, I had the Puck laying flat on the table and jogged it slightly sideways - I expected the Z acceleration to be zero, not 16000. I've now just tried standing it up on one side and jogging it slightly - and I'm seeing an X or Y axis acceleration of about 16000. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-10 by @gfwilliams
Yes, that's correct. I believe it is possible to configure the accelerometer to do a 'high pass filter' to discount any acceleration due to gravity, but that has its own side effects (twisting the Puck will then show 1g acceleration until the filter updates) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2021-03-09 by maby
I'm puzzled by what I'm seeing... I have a Puck programmed up to display the values coming back from the accelerometer :
It certainly reports numbers, but they don't seem to bear much relationship to the magnitude of the movement. A small tap on the table produces : {'type': 'M', 'x':-644, 'y':133, 'z':14235, 'gx': -675, 'gy':-2386, 'gz':1043} and a major movement produces : {'type': 'M', 'x':2926, 'y':402, 'z':19069, 'gx': -675, 'gy':-2386, 'gz':1043}
what are the units?
TIA
Martin
Beta Was this translation helpful? Give feedback.
All reactions