On paper, the Orange Pi Zero looked like a a single board computer that could be useful, so I purchased one. As a first test, I installed Ubuntu Server (Armbian). I also installed mosquitto the MQTT broker.
The comments below are only first impressions because I only wanted to check that the hardware worked. I will set aside the Orange Pi Zero to complete more urgent projects.
Table of Contents
- Hardware
- References
- Installation of Armbian
- First Boot
- Updating Armbian
- Wi-Fi Connection
- Static IP Addresses
- Configuring the Orange Pi Zero
- Locale Configuration
- Installing Domoticz
- Setting Up Domoticz
- Installing a MQTT Broker
- H2+ Running Hot
- Observations
Hardware
The Orange Pi Zero (now OPiZ), from Shenzhen Xunlong Software CO., Limited is a very small single-board computer that nevertheless has a four-core processor. In my opinion, its capabilities place it between the Raspberry Pi Zero W (ireless) and the Raspberry Pi 3.
Orange Pi Zero | Raspberry Pi Zero W | Raspberry Pi 3 | |
SOC | Allwinner H2+ | BCM 2835 | BCM 2837 |
CPU | ARM Cortex A7 | ARM11 | ARM CORTEX A53 |
Cores | 4 (32 bits) | 1 (32 bits) | 4 (64 bits) |
Frequency | 1.2GHz | 1 | 1.2GHz |
GPU | Mali400 (600MHz) | VideoCoreIV (250MHz) | VideoCoreIV (400Mhz) |
RAM | 512MB | 512MB | 1GB |
Storage | MicroSDHC | MicroSDHC | MicroSDHC |
SPI Flash | 2MB | --- | --- |
Ethernet | 10/100Mb | --- | 10/100Mb |
WiFi | 802.11 b/g/n | ||
Bluetooth | --- | 4.1 & BLE | |
USB | 1 | --- | 4 |
USB OTG | 1 | 1 | |
HDMI output | --- | mini | yes |
Composite video | yes | yes | yes |
Camera connector | --- | CSI | CSI |
GPIO | 26 pins, 13 pins | 40 pins | 40 pins |
Dimensions | 46x48 mm | 65x30mm | 85.6x56.5mm |
There is a slightly cheaper version with only 256MB of memory. There is also an expansion card adding two USB outputs, a microphone, an infrared receiver and an audio/video output. I bought Set 6 which adds a small case that can accommodate the OPiZ and the expansion card. It all cost just under $ 25 CDN including shipping costs.
A 4GB or greater micro SD card is also needed. I used a 16 GB Verbatim class 10 card. Finally, a 5V power supply with a microUSB cable is necessary.
The OPiZ is fussy about its power supply. It refused to work with a power supply (1A at 5V) used with Raspberry Pis, smart phones, tablets, etc. In contrast an old power supply for Nexus 7 (1.3A at 5.2V) bought used and a generic power supply (1A at 5V) worked without problem.
In addition, some USB cables can not be used. It seems that the microUSB connector was too short when the OPiZ was in the case because the same cables worked if the board was out of the case. This is something that I have already observed with a Raspberry Pi 3 in a tranparent case with thick plastic walls.
References
The manufacturer's website dedicated to the Orange Pi Zero is the obvious starting point when looking for documentation about this single-board-computer.
Many have videos on YouTube or sites with information that may be useful. I subscribed to MickMake who tested the OPiZ Orange Pi Zero: Better than the Raspberry Pi Zero? // Review. Perhaps it was because of this video that the idea of buying OPiZ sprouted in my mind. The video is almost a year old and I think some of the issues listed (about SPI for example) seem to be resolved if we can trust Kaspars Dambis's video, Display for Orange Pi Zero. The video Orange Pi Zero Setup and Setting up of Orange Pi Zero using an Armbian/Debian Jessie distro by Brian Greul have proved to be useful when it came to the TV output. I also appreciated two videos by Richard Hughes, Orange's Pi Zero Review accessories & comparison and Orange Pi zero update.
Finally, let us mention that according to Shenzhen Xunlong we can do almost what we want with the OPiZ because it is "open source". Indeed, we can find the schematic of the board.
Installation of Armbian
Almost everyone listed above has chosen an Armbian
image of Debian or Ubuntu
as their operating system. So I decided to follow suit by installing
Ubuntu server - legacy kernel
found here.
I did not choose the newer Ubuntu server - mainline kernel
,
because it does not support the XR819 WiFi module found on the board.
If you prefer Debian, the images are
here.
The image has to extracted from the the downloaded archive. This file is easy
to identify by its name and size.
I used ETCHER to copy the image of the operating
system to an SD card. The software is available for Linux, Windows and
OS X and its operation should be similar on all those platforms. Download the
correct version of ETCHER
according to the operating system of the desktop. The application has to be
extracted from the downloaded archive. In 64-bit Linux, it is named
Etcher-1.0.0-linux-x64.AppImage
.
- Insert the SD card into a card reader on the desktop computer.
- Double-click on
Etcher-1.0.0-linux-x64.AppImage
. When the software asks if it should be installed, I answer No , but if you think you will reuse this application often, you can always answer Yes. - Wait until Etcher starts, which can take a few tens of seconds.
- Click on and select the operating system image extracted from the downloaded archive.
- If ETCHER does not display the correct SD card as a target, click Change and select the correct target. Since only one SD memory card is plugged in and no other removable drive is connected to my computer, Etcher correctly identified the target.
- Click on .
- Wait until Etcher has finished uploading the operating system to the SD card and has completed checking the contents and then close the application.
Once again, thanks to the developers of Etcher for the simple and effective program.
First Boot
One way to boot the board is to connect a USB-TTL converter to the UART to the three pin header near the RJ45 connector on the OPiZ. This is described in a later post. While I have just today (November 27) tried this, it will become my favourite method of booting the OPiZ especially when trying to debug problems at startup.
There are two ways to get the information. One can try to spot the newcomer on the network by examining the list of devices connected to the router. Typically, routers display this list in the web interface that is used to manage them. Unfortunately, the presentation of this interface is different from one model to another, it is not possible to give instructions. As an example, here is part of the list displayed by my router showing an unknown device.
The other way to get this list is to use a network explorer that looks at all the IP addresses and, for each, searches for open TCP ports. I use Nmap with the Zenmap GUI (installed from the Ubuntu repository). Others might prefer Angry IP Scanner which runs on Windows, Linux and MAC as long as a fairly recent version of Java is already installed.
The principle is the same, no matter how we want to identify the OPiZ. An initial scan of the local network is made to obtain the list of devices already connected to the network. Then insert the SD memory card programmed, connect the Ethernet cable into the RJ45 socket and connect the power supply to the OPiZ. If all goes well, Ubuntu will boot and after thirty seconds it will get an IP address and accept an SSH connection on port 22. If we then redo the scan of the local network, it should be easy to identify the new device.
In the picture above we can follow the steps for Zenmap. First the target is defined: 192.168.1.0/24
which
means a scan of addresses 192.168.1.0
to
192.168.1.255
. Then I chose to do a Quick scan
which
is sufficient for our needs. The analysis is triggered by pressing the
Scan
button. After the scan was completed, I displayed the IP
addresses of hosts based on available Services
because, as
mentioned above, OPiZ opens port 22 to accept SSH connections. There are
only three hosts that offer this service on my network: the first is the
Raspberry Pi which is the home automation server. The second is my desktop
and I concluded that the last 192.168.1.130
is the OPiZ.
The most difficult is done, it remains now to launch an SSH connection
with the OPiZ as root (password 1234). Immediately, it will be necessary
to change the password of root and to create a user account. Automatically
that user will be member of the sudoers
group which means that
the user can execute the commands normally reserved to root by using the prefix
sudo
.
ssh
is used with this
address, there will be a dialogue asking if the security keys are to be
registered. Answer yes ("yes" in full).
If security keys have already been registered for this address, a warning is displayed.
It is now better to log off and log in again as the new user.
Update Armbian
I have updated and upgraded Armbian
Be aware that this last step can take a considerable amount of time.
Wi-Fi Connection
The Armbian configuration utility can be used to start a WiFi connection.
The following screen is displyaed:
Hit the space bar to confirm that you understand the risks associated with using this utility with the highest privileges and then hit Enter to go to the main menu.
Select WiFi
, then in the list of access points,
select your local WiFi network and enter the password.
Click on the <OK>
button.
I took the opportunity to set the time zone (Timezone
) I
also looked at Network
and found out that the utility does not
perform any network configuration. Network Manager
(nmui
ou nmcli
) must be used. Exit the utility by
selecting <Exit to shell>
in the main menu.
Now verify that the wireless interface is active:
Static IP Addresses
The home automation program Domoticz contains a web server that is accessed with a web browser such as Firefox, Chrome, or Safari . This means that the web server must be at a fixed IP address. However, by default, the Orange Pi Zero uses DHCP to obtain a variable IP address from a DHCP server on the local network.
This will require changes to the network configuration. It also means that a decision must be made as to which interface will be used. The OPiZ contains two network interfaces: a wired Ethernet link (Cat5 or Cat6 cable with RJ45 connectors already in use) and a wireless WiFi connection. The wireless interface is obviously more flexible, because it allows me to place the single board computer almost anywhere.
Typically, there are two ways to assign a static IP address. You can change the network configuration of the OPiZ or you can change the settings of the DHCP server so that it always assigns the same address to the network interface of the OPiZ. Previously I used both approaches simultaneously (suspenders and belt to be safe!). But if the limit on the number of DHCP reservations in the router is reached then there is no other choice, the network settings of the OPiZ must be changed.
In the main menu of NetworkManager TUI
(TUI for Text User Interface I suppose) select
Edit a connection
then press <OK>
.
Since the connection with the OPiZ was wired (Ethernet), I started by editing the Wi-Fi connection.
The WI-FI section can be hidden (<Hide>
) while the
IPv4 CONFIGURATION
section can be shown (<Show>
).
You must change the IPv4 configuration to <Manual>
and enter the desired IP address. Here I entered 192.168.1.31/24
.
The /24
corresponds to a network mask of 24 bits:
255.255.255.0
.
I did the same thing for the Ethernet connection except that the address
is 192.168.1.30/24
. The static IP addresses thus fixed must not
be in the range of IP addresses that can be assigned by the DHCP server. You
have to go to the router's webpage to set this range. Finally to restart the
network I use the following command
Unfortunately, it seems that the WiFi connection will only be
established if the OPiZ is connected by Ethernet cable to the local network.
However, if we return the IPv4 configuration of eth0
to
automatic
then it becomes possible to open a ssh
session via WiFi without a concurrent Ethernet connection. That's a little
disconcerting. This is the first time I use Network
Manager so it may well be that I made a mistake. The definitions
of the interfaces are located in the folder /etc/NetworkManager/
system-connections/
. I will examine the files it contains and the whole
question later.
Finally, I used nmtui
to change the name of the host that is
now domopiz
.
Configuring the Orange Pi Zero
I did not change the configuration of the OPiZ much since this was only
a first look. But since I wanted to test the composite video output, I had to
add tv
to the modules to load at startup.
#w1-sunxi #w1-gpio #w1-therm #sunxi-cir xradio_wlan g_serial xradio_wlan tv
That allowed me to verify that the video output of the expansion card is working in a fashion. However, there is so much overscan that it will be practically useless without corrections. I found two references on the web about this and if the need arises I will consider the question later: PSA: Orange Pi Zero expansion board tv-out not working solution et Allwinner Composite Video Configuration Tool.
By default, systemd
saves logs to files saved on the SD
card. This may not be the best arrangement because there is a limit to the
number of reads and writes that can be made on an SD card. It is better to
write the log in memory.
Edit the journald
configuration file, changing three lines as
shown below.
The source of this tip is the Domoticz wiki. However, it may be best to wait before taking this advice so as to keep the logs persistent until everything is stable.
If there is to be more than one Orange Pi Zero on the local network, it is probable a good idea to change the hostname of the system. This can be done with the configuration utility.
Select, Personal TimeZone, languague, hostname
and then Hostname Change your hostname (orangepizero)
options. Type in the new host name. It will be necessary to reboot for the change to take effect. Once that is done it is a dood idea to check the /etc/hosts
file.
to make sure that it has been updated and that orangepizero
has been replaced by the new host name in the first line.
Locale Configuration
I noticed today (July 12 2020) that a locale configuration issue remained after a system update and upgrade. While the locale was en_US.UTF-8
, it was impossible to enter Unicode points such as 'é' or '°' in the nano
editor. Indeed, the Bash command line would not accept these non-ASCII characters. This problem was described in the Armbian Forum in April of 2019 and a simple solution was provided. Edit the /etc/environment
file.
If it contains the line
remove it. Unicode (UTF-8) will be fully supported in new sessions from then on.
The original version of this post dates from October 2017 and the installed system was then Armbian 5.30 with the 3.4.113-sun8i kernel based on Ubuntu 16.04.2 LTS. I am not sure if the problem described above existed in that version. Note that jeanrhum
who raised the problem in the forum said that the problem was not present in Armbian Strech 5.75 but appeared in version 5.77. I can confirm that the locale configuration problem had to be resolved as explained above in Armbian 5.90 based on Debian Stretch with the 4.19.62-sunxi Linux kernel.
Installing Domoticz
As the Domoticz download page explains, a one-line script installs the program.
There is a little more to do obviously. Some questions need to be answered, but the default answers are acceptable:
- The first screen displayed by the installer reminds you that a static IP address is required and suggests to donate to the project.
- Then, a screen asks if HTTP and HTTPS (secure HTTP) access to the server is allowed. Both are enabled by default which I accepted. However, HTTPS access is problematic without security certificates.
- The following two screens ask for HTTP and HTTPS port numbers: I
accepted the default responses, port
8080
, for HTTP and port443
for HTTPS. - Then, the installation directory must be specified. Again, I accepted the default. The final screen gives the addresses for HTTP and HTTPS access to the Domoticz server and also displays the addresses of the >Domoticz wiki https://www.domoticz.com/wiki) and the forum (https://www.domoticz.com/forum).
This is the end of the installation:
Start a web browser on your desktop and connect to the
Domoticz server site on the Raspberry Pi at
http://192.168.1.31:8080
. There will not be much to see; a black
screen for the most part, since nothing is installed yet. At least that confirms
that the software is installed correctly.
Setting Up Domoticz
At this stage, some basic parameters of the system should be defined. At a minimum, the location (longitude and latitude) must be specified. In addition, we should add a password and so on.
To verify that the OPiZ can host the home automation system that is already installed on a Raspberry Pi, I proceeded in another way. I copied the Domoticz server database from the Raspberry Pi to the OPiZ. This operation is done in two steps: copy the database to a desktop computer and then copy this database to the OPiZ.
- Open the Domoticz web interface on the Raspberry Pi
with a browser on the desktop (in my case at
192.168.1.22:8080
). - Click on the Setup tab at the top right of the window.
- Select Settings in the drop-down menu.
- Click on the Backup/Restore tab.
- Click on the button and save the file to a folder on the desktop computer.
- Open the Domoticz Web Server on the OPiZ (at
192.168.1.31:8080
) in the desktop browser. - As before, click on the Setup tab at the top right of the window.
- Select Settings in the drop-down menu.
- Click on the Backup/Restore tab.
- Click on the Restore Database button. and save the file to a folder on the desktop computer.
- Cliquer sur Restaurer la base de données. The following window appears.
- Click on Browse... to find the saved data base.
- Click on Upload to get the data base. As shown on the screen, this may take some time.
Switches and other devices will now be visible. However, if you click on a lamp to turn it on or off, nothing will happen. The reason is simple, the address of the MQTT broker is not correct. Here's how to correct the address.
- Click on the Setup tab at the top right of the window.
- Select Hardware in the drop-down menu.
- Click on the
MQTT
row in the table at the top of the window. - Replace
localhost
in theRemote Address:
box with the IP address of the MQTT broker on the Raspberry Pi:192.168.1.22
. - Click the button directly below the top table.
Now the lamps can be controlled with this Domoticz server.
This shows that potentially this home automation software could be used on an Orange Pi Zero.
Installing a MQTT Broker
To replace the Raspberry Pi as a host of my home automation system, I also verified that Mosquitto can be installed on the OPiZ.
The procedure is different from that used with the Raspberry Pi, because the Linux system on the OPiZ is Ubuntu and not Debian. Fortunately, it's even easier to install on this new computer by following the instructions found at Mosquitto org.
The Mosquitto clients to subscribe to topics and to post messages can also be installed at this point.
Once this installation completed, we can see all the messages received by the broker.
Verification that the MQTT server is working is done by opening a terminal on the desktop and publishing a message.
Here is what is displayed in the terminal subscribed to the MQTT messages.
Check that Domoticz works with the local MQTT
broker on the OPiZ by restoring localhost
as the remote address of
the MQTT hardware.
H2+ Running Hot
Like many, I noticed that the Allwinner H2+ chip seems to run at high temperatures. The reliability and even the life of the OPiZ could be at stake.
As can be seen, the temperature of the microprocessor is about 60°C while it does practically nothing at a frequency less than 1/4 of its maximum rate. The ambient temperature is about 19°C, the board is not in its case and the expansion card is not connected.
This phenomenon of overheating is especially associated with the most recent version of the card, version 1.4. Here are three references to this topic: New OPi Zero (v1.4 PCB) - High temperature , OrangePi Zero high temperature? and New OPi Zero - Yet another high temperature issue... . The first link is on the Orange Pi forum, the other two on the Armbian forum. The page dedicated to the Armbian OPiZ contains a link to the last reference with the following mention board revision 1.4 report false high CPU temperatures. Is there an error when reading the temperature? I can press my finger on the chip for more than 15 seconds without burning it. This is not a very scientific test and by reading the posts on the forum, it is not clear that these are false positives
A utility can be used to reduce power consumption and, in principle, reduce the temperature.
Since it is almost certain that the OPiZ will be used as a server, there are no consequences to stopping the graphics processor.
After an hour here is the result
Hard to say that there is a great improvement especially that the workload of the microprocessor seems weaker. We can reduce the consumption even more.
Here are the results of this more aggressive approach that stops the operation of the graphics processor, the Ethernet interface, the USB connection and which manages the power consumption of the WiFi interface.
Observations
I remain enthusiastic about this small computer despite some problems. I am not convinced that the temperature of the microprocessor is a real problem. However, there may be overheating in the small housing. If the expansion card is used, it becomes difficult to use a heat sink of sufficient mass given the limited space between the two cards.
I already mentioned the difficulties I had with the Allwinnner Wi-Fi module, the XR819. The module is new, the drivers are not necessarily stable. My first impression is that the Wi-Fi connection is not reliable enough for a home automation system. At a minimum, a watchdog should be provided, which would restart the module when necessary.
I will also have to look at other operating systems. Among others, there is the Debian version of Armbian already mentioned and a clean version of Debian Jessie offered by dietpi. Knowing a little better Debian because of Raspbian used on the Raspberry Pi, I may be able to run the network connections reliably.
Instead of replacing the Raspberry Pi, the OPiZ could be a complement. A page intrigues me How to Setup an Orange Pi Zero DIY Smart Speaker with Google Assistant SDK. I'm looking forward to trying to replicate this project that could be part of a home automation system.
If it turns out that only the Ethernet connection is reliable, then I'll look at another project: Pi-hole®: A black hole for Internet advertisements. From what I've seen, it's quite possible to install this ad blocker on the OPiZ.