Putting it to work · 11 of 11

When it reads wrong

Five things a serial monitor can show when something is off, and what each means. Three are faults and have one fix each. Two are the chip behaving exactly as its data sheet says, and the fix is to know that.

Read the screen first

Almost every problem with this board shows up on the serial monitor as one of a handful of patterns, and each pattern points at one cause. Pick what you see:

When it reads wrong
What you see
Nothing answered at 0x19. Almost always wiring: GND not connected, or SDA and SCL swapped, which still leaves both lines idling high and so looks fine with a meter. Count from the square pad — GND, 3V3, SCL, SDA — and check the host's pins against its own pin-out. If the power light is off, 3V3 never arrived.

The three faults

No SC7A20 at 0x19 means the check in setup() failed: nothing answered, or something answered with the wrong name. In that order: GND, then SDA and SCL swapped, then 3V3 on a pin that is actually powered. The power light proves only the last of those.

Every axis reads 0.000, or the same numbers never change, means the chip is still asleep. CTRL_REG1 was never written, or was written with a zero data rate. The first sketch writes it in setup(); a sketch of your own that forgot it reads a chip that has never taken a measurement. It wakes up asleep.

A library says there is no chip when a scan finds one at 0x19. The library was written for a different chip and is checking the wrong address and the wrong name. Nothing is broken; the library does not know this part.

The two that are not faults

Level, but X or Y reads 0.05 or 0.08. The zero-g offset of a mounted chip is typically 90 mg and at most 120. It is not noise and it will not average away, but it is the same every time, so measure it once and subtract it. From counts to g covers it.

Z reads −1. The board is upside down, chip side facing the table. An axis reads +1 g pointing up and −1 g pointing down, and on this board Z comes out of the chip side.

And one that is waiting to happen

If this board is fed from 5 V, or wired straight to a 5 V Uno's pins, it may well work for now. The chip's absolute maximum is 3.6 V on its supply and 3.6 V on its pins at a 3.3 V supply, and a part run past its absolute maximum fails when it fails, not when it is wired. Feed it 3.3 V, and put a TK97 between it and an Uno.

When it does not work

The scanner finds 0x19 but my library says no chip.

The library is looking for a different chip. Accelerometer libraries of this family usually default to address 0x18 and expect WHO_AM_I to read 0x33 for an ST LIS3DH; this board is 0x19 and 0x11. Use the sketches in this book, which need no library.

It worked, then stopped after I moved it.

A wire moved. An accelerometer is the one sensor you are guaranteed to pick up and turn over, and a jumper that is loose in a breadboard makes and breaks as you do. The first sketch prints read failed when it happens. Plug the header straight into the breadboard, or use wires that grip.

The readings are fine but jump by a few thousandths.

That is noise, and every accelerometer has some. Average several readings if you need a steadier number, or read at a lower rate. The sketches print three decimal places because that is one count at ±2 g, not because all three are to be trusted.

Two TK115s on one bus: only one shows up.

Both answer at 0x19, because the address is set by a pad under the chip, not by a jumper. Put the second on the other I²C bus of an ESP32 or ESP32-S3, with Wire1 in Arduino or I2C(1) in MicroPython.

Where this goes next

The block to put between this board and a 5 V Arduino Uno.

TK97 Logic Level Converter →

Edit this page — content/books/3-axis-accelerometer/when-it-reads-wrong.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

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.

Browse Modules and blocks on the forum →