Raspberry Pi GPIO Pinout
I found these awesome Raspberry Pi pinout diagrams by Pighixxx at Flickr.
When I am trying to learn something new, I make my own diagrams.
I have been doing some reading about safely connecting things to the GPIO pins of the Raspberry Pi, especially regarding Voltage and Amps. It is not as simple as one would think, considering all the hype about a beginner being able to learn Programming and Electronics with a Raspberry Pi. The main thing I have learned, so far, is:
A maximum of 16mA per pin with the total current from all pins not exceeding 51 mA.
So doing some simple arithmetic, I can use all 17 GPIO pins, if the current on each pin is not more than 3mA (17 * 3 = 51). If only one pin is used, then it can handle a maximum of 16mA.
There are all sorts of other caveats as well. GPIO pins may be permanently damaged if things are wired wrong. That is scary. I am going to have to be extremely careful. The bywords for learning Electronics on a Raspberry Pi are going to be Check, Double Check, and Triple Check all circuits before applying power.
Having said all that, I was determined to STEAM ahead and try to do a Hello World Blinking LED circuit, using the GPIO pins of my Raspberry Pi computer. I wired it up using a 170-hole mini-breadboard, a couple of male-to-female jumper wires, a 1K Ohm resistor (brown, black, red), and a 3mm Red LED. I hooked the Ground Pin 9 to the cathode of the Red LED. The other lead of the LED connected to one lead of the 1K Ohm resistor. The other lead of the resistor connected to GPIO Pin 27.
I had to download some files to my Raspberry Pi before I could continue. I used the apt-get utility.
# apt-get update
# apt-get install python-dev
# apt-get install python-rpi.gpio
Once that was completed, I opened an editor and typed in this source code, modified from an example in The Raspberry Pi Cookbook by Simon Monk:
# run as superuser # #python led_blink.py import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(27, GPIO.OUT) while (True): GPIO.output(27, True) time.sleep(1.0) GPIO.output(27, False) time.sleep(2.0) # Ctrl-C to quit
When I executed the Python script, the Red LED blinked. Hello, World !
For more detail: Raspberry Pi GPIO Pinout