Orange ft One / Lite (tutorial): use the GPIO in Python, pins (pinout) [Exclusive Guide]

3:27 pm January 16, 201712463

Orange Pi for an extension connector ( GPIO ) 40 pin compatible with that of the Raspberry Pi (model B +). In this tutorial, we will install python so that the bookstore pyA20 adapted to the GPIO of Orange Pi. On paper, the connector is compatible, only flat call of the pins is different what needed to resume the Python programs developed for the Raspberry.  It’s a shame but the very attractive price of the Orange IP range remains a strong argument.

for this tutorial, I used Armbian installed on a Orange Pi Lite (Wi – Fi version). The GPIO is the same across the Orange IP range with the exception of the Orange Pi Zero that for a 26 GPIO pins.

Let’s start by preparing the environment by installing Python

now we need to install the library that allows to manage the GPIO of Orange Pi. Place you in your Home (for example/home/pi) folder and then clone the library pyH3 ( https://github.com/duxingkei33/orangepi_PC_gpio_pyH3 ). It is an adaptation by Duxingkei Chow of the ‘python control orangepi_PC ALLwinner H3 ext GPIO’ library based on the bookstore “pyA20 0.2.1.

enter the directory of the library

and start the installation (it is preferable to previous order by a sudo if you are not connected as root).

as I mentioned in the introduction, the expansion slot is compatible with that of the Raspberry models B + (40 pins). The location, however, is different.

Raspberry Pi Orange Pi pin

(colonne gauche)

pin

(colonne droite)

Orange Pi Raspberry Pi
3V3 1 2 + 5V + 5V
GPIO2

SDA1 I2C

PA12 3 4 + 5V + 5V
GPIO3

I2C SCL

PA11 5 6 GND GND
GPIO4 PA6 7 8 PA13 GPIO14

UART_TXD

GND GND 9 10 PA14 GPIO15

UART_RXD

GPIO17 PA1 11 12 PD14 GPIO18

PCM_CLK

GPIO27 PA0 13 14 GND GND
GPIO22 PA3 15 16 PC4 GPIO23
3V3 3V3 17 18 FP7 GPIO24
GPIO10

SPI0_MOSI

PC0 19 20 GND GND
GPIO9

SPI0_MISO

PC1 21 22 PA2 GPIO25
GPIO11

SPI0_SCLK

PC2 23 24 PC3 GPIO8

SPI0_CE0_N

GND GND 25 26 PA21 GPIO7

SPI0_CE1_N

ID_SD

I2C EEPROM ID

PA19 27 28 PA18 ID_SC

I2C EEPROM ID

GPIO5 PA7 29 30 GND GND
GPIO6 PA8 31 32 PG8 GPIO12
GPIO13 PA9 33 34 GND GND
GPIO19 PA10 35 36 PG9 GPIO16
GPIO26 PA20 37 38 PG6 GPIO20
GND GND 39 40 PG7 GPIO21

just like on the Raspberry Pi, the output voltage is 3, 3V.

finally last difference (!) and the connector is turned 180 degrees compared with the Raspberry. Mean will necessarily be required to a sign for breadboard with a tablecloth flexible If you want to connect the Orange to a breadboard (breakout) of connection

for this first tutorial on the GPIO of Orange Pi, we’re not going very far. Anyway it is exactly the same as for the Raspberry. It’s the call of the pins that differs.

create a new file. For example test.py

, paste the following code and save with Ctrl + X then Y. This code is very simple, it turns on for 2 seconds a Led connected to pin PG7 (equivalent to the GPIO21 of the Raspberry). Connect a Led on pin PG7 (the last of the right column) to a GND through 220Ω resistance.

we make the script executable

you not logged as root, should precede the python of a sudo command (the password you will be asked).

if the wiring is correct, the Led should light for 2 seconds.

orange pi one lite raspberry gio python

that is, you have now all what you need to use the GPIO of Orange Pi. It is a pity that the calls are different. Existing programs are not directly usable. Another regret, the rotation of the connector that makes use of the cards much less convenient (and compact!) HAT