How a touch becomes HIGH · 05 of 10

VCC sets the voltage

On a hit the switch connects SIGNAL straight to VCC, so the voltage on VCC is the voltage your pin receives. Beside an ESP32, an ESP32-S3 or a Pico that has to be 3V3. Beside an Uno, 5V. Getting this wrong is the one way this block can damage a board.

Nothing between VCC and your pin

On a hit the switch's blade joins COM to NO, which on this board is VCC to SIGNAL. The switch's drawing puts the contact at no more than 100 mΩ, which for this purpose is a plain wire. Nothing on the block changes the level on the way through.

So while the lever is in, 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.

VCC sets the voltage
Your board
The block's VCC pin goes to
At rest
0 V
On a hit
3.3 V
Pin reads
HIGH
On a hit, SIGNAL sits at 3.3 V, inside the ESP32-S3's own range and well above the 2.475 V it needs to read HIGH. At rest, 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 bumper works, and the pin is past its rating every time the robot touches something. 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. Only the red LED is dimmer.

5V beside an Uno

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

Never the motor battery

On a robot there is usually a second, bigger supply for the motors. VCC does not go there, whatever its voltage: it goes to the same board that reads SIGNAL, from that board's own 3V3 or 5V pin. And the two boards, if there are two, share a GND.

VCC left off

With VCC unconnected, the switch has nothing to join SIGNAL to. Lever in or out, 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. On a hit, 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 bump. Connect VCC to 3V3. The block works just as well from it.

My robot's battery is 6 V or more. Can VCC go there?

No. VCC is not a power input for the block so much as the level it hands back to your pin. Connect it to your microcontroller's own 3V3 or 5V pin, never to a motor battery. The block draws under 3 mA, which any board's supply pin can give.

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 a hit.

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

Where this goes next

Three wires and a sketch that prints what the pin says.

The first read

Edit this page — content/books/collision-sensor/vcc-sets-the-voltage.mdx

Community

Questions about this product

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

Ask a question ↗

Collision 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