3

I have a model B in a nice prefab case with a slot through it to connect a 26-wire ribbon to the GPIO header. However, I'd like to leave a small I2C based device inside the case as well.

I've thought about soldering leads from the bottom of the board, but the tight fit on the case makes this awkward -- there's no simple place to bring them out to the top because, e.g., the mounting screw holes are compartmentalized underneath to add structural integrity.

I've thought about soldering onto the male header, but this would be hard to do without leaving the ribbon connector raised, and the clearance inside the case is quite tight. It also commits me to attaching another plug and cramming that in loosely, or else permanently wiring the device in. So I've thought about just wrapping the wires and putting the ribbon connector over top, but that seems prone to disaster.

Are there any other options here?

  • Wire wrap has the advantage of being more temporary, but a secure several-turns wrap will be taller vertically than if you solder a single wrap of the same wire. You almost certainly have room for such a connection under the board, as well. – Chris Stratton May 17 '15 at 6:28
6

The rev. 2 model A and B both have a breakout for a second I2C bus, with the caveat that you can't use it and the camera header at the same time (this is software switchable while the pi is running).

The eight hole breakout is easy to see just inside of the GPIO header.

enter image description here

This is usually referred to as the P5 header in documentation, but on one (of two) of mine the label on the back is unmistakably P6;1 no matter since it's impossible to confuse with anything else.

There's a diagram detailing each hole here, but beware that pic is taken from the bottom of the board. From the top as in my pic, in order left to right:

  • Top row: 5V, GPIO 28, GPIO 30 (those aren't on the other header), ground.
  • Bottom row: 3.3V, GPIO 29, GPIO 30, ground.

The I2C connections are GPIO 28 for SDA and GPIO 29 for SCL. If you attach header pins on the top of the board, beware that you can't then easily fit connectors if there are already some in line on the existing 26-pin header. However, I managed to bend them subsequently so the vertical clearance is about the same, which is necessarily if the case is snug. Doing that if you wanted to use a bonified plug, or all 8 pins at once, might be more of a problem, so think about this before you heat up the iron.

enter image description here

Notice the GPIO ribbon out the side and the red/yellow/orange/brown wires on the second header, which attaches the 8x8 LED inside the clear top case.

To actually make this work, you have to reconfigure some pins. Also, as mentioned, enabling this disables the camera connector, but can just as easily be switched back on the fly. There are some stand alone utilities that you can use to enable the second bus. Originally I used hipi-i2c -- installation instructions here, but unless you are installing to Raspbian wheezy, they won't fly. Currently I'm using a blip of code compiled with libbcm2835,2 run from /etc/rc.local. /dev/i2c-1 is the regular bus; now there's

> ls /dev | grep i2c
i2c-0
i2c-1

i2cdetect 1 and i2cdetect 0 will show attached devices. I've noticed I often have to run this twice to get correct results for the latter and that sometimes the output is otherwise odd, however, I've been using both buses for a while now without any further issues.


1. P6 is usually the extra "reset" header; this is also labelled differently but I can't remember what and can't be bothered to take the case apart to check.

2. Here it is; note I did not implement an "off" function since I don't use that pi with a camera, but I'd guess it is the inverse (setting 28 and 29 back to inputs and 0 and 1 back to ALT0). There are various similar examples of this around online.

#include <bcm2835.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void on () {
        bcm2835_gpio_fsel(0, BCM2835_GPIO_FSEL_INPT);
        bcm2835_gpio_fsel(1, BCM2835_GPIO_FSEL_INPT);

        bcm2835_gpio_fsel(28, BCM2835_GPIO_FSEL_ALT0);
        bcm2835_gpio_set_pud(28, BCM2835_GPIO_PUD_UP);

        bcm2835_gpio_fsel(29, BCM2835_GPIO_FSEL_ALT0);
        bcm2835_gpio_set_pud(29, BCM2835_GPIO_PUD_UP);
}

int main (int argc, const char *argv[]) {
        if (argc != 2) {
                puts("On or off?");
                exit(1);
        }

        bcm2835_init();

        if (!strcmp(argv[1], "on")) on();
        else puts("What?");

        bcm2835_close();
        return 0;
}

  • I would have recommended the P5 header, but I assume you were talking about using P1. You could use wire wrap on the pins (remember wire wrap - I build entire computers using this). This would raise the connector slightly (3 or 4 wraps will provide a reliable connection). Even if you use P5 wire wrap may be easier than trying to squeeze in a plug. – Milliways Nov 30 '14 at 22:37

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.