PDA

View Full Version : Using the GPIO pins on a Raspberry Pi



wraggster
June 17th, 2012, 21:52
http://hackadaycom.files.wordpress.com/2012/06/raspi.png
In addition to being a serviceable single board computer, the Raspberry Pi also has a header full of GPIO pins at your beck and call. [Tedbot] sent in a great tutorial on using these pins (http://log.liminastudio.com/writing/tutorials/tutorial-how-to-use-your-raspberry-pi-like-an-arduino) with Python, Bash, and C.
The GPIO pins on the Raspi are arranged in a 2×13 header. Until Sparkfun manages to manufacture a decent Raspi protoboard, the easiest way to break these pins out is with an old IDE ribbon cable. After plugging the other end into a breadboard, [Tedbot] had an easily accessible set of Raspi pins.
To control these pins, [Tedbot] found two libraries: the first is WiringPi (https://projects.drogon.net/raspberry-pi/wiringpi/) that implements a C-style, Arduino-like programming environment on the Raspi. The second is theRPi.GPIO Python package (http://pypi.python.org/pypi/RPi.GPIO). Since the Raspi runs Linux, and everything in Unix is a file, [Tedbot] used a shell script (http://elinux.org/RPi_Low-level_peripherals#GPIO_Driving_Example_.28Shell_sc ript.29) to blink a LED.
One word of warning if you’re building a board to extend the capabilities of the Raspi: these pins aren’t 5 V tolerant, so you’ll need to throw in a buffer or level converter when building a Raspi circuit.
Edit: Adafruit is releasing a Pi Plate prototyping board (http://www.adafruit.com/products/801) in a few weeks. Neat, huh?

http://hackaday.com/2012/06/17/using-the-gpio-pins-on-a-raspberry-pi/