What do x, y, z values of Enviro pHAT accelerometer measure?


#1

I’m starting to play with a new Enviro pHAT on a RBP 3 and I can’t find references in the documentation that describe what the x, y, and z values coming back from the accelerometer actually measure and how I might use them to do something useful.

Are there additional resources I can use to learn more about these values and how I can make them useful?


#2

They are measuring acceleration in gs, with a range of ±2g if I remember correctly.

“Down”, ie: acceleration due to gravity, should be a vector of roughly magnitude 1g.

If your Pi is sat on a perfectly flat surface you should see something like:

x, y, z = 0, 0, -1

As you start to tilt it around the y axis, you will see that vector 0,0,-1 slowly become 0,-1,0 or 0,1,0

You can quite trivially use some naive thresholds here to figure out if your Pi has been tilted- to make a tilt alarm for example- but if you want to get complicated you can calculate the angles of tilt.

It’s explained better than I could here: http://www.hobbytronics.co.uk/accelerometer-info