2

Good day all,

I have a 5 volt I2C device that I want to use with my pi. Am I able to pull the bus up via resistors to the 5-volts that my device runs off of, or does it need to be 3.3 volts? If it must be 3.3v, can I just create a simple voltage divider from my 5 volt rail?

I guess the big question is, does it matter what voltage I tie my I2C bus to when using the rpi?

Thank you!

3
  • 1
    Use a level shifter: raspberrypi.stackexchange.com/a/49775/5538
    – goldilocks
    Jun 8, 2017 at 16:18
  • Sorry for the confusion. The I2C logic level is the same on the device I am using(3v3), it just needs 5 volts to power it. I just wanted to pull the bus line up to the 5 volts, but since PI is 3v3, can I not just use a voltage divider?
    – Lanet Rino
    Jun 8, 2017 at 17:02
  • 1
    You are in luck then, no shifter needed. There are several (non-GPIO) dedicated 5V power pins on the Pi. Just make sure the device doesn't want too much current -- most Pis the total is limited to 2 A (the Pi 3 is 2.5A), and the pi itself and other peripherals will want a large chunk of that. If you need more you will need to use an external supply -- make sure to use a common ground!
    – goldilocks
    Jun 8, 2017 at 17:05

2 Answers 2

3

The Pi's GPIO are all 3V3. Exposing them to 5V can damage the GPIO and/or the Pi.

The Pi's I2C bus operates at 3V3 - to that end hard wired 1k8 resistors are wired between GPIO 2/3 (SDA/SCL) and 3V3.

2
  • So are the I2C pins/SPI pins considered GPIO pins as well? Also, how do you determine the value of resistor to use? Don't you traditionally use 4.7k or 10k resistors for pull-ups/downs?
    – Lanet Rino
    Jun 8, 2017 at 16:05
  • Any pin connected to a GPIO is a GPIO. All the GPIO may be configured in multiple modes, e.g. serial,SPI, I2C, PWM, clock, they are still GPIO. I don't know why 1k8 was chosen on the Pi.
    – joan
    Jun 8, 2017 at 18:06
6

Some of the other comments are true, but not totally clear.

You can use the Pi I²C to connect to another I²C device, even if it is powered by 5V provided there are no pull-up resistors to 5V.

I routinely do this, and it works. Technically the High level output is marginal, but works in all cases I have tried.

If you want to be safe, use a bi-directional MOSFET level shifter. Many of the modules available have a combination of MOSFET level shifter and resistive voltage dividers. Resistive voltage dividers will NOT work with I²C, because of the pullups.

3
  • It may be worth noting that I2C multiplexors will normally transparently handle 5V devices connected to the Pi's 3V3 bus.
    – joan
    Jun 9, 2017 at 10:02
  • Why cannot I not use two resistors to create a divider off of the 5v rail? I am confused.
    – Lanet Rino
    Jun 12, 2017 at 19:22
  • @LanetRino This is not the place for a discussion of Circuit Theory; try EE or read en.wikipedia.org/wiki/Th%C3%A9venin%27s_theorem
    – Milliways
    Jun 13, 2017 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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