Sunday, February 24, 2013

Two I2C buses on the Raspberry Pi

I'm hoping this post can clear up some mis-information regarding the two I2C buses on the Raspberry Pi Model B rev 2.

In the upper left hand corner of the board you can see the GPIO header.  Below that is the P5 header footprint, a 2x4 series of vias.  You won't see the P5 label until you flip the board over.

Now, there are some folks that will tell you the only way to get to the second I2C bus is to access the camera S5 header (or the S2 header).  That would involve some incredible soldering work, or a socket.  I don't have the socket, and my hands aren't good enough to solder at that pitch.

However, I can solder that P5 header.  The unfortunate thing is that the P5 header is really close to the GPIO header.  Using the P5 header while using Lady Ada's Pi Cobbler header may be problematic.  I took some long headers and soldered them in place, at a slight angle.
I used a 2x5 socket on the header, and spaced it with a penny (between the 2x5 socket and the ribbon cable).
The process is actually pretty easy.  If you're a novice solderer you shouldn't be too daunted by this task.  Hey, the Pi itself is $35.  It's OK.

Once you get that done, you need to run some code.  I'll post the Python 3.x code in a bit.  Here's a link to the original code.  All that needs to be done for the Python 3.x code is to change the print statements to print() functions.  Here's the link to the forums, where bgreat posted the code:

In hindsight, I should have looked at putting a 2x4 socket there.  I'm just not sure that I have any.


Unknown said...

Hi I too have thought about using the p5 socket to gain the extra GPIOs. Having researched it I understand that it is meant to be used from the bottom of the board not the top. The reason isn't just because it might interfere with Adafruit's cobbler, but also some Raspberry Pi daughter cards, hence Raspberry Pi advise putting the headers on the bottom of the board (PITA).


Trock said...

In addition, the pin numbers are arranged as if the header is connected on the bottom; if you connect it on the top as you did you will need to mentally reorder the pin numbers from the documentation.

Static said...

I worried about blocking the headers. I've got a couple of plans.
First, buy another Pi. They're cheap enough that I can consider that, even on my budget.
Second, I can engineer a "header spacer" for some of the headers.
Third, I can always try desoldering the header.

You really have to pay attention to the pin outs on these things. While I haven't wrecked a board, yet, I'm the first one to include that "yet". Make a mistake with your pins, and you're really looking to brick your board.

Thanks for the good points, folks. If you come up with novel solutions, please sound off!