reed switch/How it works/05. VCC is your logic voltage
How it works · 05 of 9

VCC is your logic voltage

A closed switch joins SIGNAL straight to VCC, with no resistor in between. So VCC is the HIGH your board reads, and it has to be the voltage your board's pins run at: 3V3 on an ESP32, an ESP32-S3 or a Pico, 5V on an Uno. The block works on either; your pin does not.

What the pin sees

Open, SIGNAL is 0 V through the 10 kΩ. Closed, it is VCC, less a fraction of a millivolt across the contacts. Nothing on the block changes that voltage: no regulator, no divider, no resistor in series. Whatever you wire to VCC is what arrives on your pin every time a magnet comes near.

VCC is your logic voltage
Your board
VCC wired to
SIGNAL closed
5 V
Reads
HIGH
ESP32-S3 runs at
3.3 V
Wire VCC to
3V3
Wrong. A closed switch puts 5 V straight onto a pin whose own supply is 3.3 V. It will read HIGH, and it is also more than the pin is rated for; there is no resistor in the way to limit it. Move VCC to 3V3.

Pick your board, then try both supplies. The green bar is what a closed switch puts on SIGNAL. The dashed line is the lowest level the pin is sure to call HIGH: 0.6 × VCC on the Uno's ATmega328P, 0.75 × VDD on an ESP32, 2.0 V on a Pico's RP2040. The red line is the pin's own supply.

Which pin, on which board

  • ESP32, ESP32-S3, Pico: VCC to 3V3. Their pins run at 3.3 V. The 5V pin (VBUS on a Pico) would put 5 V on a 3.3 V pin with nothing to stop it.
  • Arduino Uno: VCC to 5V. 3V3 is read as HIGH too, but with only 0.3 V to spare.

The switch itself does not care. The sheet rates it for far more voltage and current than any of these boards can give it; at 5 V it carries about 3.5 mA. VCC is set by what reads SIGNAL, not by what the block needs.

When it does not work

I wired VCC to 5V on my ESP32 and it still reads fine.

It reads HIGH because 5 V is well above HIGH. It is also 5 V on a pin whose own supply is 3.3 V, every time the magnet comes near, with nothing to limit it. Move VCC to 3V3 before it costs a pin.

My Uno reads the switch with VCC on 3V3. Is that fine?

It works, with little to spare: the Uno reads HIGH from 3.0 V and 3V3 gives it 3.3. Move VCC to the Uno's 5V and the margin is the whole supply.

Can I power the block from 5V and use a resistor to protect a 3.3 V pin?

There is no need. Wire VCC to your board's 3V3 pin and SIGNAL can never go above 3.3 V. The block has nothing on it that wants 5 V.

Alongside this page
Where this goes next

Three wires and six lines of sketch.

The first read →

Edit this page — content/books/reed-switch/vcc-is-your-logic-voltage.mdx

Community

Questions about this product

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

Ask a question ↗

Reed Switch

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 →