RPi Tutorial Easy GPIO Hardware & Software

Aims
The aim of this tutorial is to introduce the basic circuits which can be used to interface with the RPi's GPIO.

Basic electronics knowledge will be required (i.e. familiar with typical discrete components such as transistors, diodes and resistors).

This is based on the following forum thread: Easy GPIO Hardware & Software.

While most of these circuits may interface directly to the RPi, the use of a buffered interface (such as the one supplied by the Gertboard) is recommended which will help protect against damage. Alternatively, experiment with one of the.

'''Extreme caution should be exercised when interfacing hardware at a low level, you may damage your RPi, your equipment and potentially yourself and others. Doing so is at your own risk!'''

Useful Links/Resources
Introduction To Embedded Programming - GPIO

Microchip's PIC Tips and Tricks PDF

Contains lots of useful example circuits for use with PIC micro-controllers, can be adapted for use with the RPi (3.3V GPIO).

Alternative Test Platforms
Until you have a RPi to test with, there are many alternative platforms available which will allow the testing of basic circuits. In addition, they may be interfaced with directly using the RPi in the future.

TI LaunchPad - A low cost development platform ($4.30 including free world shipping)

Includes programmer/debug board, two processors (with 16 GPIO including I2C/SPI/UART, 8ch 10bit ADC etc).

Arduino - Common hobbyist development platform

Excellent community support and additional hardware.

PICAXE

STM32 Primer/EvoPrimer - Self Contained development platform

Mentioned since I may use one at some point (brought the original Primer a long time ago), includes battery, acceleration sensors and built in display screen.

General GPIO Information
See General Purpose Input/Output (GPIO) page for details.

Basic Circuits
1. LED output

Directly driven (will need very low powered LED) or driven via transistor (allowing higher current).

2. Small DC motor drive

MOSFET or Darlington Pair to provide high power drive and reverse bias diode to protect from motor coils.

3. Simple on/off switch input

With or without de-bouncing.

4. Analogue resistive sensor sampled as a digital input

Using a basic transistor switch circuit.

Intermediate Circuits
1. Analogue to Digital Circuit

Use of a ADC chip to sample inputs.

2. PWM Driving Circuit

For example motor speed control.

3. Alpha-numeric 2x16 LCD Display

Control via 4-wire data (total 6 GPIO) and also alternative 2-wire interface circuit.

Advanced Circuits
1. Control Hardware Over The Internet

Implement web control and monitoring of GPIO connected components.

Contributing to this tutorial
This is an open project so please feel welcome to add your own sections and improve its content.

Please see the Talk:RPi Tutorial Easy GPIO Hardware & Software page to discuss this page.