Arduino and Orange Pi Zero

Zápisník experimentátora

Hierarchy: Orange Pi

In the previous article on Orange Pi Zero, we showed GPIO pin control using the WiringOP library. For a simple task, this library will serve you well, but for more complicated projects, you would be bothered to get rid of everything. If you have Arduino available, you can connect it to the USB port and take advantage of it. For Arduino, libraries have been written for each integrated circuit you can remember. Therefore, you only have to solve a single problem. How to communicate with Arduino.

Used parts

We will need the following components:

  • Arduino Uno - You can use any Arduino.
  • Orange Pi Zero (link) -  use the version with 512 MB of RAM.
  • SD card - You need to use the Class 10 SD card. You need a size of 8 - 16 GB. The Armbian operating system must be installed on the SD card. I have used the version of Armbian 5.30, Debian Jessie 3.4.113.
  • Power supply with micro USB connector - At home you will surely have a mobile phone charger. Orange Pi Zero does not need a special power supply. Just check whether it is able to deliver 1.5 - 2 A.
  • Ethernet cable or Wi-Fi - This depends on how you set Orange Pi Zero. Connecting to a router via an Ethernet cable is the simplest way. If you have set up Wi-Fi, you can have your Orange Pi Zero placed anywhere in the apartment.

You can see the USB port in the lower left corner. Connect any Arduino to it. Arduino will automatically appear in the serial port list. You can verify this with the command ls /dev/ttyA*. If you have the sketch that communicates over the serial port in the Arduino, you can check whether Arduino is sending something using the command cat /dev/ttyACM0. If you have everything well connected, you should see the same results as in the following picture.


For further communication with the Arduino we will use Node.js. All the necessary information on the use of Node.js on Orange Pi Zero is explained in the previous articles.


We will use the source code I wrote to the previous articles. First, from the GitHub, clone the arduinoslovakia directory with the command git clone

Then with command cd arduinoslovakia/node.js/arduinoserialtest2/node move to the source code directory for Node.js and install the packages with the command npm install. For the ARM platform, packages are not ready, but Orange Pi Zero compiles them directly from the source code of the serialport package.

You can then test the list of serial ports with command node list.js. Our Arduino will appear on /dev/ttyACM0. In addition to this port, we see three more ports, but they are not interested us now. These ports are on a 26-pin header.

Finally, use the command node index.js run a program that offers you a selection of the serial port. After selecting the port, the content from Arduino will be posted to the console.

You can write your own program for Arduino and Node.js to control the Arduino. My example for Node.js was just a non-visual, but you can write a webserver in Node.js to control Arduino and Orange Pi Zero through your Internet browser. This manual has been written for Orange Pi Zero, but it will also work well on any Orange Pi model.

Source code

The source code is located on the GitHub server.