Adding GPIOs To The Raspberry Pi With The Camera Interface


The Raspberry Pi Model B+ was just released, and now everyone who picks one of those up has a few more GPIO pins to play around with. For the millions of people with the two-year-old version of the Pi, we’re still stuck with the same old, same old: 17 GPIOs on the big header, and that’s about it as far as toggling pins goes.

The Broadcom SoC on the Pi has far more GPIO pins than are broken out on the large header, and a few of those go to the CSI camera interface. These GPIOs can be broken out with a few flat cables (Portuguese, Google Translatrix), giving you four more GPIOs, and this technique can also be used with the new, expanded Model B+.

The CSI camera connector has two I²C lines that go directly to the camera, controllable in Linux as GPIO0 and GPIO1. There are two more GPIO connectors on the CSI connector controllable as GPIO5 and GPIO21. By carefully slicing and soldering wires to a flat cable, these GPIO lines can be broken out onto a breadboard.

There’s a video below demonstrating these GPIO lines being used to control a few LEDs. Of course, anything that is possible with a normal Raspi GPIO is possible with the CSI connector GPIO lines.

9 thoughts on “Adding GPIOs To The Raspberry Pi With The Camera Interface

    1. Indeed, I’d put it right there with the folks removing the ethernet and USB jacks from a model B to get a model A form factor with 512MB RAM. The majority of Pi users won’t ever do this, but it’s great for the few who might need it.

        1. I don’t think you made the mental leap from my first sentence to the second one, unless you meant to say the ribbon cable hack has been done since before the model A was released? My first sentence agreed with Dodo, that this is trivial but useful, like cutting down a model B to save space was. My second sentence was saying that the majority of Pi users won’t ever do the ribbon cable hack. Sorry if I confused you.

    1. Actually, yes it is; while the outputs were already there, prior to this, the were single-purpose (only meant for the camera) not general-purpose (usable for anything you feel like).

    1. No, because the CSI interface is high-speed LVDS (Low Voltage Differential Signaling) and requires a specialized hardware interface (in the BCM2835) for serializing/deserializing/level conversion, etc. The GPIO pins are strictly for simple hardware interfaces (e.g. I2C, SPI, UART, etc.) or for bit-banging by software.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.