In this guide, you’ll find the Orange Pi Zero pinout diagrams (the 26-pin GPIO header and the 13-pin interface header), its datasheet and schematic diagram, and every pin group explained with its default pins and the Armbian overlay that enables it. Without further ado, let’s get right into it!
The Orange Pi Zero is a tiny (48 x 46mm) Linux board built around the Allwinner H2+ (some batches carry the H3): a quad-core Cortex-A7 with 256MB or 512MB of DDR3, 100Mbps Ethernet, and XR819 Wi-Fi. It’s still one of the cheapest headless Linux boards around. The pinout is identical on every revision, including the Orange Pi Zero LTS (v1.5), and on both the H2+ and H3 versions.
Orange Pi Zero Pinout Diagram
Here is a detailed Orange Pi Zero Pinout Diagram with colored labels and legends to help you easily identify the functionalities that each pin can perform. Each pin of the 26-pin GPIO header shows its physical pin number, the Allwinner port name (PA12 style), the Linux GPIO number, the wiringOP (wPi) number, and the functions you can turn on with Armbian’s overlays. The same pinout applies to every Orange Pi Zero: H2+ and H3 boards, and the Orange Pi Zero LTS (v1.5).
Read it from the grey strip in the middle: odd pins (1, 3, 5…) are the left column, which is the row along the board edge, and even pins (2, 4, 6…) are the right column, the inner row. Pin 1 is the square pad at the end of the header away from the Ethernet jack. The small square next to a port name means the pin is 3.3v only, and the numbered badges point to the notes at the bottom of the diagram. The header ships unpopulated, so you’ll solder a 2×13 male header (2.54mm) yourself.
Note: Orange Pi’s user manual (v0.9.1, page 7) and its wiki show a 26-pin table that was copied from another board (it lists PL0/PL1 on pins 11/13 and PD11/PD14 on pins 12/26). Don’t use it. The Orange Pi Zero schematic v1.5, Orange Pi’s own pin picture, and the wiringOP pin map all agree with each other, and that’s what this guide follows.
Orange Pi Zero 26-Pin Header Pin Table
Click to expand the full pin table (26 pins)
| Pin | Name | Linux # | wPi | Functions |
|---|---|---|---|---|
| 1 | 3.3V | – | – | 3.3v power |
| 2 | 5V | – | – | 5v power |
| 3 | PA12 | 12 | 0 | I2C0_SDA, DI_RX |
| 4 | 5V | – | – | 5v power |
| 5 | PA11 | 11 | 1 | I2C0_SCL, DI_TX |
| 6 | GND | – | – | Ground |
| 7 | PA6 | 6 | 2 | GPIO (SIM_PWREN); no PWM on the H2+ |
| 8 | PG6 | 198 | 3 | UART1_TX |
| 9 | GND | – | – | Ground |
| 10 | PG7 | 199 | 4 | UART1_RX |
| 11 | PA1 | 1 | 5 | UART2_RX, JTAG_CK |
| 12 | PA7 | 7 | 6 | GPIO (SIM_CLK) |
| 13 | PA0 | 0 | 7 | UART2_TX, JTAG_MS |
| 14 | GND | – | – | Ground |
| 15 | PA3 | 3 | 8 | UART2_CTS, JTAG_DI |
| 16 | PA19 | 19 | 9 | I2C1_SDA, PCM0_CLK |
| 17 | 3.3V | – | – | 3.3v power |
| 18 | PA18 | 18 | 10 | I2C1_SCL, PCM0_SYNC |
| 19 | PA15 | 15 | 11 | SPI1_MOSI, UART3_RTS |
| 20 | GND | – | – | Ground |
| 21 | PA16 | 16 | 12 | SPI1_MISO, UART3_CTS |
| 22 | PA2 | 2 | 13 | UART2_RTS, JTAG_DO |
| 23 | PA14 | 14 | 14 | SPI1_CLK, UART3_RX |
| 24 | PA13 | 13 | 15 | SPI1_CS0, UART3_TX |
| 25 | GND | – | – | Ground |
| 26 | PA10 | 10 | 16 | GPIO (SIM_DET) |
Orange Pi Zero vs Raspberry Pi GPIO Header
The Orange Pi Zero’s 26 pins line up with the first 26 pins of a Raspberry Pi header: power, ground, I2C (pins 3/5), the UART (pins 8/10), and SPI (pins 19/21/23/24) sit in the same places. That’s why many small Pi add-on boards plug straight in. The functions behind the other pins are different, though, the Pi’s BCM GPIO numbers don’t apply, and there’s no ID EEPROM (pins 27/28) or anything past pin 26. Check a HAT’s pins before you rely on its Pi software.
Orange Pi Zero 13-Pin Header Pinout
The Orange Pi Zero has a second, 13-pin interface header (1×13, 2.54mm) along the other edge of the board. It carries two extra USB 2.0 host ports, analog line out, a microphone input, composite TV-out, and the IR receiver pin. It’s made for Orange Pi’s expansion board, which adds the USB jacks, a 3.5mm jack, a microphone, and an IR receiver.
Pin 1 is at the USB-A end of the header (marked ▶ on the board). Only pin 13 is a GPIO; the rest are USB, audio, and video signals straight from the SoC.
Click to expand the full pin table (13 pins)
| Pin | Name | Linux # | Function |
|---|---|---|---|
| 1 | 5V | – | 5v power (DCIN-5V) |
| 2 | GND | – | Ground |
| 3 | USB2 D− | – | USB 2.0 host port 2, data − |
| 4 | USB2 D+ | – | USB 2.0 host port 2, data + |
| 5 | USB3 D− | – | USB 2.0 host port 3, data − |
| 6 | USB3 D+ | – | USB 2.0 host port 3, data + |
| 7 | LINE R | – | Line out, right channel |
| 8 | LINE L | – | Line out, left channel |
| 9 | TV-OUT | – | Composite video (CVBS) |
| 10 | MIC BIAS | – | Microphone bias (MBIAS) |
| 11 | MIC1 P | – | Microphone input 1, positive |
| 12 | MIC1 N | – | Microphone input 1, negative |
| 13 | PL11 | 363 | IR receiver input (S_CIR_RX), GPIO |
Buy an Orange Pi Zero: If you don’t have one yet, you can get the official board (the 512MB LTS version) from Amazon or AliExpress. It’s one of the cheapest ways to get a real Linux board with Ethernet and Wi-Fi on your desk.
Download Orange Pi Zero Pinout Diagrams (Full Resolution)
Both Orange Pi Zero pinout diagrams (the 26-pin GPIO header and the 13-pin interface header) in full resolution (5120 px), in one ZIP file.
Orange Pi Zero Datasheet
The Orange Pi Zero is built around the Allwinner H2+ system-on-chip. Orange Pi doesn’t publish a separate board datasheet: the user manual holds the specs, and the H2+ datasheet holds the pin functions and electrical limits. Here are the official documents (Orange Pi hosts them on Google Drive, linked from its Orange Pi Zero service and support page, which also serves the LTS):
| Document | Version / Date | What You’ll Use It For | Link |
|---|---|---|---|
| Allwinner H2+ Datasheet | V1.2, 30 Aug 2015 | Pin multiplexing (Table 3-2: every function of every port), electrical characteristics, the SoC block diagram | |
| Orange Pi Zero Schematic (OrangePi_zero_schematic) | v1.5, 19 Feb 2019 (12 sheets) | The 26-pin and 13-pin headers, the I2C pull-ups, LEDs, debug UART (sheet 11), power (sheet 7), CPU pins (sheet 6) | |
| Orange Pi Zero Assembly Drawing (asmtop) | v1.1 | Part positions and the square pin 1 pads of both headers | |
| Orange Pi Zero User Manual | v0.9.1 | Specs, first boot, the debug UART setup (ignore its 26-pin table) | |
| Orange Pi Zero Mechanical Drawing | – | Board outline (48 x 46mm), mounting holes, and connector positions for cases | |
| Orange Pi Zero Product Page | Live | Hardware specification and Orange Pi’s pin picture | Web |
| wiringOP | GitHub (live) | Orange Pi’s GPIO library, the wPi pin map and gpio readall | GitHub |
Which document do I need? The H2+ datasheet for what each pin can do, the schematic for what the board wires to each pin, and the assembly drawing to find pin 1. The schematic folder on Orange Pi’s Drive also holds the older v1.1 schematic; the headers are the same, so use v1.5. The H2+ and the H3 are the same die with the same pin map, which is why Orange Pi kept the header layout unchanged when it fitted either chip.
Orange Pi Zero Schematic
Orange Pi publishes the full Orange Pi Zero schematic (v1.5, 12 sheets). The carousel below shows the three sheets that matter when you wire the board: the CPU sheet with every GPIO ball, the power sheet, and the EXT sheet with both headers, the LEDs, and the debug port. Click a page to view it full screen.
Official source: the Orange Pi Zero schematic (PDF), OrangePi_zero_schematic_v1.5, 19 February 2019, from Orange Pi’s schematic folder. The watermark across the sheets is on Orange Pi’s own file. Here’s what to look at:
- Power input (sheet 7): the micro-USB VBUS goes through Q10, an AO3415A P-channel MOSFET, to the DCIN-5V net. That 5v net is what you get on header pins 2 and 4 and on pin 1 of the 13-pin header. There’s no fuse. A SY8089A buck converter makes the 3.3v rail (VCC-IO, rated 3.3v / 2A for the whole board), and the header’s VCC3V3-EXT pins (1 and 17) hang off it.
- CPU core and memory (sheet 7): a SY8113B (3A) feeds the CPU core at 1.1v or 1.3v, switched by the CPUX-VSET line (PL6), so Linux can raise the voltage for the higher clock steps. A SY8008B powers the DDR3, another SY8089A makes the 1.2v system rail, and a separate 3.3v / 300mA LDO powers the XR819 Wi-Fi chip.
- 26-pin header CON4 (sheet 11): every GPIO goes straight to the SoC, with no level shifter and no series resistor. The only parts on the header lines are four 2kΩ pull-ups to VCC3V3-EXT: R151/R152 on TWI0 (pins 3/5) and R153/R154 on TWI1 (pins 16/18).
- 13-pin header CON5 (sheet 11): USB-DM2/DP2 and USB-DM3/DP3 come from the SoC’s USB host controllers 2 and 3, LINEOUTR/L, TV-OUT, MIC-MBIAS, and MIC1P/N from its audio codec and TV encoder, and pin 13 is IR-RX (PL11). Pin 1 is DCIN-5V. There’s no VBUS switch or fuse for the USB ports.
- LEDs (sheet 11): PWR-LED (PL10) drives D7, the red LED, and STATUS-LED (PA17) drives D8, the green LED, both active high through 2kΩ resistors. The mainline Linux device tree names them the other way round (“green:pwr” on PL10, “red:status” on PA17).
- Debug UART J3 (sheet 11): a 3-pin header with pin 1 = GND (square pad), pin 2 = RX (PA5, UART0 RX), and pin 3 = TX (PA4, through a 0Ω resistor). It’s UART0, the Linux console.
- Keys (sheet 11): the KEY block draws RECOVERY and UBOOT buttons with 47kΩ pull-ups, but no buttons are fitted on the board.
Orange Pi Zero Specs
Here are the Orange Pi Zero specifications, with the board-level details that matter when you wire it:

Get an Orange Pi Zero: the official Orange Pi board is the one I recommend. Grab it from Amazon or AliExpress.
| Feature | Orange Pi Zero |
|---|---|
| SoC | Allwinner H2+ (some batches: H3), 4x Cortex-A7, up to 1.008GHz on mainline Linux (1.2GHz with Armbian’s CPU clock overlay) |
| GPU | Mali-400 MP2 |
| RAM | 256MB or 512MB DDR3 (shared with the GPU) |
| Storage | microSD slot, 2MB SPI NOR flash |
| Ethernet | 10/100Mbps RJ45 (passive PoE option, off by default) |
| Wireless | Allwinner XR819, Wi-Fi 802.11 b/g/n, external antenna (no Bluetooth) |
| USB | 1x USB 2.0 Type-A host, 1x micro-USB OTG (also the power input), 2x USB 2.0 host on the 13-pin header |
| Video / audio | No HDMI; composite TV-out, line out and microphone on the 13-pin header |
| GPIO header | 26-pin (2×13, 2.54mm, unpopulated), 17 GPIOs, 3.3v logic, not 5v tolerant |
| Other headers | 13-pin interface header, 3-pin debug UART (115200 baud) |
| Keys / LEDs | No buttons; red power LED (PL10), green status LED (PA17) |
| Power input | 5v / 2A through micro-USB (or 5v into header pins 2/4) |
| 3.3v regulator | SY8089A buck converter, 3.3v / 2A for the whole board |
| Size / weight | 48 x 46mm, 26g |
Orange Pi Zero Specifications Summary
- The Orange Pi Zero has a 26-pin GPIO header (not 40 pins) plus a 13-pin interface header.
- It has 17 GPIOs on the 26-pin header (plus PL11 on the 13-pin), all 3.3v and not 5v tolerant.
- Every header GPIO is wired directly to the SoC: no level shifters, no series resistors.
- Pins 3, 5, 16, and 18 have 2kΩ pull-ups to 3.3v (for I2C0 and I2C1), so they idle high.
- Power pins: 5v on pins 2 and 4, 3.3v on pins 1 and 17, and 5 GND pins (6, 9, 14, 20, 25).
- There are no analog inputs on the board: add an external I2C or SPI ADC.
- UART: 3 on the header. UART1 is on pin 8 (TX) and pin 10 (RX), UART2 on 13/11, and UART3 on the SPI pins.
- I2C: 2 buses, I2C0 (pins 3/5) and I2C1 (pins 16/18).
- SPI: SPI1 on pins 19, 21, 23, and 24 (CS0) → /dev/spidev1.0.
- PWM: no hardware PWM on the 26-pin header. The only PWM output (PWM0) is on PA5, the debug UART’s RX pin.
- Debug console: a separate 3-pin UART header (GND, RX, TX) at 115200 baud.
- The pinout is the same on the H2+ and H3 boards and on the LTS (v1.5).
Orange Pi Zero H2+ vs H3 and the LTS Version
The H2+ is a cut-down H3: same die, same pin map, but without HDMI and Gigabit Ethernet, which the Orange Pi Zero doesn’t have anyway. So the 26-pin and 13-pin pinouts are identical on H2+ and H3 boards. The Orange Pi Zero LTS is the later v1.5 board (the one Orange Pi still sells), with the same headers. Orange Pi quoted lower power draw for it (about 250mA idle instead of 310mA, and 610mA under load instead of 730mA), so it runs a little cooler.
Orange Pi Zero H2+ Peripherals vs the 26-Pin Header
| Peripheral | On the Headers | Armbian Overlay | Linux Device / Notes |
|---|---|---|---|
| GPIO | 17 pins (26-pin) + PL11 (13-pin) | Always available | /dev/gpiochip0 (PA, PG), /dev/gpiochip1 (PL) |
| UART | 3: UART1, UART2, UART3 | uart1, uart2, uart3 | /dev/ttyS1, ttyS2, ttyS3; UART2 and UART3 can add RTS/CTS |
| I2C | 2: I2C0, I2C1 | i2c0, i2c1 | /dev/i2c-0, /dev/i2c-1 (2kΩ pull-ups on the board) |
| SPI | 1: SPI1 (CS0) | spi-spidev + param_spidev_spi_bus=1 | /dev/spidev1.0; SPI0 is used by the SPI flash |
| PWM | None on the headers | pwm (PA5 only) | PWM0 is on the debug UART’s RX pin |
| USB host | 2 on the 13-pin header | usbhost2, usbhost3 | Off until enabled |
| Audio | Line out + mic on the 13-pin header | analog-codec | No amplifier on the board |
| TV-out | CVBS on the 13-pin header | tve (newer Armbian kernels) | Not in the mainline device tree |
| IR receiver | PL11 on the 13-pin header | cir | /dev/lirc0 |
| ADC | None | – | The H2+ has no general-purpose ADC |
Orange Pi Zero Quick Pin Selection Guide
| Use Case | Recommended Pins | Why |
|---|---|---|
| Serial port / UART | Pin 8 (UART1 TX), pin 10 (UART1 RX) | Same position as the Raspberry Pi’s UART, /dev/ttyS1 |
| A second UART | Pins 13 (TX) / 11 (RX), UART2 | /dev/ttyS2; leaves the SPI pins free |
| I2C sensors and displays | Pins 3 (SDA) / 5 (SCL), I2C0 | 2kΩ pull-ups on the board, /dev/i2c-0 |
| A second I2C bus | Pins 16 (SDA) / 18 (SCL), I2C1 | Pull-ups on the board too, /dev/i2c-1 |
| SPI device | Pins 19, 21, 23 + CS0 pin 24 | The only SPI bus on the header |
| Hardware PWM | PA5 on the debug header (middle pin) | The only PWM pin; costs you the serial console |
| LED or button | Pin 12 (PA7), pin 26 (PA10), or pin 7 (PA6) | Free pins with no bus function and no pull-up |
| Infrared remote | Pin 13 of the 13-pin header (PL11) | The SoC’s IR receiver input |
| Relays, motors, fans | Any GPIO through a transistor or driver board | GPIOs only switch logic levels |
| Analog input | None on the board | Add an I2C or SPI ADC |
Orange Pi Zero Pins to Use With Caution
| Pin | Reason | What to Do |
|---|---|---|
| Pins 3, 5, 16, 18 | 2kΩ pull-ups to 3.3v on the board | They idle high as GPIOs; use them as inputs only for active-low signals |
| Pin 7 (PA6) | Labelled PWM1, but the H2+ has no PWM on PA6 | Use it as a plain GPIO |
| Pins 8/10 vs 11/13 | UART1 is 8/10, UART2 is 13/11; the names trip people up | Match the overlay to the pins (uart1 = pins 8/10) |
| Pins 19, 21, 23, 24 | SPI1 and UART3 share them | Enable only one of spi-spidev and uart3 |
| Pins 11, 13, 15, 22 | Also the JTAG pins | Fine as GPIO or UART2 in Linux |
| Pins 2, 4 (5v) | Board 5v rail after the input MOSFET, no fuse | Don’t feed them and micro-USB at the same time |
| Pins 1, 17 (3.3v) | Shared with the whole board’s 3.3v rail | Light loads only |
| Any GPIO | Not 5v tolerant | Level-shift 5v signals |
Orange Pi Zero Pins Functions
Only 17 of the 26 pins of the Orange Pi Zero GPIO header are GPIO pins; the rest are power and ground. The pins are divided into the following groups based on the hardware functionality they’re used for.
- Power Pins (2x 5v, 2x 3.3v, 5x GND)
- 17x GPIO Pins (with 3 numbering systems)
- Analog Input Pins (none)
- 3x UART
- 2x I2C Buses
- 1x SPI Bus (SPI1)
- PWM Pins (only PA5, on the debug header)
- JTAG and Other Functions
- Debug UART Pins (separate 3-pin header)
- USB, Audio, TV-Out, and IR (13-pin header)
Most pins can do two jobs, and each job is turned on with its own overlay in /boot/armbianEnv.txt. Pick the overlays first, so no two of them claim the same pin. Device names in this guide follow Armbian, because Orange Pi’s own images for this board are old (Linux 3.4 and 5.x). We’ll discuss each pin group in the following sections one by one in more detail.
Orange Pi Zero Power Pins
The Orange Pi Zero 26-pin header has two 5v pins (2 and 4), two 3.3v pins (1 and 17), and five GND pins (6, 9, 14, 20, and 25). The 13-pin header adds one more 5v pin (pin 1) and a GND (pin 2). They’re highlighted in red and black in the pinout diagram.

| Pin | Name | Function | Notes |
|---|---|---|---|
| 1, 17 | 3.3V | 3.3v output | VCC3V3-EXT, from the board’s SY8089A 3.3v / 2A rail (shared with the SoC) |
| 2, 4 | 5V | 5v output or input | DCIN-5V, the micro-USB 5v after the input MOSFET (Q10) |
| 6, 9, 14, 20, 25 | GND | Ground | Common ground for everything you connect |
| 13-pin: 1 / 2 | 5V / GND | 5v and ground | Same DCIN-5V net, for the expansion board’s USB ports |
5V pins: when you power the Orange Pi Zero from micro-USB, these pins give you that same 5v (minus the small drop across Q10), so you can power modules from them. They also work as a 5v input: a regulated 5v supply on pins 2/4 and GND runs the board without the micro-USB cable. There’s no fuse on this net, so a short on pin 2 or 4 goes straight back to your supply.
3.3V pins: a 3.3v output for sensors and logic chips. The regulator is rated 2A, but that’s for the whole board (SoC I/O, Ethernet PHY, SD card, LEDs), so keep the header load small and give motors, LED strips, and other heavy loads their own supply.
Power supply and heat: use a good 5v / 2A supply with a short, thick micro-USB cable. A phone charger or a thin cable is the number one cause of random reboots and “won’t boot” reports, because the voltage sags when the four cores and the Wi-Fi load up. The H2+ also runs hot in such a small board: put a small heatsink on the SoC, and if it still throttles or locks up, cap the CPU at 912MHz (for example with armbian-config or the cpufreq governor settings).
Note: Never connect a supply to the 5v pins while the micro-USB power cable is plugged in. Q10 keeps the header supply from feeding back into the USB port, but two supplies on one rail is still asking for trouble. Use one or the other, and if you power the board from the header, use a regulated 5v supply rated for at least 2A.
Never forget to connect the ground of every circuit to the Orange Pi Zero’s GND (common ground). External sensors and modules need the same ground line as the board to communicate with it properly.
Orange Pi Zero GPIO Pins
The Orange Pi Zero has 17 GPIO pins on its 26-pin header, and every one of them is a 3.3v pin that is not 5v tolerant. Each one can be an input or an output, or be switched to an alternate function (UART, I2C, or SPI) with an overlay. One more GPIO, PL11, sits on pin 13 of the 13-pin header.

| Parameter | Orange Pi Zero GPIO |
|---|---|
| Logic level | 3.3v |
| 5v tolerant | No, on every pin |
| Wiring | Directly to the H2+ (no level shifters, no series resistors) |
| On-board pull-ups | 2kΩ to 3.3v on pins 3, 5, 16, and 18 |
| Internal pull-up / pull-down | Yes, on every GPIO, set from software |
| Current per pin | Keep it to a few mA; drive LEDs through a resistor and anything bigger through a transistor |
| Interrupts | Edge events on every header GPIO (PA and PG banks) through libgpiod; wiringOP’s wiringPiISR() |
| Free pins (no bus function) | Pin 7 (PA6), pin 12 (PA7), pin 26 (PA10) |
Because nothing sits between the header and the SoC, the Orange Pi Zero GPIOs behave like a microcontroller’s pins: the internal pull resistors work, and so do outputs that drive an LED through a 330Ω–1kΩ resistor. The one exception is the four I2C pins (3, 5, 16, 18). Their 2kΩ pull-ups win against any internal pull-down, so they read high when nothing drives them. Use them for active-low buttons or outputs, or leave them for I2C.
Orange Pi Zero GPIO Numbering: Physical vs Allwinner vs Linux vs wiringOP
Every GPIO on the Orange Pi Zero has four names, and each tool wants a different one. Take physical pin 12 as an example:
| Numbering | Pin 12 Is | Used By |
|---|---|---|
| Physical | 12 | Counting pins on the header (1–26) |
| Allwinner port name | PA7 | The schematic, the H2+ datasheet, the device tree, Armbian overlay parameters |
| Linux GPIO number | 7 | sysfs (/sys/class/gpio); in libgpiod it’s gpiochip0, line 7 |
| wiringOP (wPi) | 6 | wiringOP C/Python functions and gpio readall |
The Linux number comes from the port name: bank × 32 + pin, where A = 0, B = 1, C = 2, and so on. PA7 is 0 × 32 + 7 = 7, PG6 (pin 8) is 6 × 32 + 6 = 198, and the PL bank counts as bank 11, so the power LED’s PL10 is 11 × 32 + 10 = 362 and the IR pin PL11 is 363. In libgpiod, the main GPIO controller (ports PA to PG) is gpiochip0 and the line offset is the same number (PG6 = line 198), while the PL port is its own controller, gpiochip1, with PL11 at line 11. Run gpiodetect once to confirm the chip names on your image.
The Raspberry Pi’s BCM numbers don’t apply here. A Pi tutorial that says “GPIO17” means the Pi’s physical pin 11, which is PA1 (Linux 1, wPi 5) on the Orange Pi Zero. Translate by physical pin, using the table above. wiringOP only knows the wPi numbers, and gpio readall prints all of them next to the physical pins.
|
1 2 3 4 |
gpio readall # wiringOP: physical, wPi, port name and mode of every pin gpiodetect # libgpiod: list the GPIO controllers gpioinfo gpiochip0 | head # libgpiod: lines of the PA..PG controller gpioset gpiochip0 7=1 # libgpiod v1 tools: drive PA7 (pin 12) high |
Orange Pi Zero GPIO Code Example (C/C++ and Python)
Here’s the same job in both languages: blink an LED on pin 12 (PA7), a free pin with no bus function. Wire the LED’s anode to pin 12 through a 330Ω resistor, and its cathode to GND on pin 14. Both use the libgpiod v2 API (gpiochip0, line 7): install libgpiod-dev on a release that packages v2 (Debian 13, Ubuntu 24.04, or a current Armbian) and pip install gpiod for the Python bindings. Images that ship libgpiod v1.6 need the older API.
C/C++ (libgpiod v2)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// Blink an LED on pin 12 (PA7) with libgpiod v2 // Build: gcc blink.c -o blink -lgpiod #include <gpiod.h> #include <unistd.h> int main(void) { unsigned int line = 7; /* PA7 = bank A (0) x 32 + 7 */ struct gpiod_chip *chip = gpiod_chip_open("/dev/gpiochip0"); struct gpiod_line_settings *st = gpiod_line_settings_new(); gpiod_line_settings_set_direction(st, GPIOD_LINE_DIRECTION_OUTPUT); struct gpiod_line_config *cfg = gpiod_line_config_new(); gpiod_line_config_add_line_settings(cfg, &line, 1, st); struct gpiod_line_request *led = gpiod_chip_request_lines(chip, NULL, cfg); for (int i = 0; i < 10; i++) { gpiod_line_request_set_value(led, line, (i % 2) ? GPIOD_LINE_VALUE_INACTIVE : GPIOD_LINE_VALUE_ACTIVE); usleep(500000); } gpiod_line_request_release(led); gpiod_chip_close(chip); return 0; } |
Python (gpiod v2)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# Blink an LED on pin 12 (PA7) with the gpiod v2 bindings # Run: sudo python3 blink.py import time import gpiod from gpiod.line import Direction, Value LINE = 7 # PA7 = gpiochip0, line 7 with gpiod.request_lines( "/dev/gpiochip0", consumer="blink", config={LINE: gpiod.LineSettings(direction=Direction.OUTPUT)}) as req: for _ in range(5): req.set_value(LINE, Value.ACTIVE) time.sleep(0.5) req.set_value(LINE, Value.INACTIVE) time.sleep(0.5) |
With wiringOP the same LED is gpio mode 6 out and gpio write 6 1 in the terminal, because pin 12 is wPi 6. In C, that’s pinMode(6, OUTPUT) and digitalWrite(6, HIGH) after wiringPiSetup(). wiringOP reads the board name from /etc/armbian-release or /etc/orangepi-release (BOARD=orangepizero), so it works on Armbian once you build it from Orange Pi’s GitHub.
Note: The Orange Pi Zero’s GPIOs are not 5v tolerant, and there’s nothing between the header and the SoC to protect them. 5v on a header pin can damage the H2+ for good. To connect 5v logic (an Arduino’s TX pin, a 5v sensor output), use a level shifter or a resistor divider.
Orange Pi Zero Analog Input Pins (ADC)
The Orange Pi Zero has no analog input pins. The H2+ has no general-purpose ADC (its only analog inputs are the audio codec’s microphone pins on the 13-pin header). To read a potentiometer or an analog sensor, add an external ADC such as an ADS1115 (16-bit, I2C) on pins 3/5, or an MCP3008 (10-bit, SPI) on SPI1. Power the ADC from 3.3v, so its digital lines stay at the board’s logic level.
Orange Pi Zero UART Pins
The Orange Pi Zero has 3 UARTs on its 26-pin header: UART1 on pin 8 (TX) and pin 10 (RX), UART2 on pin 13 (TX) and pin 11 (RX), and UART3 on the SPI pins. Each one is off by default and is turned on with its Armbian overlay.
Orange Pi Zero Default UART Pins: PG6 (UART1 TX, pin 8) and PG7 (UART1 RX, pin 10).

| UART | TX | RX | RTS / CTS | Overlay | Linux Device |
|---|---|---|---|---|---|
| UART1 | Pin 8 (PG6) | Pin 10 (PG7) | Not on the header | uart1 | /dev/ttyS1 |
| UART2 | Pin 13 (PA0) | Pin 11 (PA1) | Pin 22 (PA2) / pin 15 (PA3) | uart2 | /dev/ttyS2 |
| UART3 | Pin 24 (PA13) | Pin 23 (PA14) | Pin 19 (PA15) / pin 21 (PA16) | uart3 | /dev/ttyS3 |
UART1 sits where the Raspberry Pi has its serial port, so it’s the natural first choice. UART2 shares its pins with JTAG, and UART3 shares all four of its pins with SPI1, so enable either uart3 or spi-spidev, not both. RTS/CTS stay off unless you add param_uart2_rtscts=1 or param_uart3_rtscts=1. The Linux console (UART0) is on the separate 3-pin debug header, covered below.
|
1 2 3 4 5 |
# /boot/armbianEnv.txt: one overlays= line, space-separated overlays=uart1 uart2 # after a reboot: ls /dev/ttyS* |
Note: The UART1/UART2 naming trap: UART1 is on pins 8/10, and UART2 is on pins 11/13. Users regularly enable uart1 and then wire to pins 11/13 (or the other way round) and see nothing. Match the overlay to the pins, cross the lines to your device (board TX to device RX), connect GND, and keep the device at 3.3v levels.
There are so many modules that we can interface with the Orange Pi Zero using the UART, which include: GPS receivers, USB-to-serial adapters, RS-485 transceivers (Modbus), LoRa and cellular modems, fingerprint sensors, microcontroller boards, and much more.
Orange Pi Zero I2C Pins
The Orange Pi Zero has 2 I2C buses on its header: I2C0 on pin 3 (SDA) and pin 5 (SCL), and I2C1 on pin 16 (SDA) and pin 18 (SCL). Both have 2kΩ pull-ups to 3.3v on the board, and each appears as /dev/i2c-N once its overlay is on.
Orange Pi Zero Default I2C Pins: PA12 (I2C0 SDA, pin 3) and PA11 (I2C0 SCL, pin 5), the same position as the main I2C bus on a Raspberry Pi.

| I2C Bus | SDA | SCL | Pull-Ups | Overlay | Linux Device |
|---|---|---|---|---|---|
| I2C0 | Pin 3 (PA12) | Pin 5 (PA11) | R151 / R152, 2kΩ | i2c0 | /dev/i2c-0 |
| I2C1 | Pin 16 (PA19) | Pin 18 (PA18) | R153 / R154, 2kΩ | i2c1 | /dev/i2c-1 |
Allwinner calls its I2C controllers TWI (Two-Wire Interface), which is why the schematic says TWI0-SDA. The board’s 2kΩ pull-ups are fairly strong, so you don’t need extra ones; a module with its own 10kΩ pull-ups works fine alongside them. Scan a bus with sudo i2cdetect -y 0 (or -y 1 for I2C1).
|
1 2 3 4 5 |
# /boot/armbianEnv.txt overlays=i2c0 i2c1 # after a reboot: sudo i2cdetect -y 0 |
Note: Many I2C modules sold for Arduino pull SDA and SCL up to 5v. That puts 5v on header pins with no protection behind them. Power such a module from 3.3v if it supports it, remove its 5v pull-ups, or put a bidirectional I2C level shifter between them.
There are so many modules and sensors that we can interface with the Orange Pi Zero using the I2C bus, which include: RTC clocks (DS3231), OLED displays (SSD1306), temperature and humidity sensors (BME280, SHT31), IMUs (MPU6050), ADCs (ADS1115) for analog inputs, GPIO expanders (MCP23017), PWM drivers (PCA9685), and much more.
Orange Pi Zero SPI Pins
The Orange Pi Zero has 1 SPI bus on its header: SPI1 on pins 19 (MOSI), 21 (MISO), and 23 (CLK), with chip select CS0 on pin 24. Turn it on with Armbian’s spi-spidev overlay and param_spidev_spi_bus=1, and it appears as /dev/spidev1.0.
Orange Pi Zero Default SPI1 Pins: PA15 (MOSI, pin 19), PA16 (MISO, pin 21), PA14 (CLK, pin 23), and PA13 (CS0, pin 24).

| Signal | Pin | Port | Linux # | wPi |
|---|---|---|---|---|
| SPI1_MOSI | 19 | PA15 | 15 | 11 |
| SPI1_MISO | 21 | PA16 | 16 | 12 |
| SPI1_CLK | 23 | PA14 | 14 | 14 |
| SPI1_CS0 | 24 | PA13 | 13 | 15 |
SPI0 is wired to the board’s 2MB SPI flash, which is why the header bus is SPI1. Pin 26 isn’t a second chip select like on a Raspberry Pi (it’s a plain GPIO, PA10). For a second SPI device, add Armbian’s spi-add-cs1 overlay or toggle any free GPIO as a chip select yourself. Test the bus with a jumper from pin 19 to pin 21 and spidev_test -v -D /dev/spidev1.0.
|
1 2 3 |
# /boot/armbianEnv.txt overlays=spi-spidev param_spidev_spi_bus=1 |
There are so many modules that we can interface with the Orange Pi Zero using the SPI bus, which include: TFT and e-paper displays, MCP3008 ADCs, MCP2515 CAN controllers, LoRa radios (SX127x), RFID readers (RC522), W5500 Ethernet modules, and much more.
Orange Pi Zero PWM Pins
The Orange Pi Zero has no hardware PWM on its 26-pin header. The H2+ has one PWM output on the header side of the board, PWM0 on PA5, and PA5 is the RX pin of the debug UART (the middle pin of the 3-pin debug header).
Note: Pin 7 is a GPIO, not PWM1: Orange Pi’s pin picture and the schematic label pin 7 (PA6) as “PWM1”, but the H2+ datasheet (Table 3-2) gives PA6 no PWM function, and neither does the Linux driver. Users who tried a custom overlay for PA6 report no signal on the pin. Treat pin 7 as a plain GPIO.
| Channel | Pin | Port | Overlay | Cost |
|---|---|---|---|---|
| PWM0 | Debug header, middle pin (RX) | PA5 | pwm | Disables UART0 and the serial console on ttyS0 |
To use it, add the pwm overlay. Armbian then turns off UART0, so you lose the debug console (log in over SSH instead). The channel shows up as /sys/class/pwm/pwmchip0/pwm0. For example, a 50Hz signal with a 1.5ms pulse for a servo is:
|
1 2 3 4 5 |
# /boot/armbianEnv.txt: overlays=pwm (then reboot) echo 0 > /sys/class/pwm/pwmchip0/export echo 20000000 > /sys/class/pwm/pwmchip0/pwm0/period # 20ms = 50Hz echo 1500000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle # 1.5ms echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable |
Note: For more PWM channels, or to keep the console, use a PCA9685 16-channel PWM driver on I2C0 (pins 3/5). For slow jobs like dimming an LED, software PWM on any GPIO (wiringOP’s softPwm) is fine, but it jitters too much for servos.
There are so many things that we can control with the Orange Pi Zero PWM output, which include: LED dimming (through a transistor), DC motor speed (through a driver), a servo motor, a buzzer, and much more.
Orange Pi Zero JTAG and Other Pin Functions
A few Orange Pi Zero pins carry extra functions that you’ll see on the diagram’s OTHER column. None of them is needed for normal Linux work, but they explain the odd names in the datasheet.

| Function | Pins | Notes |
|---|---|---|
| JTAG (CK, MS, DI, DO) | 11 (PA1), 13 (PA0), 15 (PA3), 22 (PA2) | The same four pins as UART2 with RTS/CTS; JTAG is for SoC bring-up, not for Linux users |
| PCM0 clock and sync | 16 (PA19), 18 (PA18) | Only two of the four I2S/PCM lines reach the header, so there’s no usable I2S here |
| SIM card interface | 7 (PA6), 12 (PA7), 26 (PA10) | Smart-card signals of the H2+; use these pins as plain GPIOs |
| DI (digital audio in/out) | 3 (PA12), 5 (PA11) | Rarely used; these pins are I2C0 in practice |
Orange Pi Zero Debug UART Pins
The Orange Pi Zero’s Linux console is on a separate 3-pin debug UART header beside the Ethernet jack. It’s the H2+’s UART0, wired straight to the SoC at 3.3v, and it runs at 115200 baud, 8N1.
| Debug Pin | Signal | SoC Pin | Connect To |
|---|---|---|---|
| 1 (square pad) | GND | – | Adapter GND |
| 2 (middle) | UART0 RX (board input) | PA5 | Adapter TX |
| 3 | UART0 TX (board output) | PA4 | Adapter RX |
Any 3.3v USB-UART adapter (CP2102, CH340, FT232R) works. Open it with picocom -b 115200 /dev/ttyUSB0 on Linux, or PuTTY at 115200 on Windows. It shows the U-Boot and kernel messages, which is the fastest way to see why an overlay failed or why the board won’t boot, and it gives you a login prompt on a headless board with no network yet. Leave the adapter’s VCC pin unconnected, and remember that the pwm overlay takes the RX pin away.
Orange Pi Zero USB, Audio, TV-Out and IR Pins (13-Pin Header)
The Orange Pi Zero 13-pin header carries two USB 2.0 host ports (pins 3–6), stereo line out (pins 7/8), composite TV-out (pin 9), a microphone input (pins 10–12), and the IR receiver input (pin 13, PL11). All of them are off in a stock Linux image until you enable them.

| Function | Pins | Armbian Overlay | Mainline Linux | Notes |
|---|---|---|---|---|
| USB 2.0 host port 2 | 3 (D−), 4 (D+) | usbhost2 | interface-board overlay | Wire with 5v (pin 1) and GND (pin 2); no VBUS switch or fuse |
| USB 2.0 host port 3 | 5 (D−), 6 (D+) | usbhost3 | interface-board overlay | Same as above |
| Line out (R / L) | 7, 8 | analog-codec | codec off in the base DT; on with the overlay | Line level, no amplifier on the board: feed an amplified speaker |
| TV-out (CVBS) | 9 | tve (newer kernels) | Not supported | Composite video, PAL/NTSC |
| Microphone | 10 (MBIAS), 11 (MIC1P), 12 (MIC1N) | analog-codec | Same as line out | MBIAS powers an electret microphone |
| IR receiver | 13 (PL11) | cir | interface-board overlay | /dev/lirc0; a plain GPIO (Linux 363) otherwise |
USB ports dead? That’s the most common 13-pin question: the two USB ports stay off until you add overlays=usbhost2 usbhost3 to /boot/armbianEnv.txt. On a plain mainline kernel, the device tree overlay sun8i-orangepi-zero-interface-board turns on both USB ports, the audio codec, and the IR receiver in one go (see the official sun8i-h2-plus-orangepi-zero.dts, which leaves the codec disabled by default).
TV-out: composite video was only ever supported on Orange Pi’s old Linux 3.4 images. The mainline kernel doesn’t drive the H2+/H3 TV encoder, but newer Armbian kernels (the 6.18 builds since late August 2026) add a tve overlay that does, tested on this board. Expect 720×480 or 720×576 interlaced, good enough for a status screen.
|
1 2 |
# /boot/armbianEnv.txt: everything on the 13-pin header overlays=usbhost2 usbhost3 analog-codec cir |
Orange Pi Zero On-Board Features
Besides the two headers, the Orange Pi Zero has a few on-board features you’ll meet when you wire and debug it. Only the LEDs are tied to GPIOs, and neither one is on a header pin.
| Feature | Where / GPIO | What It Does |
|---|---|---|
| Red power LED (D7) | PL10 (Linux 362), active high | On at power-up. Mainline Linux calls it orangepi:green:pwr, even though it’s red. |
| Green status LED (D8) | PA17 (Linux 17), active high | Free for your code. Mainline Linux calls it orangepi:red:status, even though it’s green. |
| Debug UART | 3-pin header beside the Ethernet jack | Linux console at 115200 baud (see above). |
| Buttons | None fitted | No reset, power, or boot key; power-cycle the board to reset it. |
| XR819 Wi-Fi | SDIO, with an external antenna | 802.11 b/g/n only, no Bluetooth. |
| SPI flash | SPI0, 2MB | Can hold a bootloader; the mainline device tree leaves it disabled. |
| micro-USB | USB OTG port | Power input, and a USB device (gadget) port in Linux. |
To use the green LED as an “I’m alive” light for your own program, set its trigger to none and write 1 or 0 to its brightness file.
Note: The LED colours here follow Orange Pi’s schematic: PL10 is the red power LED and PA17 is the green status LED. Mainline Linux names them the other way round ( orangepi:green:pwr on PL10, orangepi:red:status on PA17), so check ls /sys/class/leds/ first: on a mainline-based image, the green LED is the one called “red:status”.
|
1 2 |
echo none > /sys/class/leds/orangepi:red:status/trigger # the green LED on PA17 echo 1 > /sys/class/leds/orangepi:red:status/brightness |
Getting Started With Orange Pi Zero GPIO
Getting the Orange Pi Zero’s pins working takes three steps: install an OS, enable the overlays you need, and pick a GPIO library.
- Install an OS: flash a current Armbian (or DietPi) image to a microSD card. Orange Pi’s own images for this board are old (Linux 3.4 and 5.x), so Armbian is the practical choice, and it’s the one this guide’s overlay and device names follow. Log in over SSH or through the debug UART.
- Enable the interfaces: add the overlay names to the single overlays= line of /boot/armbianEnv.txt (separated by spaces), plus any param_… lines they need, then reboot. armbian-config does the same from a menu.
- Pick a library: libgpiod for C/C++ and Python (chip + line offset), or wiringOP for Arduino-style C code and gpio readall. Use the Linux device nodes ( /dev/ttyS*, /dev/i2c-*, /dev/spidev1.0) for the buses.
| Interface | Overlay (armbianEnv.txt) | Linux Device / Tool |
|---|---|---|
| GPIO | – (always on) | /dev/gpiochip0 and gpiochip1 (libgpiod), gpio readall (wiringOP) |
| UART1 (pins 8/10) | uart1 | /dev/ttyS1 |
| UART2 (pins 13/11) | uart2 (param_uart2_rtscts=1 for pins 22/15) | /dev/ttyS2 |
| UART3 (pins 24/23) | uart3 | /dev/ttyS3 (not with spi-spidev) |
| I2C0 (pins 3/5) | i2c0 | /dev/i2c-0 (i2cdetect -y 0) |
| I2C1 (pins 16/18) | i2c1 | /dev/i2c-1 |
| SPI1 (pins 19/21/23/24) | spi-spidev + param_spidev_spi_bus=1 | /dev/spidev1.0 |
| PWM0 (PA5, debug RX) | pwm | /sys/class/pwm/pwmchip0 (console off) |
| USB2 / USB3 (13-pin) | usbhost2 usbhost3 | lsusb |
| Line out / mic (13-pin) | analog-codec | aplay -l, arecord -l |
| IR receiver (13-pin) | cir | /dev/lirc0 (ir-keytable) |
|
1 2 3 4 |
# /boot/armbianEnv.txt example: UART1, I2C0 and SPI1 overlay_prefix=sun8i-h3 overlays=uart1 i2c0 spi-spidev param_spidev_spi_bus=1 |
The overlay_prefix=sun8i-h3 line is already in Armbian’s file: the Orange Pi Zero uses the H3 overlays, because the H2+ is the same chip. If gpio readall complains that it can’t determine the board, check that /etc/armbian-release says BOARD=orangepizero and that you built the current wiringOP from Orange Pi’s GitHub.
Orange Pi Zero Common Problems & Fixes
I enabled uart1, but nothing comes out of pins 11/13. Why? Pins 11/13 are UART2. UART1 is on pins 8 (TX) and 10 (RX). Either move your wires or enable uart2.
Why is there no signal on pin 7 (PWM1)? Because PA6 has no PWM function on the H2+, whatever the pin picture says. The only hardware PWM is PA5 on the debug header (overlay pwm), or use a PCA9685 on I2C.
Why do pins 3, 5, 16, and 18 always read high? They have 2kΩ pull-ups to 3.3v on the board, for I2C. Use them for active-low signals, or pick pin 7, 12, or 26 for an input that needs a pull-down.
The USB ports on the 13-pin header (or the expansion board) don’t work. Why? They’re off by default. Add usbhost2 usbhost3 to the overlays= line and reboot.
Why is there no sound from the line out? The audio codec is disabled in the base device tree. Enable analog-codec (Armbian) or the interface-board overlay (mainline), then unmute the “Line Out” control in alsamixer. The output is line level, so it needs an amplified speaker.
My Orange Pi Zero gets very hot, freezes, or won’t boot. What can I do? Start with the power: a real 5v / 2A supply and a short, thick cable. Then add a heatsink, and if it still crashes under load, cap the CPU at 912MHz. The LTS (v1.5) board draws less power and runs cooler than the early boards.
Why does the temperature reading look wrong? Users report that the H2+ on-chip sensor reads badly on this board: v1.5 (LTS) boards can under-read by roughly 30–40°C, and some early rev 1.4 boards read too high. Don’t trust it for thermal decisions; touch the heatsink or use an external sensor.
The Wi-Fi is slow or keeps dropping. Why? The XR819 is a weak chip with poor driver support, and kernel updates have broken it more than once. For a reliable link, use the Ethernet port, or a USB Wi-Fi adapter on the Type-A port.
Can I use Raspberry Pi tutorials and libraries? The power, I2C, UART, and SPI pins are in the same places, so the wiring often carries over, but the GPIO numbers don’t. RPi.GPIO and gpiozero won’t run; use libgpiod, wiringOP, or the Linux device nodes, and translate the Pi’s BCM numbers by physical pin.
Orange Pi Zero vs Orange Pi Zero 2W, Orange Pi Zero 3 and Raspberry Pi Zero
The Orange Pi Zero is the oldest and cheapest of these boards, and the only one with a 32-bit CPU and DDR3. The Orange Pi Zero 3 keeps the same small shape with Ethernet and a 26-pin header, while the Zero 2W copies the Raspberry Pi Zero’s shape and 40-pin header.
| Feature | Orange Pi Zero | Orange Pi Zero 3 | Orange Pi Zero 2W | Raspberry Pi Zero |
|---|---|---|---|---|
| SoC / CPU | Allwinner H2+ (or H3), 4x Cortex-A7 | Allwinner H618, 4x Cortex-A53 @ 1.5GHz | Allwinner H618, 4x Cortex-A53 @ 1.5GHz | BCM2835, 1x ARM1176 @ 1GHz |
| RAM | 256MB / 512MB DDR3 | 1 / 1.5 / 2 / 4GB LPDDR4 | 1 / 1.5 / 2 / 4GB LPDDR4 | 512MB |
| GPIO header | 26-pin (+ 13-pin) | 26-pin (+ 13-pin) | 40-pin (+ 24-pin FPC) | 40-pin |
| Ethernet | 100Mbps | Gigabit | Through an expansion board | None |
| Wireless | Wi-Fi 4 (XR819) | Wi-Fi 5 + Bluetooth 5.0 | Wi-Fi 5 + Bluetooth 5.0 | None (the Zero W adds it) |
| Video out | Composite only (13-pin header) | Micro HDMI | Mini HDMI | Mini HDMI |
| Power input | micro-USB, 5v / 2A | USB-C | USB-C | micro-USB |
| Size | 48 x 46mm | 50 x 55mm | 65 x 30mm | 65 x 30mm |
Pick the Orange Pi Zero for the cheapest wired headless node (a print server, Pi-hole, a sensor gateway) when 512MB is enough. Pick the Zero 3 when you want the same 26-pin layout with a 64-bit CPU, more RAM, and Gigabit Ethernet, the Zero 2W for a Raspberry Pi Zero-sized board with a 40-pin header, and the Raspberry Pi Zero for the best software support.
Orange Pi Zero Pin Details
Here is every pin of the Orange Pi Zero 26-pin header in physical order, with its Allwinner port name, Linux GPIO number, wiringOP number, functions, Armbian overlays, and what the board wires to it. Pin 1 is the square pad at the end away from the Ethernet jack; odd pins are on the board edge, and even pins are on the inner row.
Orange Pi Zero 26-Pin Header Pin Details
Click to expand the full pin table (26 pins)
| Pin | Name | Linux # | wPi | Functions | Armbian Overlay | On-Board Circuit | Description |
|---|---|---|---|---|---|---|---|
| 1 | 3.3V | – | – | 3.3v power | – | VCC3V3-EXT | 3.3v output from the board’s 3.3v rail; light loads only (sensors, logic chips). |
| 2 | 5V | – | – | 5v power | – | DCIN-5V (after the input MOSFET) | The board’s 5v rail: a 5v output when the board runs from micro-USB, or a 5v input to power it. |
| 3 | PA12 | 12 | 0 | I2C0_SDA, DI_RX | i2c0 | 2kΩ pull-up to 3.3v (R151) | I2C0 data; with its 2kΩ pull-up it idles high when used as a GPIO. |
| 4 | 5V | – | – | 5v power | – | DCIN-5V | Second 5v pin, the same net as pin 2. |
| 5 | PA11 | 11 | 1 | I2C0_SCL, DI_TX | i2c0 | 2kΩ pull-up to 3.3v (R152) | I2C0 clock; idles high as a GPIO because of its 2kΩ pull-up. |
| 6 | GND | – | – | Ground | – | GND | Ground. |
| 7 | PA6 | 6 | 2 | GPIO (SIM_PWREN); no PWM on the H2+ | – | Direct | A plain GPIO. Orange Pi labels it PWM1, but the H2+ has no PWM function on PA6. |
| 8 | PG6 | 198 | 3 | UART1_TX | uart1 | Direct | UART1 transmit (/dev/ttyS1), the same position as the Raspberry Pi’s TX pin. |
| 9 | GND | – | – | Ground | – | GND | Ground. |
| 10 | PG7 | 199 | 4 | UART1_RX | uart1 | Direct | UART1 receive (/dev/ttyS1), the same position as the Raspberry Pi’s RX pin. |
| 11 | PA1 | 1 | 5 | UART2_RX, JTAG_CK | uart2 | Direct | UART2 receive (/dev/ttyS2), or a general-purpose pin. |
| 12 | PA7 | 7 | 6 | GPIO (SIM_CLK) | – | Direct | A free general-purpose pin with no bus function, a good choice for an LED or a button. |
| 13 | PA0 | 0 | 7 | UART2_TX, JTAG_MS | uart2 | Direct | UART2 transmit (/dev/ttyS2), or a general-purpose pin. |
| 14 | GND | – | – | Ground | – | GND | Ground. |
| 15 | PA3 | 3 | 8 | UART2_CTS, JTAG_DI | uart2 (param_uart2_rtscts=1) | Direct | UART2 CTS when flow control is on, otherwise a general-purpose pin. |
| 16 | PA19 | 19 | 9 | I2C1_SDA, PCM0_CLK | i2c1 | 2kΩ pull-up to 3.3v (R153) | I2C1 data; idles high as a GPIO because of its 2kΩ pull-up. |
| 17 | 3.3V | – | – | 3.3v power | – | VCC3V3-EXT | Second 3.3v output, the same rail as pin 1. |
| 18 | PA18 | 18 | 10 | I2C1_SCL, PCM0_SYNC | i2c1 | 2kΩ pull-up to 3.3v (R154) | I2C1 clock; idles high as a GPIO because of its 2kΩ pull-up. |
| 19 | PA15 | 15 | 11 | SPI1_MOSI, UART3_RTS | spi-spidev, uart3 | Direct | SPI1 MOSI, or UART3 RTS. |
| 20 | GND | – | – | Ground | – | GND | Ground. |
| 21 | PA16 | 16 | 12 | SPI1_MISO, UART3_CTS | spi-spidev, uart3 | Direct | SPI1 MISO, or UART3 CTS. |
| 22 | PA2 | 2 | 13 | UART2_RTS, JTAG_DO | uart2 (param_uart2_rtscts=1) | Direct | UART2 RTS when flow control is on, otherwise a general-purpose pin. |
| 23 | PA14 | 14 | 14 | SPI1_CLK, UART3_RX | spi-spidev, uart3 | Direct | SPI1 clock, or UART3 receive (/dev/ttyS3). |
| 24 | PA13 | 13 | 15 | SPI1_CS0, UART3_TX | spi-spidev, uart3 | Direct | SPI1 chip select 0 (/dev/spidev1.0), or UART3 transmit. |
| 25 | GND | – | – | Ground | – | GND | Ground. |
| 26 | PA10 | 10 | 16 | GPIO (SIM_DET) | – | Direct | A free general-purpose pin with no bus function. |
Orange Pi Zero 13-Pin Header Pin Details
Pin 1 is at the USB-A end of the header. Only pin 13 is a GPIO; wiringOP has no numbers for this header.
Click to expand the full pin table (13 pins)
| Pin | Name | Linux # | Function | Description |
|---|---|---|---|---|
| 1 | 5V | – | 5v power (DCIN-5V) | The same 5v rail as the 26-pin header’s pins 2 and 4; it powers the USB ports of an expansion board. |
| 2 | GND | – | Ground | Ground. |
| 3 | USB2 D− | – | USB 2.0 host port 2, data − | Data − of the second USB host port (overlay usbhost2). |
| 4 | USB2 D+ | – | USB 2.0 host port 2, data + | Data + of the second USB host port. |
| 5 | USB3 D− | – | USB 2.0 host port 3, data − | Data − of the third USB host port (overlay usbhost3). |
| 6 | USB3 D+ | – | USB 2.0 host port 3, data + | Data + of the third USB host port. |
| 7 | LINE R | – | Line out, right channel | Analog line output straight from the SoC’s codec, with no amplifier. |
| 8 | LINE L | – | Line out, left channel | Analog line output, left channel. |
| 9 | TV-OUT | – | Composite video (CVBS) | Composite video output; needs a kernel that drives the TV encoder. |
| 10 | MIC BIAS | – | Microphone bias (MBIAS) | Bias voltage for an electret microphone. |
| 11 | MIC1 P | – | Microphone input 1, positive | Positive side of the differential microphone input. |
| 12 | MIC1 N | – | Microphone input 1, negative | Negative side of the differential microphone input. |
| 13 | PL11 | 363 | IR receiver input (S_CIR_RX), GPIO | The infrared receiver input of the expansion board (overlay cir), or a plain GPIO. |
Wrap Up
To conclude this guide article, the Orange Pi Zero is a very solid entry-level Linux board when you need a cheap, wired, headless node, with a compact 26-pin header for your hardware: 17 GPIOs, three UARTs, two I2C buses with pull-ups, and SPI1, plus a 13-pin header for USB, audio, TV-out, and IR. Just remember the gotchas: every pin is 3.3v only, pin 7 isn’t a PWM pin, UART1 is on pins 8/10 (not 11/13), and the 13-pin features stay off until you enable their overlays.
I hope you’ve found this guide helpful for your Orange Pi Zero project. For more boards, check out the Pinouts, Datasheets & Schematic Diagrams Library.