Notes on: Broadcom board and the GPIO interface and breadboards - RichardChambers/raspberrypi GitHub Wiki
Notes on: Broadcom board and the GPIO interface and breadboards
A plastic breadboard comes with the Osoyoo Raspberry Pi Starter Kit which is used for the various projects. A T connector is pressed into one edge of the breadboard with a 40 pin ribbon cable connecting the Raspberry Pi Broadcom component's 40 pin connector to the 40 pin connector on the T connector. See this article about how to use a breadboard: https://learn.sparkfun.com/tutorials/how-to-use-a-breadboard
The project source code is in the C or C++ programming language and uses the wiringPi library in order to interface with the Raspberry Pi GPIO board.
The wiringPi library has been included into other languages through various C interfaces including python and JavaScript through Node.js.
WARNING: Be careful about the pins connected and used in experiments. The Raspberry Pi GPIO board has both 3.3v and 5v power pins. You can overload the I/O pins, which are 3.3v, by connecting them accidently to the 5v pin and render your Raspberry Pi dead.
Also see this article about using GPIO.cleanup() of python on program exit. http://raspi.tv/2013/rpi-gpio-basics-3-how-to-exit-gpio-programs-cleanly-avoid-warnings-and-protect-your-pi
Unfortunately the wiringPi library itself does not offer such a function however recommendations are to set any GPIO pins used to an INPUT state and to reset any pullup or pulldown resistors as part of cleaning up before exiting. https://raspberrypi.stackexchange.com/questions/44807/wiringpi-cleanup-command
The library was already part of my Raspbian build and I did not need to install it. You can check if it is already installed by using the following command line:
gpio -v
which should print out something like:
pi@raspberrypi:~ $ gpio -v
gpio version: 2.44
Copyright (c) 2012-2017 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
Raspberry Pi Details:
Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Embest
* Device tree is enabled.
*--> Raspberry Pi 3 Model B Rev 1.2
* This Raspberry Pi supports user-level GPIO access.
pi@raspberrypi:~ $
Documentation on the wiringPi library and GPIO
The wiringPi GPIO Interface library for the Raspberry Pi is at URL: http://www.wiringpi.com
The web site has a blog with quite a bit of information about using the library and the Raspberry Pi.
Documentation on the Raspberry Pi GPIO board seems to be a bit sparse however here are some resources.
First of all a YouTube 19 minute video: Raspberry Pi: Using GPIO Inputs https://www.youtube.com/watch?v=NAl-ULEattw
http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/
https://grantwinney.com/using-pullup-and-pulldown-resistors-on-the-raspberry-pi/
See as well this BCM2835 ARM Peripherals document describing the Broadcom board - http://www.element14.com/community/servlet/JiveServlet/downloadBody/43016-102-1-231518/Broadcom.Datasheet.pdf
The gpio utility of the wiringPi library has a readall command that shows the mapping of wiringPi pin designators and the official name of the pin. The column labels indicate the pin naming sceme: BCM is Broadcom standard numbering, wPi is wiringPi library standard numbering, Name is the name and description of the pin. There are two sides to this text diagram reflecting the two sides of a standard T connector used with a breadboard.
Side One || Side Two
pi@raspberrypi:~ $ gpio readall
+-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5v | | |
| 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 0 | IN | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 1 | IN | CE1 | 11 | 7 |
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
| 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | |
| 6 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | IN | GPIO.26 | 26 | 12 |
| 13 | 23 | GPIO.23 | IN | 0 | 33 || 34 | | | 0v | | |
| 19 | 24 | GPIO.24 | IN | 0 | 35 || 36 | 0 | IN | GPIO.27 | 27 | 16 |
| 26 | 25 | GPIO.25 | IN | 0 | 37 || 38 | 0 | IN | GPIO.28 | 28 | 20 |
| | | 0v | | | 39 || 40 | 0 | IN | GPIO.29 | 29 | 21 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
pi@raspberrypi:~ $
wiringPi library for Orange Pi 5 Plus
See the Orange Pi 5 Plus Wiki for details about the board, installing operating systems, and using the 40 pin connector.
The gpio
utility of the wiringPi
library has a readall
command that shows the
mapping of wiringPi
pin designators and the official name of the pin. The column labels
indicate the pin naming scheme: GPIO is Linux standard numbering, wPi is wiringPi library
standard numbering, Name is the name and description of the pin. There are two sides to this
text diagram reflecting the two sides of a standard T connector used with a breadboard.
+------+-----+----------+--------+---+ PI5 PLUS +---+--------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 16 | 0 | SDA.2 | IN | 0 | 3 || 4 | | | 5V | | |
| 15 | 1 | SCL.2 | IN | 0 | 5 || 6 | | | GND | | |
| 62 | 2 | PWM14 | IN | 1 | 7 || 8 | 0 | IN | GPIO1_A1 | 3 | 33 |
| | | GND | | | 9 || 10 | 0 | IN | GPIO1_A0 | 4 | 32 |
| 36 | 5 | GPIO1_A4 | IN | 0 | 11 || 12 | 1 | IN | GPIO3_A1 | 6 | 97 |
| 39 | 7 | GPIO1_A7 | IN | 1 | 13 || 14 | | | GND | | |
| 40 | 8 | GPIO1_B0 | IN | 1 | 15 || 16 | 1 | IN | GPIO3_B5 | 9 | 109 |
| | | 3.3V | | | 17 || 18 | 0 | IN | GPIO3_B6 | 10 | 110 |
| 42 | 11 | SPI0_TXD | IN | 0 | 19 || 20 | | | GND | | |
| 41 | 12 | SPI0_RXD | IN | 0 | 21 || 22 | 0 | IN | GPIO1_A2 | 13 | 34 |
| 43 | 14 | SPI0_CLK | IN | 0 | 23 || 24 | 1 | IN | SPI0_CS0 | 15 | 44 |
| | | GND | | | 25 || 26 | 1 | IN | SPI0_CS1 | 16 | 45 |
| 47 | 17 | GPIO1_B7 | IN | 1 | 27 || 28 | 1 | IN | GPIO1_B6 | 18 | 46 |
| 63 | 19 | GPIO1_D7 | IN | 1 | 29 || 30 | | | GND | | |
| 96 | 20 | GPIO3_A0 | IN | 1 | 31 || 32 | 0 | IN | GPIO1_A3 | 21 | 35 |
| 114 | 22 | GPIO3_C2 | IN | 0 | 33 || 34 | | | GND | | |
| 98 | 23 | GPIO3_A2 | IN | 1 | 35 || 36 | 0 | IN | GPIO3_A5 | 24 | 101 |
| 113 | 25 | GPIO3_C1 | IN | 0 | 37 || 38 | 0 | IN | GPIO3_A4 | 26 | 100 |
| | | GND | | | 39 || 40 | 1 | IN | GPIO3_A3 | 27 | 99 |
+------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+--------+---+ PI5 PLUS +---+--------+----------+-----+------+
The library source code is in the GitHub repository https://github.com/orangepi-xunlong/wiringOP