When a tilt reads nothing
Start with the serial monitor, not the LEDs. On this block the lights only answer the sketch, so dark LEDs with only power wired are normal. If the scan reads none whatever you do, the fault is in the four pins or their order; if it reads the wrong side, two lines are swapped.
Six symptoms
Pick what the block is doing. The ringed part of the board is where to look first, and the list beside it is the order to check in, by how often each one is the answer.
Dark with only power
Not a fault. The LEDs light only while your board holds a line LOW, and with VCC and GND alone nothing holds any line. The lights wait for you explains why.
It reads, and the lights stay dark
With the first read's sketch they are meant to: each line is held LOW for microseconds per scan. With the lighting sketch they should stay lit on the low side. If they do not, VCC is not connected. The scan does not need VCC, so the readings stay correct without it.
It always reads none
No line ever followed the one held LOW. Check the four pin numbers in the sketch against the four wires, in the order A, B, C, D. Then that the cable is not one pin over: count from the square pad. On a classic ESP32, pins 34 to 39 cannot be outputs, so a line wired there can never be held LOW. And tip the board firmly: a slight lean may not move the roller.
It names the wrong side
Two lines are swapped. Swapping B and D, say, trades left for header and top for right. Check the order from the square pad: GND, VCC, A, B, C, D. And check how you are holding it: the names assume parts up, header at the bottom.
It flickers, or level reads a side
Both are the roller being a roller. It rattles when the board moves, so filter the reads. It stays where it last rolled when the board is level, so level is not a reading. Neither is a fault, and no wiring change fixes either.
When it does not work
With a multimeter on continuity, with the block unplugged. Touch the probes to A and B on the header and tip the left edge down: it should beep. Then B and C with the top edge down, C and D with the right edge down, D and A with the header edge down. A and C should never beep.
Pins 34 to 39 on a classic ESP32 are inputs only and cannot hold a line LOW. The flash pins stop the board booting if touched, and the strapping pins, 0, 2, 5, 12 and 15, are read at reset while the roller may be joining two lines. GPIO 25, 26, 27 and 32 have none of those jobs.
A wire has probably come loose, most likely one of A to D, or the cable has slipped one pin along. The right-angle pins lie flat, and a cable's weight can pull the block out of its row. Count again from the square pad.
Its maker's drawing gives no rated life, so this book cannot say how many tilts it lasts. Check it with the meter as above: if a pair never beeps with its edge firmly down, while the others do, suspect the switch. Otherwise, suspect the wiring.
The rest of the kit, and the one block that knows which way is down.
Back to the blocks →Edit this page — content/books/four-direction-tilt-sensor/when-a-tilt-reads-nothing.mdx
Questions about this product
See what other owners have asked, and read their solutions.
4-Direction Tilt Sensor
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.