push button/What is on the board/02. VCC sets the voltage
What is on the board · 02 of 9

VCC sets the voltage

The switch connects SIGNAL straight to VCC, so the voltage on VCC is the voltage your pin receives when the button is down. Beside an ESP32, an ESP32-S3 or a Pico that has to be 3V3. Beside an Uno, 5V.

The switch joins two wires

The switch has two sides. One goes to VCC. The other goes to SIGNAL. Pressing it joins them, with a contact resistance the switch's drawing puts at no more than 100 mΩ, which for this purpose is a plain wire.

So while the button is down, SIGNAL is VCC. Put 5 V on VCC and your pin gets 5 V. Put 3.3 V on it and your pin gets 3.3 V. Nothing on the block changes the level in between.

VCC sets the voltage
Your board
The block's VCC pin goes to
Released
0 V
Pressed
3.3 V
Pin reads
HIGH
Pressed, SIGNAL sits at 3.3 V, which is inside the ESP32-S3's own range and well above the 2.475 V it needs to read HIGH. Released, the pull-down holds it at 0 V. This is the wiring.

3V3 beside a 3.3 V board

An ESP32, an ESP32-S3 and a Raspberry Pi Pico run their pins at 3.3 V, and none of them is built to take 5 V. Pick 5V in the figure with one of them selected: it reads HIGH, the button works, and the pin is past its rating every time you press. That damage is slow and it does not announce itself, which is why the wiring is the rule rather than a suggestion.

Connect VCC to the board's 3V3 pin. The block works exactly the same from it, and the only thing that changes is that the red LED is a little dimmer. The light on the board works out by how much.

5V beside an Uno

The Uno's pins run at 5 V, so its 5V pin is the right supply. 3V3 would work too: the ATmega328P reads anything above 3.0 V as HIGH. But that leaves 0.3 V of margin to gain nothing, so use 5V.

VCC left off

With VCC unconnected, the switch has nothing to join SIGNAL to. Pressed or not, the pull-down holds SIGNAL at 0 V, and your pin reads LOW forever. The red LED does not light either, which is the quickest way to tell this apart from a sketch problem.

When it does not work

Can I power it from 5V next to an ESP32?

No. Pressed, SIGNAL carries whatever is on VCC to your pin, and the ESP32's pins are built for 3.3 V. It will seem to work, which is the problem: the pin is past its rating on every press. Connect VCC to 3V3. The block works just as well from it.

Will it work on an Uno from 3V3?

It will read HIGH. The ATmega328P treats anything above 0.6 of its 5 V supply, 3.0 V, as HIGH, so 3.3 V clears it by 0.3 V. That is a thin margin for no benefit. Use the Uno's 5V pin, and the red LED is brighter too.

I left VCC unconnected and it never reads pressed.

That is what should happen. The switch has nothing to connect SIGNAL to, so the pull-down holds it at 0 V whether the button is up or down, and the red LED never lights. Connect VCC and it works.

Does the block need VCC if my board has an internal pull-up?

Yes. The block is not wired for a pull-up at all: its switch goes to VCC, not to ground, and its pull-down is already on SIGNAL. Use it as it is, with VCC connected and the pin set to INPUT.

Where this goes next

What the 10 kΩ resistor is for, and what a pin with nothing on it reads.

The pull-down

Edit this page — content/books/push-button/vcc-sets-the-voltage.mdx

Community

Questions about this product

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

Ask a question ↗

Push Button

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