Difference between revisions of "RPi Tutorial Easy GPIO Hardware & Software"

From eLinux.org
Jump to: navigation, search
m (Useful Links/Resources)
(Adding links for other pages)
Line 7: Line 7:
  
 
==Aims==
 
==Aims==
The aim of this tutorial is to introduce the basic circuits which can be used to interface with the RPi's GPIO.
+
This tutorial is based on [http://www.raspberrypi.org/forum/features-and-requests/easy-gpio-hardware-software this thread] and aims to introduce basic circuits which can be used with the RPi's [[RPi Low-level peripherals#General Purpose Input/Output (GPIO) | General Purpose Input/Output (GPIO)]].
 
+
Basic electronics knowledge will be required (i.e. familiarity with typical discrete components such as transistors, diodes and resistors).
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: [http://www.raspberrypi.org/forum/features-and-requests/easy-gpio-hardware-software Easy GPIO Hardware & Software].
+
 
+
  
 
==Useful Links/Resources==
 
==Useful Links/Resources==
[http://www.scriptoriumdesigns.com/embedded/index.php Introduction To Embedded Programming - GPIO]
 
 
In particular there is lots of detailed information about GPIO inputs and outputs for beginners to understand the principles behind the circuits.
 
 
  
[http://ww1.microchip.com/downloads/en/devicedoc/40040b.pdf Microchip's PIC Tips and Tricks PDF]<ref> http://www.raspberrypi.org/forum/projects-and-collaboration-general/gpios-suitable-for-microswitches-joysticks/#p35307 </ref>
+
*[http://www.scriptoriumdesigns.com/embedded/index.php Introduction To Embedded Programming - GPIO] - In particular there is lots of detailed information about GPIO inputs and outputs for beginners to understand the principles behind the circuits.
  
Contains lots of useful example circuits for use with PIC micro-controllers, can be adapted for use with the RPi (3.3V GPIO).
+
*[http://ww1.microchip.com/downloads/en/devicedoc/40040b.pdf Microchip's PIC Tips and Tricks PDF]<ref> http://www.raspberrypi.org/forum/projects-and-collaboration-general/gpios-suitable-for-microswitches-joysticks/#p35307 </ref> - 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==
 
==Alternative Test Platforms==
Line 29: Line 20:
  
  
[http://www.ti.com/tool/msp-exp430g2 TI LaunchPad] - A low cost development platform ($4.30 including free world shipping)
+
[http://www.ti.com/tool/msp-exp430g2 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).
  
Includes programmer/debug board, two processors (with 16 GPIO including I2C/SPI/UART, 8ch 10bit ADC etc).
 
  
 
+
[http://arduino.cc/en/ Arduino] - Common hobbyist development platform. Excellent community support and additional hardware.
[http://arduino.cc/en/ Arduino] - Common hobbyist development platform
+
 
+
Excellent community support and additional hardware.
+
  
  
Line 42: Line 29:
  
  
[http://www.stm32circle.com/hom/index.php STM32 Primer/EvoPrimer] - Self Contained development platform
+
[http://www.stm32circle.com/hom/index.php STM32 Primer/EvoPrimer] - Self-contained development platform. Mentioned since I may use one at some point (I bought the original Primer a long time ago). It includes a battery, acceleration sensors and built in display screen.
  
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 [[RPi Low-level peripherals#General Purpose Input/Output (GPIO) | General Purpose Input/Output (GPIO)]] page for details.
 
  
 
==Planned Tutorials==
 
==Planned Tutorials==
Line 57: Line 39:
  
  
2. Small DC motor drive
+
2. [[RPi Tutorial EGHS:DC Motor | Small DC motor drive]]
  
 
MOSFET or Darlington Pair to provide high power drive and reverse bias diode to protect from motor coils.
 
MOSFET or Darlington Pair to provide high power drive and reverse bias diode to protect from motor coils.
  
  
3. Simple on/off switch input
+
3. [[RPi Tutorial EGHS:Switch Input| Simple on/off switch input]]
  
 
With or without de-bouncing.
 
With or without de-bouncing.
  
  
4. Analogue resistive sensor sampled as a digital input
+
4. [[RPi Tutorial EGHS:Analogue Sensor| Analogue resistive sensor sampled as a digital input]]
  
 
Using a basic transistor switch circuit.
 
Using a basic transistor switch circuit.
 +
  
 
===Intermediate Circuits===
 
===Intermediate Circuits===
1. Shift-Registers - Multiplexing Data
+
1. [[RPi Tutorial EGHS:Shift Registers| Shift Registers - Multiplexing Data]]
  
An introduction to using additional IC's.  In this case, using a parallel to serial 8-bit shift register to read 8 digital inputs using two GPIO pins.
+
An introduction to using additional ICs.  In this case, using a parallel to serial 8-bit shift register to read 8 digital inputs using two GPIO pins.
  
  
2. Analogue to Digital Circuit
+
2. [[RPi Tutorial EGHS:Analogue to Digital| Analogue to Digital Circuit]]
  
 
Use of a ADC chip to sample inputs.
 
Use of a ADC chip to sample inputs.
  
  
3. PWM Driving Circuit
+
3. [[RPi Tutorial EGHS:Driving Circuit| PWM Driving Circuit]]
  
 
For example motor speed control.
 
For example motor speed control.
  
  
4. Alpha-numeric 2x16 LCD Display
+
4. [[RPi Tutorial EGHS:Alpha-Numeric Display| Alpha-numeric 2x16 LCD Display]]
  
 
Control via 4-wire data (total 6 GPIO) and also alternative 2-wire interface circuit.
 
Control via 4-wire data (total 6 GPIO) and also alternative 2-wire interface circuit.
 +
  
 
===Advanced Circuits===
 
===Advanced Circuits===
1. Control Hardware Over The Internet
+
1. [[RPi Tutorial EGHS:Hardware Over Internet| Control Hardware Over The Internet]]
  
 
Implement web control and monitoring of GPIO connected components.
 
Implement web control and monitoring of GPIO connected components.
Line 102: Line 86:
 
Please see the [[Talk:RPi Tutorial Easy GPIO Hardware & Software]] page to discuss this page.
 
Please see the [[Talk:RPi Tutorial Easy GPIO Hardware & Software]] page to discuss this page.
  
<references>
+
<references/>
  
 
{{Template:Raspberry Pi}}
 
{{Template:Raspberry Pi}}

Revision as of 19:14, 3 February 2012

Back to the Hub.


Community Pages:

Tutorials - a list of tutorials. Learn by doing.

Guides - a list of informative guides. Make something useful.

Projects - a list of community projects. Help others out.

Tasks - for advanced users to collaborate on software tasks.

Datasheets - a frambozenier.org documentation project.

Education - a place to share your group's project and find useful learning sites.

Community - links to the community elsewhere on the web.

Games - all kinds of computer games.

Warnings

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 #Alternative Test Platforms.


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!

Aims

This tutorial is based on this thread and aims to introduce basic circuits which can be used with the RPi's General Purpose Input/Output (GPIO). Basic electronics knowledge will be required (i.e. familiarity with typical discrete components such as transistors, diodes and resistors).

Useful Links/Resources

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[2]


STM32 Primer/EvoPrimer - Self-contained development platform. Mentioned since I may use one at some point (I bought the original Primer a long time ago). It includes a battery, acceleration sensors and built in display screen.


Planned Tutorials

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. Shift Registers - Multiplexing Data

An introduction to using additional ICs. In this case, using a parallel to serial 8-bit shift register to read 8 digital inputs using two GPIO pins.


2. Analogue to Digital Circuit

Use of a ADC chip to sample inputs.


3. PWM Driving Circuit

For example motor speed control.


4. 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.

  1. http://www.raspberrypi.org/forum/projects-and-collaboration-general/gpios-suitable-for-microswitches-joysticks/#p35307
  2. http://www.raspberrypi.org/forum/projects-and-collaboration-general/gpios-suitable-for-microswitches-joysticks/#p35309