【Raspberry pi】GPIO注意事项

1、GPIO编码的方法

  1. 第三列是树莓派板子上的自然编号(左边引脚为1-15,右边引脚为2-26),RPi.GPIO.setmode(GPIO.BOARD)采用这列编号
  2. 树莓派主芯片提供商Broadcom的编号方法,相当于调用了WiringPiSetupGpio()RPi.GPIO.setmode(GPIO.BCM)采用这列编号
wiringPi Pin Name Board Pin BCM GPIO
0 GPIO 0 11 17
1 GPIO 1 12 18
2 GPIO 2 13 21
3 GPIO 3 15 22
4 GPIO 4 16 23
5 GPIO 5 18 24
6 GPIO 6 22 25
7 GPIO 7 7 4
8 SDA 3 0
9 SCL 5 1
10 CE0 24 8
11 CE1 26 7
12 MOSI 19 10
13 MISO 21 9
14 SCLK 23 11
15 TXD 8 14
16 RXD 10 15

Rev.2 新增的引脚:

wiringPi Pin Name Board Pin BCM GPIO
17 GPIO 8   28
18 GPIO 9   29
19 GPIO10   30
20 GPIO11   31

【Raspberry pi】GPIO注意事项

2、GPIO的电气特性

Also from the wiki the "maximum permitted current draw from the 3v3 pin is 50mA" and the "maximum permitted current draw from the 5v pin is the USB input current (usually 1A) minus any current draw from the rest of the board." The current draw for Model B is stated as 700mA so with a 1A power supply this leaves about 300mA to play with.

对于3.3伏的线路科承受的电流上限是50mA,对于5V的是700mA,

There will also be an issue with trying to draw to much power form the pins, according to the data-sheet each pin programmed to current drive between 2mA and 16mA, and it has been warned that trying to draw 16mA from several pins at once could also lead to a damaged Pi.

 

对于其他针脚可承受的上限是16mA,对3.3V的话至少要接入210欧的元器件总电阻。

【Raspberry pi】GPIO注意事项

上一篇:PHP开发-远程文件(图片)下载


下一篇:⑥.shell 函数