How it is wired · 05 of 11

VCC must match

VCC feeds only the four LEDs, and each LED hangs from VCC onto a line your board's pin is holding. So VCC goes to your board's own voltage: 3V3 beside an ESP32, ESP32-S3 or Pico, 5V beside an Uno. With 5V beside a 3.3 V board, a line can sit above what its pin is meant to see.

What VCC is for

On this board VCC feeds the four resistors, and through them the four LEDs, and nothing else. The switch does not use it and the scan does not need it: unplug VCC and the sketch still reads the right side, with every LED dark.

So the question is only what each LED sits between. Its top end is VCC. Its bottom end is a line, held by your board's pin either LOW or at the pull-up's voltage, which is your board's own supply. VCC should be that same voltage.

Match it to your board

VCC must match
Your board
The block's VCC pin goes to
At rest
nothing flows
Lit, per LED
about 1.3 mA
Scan works
yes
VCC is the ESP32-S3's own 3.3 V. A released line sits at the same voltage, so each LED and its resistor have nothing across them, and nothing flows until the sketch holds a line LOW. Then about 1.3 mA lights it. This is the wiring.

Pick your board and where the block's VCC goes. When the two match, a released line and VCC are at the same voltage, nothing flows through the LED, and it lights only when the line is held LOW.

5V beside a 3.3 V board. A released line rests at 3.3 V on the pull-up, with 1.7 V across its LED and 1 kΩ. That is just under where a red LED starts to light, so a little current can leak down into the pin. And during a reset, before the sketch switches the pull-ups on, a line has nothing holding it, and its LED can lift it above 3.3 V. Neither is a large current, but it is more than a 3.3 V pin is meant to see. Put VCC on 3V3.

3V3 beside an Uno. Harmless. The released lines rest at 5 V, above VCC, so each LED sits reverse-biased by 1.7 V, which it tolerates. The reads are right and the LEDs are dimmer. 5V is still the better choice.

The rule, in one table

Your boardVCC toA line held LOW lights its LED at
Arduino Uno5Vabout 3 mA
ESP32, ESP32-S3, Pico3V3about 1.3 mA

The currents are worked out for a red LED at about 2.0 V, not measured. GND goes to your board's GND in both cases. On this board it reaches nothing, but it is the reference the block and your board share.

When it does not work

I have had VCC on 5V beside my ESP32 and it worked.

It will seem to. The reads come out right, and the LEDs light. The problem is the 1.7 V left across each LED and its resistor while its line rests at 3.3 V, which can push a little current into the pin, and during a reset, with no pull-up switched on, a line can be lifted above 3.3 V. Move VCC to 3V3.

Is 3V3 on an Uno harmful?

No. The Uno's pull-ups hold the released lines at 5 V, which leaves each LED reverse-biased by 1.7 V, and that does it no harm. The reads are correct and the LEDs are dimmer, about 1.3 mA instead of 3 mA. 5V is still the match.

The sketch reads the right side but no LED ever lights.

VCC is probably not connected. The scan needs nothing from VCC, because your board's pull-ups and its LOW do all the work, so the reads are unaffected. The LEDs need nothing else.

What does GND do on this board?

On the board itself, nothing: it is in a net by itself. It is the common ground between the block and your board, and with both powered from the same board it changes nothing you can measure. Wire it anyway, as on every block.

Where this goes next

Six wires and the scan, printing which edge is down.

The first read

Edit this page — content/books/four-direction-tilt-sensor/vcc-must-match.mdx

Community

Questions about this product

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

Ask a question ↗

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.

Browse Modules and blocks on the forum