Preassembled 40-pin Pi Wedge Hookup Guide

Pages
Contributors: Byron J.
Favorited Favorite 7

Introduction

The preassembled 40-pin Pi Wedge is the newest member in our Pi Wedge family. It's an excellent way to get those pesky Pi pins broken out to a breadboard so that they can easily be used.

SparkFun Pi Wedge

SparkFun Pi Wedge

BOB-13717
$12.95
12

Check out the Pi Wedge in the product showcase at 2:47!

This Pi Wedge is compatible with members of the Pi family with 40-pin GPIO headers, including

It adapts the 40-pin GPIO connector on recent Pis to a breadboard-friendly form factor and rearranges the pins by similar function. Also, the GPIO pins are arranged in ascending order.

This version also comes fully assembled -- no soldering is required!


alt text

The Pi Wedge, shown with a Pi B+.


Covered in This Tutorial

But before you begin, check out these links and brush up on topics you may not be familiar with:

Suggested Reading

Suggested Viewing

Background

In the process of developing projects like the Twitter Monitor and Great American Tweet Race around the Raspberry Pi, we found that we were experiencing some growing pains when trying to expand the Pi into a prototype that involved external hardware.

Bob Pease would be proud

There's a Pi somewhere in this ratsnest

The Raspberry Pi Model B+ has a 40-pin connector that provides access to several communication interfaces, plus GPIO and power. But the connector doesn't have detailed labeling, and the native pin arrangement is somewhat scattershot. Pins used for similar functions aren't always grouped together, and power and ground pins are interspersed with no obvious pattern.

The pins also don't translate to a solderless breadboard very easily. Our first projects used a bunch of F-M jumper wires that we just plugged into the header. They involved a lot of "ratsnest jiggling" when things stopped working.

Bootstrapping

In addition to the physical issues of using the I/O connector, getting started with a brand new Raspberry Pi B+ always seems to involve a chicken-and-egg situation. We just want to SSH into it, so we can use the command line. But in order to SSH to it, we need to know it's IP address...and of course, the IP address is most easily learned by running ifconfig on the command line.

The Solution

alt text

Meet the 40-Pin Pi Wedge

The Pi Wedge B+ connects to the 40-pin GPIO connector, and breaks out the pins in a breadboard-friendly arrangement and spacing. It adds a pair of decoupling capacitors on the power supply lines, and it makes the initial bringup process easier - you can plug an FTDI Basic module into the serial port.

Assembly

Contents

The Preassembleed Pi Wedge comes with the Wedge PCB, and a 40-pin ribbon cable.

Connection

The 40-pin ribbon cable is used to connect the wedge to the Pi. This cable is polarized — notice that the pin 1 marking is very subtle. On the Pi Wedge PCB end, the tooth on the cable will interface with the notch in the shrouded header. Insert the IDC cable into the Pi Wedge's polarized connector so that the cable extends away from the breadboard connection.

alt text

Inserting the ribbon cable

Insert the Wedge into the center of the breadboard so that each pin has their own row.

alt text

Wedge inserted in breadboard.

The header on the Pi itself doesn't have anything to help guarantee the alignment. You'll need to take care that it gets connected properly. Pin 1 on the Pi is marked with a dog-eared corner on the silkscreened rectangle. The ribbon cable connector is embossed with (a barely visible) small triangle that marks pin 1. The first pin is also coded on the wire, such as the red markings in the photo below (though it may also be another color, such as black or dark blue). Insert the IDC cable to the Pi so that the cable extends away from the Pi.

Proper Orientation for the IDC Cable on the Pi

Proper pin-1 orientation

If you decide to connect to the Pi using serial, you can insert a 3.3V FTDI to the Pi Wedge. The FTDI connector needs to be aligned correctly. Be sure to match up the "GRN" and "BLK" markings on both boards.

FTDI connected to Pi Wedge

Proper 3.3V FTDI-Basic orientation

Your setup will look similar to the image below. In this case, we used a Pi 3 in an enclosure.

Pi Wedge Setup with Pi

In the next section, we'll explore how the signals from the Pi are mapped to the Wedge.

Pin Mapping

Changes With the B+

When the Raspberry Pi foundation introduced the B+, they expanded the GPIO header from 26 to 40 pins. These changes have been carried forward by the A+ and Pi 2 Model B. The connector adds nine more GPIO pins plus the ID_SC and ID_SD pins to identify external peripherals, which you can learn more about in our SPI and I2C tutorial.

Signal Location

The Pi Wedge reorganizes the I/O pins on the Pi, putting similar functions on adjacent pins. The SPI, I2C and UART signals are all grouped near each other.

alt text

Functional Groupings

The pins are labeled, though the labels are short, to fit the space available on the PCB. The UART, SPI and I2C pins are marked with their communication bus functions, but they are also available as GPIO pins when configured in that mode.

The following table denotes the assignment of signals on the Pi Wedge, including the peripheral and alternate GPIO assignments where appropriate.

Wedge Silk Python (BCM) WiringPi GPIO Name Name WiringPi GPIO Python (BCM) Wedge Silk
G17 17 0 GPIO17 (GPIO_GEN0) GPIO18 (GPIO_GEN1) 1 18 G18
G16 16 27 GPIO16 GPIO19 24 19 G19
G13 13 23 GPIO13 GPIO20 28 20 G20
G12 12 26 GPIO12 GPIO21 29 21 G21
G6 6 22 GPIO06 GPIO22 (GPIO_GEN3) 3 22 G22
G5 5 21 GPIO05 GPIO23 (GPIO_GEN4) 4 23 G23
G4 4 7 GPIO04 (GPIO_GCLK) GPIO24 (GPIO_GEN5) 5 24 G24
CE1 11 GPIO7 (SPI_CE1_N) GPIO25 (GPIO_GEN6) 6 25 G25
CE0 10 GPIO8 (SPI_CE0_N) GPIO26 25 26 G26
MOSI 12 GPIO10 (SPI_MOSI) GPIO27 (GPIO_GEN2) 2 27 G27
MISO 13 GPIO09 (SPI_MISO) GPIO03 (SCL1, I2C) 9 SCL
SCK (no worky 14) GPIO11 (SPI_CLK) GPIO02 (SDA1, I2C) 8 SDA
RXI 16 GPIO15 (UART_RXD0) GPIO0, ID_SC (I2C ID SC EEPROM) 31 IDSC
TXO 15 GPIO14 (UART_TXDO) GPIO1, ID_SD (I2C ID SD EEPROM) 30 IDSD
5V 5V
3.3V 3.3V
GROUND GROUND

Pi Wedge B+ Pin-Function mapping

Logic Levels And Power

Logic Levels

The Pi uses 3.3V logic levels, which are not 5V tolerant. Many peripheral devices are capable of running at 3.3V, but in the case that you need to interface with 5V devices, use a level shifter, such as the TXB0104 breakout.

Communications

The signals on the 6-pin FTDI header are also limited to 3.3V logic levels. Be sure to use it with a 3.3V FTDI module, and not a 5V one.

Power

Understanding the Pi's power supply is critical to using it successfully, particularly when building it into a larger system.

The Raspberry Pi B+ is more efficient than it's predecessors, as it replaces the former chain of linear power regulators with switching regulators.

The most recently published schematics are for the Raspberry Pi B+, and we're assuming that the Pi2 model B and A+ are similar. Inspecting those schematics, we see that 5V comes into the the board via connector J1 - it's a micro USB connector, but only the power and ground pins are connected. The 5V coming from this connector passes through a fuse and a transistor circuit that protects against power polarity mishaps, then continues around the board without any further regulation. The 5V connections on the Pi Wedge come straight from this line.

On the B+, the 5V goes to a dual switching regulator that further reduces it to 3.3V, and 1.8V. The regulated 3.3V is present on the I/O connector.

Power Regulation

There are several power strategies that can be applied in a Pi deployment, depending on the overall needs and availability.

Power Through the GPIO Connector

The most obvious strategy for powering small external circuits is to get power directly from the GPIO connector. To power small circuits on your breadboard, you can run jumpers from the 5V or 3.3V and Ground pins on the wedge to the power rails on the breadboard.

alt text

Jumpering power to the breadboard rails

While this is the most immediate way to access power, it only extends to small circuits. The B+ itself is limited to 2A total from the 5V line, most of which is needed by the B+ itself. The stated limit for the 3.3V pins is 50 mA.

If you're developing external circuitry, and the Pi resets when you're testing it, you may be exceeding the current limits. We saw this exact situation arise as we added SPI controlled 7-segment LED displays - if we illuminated one too many segments, the system crashed. For circuits with higher power draw, we'll need to explore some alternatives.

Daisy Chaining

The next power option is to connect each section of the circuit directly to the power supply. This means that the peripherals aren't constrained by the current limits of the fuses and regulators on the Pi itself.

daisy chained power

The peripherals are powered directly by the supply directly

For peripherals that use 5V logic, they should also include 3.3V/5V logic level translation.

Back Power Through J8

As described above, a simple deployment can power peripherals via the 5V and 3.3V pins of J8, but it's also possible to apply power to the Pi via those lines. The Pi Foundation call this "back powering", and they have a number of recommendations for it's implementation.

Backpowering

The first recommendation is to duplicate the fuse and MOSFET + BJT power protection circuit as seen on the Pi itself. This circuit is a variant on the "ideal diode" circuit.

Ideal Diode

It serves several purposes:

  • Under ordinary circumstances, with power coming in via the micro-USB plug, the MOSFET is biased fully on, so there is only minimal voltage drop across it, where a typical Schottky or Silicon diode would drop 0.3V or more.
  • Second, it prevents power from flowing if the power polarity at the micro-USB plug is incorrect.
  • Third, if the board is powered via J8, it prevents power from being drawn from J1, to prevent contention if two supplies are present at the same time.

The other recommendation is that the HAT needs to be able to provide 5V, +/- 5%, with at least 1.3 A available for the Pi.

Resources and Going Further

If you want more detailed information about the Wedge and the interfaces it breaks out, check out the following materials:

  • To take a closer look at programming for the I/O on a Pi, in both Python and C, take a look at our Raspberry gPIo tutorial.
  • If you want to use the synchronous serial interface broken out by the wedge, you can learn more in out I2C & SPI tutorial
  • The design files for the PCB, and some WiringPi software examples can be found in the 40-pin Pi Wedge GitHib repository.

Raspberry gPIo

How to use either Python or C++ to drive the I/O lines on a Raspberry Pi.

Raspberry Pi SPI and I2C Tutorial

Learn how to use serial I2C and SPI buses on your Raspberry Pi using the wiringPi I/O library for C/C++ and spidev/smbus for Python.

Python Programming Tutorial: Getting Started with the Raspberry Pi

This guide will show you how to write programs on your Raspberry Pi using Python to control hardware.

Python GUI Guide: Introduction to Tkinter

Tkinter is the standard graphical user interface package that comes with Python. This tutorial will show you how to create basic windowed applications as well as complete full-screen dashboard examples complete with live graph updates from matplotlib.

Looking for more inspiration? Check out these other Rasperry Pi tutorials:

Raspberry Pi 3 Starter Kit Hookup Guide

Guide for getting going with the Raspberry Pi 3 Model B and Raspberry Pi 3 Model B+ starter kit.

Qwiic pHAT for Raspberry Pi Hookup Guide

Get started interfacing your Qwiic enabled boards with your Raspberry Pi. The Qwiic pHAT connects the I2C bus (GND, 3.3V, SDA, and SCL) on your Raspberry Pi to an array of Qwiic connectors.

Nintendo Switch Macro Recording on the Raspberry Pi

Learn how to record and playback controller 'macros' for your Nintendo Switch using a Raspberry Pi, SparkFun Top pHAT, and Joycontrol.

Qwiic pHAT Extension for Raspberry Pi 400 Hookup Guide

Get started interfacing your Qwiic enabled boards with your Raspberry Pi 400! SparkFun Qwiic pHAT Extension for the Raspberry Pi 400 provides you with a quick and easy solution to access all of the 400's GPIO, stack your favorite HAT right-side up, or connect a Qwiic-enabled device to the I2C bus (GND, 3.3V, SDA, and SCL).

For more information about the Raspberry Pi B+ and the software described here, please visit their sites.


If you have any problems or questions, our technical support department can help. Please don’t hesitate to contact us. We also love to hear about your projects!