RPi GPIO Interface Circuits
This page shows a number of common circuits used for interfacing the Raspberry Pi's GPIO pins to various other electronic circuits.
Please note: this page is currently under construction
This circuit may be used to connect a digital signal from a 5V device to a GPIO pin on the Pi, which requires a 3.3V input level. The Ov point in the schematic should be connected to one of the Ground lines on the Pi's GPIO connector, and also to the 0v (or Ground) signal on the input device.
The important thing here is the ratio of R1 to R2; R1 should be just over half R2's value to ensure 5V is divided down to 3.3V. The values shown here should be suitable for most uses.
(See the [http://en.wikipedia.org/wiki/Voltage_divider Wikipedia article on voltage dividers).
The GPIO pins are connected directly to the BCM2835 chip at the heart of the Raspberry Pi. These provide only a 3.3V output level, and are not capable of supplying much power. More importantly, if they are damaged through misuse the Pi itself will need to be replaced.
So, if you are connecting anything more than a small LED to the GPIO output, you should use an additional circuit to boost the voltage and/or current.
Using an NPN transistor
This shows a cheap NPN transistor being used to switch a load on and off. When the GPIO is 'high' (logic 1) the load will be turned on; when it is 'low' the load will be off. The circuit shows a 5V power rail, but with the 2N3904 transistor shown, a supply of up to 40V may be used (this is the VCEO value given in the transistor's datasheet). It should be suitable for a load current of up to 100mA.
For bigger loads, you will need a bigger transistor to switch higher voltages (the VCEO value) or currents (the IC value), but note that you will need a transistor with a higher gain (the hFE value) as well. The gain is the ratio of the current in R1 (in this case, about 2.5mA), to the current in the load: a 1A load will need a gain of 400. So-called Darlington transistors, such as the TIP112 (1A, 100V) provide high gain at high currents.
Using a FET
Note: If you wish to produce new or modified schematics matching the ones above, you can use Inkscape using symbols from File:Circuit_Symbols.svg.