Orange Pi Zero2 Information


Note: the most important and helpful resource is the manual, which is available here.

Prepare the SD card

  1. Copy the orange pi image over to an sd card

  2. Expand the sd card

  3. Update netplan. Open up the sd card and modify the network config:

    sudo mv orangepi-default.yaml orangepi-default.yaml.bak
    cat << EOL | sudo tee 99-home.yaml
        version: 2
                dhcp4: no
                dhcp6: no
                optional: true
                dhcp4: no
                dhcp6: yes
                    <put your wifi ssid here>:
                        password: <put yoru wifi password here>
                    - to: default
    sudo chmod 664 99-home.yaml


With these changes you should be able to connect in a headless way

  1. SSH

    ssh orangepi@
    #default password is orangepi

    harden ssh:

  2. install tmux

    sudo apt update && sudo apt install -y tmux

    then open a new tmux window using the tmux command and upgrade your packages

  3. (optional) install tailscale

    you can use these instructions

  4. (optional, can do later) Upgrade

    sudo apt upgrade -y

    use ctrl+b then d to exit and let the install run. You will need to check in periodically to intervene

  5. (Optional) Set up orange pi config

    sudo orangepi-config

Update systems

sudo adduser $USER i2c
echo "overlays=i2c3" | sudo tee -a /boot/orangepiEnv.txt && sudo reboot now

once restarted run

sudo i2cdetect -y 3

Working with I/O

you will need some prerequisites:

sudo apt install -y python3-pip swig python3-dev python3-setuptools

(optional) Install WiringOP

orangepi@orangepi:~$ sudo apt update
orangepi@orangepi:~$ sudo apt install -y git
orangepi@orangepi:~$ git clone
2) Compile and install wiringOP
orangepi@orangepi:~$ cd wiringOP
orangepi@orangepi:~/wiringOP$ sudo ./build clean
orangepi@orangepi:~/wiringOP$ sudo ./build

Install wiringop-python

git clone --recursive
cd wiringOP-Python
find . -type f -name "*.c" -print0 | xargs -0 sed -i 's|/dev/i2c-[0-9]|/dev/i2c-3|g'
find . -type f -name "*.py" -print0 | xargs -0 sed -i 's|/dev/i2c-[0-9]|/dev/i2c-3|g'
python3 > bindings.i
pip3 install .
sudo pip3 install .
sudo python3 ~/wiringOP-Python/examples/orangepi-sensors/

to get it to run on startup,

(sudo crontab -u root -l; echo "@reboot python3 $HOME/wiringOP-Python/examples/orangepi-sensors/" ) | sudo crontab -u root -

got help from here

Other Resources

Older Stuff

Other packages it seems might be necessary

sudo apt install -y libgpiod2 python3-libgpiod sudo apt install -y python3-smbus python3-dev i2c-tools python3-lgpio sudo apt install -y python3-dev python3-setuptools pip3 install gpiod && sudo pip3 install gpiod

From here:

OLED and SSD1306 Driver

sudo pip3 install Adafruit-SSD1306

sudo apt-get install -y python3 git python3-pip
sudo apt-get install libgpiod2 python3-libgpiod
pip3 install gpiod
sudo apt update && sudo apt upgrade -y
sudo pip3 install --upgrade setuptools

sudo apt install -y python-smbus python-dev i2c-tools
sudo adduser $USER i2c

pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
sudo bash
pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U

pip3 install adafruit-blinka
sudo find / -iname "sun50*"

got help from here

echo -e "overlays=uart2 uart3 i2c0 i2c1 i2c2 spi-spidev usbhost1 usbhost2 usbhost3\nparam_spidev_spi_bus=0" | sudo tee -a /boot/orangepiEnv.txt
overlays=uart1 uart2 uart3 i2c0 i2c1 i2c2 spi-spidev usbhost0 usbhost1 usbhost2 usbhost3 pwm

prior to clearing

#overlays=uart1 uart2 uart3 i2c0 i2c1 i2c2 spi-spidev usbhost0 usbhost1 usbhost2 usbhost3 pwm
#overlays=uart2 uart5 i2c1 i2c2 i2c3 i2c4 spi-spidev pwm12 pwm34

pip3 install –upgrade adafruit-blinka adafruit-platformdetect

pip install wiringop

cat /proc/device-tree/compatible sun50i-h616

sudo find / -iname “sun50i-h616*”

sudo pip3 install ./