RPi.GPIO Quick Reference

RPi.GPIO Quick Reference
You can download the .txt version of this for cutting and pasting from
http://RasPi.TV/download/rpigpio.txt
Or directly on your Raspberry Pi with...
wget http://RasPi.TV/download/rpigpio.txt
You may redistribute this freely as long as it remains intact.
http://RasPi.TV/rpi-gpio
RPi.GPIO Quick Reference
We now have B+, Rev 2 and Rev 1 Pi pinouts to deal with.
GPIO Numbers
Raspberry Pi B
Rev 1 P1 GPIO Header
Raspberry Pi A/B
Rev 2 P1 GPIO Header
Pin No.
3.3V
GPIO0
GPIO1
GPIO4
GND
GPIO17
GPIO21
GPIO22
3.3V
GPIO10
GPIO9
GPIO11
GND
1
3
5
7
9
11
13
15
17
19
21
23
25
2
4
6
8
10
12
14
16
18
20
22
24
26
Raspberry Pi B+
B+ J8 GPIO Header
Pin No.
5V
5V
GND
GPIO14
GPIO15
GPIO18
GND
GPIO23
GPIO24
GND
GPIO25
GPIO8
GPIO7
3.3V
GPIO2
GPIO3
GPIO4
GND
GPIO17
GPIO27
GPIO22
3.3V
GPIO10
GPIO9
GPIO11
GND
Key
Power +
GND
I²C
1
3
5
7
9
11
13
15
17
19
21
23
25
2
4
6
8
10
12
14
16
18
20
22
24
26
Pin No.
5V
5V
GND
GPIO14
GPIO15
GPIO18
GND
GPIO23
GPIO24
GND
GPIO25
GPIO8
GPIO7
UART
SPI
GPIO
3.3V
GPIO2
GPIO3
GPIO4
GND
GPIO17
GPIO27
GPIO22
3.3V
GPIO10
GPIO9
GPIO11
GND
DNC
GPIO5
GPIO6
GPIO13
GPIO19
GPIO26
GND
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
5V
5V
GND
GPIO14
GPIO15
GPIO18
GND
GPIO23
GPIO24
GND
GPIO25
GPIO8
GPIO7
DNC
GND
GPIO12
GND
GPIO16
GPIO20
GPIO21
Alternative Functions
Raspberry Pi B
Rev 1 P1 GPIO Header
Raspberry Pi A/B
Rev 2 P1 GPIO Header
Pin No.
3.3V 1
SDA0 3
SCL0 5
GPCLK0 7
GND 9
GPIO17 11
GPIO21 13
GPIO22 15
3.3V 17
MOSI 19
MISO 21
SCLK 23
GND 25
2
4
6
8
10
12
14
16
18
20
22
24
26
Raspberry Pi B+
B+ J8 GPIO Header
Pin No.
5V
5V
GND
TXD
RXD
PWM
GND
GPIO23
GPIO24
GND
GPIO25
CE0
CE1
3.3V 1
SDA1 3
SCL1 5
GPCLK0 7
GND 9
GPIO17 11
GPIO27 13
GPIO22 15
3.3V 17
MOSI 19
MISO 21
SCLK 23
GND 25
2
4
6
8
10
12
14
16
18
20
22
24
26
Pin No.
5V
5V
GND
TXD
RXD
PWM
GND
GPIO23
GPIO24
GND
GPIO25
CE0
CE1
Key
Power + UART
GND
SPI
I²C
GPCLK
GPIO
You may redistribute this freely as long as it remains intact.
3.3V
SDA1
SCL1
GPCLK0
GND
CE1_1
GPIO27
GPIO22
3.3V
MOSI_0
MISO_0
SCLK_0
GND
DNC
GPCLK1
GPCLK2
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
PWM1/GPIO13 33
PWM1/MISO_1 35
GPIO26 37
GND 39
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
5V
5V
GND
TXD
RXD
PWM0/CE0_1
GND
GPIO23
GPIO24
GND
GPIO25
CE0_0
CE1_0
DNC
GND
PWM0/GPIO12
GND
CE2_1
MOSI_1
SCLK_1
http://RasPi.TV/rpi-gpio
RPi.GPIO Quick Reference

RPi.GPIO Tutorials
RPi.GPIO Basics series
1.
2.
3.
4.
5.
6.
7.
How to check what RPi.GPIO version you have
How to check what Raspberry Pi board Revision you have
How to Exit GPIO programs cleanly, avoid warnings and protect your Pi
Setting up RPi.GPIO, numbering systems and inputs
Setting up and using outputs with RPi.GPIO
Using inputs and outputs at the same time with RPi.GPIO, and pull-ups/pulldowns
RPi.GPIO cheat sheet
RPi.GPIO more advanced
Interrupts (needs RPi.GPIO 0.5.2+)
1.
2.
3.
4.
Background and simple interrupt: How to use interrupts with Python on the
Raspberry Pi and RPi.GPIO
Threaded callback: How to use interrupts with Python on the Raspberry Pi
and RPi.GPIO – part 2
Multiple threaded callback: How to use interrupts with Python on the
Raspberry Pi and RPi.GPIO – part 3
Edge Detection: Detecting both rising and falling edges with RPi.GPIO
Software PWM
1.
PWM explained: RPi.GPIO 0.5.2a now has software PWM – How to use it
2.
PWM practical: How to use soft PWM in RPi.GPIO 0.5.2a pt 2 – led dimming
and motor speed control

You may redistribute this freely as long as it remains intact.
http://RasPi.TV/rpi-gpio