scraff
Posts: 15
Joined: Tue Jun 30, 2015 10:21 am

5v to 3.3v GPIO

Sun Aug 02, 2015 8:46 am

Hi all. Just a quick question. I have searched and searched but not found a definite answer.

I have some modules designed for Arduino that output 5v. Obviously can't connect these directly to RPi's gpio pins.

I've read in various places to just put a 1k resistor in between the module and the gpio input.

Others say u have to use a 2k and 3k to split the voltage. I know this splits the voltage at a 3:2 ratio.

Is just putting one 1k resistor in there enough? What does this do exactly compared to the voltage splitter?

Thanks

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 5v to 3.3v GPIO

Sun Aug 02, 2015 8:55 am

I believe using a pair of resistors to form a voltage divider will be safer.

A single resistor will limit the current flow. I believe the idea is to limit the 5V current flow to something less than 0.5 mA which some believe may safely be handled by the Pi's internal circuitry.

User avatar
PeterO
Posts: 5877
Joined: Sun Jul 22, 2012 4:14 pm

Re: 5v to 3.3v GPIO

Sun Aug 02, 2015 9:04 am

joan wrote:I believe using a pair of resistors to form a voltage divider will be safer.

A single resistor will limit the current flow. I believe the idea is to limit the 5V current flow to something less than 0.5 mA which some believe may safely be handled by the Pi's internal circuitry.
It's not hard to work out the actual current flow:
Assuming the GPIO input is clamped to 3.3V, and the external device's output is 5V, then the 1000 ohm resistor will have 5V-3.3V = 1.7V across it, leading to a current flow of 1.7/1000 = 1.7mA into the GPIO pin.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

scraff
Posts: 15
Joined: Tue Jun 30, 2015 10:21 am

Re: 5v to 3.3v GPIO

Sun Aug 02, 2015 9:06 am

Thanks Joan.
I had kind of assumed this but really wasn't sure.

One more question: is splitting the voltage using 2 resistors just as good as a logic level converter (eg the adafruit one)? Is a logic level converter overkill?

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 5v to 3.3v GPIO

Sun Aug 02, 2015 9:13 am

scraff wrote:Thanks Joan.
I had kind of assumed this but really wasn't sure.

One more question: is splitting the voltage using 2 resistors just as good as a logic level converter (eg the adafruit one)? Is a logic level converter overkill?
I've never used a device which needed more than a pair of resistors, i.e. they were all Pi inputs. The level converters may be targeted at devices where a single line is used both as an input and an output.

Return to “Beginners”