Using the GPIO pins on a Raspberry Pi

In addition to being a serviceable single board computer, the Raspberry Pi also has a header full of GPIO pins at your beck and call. [Tedbot] sent in a great tutorial on using these pins with Python, Bash, and C.

The GPIO pins on the Raspi are arranged in a 2×13 header. Until Sparkfun manages to manufacture a decent Raspi protoboard, the easiest way to break these pins out is with an old IDE ribbon cable. After plugging the other end into a breadboard, [Tedbot] had an easily accessible set of Raspi pins.

To control these pins, [Tedbot] found two libraries: the first is WiringPi that implements a C-style, Arduino-like programming environment on the Raspi. The second is the RPi.GPIO Python package. Since the Raspi runs Linux, and everything in Unix is a file, [Tedbot] used a shell script to blink a LED.

One word of warning if you’re building a board to extend the capabilities of the Raspi: these pins aren’t 5 V tolerant, so you’ll need to throw in a buffer or level converter when building a Raspi circuit.

Edit: Adafruit is releasing a Pi Plate prototyping board in a few weeks. Neat, huh?


  1. imroy264 says:

    Adafruit already has a prototype board for the Raspberry Pi:

  2. MysticWhiteDragon says:

    I just want to know if anyone has an idea of how to connect an IR module such as TSOP 1738 to the board using the GPIO and LIRC drivers.

  3. Reggie says:

    There are probably already code examples in the wild to bitbang lirc, shouldn’t be that difficult to port.

  4. t&p says:

    I wished they open sourced their hardware. That way us United Stateans can buy a clone or something.

    • virgildisgr4ce says:

      It would be great to have their designs, but the schematics are only part of the equation. The supply chain is the real hard part; even with the schematics there’s no way we’d be able to get the price close to $25.

  5. raidscsi says:

    I thought the Raspberry Pi company went bankrupt or default or something, this things actually exist?

    (Sarcasm above.)

  6. Kaithar says:

    > the easiest way to break these pins out is with an old IDE ribbon cable

    IDE ribbon cables have over half their conductors as ground, including a few that are mapped to actual pins, and all those ground conductors are connected via a conductor in each of the connectors.
    Plug an IDE cable in to anything that isn’t designed with those ground cables in mind and you will short some of your pins… which is usually a good way to annoy your hardware.
    There are also a couple of pins that aren’t connected at all in one of the connectors, and a keying pin that is blocked up just to make your life fun. for full details.

    • virgildisgr4ce says:

      Huh, never knew that. Crazy. In this case, it’s a totally plain IDC ribbon cable connector, no special wiring. Obviously safest to crimp your own. I tested all the pins for funny business before powering anything (3 times), as I always do. I’ll add this information to the tutorial. Thanks!

    • Tom Hargrave says:

      The newer higher speed IDE 80 wire cable is the one that has every second conductor grounded, the older 40 wire cable does not. And it’s easy to tell the difference – just count the conductors in the ribbon cable!

  7. robmobz says:

    not the really cheap ones. only ide-80 not ide-x25.

  8. heavyminer says:

    I want to know if its possible to connect an old eide/pata cd/DVD drive up to my raspi to play movies and such.
    Any suggestions?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,704 other followers