JacekQ
Posts: 32
Joined: Fri May 18, 2012 1:17 pm

Re: I2C: How to connect multiple devices.

Sat Mar 30, 2013 2:13 pm

Hello,
I have another questions:
1. "Hotplug" - is it safe to connect/disconnect I2C device to working RPi?
If it's safe and should be like this:
- Connecting:
  • GND
  • 5V/3V3
  • SCL
  • SDA
- Disconnecting:
  • SDA
  • SCL
  • 5V/3V3
  • GND
2. Connecting multiple devices ...
I have: Can I connect these devices as shown in the attached diagram?
RPi I2C.png
RPi I2C.png (22.29 KiB) Viewed 3504 times
--
Best regards,
Jacek Q.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: I2C: How to connect multiple devices.

Sat Mar 30, 2013 3:45 pm

As long as
  • Combined current from ALL devices is less than 50mA
  • Combined 5V current from all devices is less than 200mA (maybe less depending on USB loading)
  • NO devices have any pullups on their SDA and SCL - I2C lines
  • All devices can properly handle 3V3 level I2C signals.
Be wary of hotplugging as this puts surges in power rails and can cause dips in power on Pi, maybe reseting it. Put at least a 10uF capacitor at Pi end for 5V and 3V3, to help alleviate this.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

JacekQ
Posts: 32
Joined: Fri May 18, 2012 1:17 pm

Re: I2C: How to connect multiple devices.

Sat Apr 06, 2013 8:23 am

Hello,
I checked every device and only LCD requires 5V power supply. All other devices work with 3V3 or 5V. I think that better solution is to connect all devices to 5V but I found infromation than i2c devices should be powered 3V3 and if I want to use 5v then I have to use logic level shifter.
Do I have to use logic level shifter or will it work with 5V power supply without level shifter?
--
Best regards,
Jacek Q.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: I2C: How to connect multiple devices.

Sat Apr 06, 2013 9:38 am

JacekQ wrote:Hello,
I checked every device and only LCD requires 5V power supply. All other devices work with 3V3 or 5V. I think that better solution is to connect all devices to 5V but I found infromation than i2c devices should be powered 3V3 and if I want to use 5v then I have to use logic level shifter.
Do I have to use logic level shifter or will it work with 5V power supply without level shifter?
In most cases and proper I2C interfaces, ensure all modules have NO pullup resistors on SDA and SCL, then if modules powered from 5V the I2C will work at 3V3. Only checking datasheets for each device can tell if the Voltage high threshold is low enough that when powered by 5V it will recognise anything over 3V as a high input.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

pjac
Posts: 11
Joined: Tue Apr 17, 2012 3:41 pm

Re: I2C: How to connect multiple devices.

Fri Jan 10, 2014 11:58 am

ember wrote:problem solved.
ember wrote:is it possible, that the fact that I didn't solder the pins in GY-80 are causing so much problems? Is it necessary, or can I just plug it in?
apparently it is necessary...
Yes - I found that too, until I soldered the pins on the GY-80 board I couldn't detect the sensors. Simply slotting the pins in place was not enough.

P.S. I also found just four jumper wires was enough, blog post: http://astrobeano.blogspot.com/2014/01/ ... ry-pi.html

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: I2C: How to connect multiple devices.

Sun Jan 12, 2014 8:09 pm

PeterO wrote:Pull up resistors are already on the Pi board.

Just wire all the i2c devices in parallel, so connect all the SDA pins together, and all the SCL pins together. as shown here http://en.wikipedia.org/wiki/I%C2%B2C

Each one has it's own address so they don't interfere with each other.

PeterO
Just because the RPI has pullups does not mean that the remote device should not have them. Having 10k pullups will help balance the impedance at both ends of the wire. If the I2c Bus wires are very short ( < 1 meter) then pullups may be optional depending on bus speed. Try a i2cdetect at 1 mhz with and without pullups for an experiment.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

Return to “Interfacing (DSI, CSI, I2C, etc.)”