Shenzhen Xunlong Software Orange Pi Zero 2w User manual

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
Orange Pi Zero 2w
User Manual

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
目录
1. Basic features of Orange Pi Zero 2w...............................................................................1
1.1. What is Orange Pi Zero 2w ................................................................................................. 1
1.2. Usage of Orange Pi Zero 2w ............................................................................................. 1
1.3. Who is Orange Pi Zero 2w designed for?........................................................................ 1
1.4. Hardware features of Orange Pi Zero 2w ........................................................................... 2
1.5. Top view and bottom view of Orange Pi Zero 2w ...............................................................3
1.6. Orange Pi Zero 2w interface details ....................................................................................4
1.7. Orange Pi Zero 2w 24pin expansion board interface details..............................................5
2. Introduction to the use of development boards............................................... 7
2.1. Prepare necessary accessories ........................................................................................... 7
2.2. Download the development board image and related information................................ 11
2.3. Method of burning Linux image to TF card based on Windows PC ................................. 12
2.3.1. How to burn Linux image using balenaEtcher...................................... 12
2.3.2. How to burn Linux image using Win32Diskimager..............................16
2.4. Method to burn Linux image to TF card based on Ubuntu PC ......................................... 19
2.5. Method of burning Android image to TF card ..................................................................23
2.6. Instructions for using micro-linux system in onboard SPI Flash ....................................... 30
2.7. Start the Orange Pie development board .........................................................................31
2.8. How to use the debugging serial port .............................................................................. 32
2.8.1. Debug serial port connection instructions ............................................. 32
2.8.2. How to use the debugging serial port on Ubuntu platform................... 34
2.8.3. How to use the debugging serial port on Windows platform................ 36
2.9. Instructions for using the 5v pin in the 40pin interface of the development board for
power supply .............................................................................................................................. 39
3. Debian/Ubuntu Server and Xfce desktop system usage instructions............................ 41
3.1. Supported linux image types and kernel versions ............................................................41

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
3.2. Linux kernel driver adaptation situation .......................................................................... 42
3.3. Linux command format description in this manual ..........................................................43
3.4. Linux system login instructions .........................................................................................45
3.4.1. Linux system default login account and password................................45
3.4.2. How to set up automatic login of Linux system terminal..................... 46
3.4.3. Instructions for automatic login of Linux desktop version system....... 46
3.4.4. Setting method for automatic login of root user in Linux desktop system48
3.4.5. How to disable the desktop in Linux desktop system........................... 48
3.5. Onboard LED light test instructions ..................................................................................49
3.6. Operation instructions for rootfs partition capacity of Linux system in TF card .............. 51
3.6.1. The first startup will automatically expand the capacity of the rootfs
partition in the TF card........................................................................................51
3.6.2. Method to prohibit automatic expansion of rootfs partition capacity in
TF card.................................................................................................................53
3.6.3. Method to manually expand the capacity of rootfs partition in TF card54
3.6.4. Method to reduce the capacity of rootfs partition in TF card................60
3.7. 24Pin expansion board interface pin description .............................................................64
3.8. How to use the two LRADC buttons on the 24pin expansion board ................................66
3.9. Network connection test .................................................................................................. 71
3.9.1. Ethernet port test....................................................................................71
3.9.2. WIFI connection test............................................................................. 73
3.9.3. Method to create WIFI hotspot through create_ap................................82
3.9.4. How to set a static IP address ................................................................ 89
3.9.5. How to set up the Linux system to automatically connect to the network
for the first time...................................................................................................97
3.10. SSH remote login development board ......................................................................... 102
3.10.1. SSH remote login development board under Ubuntu........................102
3.10.2. SSH remote login development board under Windows.................... 103
3.11. HDMI test ......................................................................................................................105
3.11.1. HDMI display test............................................................................. 105
3.11.2. HDMI to VGA display test................................................................106

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
3.11.3. How to set HDMI resolution in Linux5.4 system............................. 107
3.11.4. How to modify the width and height of Framebuffer in Linux5.4
system................................................................................................................108
3.11.5. Framebuffer cursor setting.................................................................109
3.12. How to use Bluetooth ...................................................................................................110
3.12.1. Testing method for desktop image.....................................................110
3.12.2. How to use server version image.......................................................113
3.13. USB interface test ......................................................................................................... 116
3.13.1. USB interface extension description ................................................. 116
3.13.2. How to set USB0 to HOST mode......................................................117
3.13.3. Connect USB mouse or keyboard to test...........................................119
3.13.4. Connect USB storage device for testing ............................................119
3.13.5. USB Ethernet card test...................................................................... 120
3.13.6. USB camera test................................................................................ 121
3.14. Audio test ......................................................................................................................124
3.14.1. How to play audio using the command line ...................................... 124
3.14.2. Test audio methods on desktop systems ............................................125
3.15. Infrared reception test ..................................................................................................127
3.16. Temperature sensor ......................................................................................................129
3.16.1. How to check the temperature in linux5.4 system............................ 129
3.16.2. How to check the temperature in linux6.1 system............................ 130
3.17. 40 Pin Interface pin description ....................................................................................131
3.18. How to install wiringOP ................................................................................................ 132
3.19. 40pin interface GPIO, I2C, UART, SPI and PWM testing ............................................... 134
3.19.1. 40pin GPIO port test..........................................................................134
3.19.2. How to set the pull-down resistor of 40 Pin GPIO port.................... 135
3.19.3. 40pin SPI test.....................................................................................136
3.19.4. 40pin I2C test.................................................................................... 139
3.19.5. 40pin UART test................................................................................143
3.19.6. PWM test method ..............................................................................146
3.20. How to install and use wiringOP-Python ......................................................................150
3.20.1. How to install wiringOP-Python....................................................... 157

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
3.20.2. 40pin GPIO port test..........................................................................159
3.20.3. 40pin SPI test.....................................................................................162
3.20.4. 40pin I2C test.................................................................................... 165
3.20.5. 40pin UART test................................................................................169
3.21. Hardware watchdog test .............................................................................................. 173
3.22. Check the chipid of H618 chip ......................................................................................174
3.23. Python related instructions .......................................................................................... 174
3.23.1. How to compile and install Python source code............................... 174
3.23.2. How to replace pip source in Python.................................................175
3.24. How to install Docker ....................................................................................................176
3.25. How to install Home Assistant ......................................................................................177
3.25.1. Installation via docker....................................................................... 177
3.25.2. Installation via python ....................................................................... 181
3.26. OpenCV installation method ........................................................................................ 183
3.26.1. Use apt to install OpenCV.................................................................183
3.27. Set up the Chinese environment and install the Chinese input method ..................... 183
3.27.1. Debian system installation method....................................................183
3.27.2. Installation method of Ubuntu 20.04 system.....................................190
3.27.3. Installation method of Ubuntu 22.04 system.....................................194
3.28. How to remotely log in to the Linux system desktop ................................................... 200
3.28.1. Remote login using NoMachine........................................................200
3.28.2. Remote login using VNC.................................................................. 204
3.29. QT installation method ................................................................................................. 206
3.30. ROS installation method ............................................................................................... 214
3.30.1. How to install ROS 1 Noetic on Ubuntu20.04..................................214
3.30.2. How to install ROS 2 Galactic on Ubuntu20.04............................... 218
3.30.3. How to install ROS 2 Humble on Ubuntu22.04................................221
3.31. How to install kernel header files ................................................................................. 223
3.32. Testing of some programming languages supported by Linux system .........................225
3.32.1. Debian Bullseye system.................................................................... 225

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
3.32.2. Debian Bookworm system................................................................ 227
3.32.3. Ubuntu Focal system......................................................................... 228
3.32.4. Ubuntu Jammy system...................................................................... 230
3.33. Method of uploading files to the development board Linux system........................... 232
3.33.1. Method to upload files to the development board Linux system in
Ubuntu PC......................................................................................................... 232
3.33.2. Method to upload files from Windows PC to development board Linux
system................................................................................................................236
3.34. Instructions for using the logo on and off the machine ............................................... 241
3.35. How to turn on the power button in Linux5.4 ............................................................. 241
3.36. How to shut down and restart the development board .............................................. 243
4. Linux SDK——orangepi-build usage instructions..................................................... 244
4.1. Compilation system requirements ................................................................................. 244
4.2. Obtain the source code of linux sdk ............................................................................... 246
4.2.1. Download orangepi-build from github................................................246
4.2.2. Download the cross-compilation tool chain........................................ 248
4.2.3. orangepi-build complete directory structure description.....................250
4.3. Compile u-boot ...............................................................................................................251
4.4. Compile the linux kernel .................................................................................................255
4.5. Compile rootfs ................................................................................................................ 259
4.6. Compile linux image ....................................................................................................... 263
5. Instructions for using the Orange Pi OS Arch system.................................................268
5.1. Orange Pi OS Arch system function adaptation status................................................... 268
5.2. Orange Pi OS Arch System User Guide Instructions ....................................................... 269
5.3. How to set DT overlays ................................................................................................... 274
5.4. How to install software ...................................................................................................276
6. Android 12 TV system usage instructions...................................................................277
6.1. Supported Android versions ........................................................................................... 277
6.2. Android 12 TV function adaptation status ..................................................................... 277

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
6.3. Onboard LED light display instructions ...........................................................................278
6.4. How to return to the previous interface in Android.......................................................278
6.5. How to use ADB .............................................................................................................. 279
6.5.1. Use network connection adb debugging ..............................................279
6.5.2. Use data cable to connect adb debugging............................................280
6.6. View how to set HDMI display resolution ...................................................................... 280
6.6.1. HDMI to VGA display test..................................................................282
6.7. WI-FI connection method ...............................................................................................283
6.8. How to use WI-FI hotspot ...............................................................................................285
6.9. How to check the IP address of the Ethernet port.........................................................287
6.10. Bluetooth connection method ..................................................................................... 289
6.11. How to set USB0 to HOST mode ...................................................................................292
6.12. How to use USB camera............................................................................................... 293
6.13. Android system ROOT description ................................................................................294
6.14. How to use MiracastReceiver to cast the mobile phone screen to the development
board .........................................................................................................................................296
6.15. Method of turning on and off the machine through buttons or infrared remote control299
6.16. 40pin interface GPIO, UART, SPI test ............................................................................ 301
6.16.1. 40pin GPIO port test method.............................................................301
6.16.2. 40pin UART test method...................................................................304
6.16.3. 40pin SPI test method........................................................................307
6.16.4. 40pin I2C test method....................................................................... 310
6.16.5. 40pin PWM test .................................................................................315
7. How to compile Android 12 source code.................................................................... 318
7.1. Download the source code of Android 12 ......................................................................318
7.2. Compile the source code of Android 12 .........................................................................320
8. Appendix......................................................................................................................322
8.1. User manual update history ........................................................................................... 322

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 1www.xunlong.tv
1. Basic features of Orange Pi Zero 2w
1.1. What is Orange Pi Zero 2w
Orange Pi is an open source single-board card computer, a new generation of arm64
development board, which can run operating systems such as Android TV 12, Ubuntu and
Debian. The Orange Pi Zero 2w development board uses the Allwinner H618
system-on-chip, and can optionally have 1GB or 1.5GB or 2GB or 4GB LPDDR4
memory.
1.2. Usage of Orange Pi Zero 2w
We can use it to achieve:
A small Linux desktop computer
A small Linux network server
Install the Klipper host computer to control the 3D printer
Android TV TV box
Of course, there are more functions. Relying on a powerful ecosystem and a
variety of expansion accessories, Orange Pi can help users easily achieve delivery
from ideas to prototypes to mass production. It is an ideal choice for makers,
dreamers, and hobbyists. An ideal creative platform for readers.
1.3. Who is Orange Pi Zero 2w designed for?
The Orange Pi development board is not only a consumer product, but also designed
for anyone who wants to use technology to create and innovate. It's a simple, fun, and
practical tool you can use to shape the world around you.

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 2www.xunlong.tv
1.4. Hardware features of Orange Pi Zero 2w
Introduction to hardware features
CPU
Allwinner H618 quad-core 64-bit 1.5GHz high-performance
Cortex-A53 processor
GPU
Mali G31 MP2
Supports OpenGL ES 1.0/2.0/3.2、OpenCL 2.0
Memory
1GB/1.5GB/2GB/4GB LPDDR4 (shared with GPU)
Onboard storage
TF card slot, 16MB SPI Flash
WIFI+BT
•20U5622 chip, supports IEEE 802.11 a/b/g/n/ac, BT5.0
Video Output
•Mini HDMI 2.0 interface
Audio Output
•Mini HDMI output
Power Supply
Type-C 5V/2A
USB 2.0 port
Type-C USB2.0 x 2
40pinexpansion
interface
Used to expand GPIO, UART, I2C, SPI, PWM
24pinexpansion
interface
Used to expand USB2.0 x 2, 100M Ethernet, infrared
reception, audio output, TV-OUT output, power on/off
button, LRADC button x 2
LED Light
Power light and status light
Supported OS
Android 12 TV ,Debian11 ,Debian12 ,Ubuntu22.04 ,
Ubuntu20.04,Orange Pi OS(Arch)etc.
Appearance specifications introduction
PCB Size
30mm x 65mm x 1.2mm
Weight
12.5g
range Pi™ is a registered trademark of Shenzhen Xunlong Software Co., Ltd.

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 7www.xunlong.tv
2. Introduction to the use of development boards
2.1. Prepare necessary accessories
1) TF card, high-speed SanDisk card with minimum capacity of 8GB, class 10 or above
When using other brands of TF cards (non-SanDisk TF cards), as shown in the
picture below (including but not limited to these cards), some friends have reported
that problems will occur during system startup, such as the system getting stuck
halfway through startup. Or the reboot command cannot be used normally, and it
was finally solved after replacing the SanDisk TF card. Therefore, if you are using a
non-SanDisk TF card and find problems with system startup or use, please replace it
with a SanDisk TF card and then test again.
There are currently reports that some TF cards have problems booting on Orange Pi Zero 2w.
In addition, TF cards that can be used normally on other types of development
boards are not guaranteed to be able to start normally on Orange Pi Zero 2w. Please
pay special attention to this point.
2) TF card reader, used to read and write TF cards

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 8www.xunlong.tv
3) Mini HDMI to HDMI cable, used to connect the development board to an HDMI
monitor or TV for display
4) Power supply. If you have a 5V/2A or 5V/3A power supply, you only need to prepare
a USB to Type C interface data cable as shown in the picture on the left below. You can
also use a cable similar to the picture on the right below. 5V/2A or 5V/3A high-quality
USB Type C interface power adapter integrated with the power head.
Both Type-C interfaces on the development board can be used for power supply.
5) 24pin expansion board

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 9www.xunlong.tv
6) USB interface mouse and keyboard, as long as it is a standard USB interface mouse
and keyboard, the mouse and keyboard can be used to control the Orange Pi development
board
7) Infrared remote control, mainly used to control Android TV system
Note that the remote control of the air conditioner or the TV cannot control the
Orange Pi development board. By default, only the remote control provided by
Orange Pi can.
8) Network cable to connect the development board to the Internet
9) AV video cable. If you want to display video through the TV-OUT interface instead of
the HDMI interface, you need to connect the development board to the TV through the
AV video cable.

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 10 www.xunlong.tv
10) Heat sink. If you are worried that the temperature of the development board is too
high, you can add some heat sinks and stick the heat sinks on the H618 chip and memory
chip.
11) 5V cooling fan, as shown in the figure below. There are 5V and GND pins on the
40pin interface of the development board that can be connected to the cooling fan. The
spacing of the 40pin pins is 2.54mm. The power interface of the cooling fan can be
purchased according to this specification.
Note that the 5V pin can be used directly after the development board is
plugged in and no other settings are required. In addition, the voltage output by the
5V pin cannot be adjusted or turned off through software.

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 11 www.xunlong.tv
The pin headers on the 40pin interface are not soldered by default, and you need
to solder them yourself before you can use them.
12) Type-C to USB cable for connecting USB devices
13) USB to TTL module and Dupont cable. When using the serial port debugging
function, a USB to TTL module and Dupont cable are needed to connect the development
board and the computer.
Note that the TTL level used by the development board is 3.3v. In addition to
the USB to TTL module shown in the picture above, other similar 3.3v USB to TTL
modules are generally available.
14) X64 computer with Ubuntu and Windows operating systems installed
1
Ubuntu22.04 PC
Optional, used to compile Android and Linux source code
2
Windows PC
For burning Android and Linux images
2.2. Download the development board image and related
information
1) The download URL for the Chinese version of the information is
http://www.orangepi.cn/html/hardWare/computerAndMicrocontrollers/service-and-
support/Orange-Pi-Zero-2W.html

range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
www.orangepi.cn 12 www.xunlong.tv
2) The download URL for the English version of the information is
http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and
-support/Orange-Pi-Zero-2W.html
3) The information mainly includes
a.Android source code: saved on Google Cloud Drive
b.Linux source code: saved on Github
c.Android image: saved on Google Cloud Drive
d.Ubuntu image: saved on Google Cloud Drive
e.Debian image: saved on Google Cloud Drive
f.Orange Pi OS (Arch) image: saved on Google Cloud Drive
g. User manual and schematic diagram: chip-related data manuals will also be
placed here
h.Official tools: mainly include software needed when using the development board
2.3. Method of burning Linux image to TF card based on
Windows PC
Note that the Linux image mentioned here specifically refers to the Linux
distribution image such as Debian or Ubuntu downloaded from the Orange Pi
information download page.
2.3.1. How to burn Linux image using balenaEtcher
1) First prepare a TF card with 8GB or larger capacity. The transmission speed of the TF
card must be class10 or above. It is recommended to use TF cards from SanDisk and
other brands.
2) Then use the card reader to insert the TF card into the computer
3) Download the compressed package of the Linux operating system image file you want
to burn from the Orange Pi information download page, and then use the
decompression software to decompress it. In the decompressed file, the file ending with
".img" is the image file of the operating system. The size is generally above 1GB
4) Then download the Linux image burning software-balenaEtcher, the download
Table of contents
Other Shenzhen Xunlong Software Single Board Computer manuals
Popular Single Board Computer manuals by other brands

Data Modul
Data Modul eDM-SBC-iMX8Mm manual

Shenzhen Xunlong Software Co., Ltd
Shenzhen Xunlong Software Co., Ltd Orange Pi 3G-IoT user manual

Infineon
Infineon Cypress CYW43353 manual

Advantech
Advantech RSB-4760 user manual

IEI Technology
IEI Technology NANO-8522 user manual

Vantron
Vantron VT-SBC-3588 user manual