Support for UART communication on orange pi zero

I am working on a project that needs more of hardware resources of the board, I am new to balena and docker and dont know if this is a small issue but i was not able to figure it out yet, As of now I am able to get GPIO working but not able to get UART and I2C on orange pi zero board.

The Dockerfile and code is below,

#Python Base Image from
FROM arm32v7/python:3.7-stretch

COPY . /usr/src/app
WORKDIR /usr/src/app

RUN pip3 install pyserial
RUN pip3 install OPi.GPIO

CMD [ “python3”, “./” ]

UART code :

import time
import os
import sys

import serial
ser = serial.Serial ("/dev/ttyS1", 115200) #Open port with baud rate

def serialReceive():
received_data = #read serial port
data_left = ser.inWaiting() #check for remaining byte
received_data +=
print (received_data)

while True:

I am getting the error as :

11.10.19 16:09:14 (+0530) main raise SerialException(“Could not configure port: {}”.format(msg))
11.10.19 16:09:14 (+0530) main serial.serialutil.SerialException: Could not configure port: (5, ‘Input/output error’)

please have a look at it and suggest me the solution.
Thank you!

Hi, first I think you need to use a balenalib base image, not arm32v7 one:

For using UART you need to enable it. Please refer to the following topics from our documentation:

If you still have issues afterwards, please let us know.


I checked mentioned docs, but examples are dedicated to Raspberry Pi family with configuration by config.txt and RESIN_HOST_CONFIG_dtoverlay .

I’m interested in using UART and i2c sensors on Orange Pi.
How those configuration directives should be send to Orange Pi (zero)?

Do you have any hints?


Hi @mich unfortunately currently the way the Orange Pi family is implemented, the are no dtoverlays, so the interfaces can’t be dynamically changed, so you can only use the ones that are compiled by default. To enable other ones, it would be necessary to add the right dt fragments into the Device tree and rebuilt the OS image with yocto. We do plan to eventually add a similar overlay mechanism similar to what armbian.txt has for OPI devices, but its quite a bit of work and currently we don’t have a lot of usage on the orange pi devices so it hasn’t been prioritised.

If you can describe which specific interfaces you would like to enable and on which device type exactly, we could get @floion to look into adding them on the device as default, provided they don’t conflict with any of the other default interfaces.

Thank you very much for the information.
I exactly have one use case in my mind - sensors network based on Orange Pi Zero.

I would like to use:

  • Orange Pi Zero (Allwinner H2+)
  • I2C enabled HTU 21 thermometer (i2c-0 or i2c-1)
  • UART enabled PMS7003 particle concentration sensor (ttyS1 or ttyS2)

I already have everything programmed on Armbian with python, but I would be great if I could migrate to Balena solution. Managing tens of such devices without good system is very painful.

Your support will be very helpful for me.