Here is another somewhat larger interface shown connected to a switch unit and a 16 LED output board. As the Pi connector does not have 20 GPIO pins, three of the pins are shared and can be connected to be either input or output via tree links.
I designed the pin-out of this interface so that most of my Velleman projects can be connected to it without alterations. The finished product provides four input lines and sixteen output lines. The outputs are buffered by two ULN 2803 Darlington driver which can sink – with luck – 500mA with each output. The board connects to the Raspberry Pi via a parallel cable.
The circuit diagram is on the right.
GPIO pins 3 and 4 are internally connected to the 3.3V line by 1.8k transistors, so their protection is via two 3.3V zener diodes rather than two resistors as used for the other two input lines. The rest of the circuit is entirely conventional. The shared lines are GPIO 2,4 and 17.
A LED is connected to the 5V line to indicate power on. The draw file of a suggested PCB layout can be downloaded via the link below.
For those of you who don’t use RISC OS, the draw file above will be of no use and I present a gif of the same design. This is of a lower resolution of course, but should do the job.
I heartily recommend RISC OS though, it’s much more fun than Debian.
Finally, here is a circuit diagram.
For more detail: Another (larger) Raspberry Pi Interface Board