Which way is X
Nothing on the board says which way the three axes point, and a reading with the wrong sign usually means you pictured an axis the wrong way round. By the data sheet's drawing, X runs down the board to the header, Y runs across to the SDA end, and Z comes out of the chip side.
Three arrows nobody printed
The back of the board has a drawing of three arrows, but no letters on it, and the front has none at all. So the directions come from the chip.
The SC7A20H data sheet draws the package with its pin 1 marked, and shows X and Y along two of its edges and Z straight up out of the top. On this board the chip is turned a quarter turn from that drawing, with pin 1 at its lower left. Turned with it, the axes land like this, chip side up and header at the bottom:
- X points down the board, towards the header.
- Y points across the board, towards the SDA end, on the right.
- Z points out of the chip side, towards you.
That is worked out, not measured, so the next part is how to check it.
Stand it on each face
An axis reads +1 g when it points straight up and −1 g when it points straight down. So set the board on each of its faces in turn, and the axis that reads ±1 is the one pointing along gravity:
Flat, chip side up, is the one you will see first: Z at +1, X and Y near 0. Stood on its header, X points down and reads −1. Stood on its right-hand edge, the SDA end down, Y reads −1.
The first sketch prints all three every fifth of a second, which is fast enough to do this in ten seconds. If your board disagrees with the figure, your board is right: note which axis did what, and flip a sign in the sketch.
Why the sign matters later
For a reading on its own, a wrong sign is a curiosity. For tilt it is the whole answer: "tipped forward 20°" and "tipped back 20°" are the same number with the opposite sign. Tilt from gravity works out pitch as positive when the header end goes down, and it gets that from X pointing towards the header.
When it does not work
Then X points the other way from the one this page works out. It is derived from the data sheet's drawing and the chip's placement, not measured on a board. Trust the board: an axis that reads +1 g is the one pointing up, whatever any drawing says, and your sketch can flip its sign in one character.
The board is resting on a corner or an edge at about 45°, so the 1 g is split between two axes. To find one axis cleanly, set the board on a flat edge so that only one reading is near ±1 and the other two are near 0.
A hand is never still, and every tremor adds a little push. Rest the board against something solid — a book, the edge of the desk — for each pose, and read after it settles.
Six of the chip's twelve pads are not connected, and four of them decide something.
The pins left open →Edit this page — content/books/3-axis-accelerometer/which-way-is-x.mdx
Questions about this product
See what other owners have asked, and read their solutions.
3-Axis Accelerometer
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.