---
title: Orange Pi Zero GPIO Pins
date: 2017-02-25T13:06:01+00:00
modified: 2025-10-27T10:23:30+00:00
image:: https://kaspars.net/wp-content/uploads/2017/02/orange-pi-zero-gpio-pins.png
permalink: https://kaspars.net/blog/orange-pi-zero-gpio
post_type: post
author:
  name: Kaspars
  avatar: https://reverse.kaspars.net/gravatar/avatar/92bfcd3a8c3a21a033a6484d32c25a40b113ec6891f674336081513d5c98ef76?s=96&d=mm&r=g
category:
  - Electronics
  - Linux
post_tag:
  - How to
  - Orange Pi Zero
  - raspberrypi
---

# Orange Pi Zero GPIO Pins

[The 26-pin expansion port](https://linux-sunxi.org/Xunlong_Orange_Pi_Zero#Expansion_Port) of the [Orange Pi Zero](https://kaspars.net/go/orange-pi-store) is placed on the opposite side of the board compared to Raspberry Pi while the pinout is exactly the same:

[![Orange Pi Zero Expansion Board Location vs Raspberry Pi](https://kaspars.net/wp-content/uploads/2017/02/orange-pi-zero-expansion-pinout-raspberry-pi-1024x682.jpg)](https://kaspars.net/wp-content/uploads/2017/02/orange-pi-zero-expansion-pinout-raspberry-pi.jpg)

OSH Lab created a nice illustration of the [Orange Pi Zero expansion port](https://oshlab.com/orange-pi-zero-pinout/).

## Orange Pi Zero GPIO Pins

It took me a while to discover that the General Purpose Input/Output (GPIO) numbering on the Orange Pi Zero with Armbian Legacy 3.4.113 is different from the Raspberry Pi and Raspbian. Here is how Allwinner SoC port names (such as PB12) are mapped to their GPIO pin numbers [in the Linux kernel](https://github.com/torvalds/linux/blob/4924982e306e256d2737f94fcd004a536da6df54/drivers/pinctrl/sunxi/pinctrl-sunxi.h#L19-L30):

```
(Position of letter in alphabet - 1) * 32 + Pin number
```

For example, port `PB12` would map to `GPIO 44`:

```
(2 - 1) * 32 + 12 = 44
```

Here is [an online tool that does the GPIO mapping](https://jsfiddle.net/tuav7f6q/1/) which I used when creating this illustration of the Orange Pi Zero GPIO pins:

[![Orange Pi Zero GPIO Pins](https://kaspars.net/wp-content/uploads/2017/02/orange-pi-zero-gpio-pins.png?strip=all&quality=90&resize=800,746)](https://kaspars.net/wp-content/uploads/2017/02/orange-pi-zero-gpio-pins.png)Orange Pi Zero GPIO Pins.

## Using the GPIOs

Knowing the GPIO pin numbers is important for building all the Raspberry Pi based projects since their GPIOs are numbered differently (not sure how they do it, probably map to [the datasheet](https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf)?). In the follow-up post I show [how to add an LCD monitor to the Orange Pi Zero via the SPI bus](https://kaspars.net/blog/linux/spi-display-orange-pi-zero).