2
\$\begingroup\$

I have a microcontroller and a Raspberry Pi, both running off of the same 5v supply, in parallel. The microcontroller has 4 5v output pins and the other is a Raspberry Pi, that can only accept inputs of 3.3v and less.

Obviously I cannot directly connect the outputs to the inputs - that'll fry the Raspberry Pi.

How can I connect 5v outputs to the GPIO pins on the Raspberry Pi?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

Use a level translator such as the one sold by sparkfun.

Hook one VCC to 5V and the other to 3.3V on the Rasberry Pi.

\$\endgroup\$
4
  • \$\begingroup\$ With a little more research, I found this. This appears to be exactly what I need, thank you. \$\endgroup\$ Mar 11, 2013 at 23:53
  • \$\begingroup\$ For a single-directional connection like OP seems to be asking about, a voltage divider will be cheaper than a translator chip. \$\endgroup\$
    – The Photon
    Mar 12, 2013 at 0:06
  • \$\begingroup\$ @ThePhoton: True. \$\endgroup\$ Mar 12, 2013 at 0:09
  • \$\begingroup\$ That's what I thought I could do at first, but in this case buying the resistors for the dividers + shipping will end up costing the same as this chip, which will take up less space than veroboard. \$\endgroup\$ Mar 12, 2013 at 0:10
2
\$\begingroup\$

If the connection is going one way: from 5V to 3.3V, then in addition to a dedicated chip, a variety of voltage shifting techniques are available, as described in this post. The most relevant (cheapest, easiest, etc) are:

  • Voltage divider (two resistors connected in series from your +5 output to GND with the center "tap" connected to your 3.3V input
  • Diode voltage down shifter circuit (diode connected in series with a resistor to the lower voltage, 3.3V in this case)
\$\endgroup\$

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.