Follow @devcrafter91

Getting Started with Orange Pi (PC2)

Thu May 30 2019 embedded IOT orangepi devices

Intro

Orange Pi are some great open source boards, they're cheaper and powerful than their competitors like Raspberry Pi or Banana Pi boards but they lack some support and besides their forums you can't find any good tutorial and enough informations about their products. I'm not trying to advertise these bad guys but if you want something cheap/powerful and you're willing to take risks messing with code and stuff then Orange Pi is your choice. Before we begin this short tutorial I would like to say a few things. First of all, your Orange Pi board is not dead or have a short circuit as you think and please stop giving wrong impressions or negative reviews. Now, of course you will ask yourself why my orange pi LEDs are not working when I power on the board? Truth is no LED is not programmed to turn when powered on, until you successfully burn the image on your high speed SD card and supply enough power to your Orange Pi, LEDS are not gonna work.

What should I buy

orange pi pc2

5V/3A Power supply

You need to buy a certain power supply capable of producing 5V, 3A. I've tested it with power supplies like 2A/2.5 and it was FAILING badly or and stucking during boot. Do not skip that cause you'll have a brick board.

Fast microSD card
You must have a decent SD card with high read/write speed because your orange pi is not gonna work properly. I tried SD cards with low speeds and sometimes I was having boot problems and stuff so don't try it. I spent 8 euro on a Transcend Micro SD Card 60 mb/s UHS-I 400X and it's working perfectly without any problems for months now.

How to flash

1: Go to http://www.orangepi.org/downloadresources/ and download a Linux image (not Android) for your board.
2: Download & install Ether from https://www.balena.io/etcher.
3: Clean your microSD card using diskpart (Windows) or fdisk (Linux). Do not skip this!
4: Burn the image using Etcher

GPIO pins

Read your manufacturers pdf because some boards with Allwiners H3 processors may work using libraries from https://github.com/zhaolei/WiringOP.git and others like PC2 with H5 many need a modified version of WiringPi. I'm using this version without problems on my PC2 (H5) https://github.com/tumugin/WiringOP.

Led blink using the Pins (PC2 H5)

SSH into your Orange Pi and run the following commands at root.

git clone https://github.com/tumugin/WiringOP -b h5
cd WiringOP
chmod +x ./build
./build
gpio readall

Result:

 +-----+-----+----------+------+---+-Orange Pi+---+---+------+---------+-----+--+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
 |  12 |   8 |    SDA.0 | ALT5 | 0 |  3 || 4  |   |      | 5V       |     |     |
 |  11 |   9 |    SCL.0 | ALT5 | 0 |  5 || 6  |   |      | 0v       |     |     |
 |   6 |   7 |   GPIO.7 | ALT3 | 0 |  7 || 8  | 0 | ALT5 | TxD3     | 15  | 13  |
 |     |     |       0v |      |   |  9 || 10 | 0 | ALT5 | RxD3     | 16  | 14  |
 |   1 |   0 |     RxD2 | ALT5 | 0 | 11 || 12 | 0 | ALT3 | GPIO.1   | 1   | 110 |
 |   0 |   2 |     TxD2 | ALT5 | 0 | 13 || 14 |   |      | 0v       |     |     |
 |   3 |   3 |     CTS2 | ALT5 | 0 | 15 || 16 | 0 | ALT3 | GPIO.4   | 4   | 68  |
 |     |     |     3.3v |      |   | 17 || 18 | 0 | ALT3 | GPIO.5   | 5   | 71  |
 |  64 |  12 |     MOSI | ALT4 | 0 | 19 || 20 |   |      | 0v       |     |     |
 |  65 |  13 |     MISO | ALT0 | 0 | 21 || 22 | 0 | ALT5 | RTS2     | 6   | 2   |
 |  66 |  14 |     SCLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE0      | 10  | 67  |
 |     |     |       0v |      |   | 25 || 26 | 0 | ALT3 | GPIO.11  | 11  | 21  |
 |  19 |  30 |    SDA.1 | ALT4 | 0 | 27 || 28 | 0 | ALT4 | SCL.1    | 31  | 18  |
 |   7 |  21 |  GPIO.21 | ALT3 | 0 | 29 || 30 |   |      | 0v       |     |     |
 |   8 |  22 |  GPIO.22 | ALT3 | 0 | 31 || 32 | 0 | ALT5 | RTS1     | 26  | 200 |
 |   9 |  23 |  GPIO.23 | ALT3 | 0 | 33 || 34 |   |      | 0v       |     |     |
 |  10 |  24 |  GPIO.24 |  OUT | 1 | 35 || 36 | 0 | ALT5 | CTS1     | 27  | 201 |
 |  20 |  25 |  GPIO.25 |  OUT | 1 | 37 || 38 | 0 | ALT5 | TxD1     | 28  | 198 |
 |     |     |       0v |      |   | 39 || 40 | 0 | ALT5 | RxD1     | 29  | 199 |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+-Orange Pi+---+------+----------+-----+-----+

Now based on the result you got back from gpiop plug your LED into 35 pin (positive) and 39 pin (negative)

After you connected the pins, run gpio mode 24 output to set PIN to output and gpio write 24 1 to power on the LED or gpio write 24 0 to power it off.

orange pi pc2

Share