dual axis joystick/The stick/04. VCC sets the top
The stick · 04 of 10

VCC sets the top

Every line on the header reaches VCC: X and Y at the ends of the travel, SW on every click, and nothing on the board limits it. So VCC is your board's own logic voltage, 3V3 beside an ESP32, an ESP32-S3 or a Pico and 5V on an Uno. The wrong one either overdrives a pin or wastes half the scale.

Every line reaches VCC

X and Y are wipers on tracks from VCC to GND. At the end of the travel a wiper is on the end of its track, so the pin sees VCC. SW is joined straight to VCC by the switch every time the stick is pressed. There is no regulator on the board, no divider on the outputs and no resistor in series with any of them, so whatever VCC is, the pins see it.

VCC sets the top
VCC wired to
Your board
Most on a pin
3.3 V
Top reading
4095 of 4095
Wire VCC to
3V3
VCC on 3V3 beside a ESP32. Every line tops out at 3.3 V, which is what its pins are for, and the stick covers the ADC's range. This is the only right way round for a 3.3 V board.

Pick what VCC is wired to and which board reads the pins. The bars are the most each line can put on its pin, and the shaded band is more than that board's pins are for. Only one choice per board keeps every bar out of the band and still reaches the top of the scale.

5V beside a 3.3 V board

An ESP32, an ESP32-S3 and a Raspberry Pi Pico run their pins at 3.3 V. With VCC on 5V, pushing the stick to the end of its travel puts 5 V on an analog pin, and every click puts 5 V on SW's pin. That is over what those pins are rated for. It may not fail on the first click, which is what makes it easy to leave wired that way.

3V3 on an Uno

The other way round is safe and only wasteful. The Uno measures against 5 V, so a stick on 3.3 V reaches about 675 of 1023 and rests near 338. A click is 3.3 V, and the Uno counts anything above 3 V as HIGH, so it still reads, with little room to spare. Wire VCC to 5V and both problems go away.

Why the matching board wins

With VCC on your board's own logic voltage, the stick and the ADC share one reference on an Uno or a Pico: if the supply sags a little, the reading and full scale sag together and the share stays right. The ESP32s measure against a reference inside the chip instead, which is one more reason the sketches in this book measure their own centre rather than trusting half of full scale.

When it does not work

I powered it from 5V on my ESP32 and it still works.

For now. Every click has been putting 5 V on a pin rated for 3.3 V, and so has every push to the end of the travel. Move VCC to 3V3 before the pin gives up; nothing on this board limits the voltage.

My Uno never reads above about 675.

VCC is on the Uno's 3.3V pin. The stick can only reach 3.3 V, which is about 675 of the Uno's 1023. Move VCC to 5V: the Uno's pins are 5 V pins, and the stick then covers the whole scale.

The lights are dim on 3V3 and brighter on 5V.

Normal. Each light runs from VCC through a 5.1 kΩ resistor, so less voltage means less current: worked out, about 0.29 mA on 3V3 and 0.63 mA on 5V for the red PWR light, and about 0.14 mA and 0.47 mA for the blue SW light, whose LED drops more of the supply. They are indicators, not lamps, and say the same thing either way.

Where this goes next

Why SW reads LOW at rest and HIGH when pressed, and what the SW and PWR lights say.

The click and two lights

Edit this page — content/books/dual-axis-joystick/vcc-sets-the-top.mdx

Community

Questions about this product

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

Ask a question ↗

Dual Axis Joystick

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