Raspberry Pi B+ Header Board

This project is simply a header board, to enable easy connection of our modular I/O capability to a Raspberry Pi B+. This is basically a new version of the header board we designed for the model B Raspberry Pi.

Design

2x20 header
Our header board connects to the Raspberry Pi B+ using a 2x20 (40-way) PCB header. We are using one with extended pins this time, to enable other boards to piggy-back on top of it.

The design is made easier by the fact that the first 26 GPIO pins of the RPi B+ are identical to those of the RPi B. The B+ has 40 pins and enables another 9 generic I/O pins.

We are using one of these 9 pins to free up the GPIO pin currently used for 1-wire functionality and then exposing a further 8 pins via a PCB 10-way header. This means we have three sets of 8 I/O pins exposed via three 10-way PCB headers. These can be configured for input or output and easily interfaced using the other boards we have developed for use in our smart home and other projects.

The board is designed to fit within the footprint of the Raspberry Pi B+ PCB and not foul any of the other components on it.

GPIO & Pin Numbering

Pin numbering
This is a great diagram showing the RPi B+ GPIO pins and their assignment by Element 14.

Pi4J & WiringPi numbering
The Pi4J pin numbering is different though and based upon the Wiring Pi numbering scheme.

Whilst many argue that this is confusing, we support this approach which is consistent across board revisions.

To summarise all of this we created this spreadsheet.

I2C

The GPIO 2 (pin 3) and GPIO 3 (pin 7) are used for I2C communications and we have used a 2-way jumper to isolate them from port 1 if they need to be used for I2C functions.

Dallas 1-Wire

By default the 1-Wire drivers use GPIO 4 (pin 7) on all models of the Raspberry Pi. Previously we connected this pin via a jumper in case 1-Wire functionality wasn't needed. We now route this to a 3-way connector for dedicated 1-Wire usage. GPIO 5 (pin 29) now replaces this pin on port 1.

A 4-pin SIL connector has the three connections required to connect one or more Dallas DS1820 temperature sensors:

  1. 1-Wire data
  2. +3.3V
  3. Ground

Ports

We are exposed three ports via 1-way headers. Each port has 8 channels and can be configured as inputs or outputs.

10-Way Header

To keep things simple we grouped I/O capability into 'ports', each of which supports 8 channels. This doesn't mean each I/O board and application needs to be fully populated with components but it makes things simpler from both a hardware and software perspective. We expose each 8-channel input or output port via a standard 10-way header.

Header pins
Header pins designation. Though marked inputs these could equally as well be outputs.

Testing

We are not prototyping this hardware design because we gained enough experience from our previous header board project to be confident of the design.

We did test our software though by configuring all of the ports and pins as inputs and connecting them to +3.3V via a 1KΩ resistor, to check the operation.

Manufacturing

We have created a circuit schematic using DesignSpark PCB.

This is the PCB layout. It is 61mm × 37mm in size:

DesignSpark PCB is a free design tool and although it may not be the best tool for this task or produce the most efficient designs, thesse boards are being produced in low volumes only, for rapid prototyping. We are not overly concerned about the quality of the PCB design, so as long as it works and does the job of letter us build and test innovative new hardware and services quickly.

This is the manufactured PCB (top side):

This is the manufactured PCB (bottom side):

This is the completed board:

Software

We are using Pi4J and our own Java software to do the control. We are not going to provide complete programs here but the following code segments show how we write software using the hardware described in this project. For the purposes of this project, we are showing Port 1 being used as outputs and Port 2 and 3 as inputs. Any pin can be used for input of output but it makes more sense from a hardware perspective to keep all the pins on each port doing the same function (unless you have a bespoke piece of hardware and application in mind).

Pi4J Installation

The Pi4J installation is well documented.

Note that you need root permissions to run Java code using Pi4J.

Initialisation

The first thing to do is to create a GPIO controller instance:

final GpioController gpio = GpioFactory.getInstance();

We then assign the various (for example) port 1 pins as outputs, so for example the last 4 outputs of ports 1 would be assigned like this:

// Output 5, Header pin 24
final GpioPinDigitalOutput output5 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_10, "Output5", PinState.LOW);
// Output 6, Header pin 21
final GpioPinDigitalOutput output6 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_13, "Output6", PinState.LOW);
// Output 7, Header pin 19
final GpioPinDigitalOutput output7 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_12, "Output7", PinState.LOW);
// Output 8, Header pin 23
final GpioPinDigitalOutput output8 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_14, "Output8", PinState.LOW);

We then assign the various (for example) port2 pins as inputs like this:

// Input 1, Header pin 10
final GpioPinDigitalInput input1 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_16, "Input1", PinPullResistance.PULL_DOWN);

Then we create and register input listeners for each input pin of like this:

input8.addListener(new GpioPinListenerDigital() {
	@Override
	public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event8) {
		Log.Print('D', "Input8 = " + event8.getState());
	}
});

Summary

You don't need a header board like this to use the Raspberry Pi B+ but it does make it much easier to connect things to it and to re-use other boards we have developed for input and output. It also makes it much easier to re-use the software we have written.

If anyone wants to pick up this design and turn it into a commercial product, to be sold large volumes we are happy to support them in this activity.

Share ...
We are on ...
Facebook Twitter
YouTube Flickr Follow us on Pinterest