And prepare a task – to get on the leaderboard. However, the task will be solved even more interesting if we put a rigid restriction – artificial intelligence resources will not be derived from our undoubtedly powerful computer, but from a single-board on the ARM architecture! At the same time we will get not only experience with portable devices, but also the ability to keep the bot enabled 24/7 without any damage to the main computer!
How long, short , Were found three single-board computers with a penny price – Orange Pi Zero, NanoPi Neo, NanoPi Neo2, their brief characteristics are shown in the table:
|Orange Pi Zero||NanoPi Neo||NanoPi Neo2|
|The amount of operative memory||512MB DDR3||512MB DDR3||512MB DDR3|
|The processor||Allwinner H2 + Cortex A7 (32-bit architecture, 4 cores, frequency up to 1200Hz)||Allwinner H3 Cortex A7 (32-bit architecture, 4 cores, frequency up to 1200Hz)||Allwinner H5 Cortex-A53 ( 64 -bit architecture, 4 cores, frequency up to 1500Hz )|
|The graphic core||ARM Mali400 MP2, without a hint of OpenCL||ARM Mali400 MP4, without a hint of OpenCL||ARM Mali450 MP4, without a hint of OpenCL|
|"Three sizes", mm||52x46x17||40x40x17||40x40x17|
|Access to the Internet||100Mbps Ethernet + 802.11 b / g / n WiFi with antenna||100Mbps Ethernet||1Gbps Ethernet|
|The number of USB outputs||1 (+2 inferred)||1 (+2 inferred)||1 (+2 inferred)|
|Price (+ shipping to Moscow), $||7 + 3.85 = 10.85||8 + 5 = 13||15 + 5 = 20|
Delivery Orange Pi Zero took exactly 20 days, Neo and Neo2 came a day earlier, I think very quickly.
Let's start to understand …
It should be noted that for the Neo was ordered Basic Starter Kit (+13 dollars), which, in addition to the computer, includes:
– USB-to-UART converter;
– large (if you can call an aluminum plate the size of a computer) radiator + mount;
– MicroSD card for 8GB SanDisk 10class.
– MicroUSB cable.
There is also a Complete Starter Kit ($ 29 + shipping), it includes everything that is in Basic, plus the case and OLED screen, but for our purpose this is a little unnecessary.
Let's get ready for the first launch …
From the armbian site we download three fresh images for NanoPi Neo, Neo2 and OrangePi Zero, we will use the MicroSD card obtained from the Basic Starter Kit.
From now on, a single-board computer will be called a single-board computer, and a computer – a familiar large and powerful computer or laptop for us. Now we have two ways with which you can work with single-board:
 Via Ethernet
- We connect a single board with an Ethernet cable to a laptop, computer or router;
- Turning on the power for the single-board
- Scan the network, for most linux-based systems can be done through the command "arp -a", for Windows there is nmap;
- We connect to the single-board, for linux: "ssh ip -l root", the default password is "1234"; In Windows you can use any ssh-client, for example, multifunctional putty
 Using the USB-to-UART converter.
- We connect the converter to the computer, we determine its physical address: in linux we look at the last lines of the command "dmesg | Grep tty "and look for something similar to ttyUSBX, for Windows we look in the Device Manager new COM-devices
- We connect a single-board to the converter: connect the wire to the converter so that GND is connected by a black wire, and TX – yellow, then connect a single-board (Neo / Neo2 connect to a single soldered contacts near the USB-port so that the black wire is near the nearest Edge, and yellow points in the direction of the flash card, you get the order: GND, 5V, RX, TX; Orange Pi Zero can not be connected with the cable that comes with the Starter Pack, there is no 5V in the middle, so you'll need to use a different cable)
- Now you need to find a program in which it will be convenient to work with the console on TTY / COM: for linux, I'll advise a convenient minicom or putty (you need to run it with superuser rights), for Windows it's still relevant putty
It is necessary to monitor the temperature, the temperature should be monitored …
We need to control the temperature if we want to keep the AI on the Windinium on it, avoiding a drop in frequency, hang-up or a single-board failure. Let's write a simple script for monitoring the temperature (at the same time we will practice running .py files):
import time, sys Print ('NanoTemp 0.1') While True: With open ('/ sys / devices / virtual / thermal / thermal_zone0 / temp', 'r') as f: Temp1 = f.read () [:-1] With open ('/ sys / devices / virtual / thermal / thermal_zone1 / temp', 'r') as f: Temp2 = f.read () [:-1] Print (' r' + temp1 + '' + temp2) Time.sleep (0.5)
Now you can put this file on your flashcard in the directory /home/username/.
TIP: Ubuntu, Debian and many other Linux-based operating systems can work with ext3 / ext4 file systems from under Boxes; Windows will offer a flash drive format. You need to use utilities that allow you to work with this kind of file systems, for example, install the Ext2Fsd driver.
Later I learned about a program like armbianmonitor, with which you can safely monitor not only the temperature, but also the frequency, Local time and load, which is undoubtedly useful.
We connect each single-board to the power network, wait 15 minutes in idle time and see the results:
|Orange Pi Zero||NanoPi Neo||NanoPi Neo2|
|60 ° C||35 ° C||50.3 ° C|
Quite interestingly, the Neo2 sensor shows the temperature right up to the first decimal point, but hides the information about the current processor frequency from us.
It's sad that Orange Pi Zero is so hot in idle, unlike his brother Neo at the same frequency 240MHz. Forums are dotted with discontent on this topic. As an option that solves this problem, a special script is offered, editing system files and using cooling. However, there is also information that these were all measures against heating up to 80 degrees during idle time, and 55-60 degrees in the fresh version of armbian is normal in this case. Apparently, the problem is solved only partially.
Let's try to install passive cooling. For Orange Pi Zero were bought for 2.82 dollars a special set of two radiators for the processor and RAM. In the case of NanoPi, we have a powerful heatsink that can be purchased separately from the Starter Pack for $ 2.99.
Now the picture 15 minutes after launch looks like this:
|Orange Pi Zero||NanoPi Neo||NanoPi Neo2|
|53 ° C||30 ° C||39.5 ° C|
Let's warm up to the full!
It was noticed that the orange was very warm. I wonder how many degrees the temperature will jump during the load. We use the cpuburn program available in the repositories (for Neo and Zero we will use the burnCortexA7 command, for Neo2 – burnCortexA8).
Well, say …
All single-board cards easily reach temperatures of 80 degrees with four copies of cpuburn – passive Cooling trite does not cope with such heating. However, I believe that in the case of Vindinium, not everything will be so sad – there is a cyclic phase change of work and idle time (waiting for a response from the server), and the cpuburn program itself is designed for the most efficient heat dissipation, to such an extent the AI can not load the processor as Minimum due to the need to wait for data from memory, because our task can not fully fit into the cache of the processor.
However, there is an interesting feature – Orange Pi Zero reaches 80 degrees, even with a single copy of cpuburn, For Neo2 three copies are enough, and Neo – four copies of the test.
Benchmarks, people require bread and benchmarks!
Before writing AI, you need to determine the most important question: how many times these single-board are weaker than ordinary computers? I can not believe that a small piece of silicon, metal and textolite can do anything out of the ordinary.
The utility phoronix-test-suite was used to conduct benchmarks.
In contrast to all single-boarders, let me include in testing Its laptop (i5 2450M, 6gb DDR3, without discrete graphics, running Ubuntu 16.04 LTS) to facilitate the development of AI (you can run certain pieces of code and know how much, approximately, the time of the same piece on the single-board will change). We use only passive cooling. For a unit of productivity, let's take an orange.
UPD: while the article was moderated, an old computer was found near the house (Intel Pentium 4 (1 core, 2 streams, 2003, pre-top processor on its architecture), 512MB DDR x2, Radeon 9600XT 128MB DDR), thirteen years ago such a system can be Was to call strong. In order to compare how it was, I installed [Windows 2000] Ubuntu 16.04 LTS which, to my surprise, turned out to be very workable.
|Laptop||Computer-dinosaur||Orange Pi Zero||NanoPi Neo||NanoPi Neo2|
|John The Ripper 1.8.0, Test: Blowfish (parrots / sec)||797 Real C / S (+125%)||313 Real C / S (+125%)||354 Real C / S||394 Real C / S (+11%)||475 Real C / S (+34%)|
|Smallpt V1.0.2 (seconds)||586 Seconds (4.6 times faster)||1214 Seconds (2.2 times faster)||2694 Seconds||2240 Seconds (1.2 times faster)||1289 Seconds (2.08 times faster)|
|C-Ray v1.1 (seconds)||120.86 Seconds (5.03 times faster)||294.61 Seconds (2.37x faster)||607.83 Seconds||485.71 Seconds (1.25 times faster)||349.51 Seconds (1.74 times faster)|
|Himeno Benchmark v3.0 (parrots)||1165.11 MFLOPS (+8908%)||385.28 MFLOPS (+ 2455%)||15.08 MFLOPS||13.08 MFLOPS (15% weaker)||37.23 MFLOPS (+185%)|
|Compress 7zip (parrots)||5010 MIPS (+ 585%, large deviation from the mean: 22.77%)||1706 MIPS (+88%)||857 MIPS||950 MIPS (+11%)||1103 MIPS (+29%)|
|ffmpeg (seconds)||30.69 Seconds (at 13.25 times faster)||81.22 Seconds (5 times faster)||406.76 Seconds||426.94 Seconds (5% slower)||The test did not start – compilation error|
|The cost including delivery and radiators||283.39 $ (+ 2046%)||–||13.67 $||15.97 $ (+17%)||22.97 $ (+ 68%)|
When studying the information on the Internet, it became clear that H2 + is a slightly modified version of H3:
H2 + is a variant of H3 designed for low-performance OTT units that does not support Gigabit MAC and 4K HDMI.
H2 + is a variant of H3, targeted at low-end OTT boxes, which lacks Gigabit MAC and 4K HDMI output support.
In this case, it becomes interesting, for what reason, there is such a difference in performance and the thermal regime between H2 + and H3.
To sum up.
Comparing three different single-board, I can sum up:
- Orange Pi Zero, undoubtedly, is the cheapest among all. The presence of WiFi on board is a very good advantage, but its speed is no more than 4Mbit / s (I got about the same value), which excludes its use as a normal wireless file server, but for IoT it will do just fine. You should buy at least some radiator, so as not to experience problems with abnormal temperatures, even in idle time. There is another wonderful side – the presence of TV-OUT, which I worked with, but if you are looking for a single-board for graphics mode, you should look towards devices with HDMI, because the screen resolution of 720×576 is not pleasing to the eye. It is very convenient that the official store of the manufacturer is available on Alyexpress;
- NanoPi Neo, unlike its younger brother, is deprived of TV-OUT and built-in Wi-Fi (for wireless work it will be necessary to buy for $ 2-3 $ Wi-Fi dongle, the declared data transfer rate of which is at 150 Mbps) , And by itself it comes out to the fifth part more expensively, but it can please us with lower heat generation, a brand-name solid radiator, higher performance, which will cover all the disadvantages of the platform. Also worth noting is the wide variety of accessories offered by the manufacturer for their offspring. Another nuance – will have to be ordered from the official site, although this is actually not so difficult;
- NanoPi Neo2. The version of the firmware from armbian is at the experimental stage, which was expressed in the problems described in the article (impossibility to look at the frequency, error when compiling ffmpeg). However, even in this raw form, the second coming of Neo boasts a fairly good performance in tests (remember about the 64-bit architecture), Gigabit Ethernet, which immediately elevates it to the favorites for those tasks where good performance and wire transfer speed are needed. But do not forget about Ubuntu Core, on it the situation can be better, and the armbian does not stand still. At a cost, of course, it exceeds the orange by more than one and a half times, so it's worth seeing competitors in its price segment.
For myself, I decided to continue working with Neo and Neo2, and postpone the orange until there is some interesting idea for a smart home, because Neo is very similar to Zero in performance, but without problems with temperature.
In the next article, we will choose a new programming language for ourselves, which can be learned as soon as AI is written.
→ Link to Vindinium
] → Link to sabreddit Vindinium – a very useful thing, there you can track my movements on Vindinium
→ Link to my githab with little work on Vindinium
I will be very pleased if more people are drawn to this game, because during the rivalry the most interesting begins!