10

I'm trying to figure out the Seeed Studio XIAO board (essentially a smaller version of the Arduino) and I noticed that there was a line in the specifications saying "All the I/O pins are 3.3V, please do not input more than 3.3V, otherwise, the CPU may be damaged." I'm very new to electronics so my question is, what exactly does this mean? How do I control input voltage?

For example, if I were to power a push button by connecting it to the board's 5V and ground pins, and then connect another leg of the button to one of the board's digital I/O pins, would this be allowed? Or would this burn the circuit because 5V is too high?

pipe
  • 13,748
  • 5
  • 42
  • 72
Rena W
  • 123
  • 1
  • 4

3 Answers3

25

In the case of an input, it means don't connect a voltage higher than 3.3V to the pin.

In the case of an output, it usually means that the pin will output either 0V (or close to), or 3.3v (or close to).


In your example with a button connected to the 5V rail, pressing the button would connect 5V to the pin. 5V is higher than 3.3V, so yes you would damage the pin.

Instead you should connect the button to a 3.3V power rail, or to a potential divider which reduces the button voltage to under 3.3V. You can also connect the push button to GND, and use a pull-up resistor to 3.3V.

Good vs Bad Circuits

Tom Carpenter
  • 63,168
  • 3
  • 139
  • 196
  • 7
    One thing to note: Most microcontrollers have pullup (or pulldown) resistors built in, usually enableable through software. So if your microcontroller has e.g. built-in pullups, all you need to do is connect the button on the one side to your microcontroller pin, and on the other side to GND. Then enable the pullup in the microcontroller. This way, the pullup will pull the pin's voltage up to 3.3V, and when the button is pressed, this is overcome by the direct connection to GND, so the voltage will be close to GND now. – Dakkaron Jul 25 '22 at 22:00
5

Yes, 5V is more than 3.3V so don't connect 5V to an input that can only handle 3.3V.

Besides, a pushbutton would generally have only two pins, so it would be impossible for it to be powered by GND and 5V supply and then additionally connected to MCU.

Justme
  • 127,425
  • 3
  • 97
  • 261
  • 1
    I have some push buttons with four legs. They are all disconnected when not pushed, and all shorted together when pushed. I would guess there are also buttons with 3 or even more than 4 legs. – Dakkaron Jul 25 '22 at 22:08
0

Tom Carpenter already did a great job explaining the main question, so I'll answer the side question:

For example, if I were to power a push button by connecting it to the board's 5V and ground pins, and then connect another leg of the button to one of the board's digital I/O pins, would this be allowed? Or would this burn the circuit because 5V is too high?

Many push buttons have 4 legs (or maybe even more). These legs are usually all disconnected from each other, until you press the button, then all the legs are shorted together.

So if you connect 5V, GND and the microcontroller's input pin to the same button and press the button, you will short 5V to GND, which is very bad.

Depending on your power source, you are now looking at anything between no power on the board (e.g. if you power it from a low-power alcaline battery), a broken power supply (when you power it from an LDO or other simple power source) or a fire (e.g. if you power it from a high-power lipo battery).

Whatever happens, the 5V rail will get pulled close to the GND rail, so your microcontroller will probably brown out (means, there isn't enough voltage to run the controller, so it temporarily stops working). If it doesn't, you will probably be reading garbage from the IO pin (can be either HIGH or LOW).

So whatever you do, don't short 5V and GND in any way, not even across a button.

Dakkaron
  • 767
  • 1
  • 8
  • 18
  • 6
    I've never seen a pushbutton that has four leads where all of them are open circuit until the button is pressed. I've seen tons of them that have four leads where 1 and 2 are always shorted together, 3 and 4 are always shorted together, and pressing the button shorts 1/2 to 3/4. – Hearth Jul 26 '22 at 05:55
  • 1
    I have some on my desk right now. I just measured them, and they work like that. All pins are open when not pushed, and when pushed, all four pins are shorted together. Sadly, they are unbranded. I bought them maybe 5 or 7 years ago on Aliexpress, so there is no product listing to refer to. – Dakkaron Jul 26 '22 at 09:56