When the Raspberry Pi was first released, I felt that the on-board I/O capabilities were not adequate for my needs. So I decided to build my own I/O expansion board. I decided to include:
- MCP23017 that adds two 8-pin general purpose input/output (GPIO) ports,
- PCA9685 that adds 16 12-bit pulse width modulation (PWM) channels with variable PWM Frequency (20-1000Hz), and
- MCP3008 that adds an 8-channel 200Ksps analog to digital converter (ADC).
The first two are attached to the I2C bus while the last is attached to the SPI bus. I designed the board layout using the Eagle PCB layout tool in the Fall of 2012. I even ordered some bare PCBs at the time, but I didn’t have the time /equipment to populate the board. So I put it on the back burner and conveniently forgot about it. The emergence of many other I/O expansion boards such as the awesome Gertboard and Piface further reduced my incentive to continue with this project.
Recently however I decided to revive this project…..at the very least as a PCB layout design & soldering exercise. So I dug out the PCBs & populated them with the necessary parts and did some pre-eliminary testing. So far everything seems to be functional (all power connections are fine, the “i2cdetect” also detects the device addresses of all i2c devices) but I’ve yet to run any major programs on it. I will be posting updates on this in the next couple of weeks. I will also post code examples for interfacing the PCA9685 chip with the Raspberry Pi.
One of my main objectives for this I/O expansion board was to make it as low cost as possible to manufacture…..perhaps under $15 if mass produced. The three chips chosen cost about $1-2 each in unit quantities and are sure to cost significantly less in larger quantities.
The board can also be powered from either the Raspberry Pi header or another power source (selectable by a switch), which is for now just a 2 pin male header. It also brings out all 16 PWM channels, 16 GPIOs, 8 ADC channels, the I2C bus pins, the SPI bus pins & UART pins. I consciously decided not to bring out the Raspberry PI’s native GPIO pins due to space limitations. Besides…using the MCP23017 GPIOs instead, reduces the risk of damaging the Raspberry PI’s GPIO pins.
Other modifications that I’m considering for the Rev 1 board:
- Use a stacking header to enable the board to plug into the RPi….right now it connects to the 2×13 RPi header with a 2×13 IDC terminated ribbon cable.
- Resize the board dimensions to exactly match those of the Raspberry Pi.
- Create matching mounting holes to those on the Rev 2 Raspberry Pi so that the Expansion board can be solidly attached to the Raspberry Pi Board.
- Create additional “shields” or “cape” boards (perhaps with an Arduino shield form factor) that can be attached to the expansion board e.g. Character LCD shield, Graphic LCD shield, 16- channel servo shield, dual h-Bridge shield, 4 – relay shield and so forth.
- For the second power source, add a DC adapter barrel connector instead of a simple 2 pin header (space pending)
- Come up with a funky name for the board!!!!!
I plan to make the board’s schematic & PCB layout files available to all once I finalize the next revision of the board. Coding should be straightforward using standard spidev i2cdev interfaces or a library such as the awesome WiringPi . I plan to release example code in Python and C/C++.