4
\$\begingroup\$

This will probably be an extremely easy question for the seasoned EE's of you in the community. My question is this, I have 5v and 3.3v devices I want to interface with my Raspberry Pi's. I'm paranoid about burning out my Pi with some dumb wiring.

1) If I set a Raspberry Pi GPIO pin HIGH (3.3v) to a device that requires 5v logic only to be driven, do I still need a logic level converter in the mix? Or is that only required when I am accepting 5v logic (sensor or bidirectional).

2) Is there a safe way to accept 5v logic into a Raspberry Pi GPIO if the current is low enough, or do I always need to convert it down to 3.3v?

I'm just looking for some words of wisdom on how to handle logic levels and general rules of thumb. If a simple link answers this feel free to shoot it my way. I appreciate the help!

\$\endgroup\$
1

1 Answer 1

8
\$\begingroup\$

From RPi 3.3V to 5V input, depends on the input IC's Input Logic High minimum. Most ICs are 0.7 * VCC, or 3.5V. So the 3.3V won't be enough to register as a Logic High. Some ICs are 0.6 * VCC, or 3V. It will be enough, maybe. Sometimes it will act in weird ways at such a low voltage. You need a level translator circuit. A simple NPN transistor can do it, but inverts the logic (3.3V Output = 0V Input, 0V Output = 5V Input). You could fix that in code, or you need a more complex circuit or dedicated IC for non-inverting.

From 5V output to RPi 3.3V input, you always want to convert it, as the RPi does not have 5V tolerant inputs. NEVER connect it directly, even with a serial current limiting resistor, unless you want to buy a new RPi. A simple way could be a resistor voltage divider. A better way would be a real logic level translator circuit.

\$\endgroup\$
4
  • \$\begingroup\$ To get the 3V3 to register a high on 5V input, Google "simple 3V3 to 5V with transistor" if you want to avoid IC's and learn something by bread-boarding. \$\endgroup\$ Jul 5, 2016 at 18:06
  • 1
    \$\begingroup\$ @BrianDohler that would invert the logic though, not always easy to deal with \$\endgroup\$
    – Passerby
    Jul 5, 2016 at 18:09
  • \$\begingroup\$ Just to clarify, if the 3.3v HIGH output of the Pi triggers the 5v logic input (0.6 * VCC) is their anything else to be concerned about or that I should check? Is that an acceptable way to go about things if it works reliably? My main concern is damaging the pin. \$\endgroup\$
    – eescobar
    Jul 5, 2016 at 18:43
  • 1
    \$\begingroup\$ As long as the input is a High Impedance (Hi-Z) pin, and is not pulled to 5V through a pull-up externally or internally, then yes, it's fine. \$\endgroup\$
    – Passerby
    Jul 5, 2016 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.