Building a Linux server with an Asus Tinker Board

Friday 28 April 2017

Building a Linux server with an Asus Tinker Board

For several years, we have been using a Raspberry Pi as a small Linux server for monitoring our solar heating system and power usage throughout the house.  While the Raspberry Pi has been perfectly suitable for the tasks it has been given, we needed something a bit more powerful for some of our other projects. 

Asus recently released the Tinker Board, an ARM based computer in the same format as the Raspberry Pi but using a more powerful Rockchip RK3288 CPU.  It has gigabit ethernet and separate controllers for the ethernet and USB so the network performance should be faster compared to the Raspberry Pi.  We ordered a Tinker Board when it was first released in the UK in February 2017 with the intention of using it to test compatibility with the Raspberry Pi expansion boards we make and sell but after using it for a while we decided it might make a good small Linux server to run alongside our existing Raspberry Pi server.

The server would be used mainly for hosting several websites including the Partkeepr inventory manager which we use to keep a database of the thousands of electronic components we have collected over the years.  As well as a web server, we also need a local GIT server for storing backups of our development work.  A DNS server for adblocking on our computers and tablets would also be useful.  We had a spare 120GB SSD with a USB to SATA adapter that would be suitable for file and database storage so we decided to use a 32GB SD card for the OS installation and the SSD as the storage drive. 

To mount the Tinker Board and the SSD together we used a WD PiDrive 6x6 enclosure from Western Digital.  The PiDrive enclosure has space to mount the Tinker Board and SSD alongside each other with a short USB cable used to connect them together.  We had to make a few small modifications to the enclosure to make everything fit.  The PiDrive enclosure is designed to be used with Western Digital’s USB drives which have the USB connector in a different place to our SSD so we had to remove a piece of curved plastic which would normally be used for cable routing.  A pair of slots we cut into the side of the lid to add some extra airflow as the Tinker Board runs hotter than a Raspberry Pi.  Western Digital supply three magnets and washers to join the lid to the enclosure but the kit did not include any way of sticking the magnets and washers to the plastic so we had to use some epoxy resin to glue everything in place.  Two holes were drilled in the base so we could mount the enclosure vertically on a wall next to our network switch.

The case with the SDD and Asus Tinker Board fitted with SATA to USB adapter.

The case with the SDD and Asus Tinker Board fitted with SATA to USB 3 adapter.

The server will be powered through our solar monitoring system which has several 12V outputs.  This way we can monitor the amount of current the Tinker Board uses.  The Tinker Board with the external SSD uses between 500mA and 1300mA depending on the CPU load so we needed a small switching power supply to drop the 12V down to 5V.  A PTN78060 3A regulator from Texas Instruments was salvaged from our old Pick and Place machine controller and a sticky pad was used to fit it to the top of the SSD.

With the hardware complete the next stage was to install Linux onto the SD card and format the SSD.  Asus provides a version of Debian Linux on their support website but at the time of writing the rest of their support is very limited with just a couple of FAQs and some libraries for setting up the GPIO pins.  As the Tinker Board would be used as a headless server there was little point having a GUI running in the background using up memory and resources so the first job was to remove X.org and the other associated GUI libraries.  Webmin was installed so the server could be remotely administered through a web browser and samba was set up so our Windows machines could access the system.   The SSD was formatted and mounted as a folder in the root.

Next apache, php and MySQL were installed and configured to use the SSD as the database and web folder and PartKeepr was set up.  The DNS and Git servers will be installed later.

Keeping It Cool

A few basic stress tests were performed to see how well the Tinker Board coped with high CPU loads and it quickly became apparent that a fan would be needed as after a minute of 100% usage the CPU would rise to 75°C and begin throttling.  A 12V 55mm radial fan was found in our box of PC parts.  It was originally designed to be fitted in a PCI slot on the back of a computer but with a few modifications it was fitted on top of the SSD pointing at the CPU heatsink.  A cut-out was made on the plastic lid using our CNC mill to allow airflow into the fan and a simple transistor based control circuit was built onto some stripboard to control the fan using PWM from a GPIO pin.

To manage the fan speed, we wrote a simple program which gets the CPU temperature from /sys/class/thermal/thermal_zone1/temp and uses that to set the fan speed by adjusting the PWM output.  According to ASUS the PWM functions were not enabled on the version of Linux we were using but their GPIO C API, available on their support website, included an example for controlling the PWM pin using WiringPi so we tried modifying the example and found that it worked.  The code and schematic for the fan controller can be found on our GitHub account.

With the fan fitted we tried running the CPU at 100% load and found that even with the fan only running at 50% the temperature would not rise above 55°C and with no load the fan would stay off with a CPU temperature of between 35°C and 40°C.

Case with SSD, Fan, Power supply, fan controller and Asus Tinker Board.

Case with SSD, Fan, Power supply, fan controller and Asus Tinker Board

The completed case with fan cutout.

The completed case with fan cutout

 

Fan controller circuit

Speed Tests

A benchmark was run using sysbench to compare the performance of the Tinker Board against a Raspberry Pi 3.  As both systems use quad core CPUs a 4 thread test was run with the following command: 

sysbench --test=cpu --num-threads=4 --cpu-max-prime=20000 run

The results for the Asus Tinker Board are as follows:

Maximum prime number checked in CPU test: 20000

Test execution summary:  
total time: 82.2044s
total number of events:   10000
total time taken by event execution: 328.7541
per-request statistics:  
min: 32.63ms
avg:  32.88ms
max: 72.21ms
approx.  95 percentile:  33.41ms
Threads fairness:  
events (avg/stddev): 2500.0000/26.05
execution time (avg/stddev): 82.1885/0.01

 

The Raspberry Pi 3 gave the following results:

Test execution summary:  
total time: 122.8869s
total number of events: 10000
total time taken by event execution: 491.4391
per-request statistics:  
min:  47.69ms
avg:   49.14ms
max: 115.54ms
approx.  95 percentile: 47.94ms
Threads fairness:  
events (avg/stddev): 2500.0000/4.06
execution time (avg/stddev): 122.8598/0.02

As you can see from the results the Tinker Board is approximately 30% faster than the Raspberry Pi 3.  We did not try a GPU benchmark as the tasks we are running on the server will not make use of the GPU.
With the hardware and software ready we installed the server in the cupboard alongside the wireless router and network switch.