zeldor.biz

Linux, programming and more

Copyright © 2023
Log in

Orange PI zero

December 9, 2018 by Igor Drobot 2 Comments

A new generation of mini pc, is the slogan of the of the manufacturer of the Orange PI zero board.
Indeed, its only the half of the size of a normal Raspberry PI board and the half of the weight.
Solid performance for that size and price – 7,60$.

I think its a really good choice for inexpensive portable linux system.

Hardware

Board size: 48 mm × 46mm
Weight: 26g
ARM: A7 Quad core 1.2 GHz
RAM: 256/512 MB
NIC: 100 Mbit ethernet port
WIFI: IEEE 802.11 b/g/n module is integrated (antenna included)
USB: one 2.0 usb port
Storage: microSD card (Max. 32GB)
LEDs: Power led & Status led
GPIO: 26

There are two different models of Orange PI zero available. For memory hungry use cases, 512MB RAM version will be the best choice.
I have the 256MB version. I will present also some kernel and system optimisations for low memory usage.

Power/Power consumption

DC 5V, 1A

Image/Installation

The most common way is to install Debian stretch or Ubuntu Bionic to Orange PI, its up to you which distribution you choose. My decision fell on to Debian.
Both images can be downloaded from armbian and flashed with etcher to a microSD card.

After flashing the image to microSD card you have to boot the PI with a connected ethernet cable to become access on it, you will be able to see the DHCP-request and the leased IP address to the PI on your router.
On a linux box it’s looks like this one:
Dec 8 18:04:52 dhcpd[5433]: DHCPDISCOVER from 02:42:2a:0d:6b:45
Dec 8 18:04:53 dhcpd[5839]: DHCPOFFER on 10.1.100.65 to 02:42:2a:0d:6b:45 (orangepizero)

Credentials

The default credentials for the first login are:
username: root
password: 1234

After successful login, you will be requested to change the default password and create a user, please avoid to login with root.

First things first

Set correct timezone:

1
dpkg-reconfigure tzdata

dpkg-reconfigure tzdata

Perform update:

1
apt update && apt upgrade

apt update && apt upgrade

Disable NetworkManager and switch to static configuration. Wired and wireless configuration examples are presented below.
Less running software will save you memory and if you plan to run autonomous, from batteries, this is the first step to optimise the power consumption.

1
2
systemctl disable NetworkManager
systemctl stop NetworkManager

systemctl disable NetworkManager systemctl stop NetworkManager

Static configuration for the ethernet connection can look like this one:

1
2
3
4
5
6
7
cat /etc/network/interfaces
auto lo
iface lo inet loopback
 
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

cat /etc/network/interfaces auto lo iface lo inet loopback auto eth0 allow-hotplug eth0 iface eth0 inet dhcp

Alternative to be more flexible and network cable independent, switch to wifi-connection:

1
2
3
4
5
6
7
8
9
cat /etc/network/interfaces
auto lo
iface lo inet loopback
 
auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-ssid secondfloor
    wpa-psk myssidpassword123

cat /etc/network/interfaces auto lo iface lo inet loopback auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid secondfloor wpa-psk myssidpassword123

With a static ip address, you will always know the IP of your Orange PI without looking for it on your router every time you wish to establish a connection.

1
2
3
4
5
6
7
8
9
10
11
12
cat /etc/network/interfaces
auto lo
iface lo inet loopback
 
auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet static
    address 10.1.100.123
    netmask 255.255.255.0
    gateway 10.1.100.1
    wpa-ssid secondfloor
    wpa-psk myssidpassword123

cat /etc/network/interfaces auto lo iface lo inet loopback auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 10.1.100.123 netmask 255.255.255.0 gateway 10.1.100.1 wpa-ssid secondfloor wpa-psk myssidpassword123

With a static network configuration, there is also no need for the DHCP-client which is permanent running to be in touch with the DHCP-server.

Power consumption optimisations

I decided to buy a 256 MB version of Orange PI, to have enough memory for my applications it make sense, to disable everything, what is not highly required.

1
2
3
4
5
systemctl disable NetworkManager
systemctl disable ntp
systemctl disable haveged.service
systemctl disable rsyslog.service
systemctl disable systemd-journald.service

systemctl disable NetworkManager systemctl disable ntp systemctl disable haveged.service systemctl disable rsyslog.service systemctl disable systemd-journald.service

To adjust the time, you can use a cron-based mechanism to run a ntpdate periodically.
Logging is a #1 killer for a microSD card, the best way will be to disable any kind of logging to extend the lifetime of your microSD card.

A older post for BeagleBone power consumption optimisation is a pretty good base for this part. 

Install cpufrequtils to manage the cpu frequency and get detailed information about the possible frequency.

1
apt install cpufrequtils

apt install cpufrequtils

cpufreq-info is marked with the most relevant keys:

So now you know the possible frequency units and you can perform the optimisation tests.

1
2
# 240MHz
cpufreq-set -f 240000

# 240MHz cpufreq-set -f 240000

Proof of concept with usb power consumption meter:

 

Serial connection

At any time in any case without network connection, its possible to establish a serial connection to the Orange PI board.
USB-to-Serial converter can help to access a board if the network gets broken or misconfigured firewall is locked out.
Connection:
orange pi : USB-to-Serial converter
ground : ground
RX : TX
TX : RX

1
screen /dev/tty.usbserial 115200

screen /dev/tty.usbserial 115200

Serial connection from Terminal

Filed Under: Linux Tagged With: ARM, Linux, Orange PI, UART

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Comments

  1. Igor Drobot says

    February 22, 2023 at 11:53

    Hey Jim,

    I’m very sorry, that you waste some time with my older Orange PI blog post; this solutions worked for me very well at the beginning of 2018…
    So probably there are some changes on the OS side stack in combination with the wifi-implementation. Or probably some other side effects.
    At the moment my Orange PI is not in use but I’m plane to use it again in the garden…

    May I ask you, what is your use case?

  2. Jim says

    February 12, 2023 at 15:34

    Hi, This step is bullshit!

    auto lo
    iface lo inet loopback

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-ssid secondfloor
    wpa-psk myssidpassword123

    i test it and no wlan connection!
    the zero can not use the hotspot!

    other wirte you must make a new wpa_supplication.conf under /etc/network/!
    your howto works not!
    it cost time and nothin works, thanks for writimng so a bullshiz how to.

Leave a Reply

Your email address will not be published. Required fields are marked *