Posts Tagged ‘ubuntu’

Using GPIOs on NanoPi NEO 2 Board with BakeBit Starter Kit

May 21st, 2017 9 comments

NanoPi NEO 2 is a tiny 64-bit ARM development board powered by Allwinner H5 processor. FriendlyELEC sent me a couple of NEO 2 samples together with their BakeBit Start Kit with a NanoHat and various modules via GPIOs, analog input or I2C. I’ve already tested both Armbian with Linux 4.11 and Ubuntu Core Qt with Linux 3.10, and ran a few benchmarks on NanoPi NEO 2. You would normally prefer to use the Armbian image with Linux mainline since it provided better performance, but at the time I was told GPIO support was not there.

Configuring NanoPi NEO 2 board with BakeBit library

So this week-end, when I decided to test GPIO support and BakeBit Starter Kit, I decided to follow this advice, especially image is still the recommended one in the Wiki. So I went with that image.

I’ll use Python examples from Bakebit library, but if you prefer something similar to WiringPi, you may consider using WiringNP library directly instead of using Bakebit. Since NanoHat Hub comes with header with digital I/O (including 2 PWM), analog input, I2C and UART interfaces, I’ll make sure I try samples for all interfaces I have hardware for. FriendlyELEC did not include a module with a UART interface, so I’ll skip that one.

I followed instructions in BakeBit wiki from a terminal which you can access from the serial console or SSH. First, we need to retrieve the source code:

Then we can start the installation:

The last line will install the following dependencies:

  • python2.7           python2.7
  • python-pip         alternative Python package installer
  • git                        fast, scalable, distributed revision control system
  • libi2c-dev           userspace I2C programming library development files
  • python-serial     pyserial – module encapsulating access for the serial port
  • i2c-tools              This Python module allows SMBus access through the I2C /dv
  • python-smbus   Python bindings for Linux SMBus access through i2c-dev
  • minicom             friendly menu driven serial communication program
  • psutil                   a cross-platform process and system utilities module for n
  • WiringNP           a GPIO access library for NanoPi NEO

This will take a while, and after it’s done, the board will automatically reboot.

We can check if everything is properly running, but try out one of the Python scripts:

hmm, python-smbus was supposed to be installed via the installation script. Let’s try to install it manually:

Running the command again with verbose option shows the download URL is not valid:

So I went to looking for another python-smbus library in case the name has changed, and I finally installed the pysmbus:

I could go further, but the I2C bus was not detected:

So maybe the driver needs to be loaded. But running sudo modprobe i2c_sunxi it does nothing, and I could notice the .ko file is missing from the image…

So let’s try to build the source code for the board following the Wiki intructions:

We also need to install required build packages…

… download gcc-linaro-aarch64.tar.xz toolchain, and copy it to lichee/brandy/toolchain directory (do not extract it, it will be done by the build script).

Now we can try to build the kernel for NanoPi NEO 2 (and other Allwinner H5 boards).

and it failed with more errors possible related to CROSS_COMPILE flag. There must be a better solution… FriendlyELEC guys might not work on Saturday afternoon, and while I did contact them, I decided to try one of their more recent images with Linux 4.11 available here.

Let’s pick since it has a similar name, and is much newer (released 3 days ago). I repeated the installation procedure above, and …

Success! Albeit after 4 to 5 hours of work… Let’s connect hardware to ind out whether it actually works, and not just runs.

Analog Input and Digital Output – Sound Sensor Demo

The simplest demo would be to use the LED module, but let’s do something more fun with the Sound Sensor demo I found in BakerBit Starter Kit printed user’s manual, and which will allow us to use both digital output with the LED module connected to D5 header, and analog input with the Sound sensor module connected to A0 header. Just remember the long LED pin is the positive one.

You can run the code as follows:

I changed the source a bit including the detection threshold, and timing to make it more responsive:

The LED will turn on each time the the sound level (actually analog voltage) is above 1.46V.

PWM and Analog Input – Servo and Rotary Angle Sensor Demo

We can test PWM output using the Servo module connected to D5 header, and control it using the rotary angle sensor module connected the A0 analog input header .

Click to Enlarge

The sample for the demo runs fine, and use the potentiometer is detected:

However, the servo is not moving at all. Raspberry Pi relies on rpi-config to enable things like I2C and other I/Os, and I noticed npi-config in the Wiki for NEO 2. So I ran it, and sure enough PWM was disabled.

So I enabled it, and answered Yes when I was asked to reboot. The only problem is that it would not boot anymore, with the system blocked at:

So maybe something went wrong during the process, so I re-flashed the Ubuntu image, reinstalled BakeBit, and re-enabled PWM0. But before rebooting, I checked the boot directory, and noticed boot.cmd, boot.scr, and the device tree file (sun50i-h5-nanopi-neo2.dtb) had been modified. The DTB looks fine, as I could decode it, and find the pwm section:

Let’s reboot the board. Exact same problem with the boot stuck at “Starting kernel…”. So there’s something wrong with the way npi-config modifies one or more of the files. With hindsight, I should have made a backup of those three files before enabling PWM the second time… I’ll give up on PWM for now, and ask FriendlyELEC to look into it.

I2C and Analog Input – OLED UI controlled with Joystick

The final test I’ll use the I2C OLED display module connected to one of the I2C headers, together with the analog joystick module connected to A0 header.

Click to Enlarge

Let’s run the sample for the demo:

It works, but there’s a bit of a lag, and the sample may have to be improved to better detect various states. I’ll show what I mean in the video below.

The bad parts are that documentation is not up-to-date, enabling PWM will crash the image, and while the Python sample do demonstrate IO capabilities, they should probably be improved to be more responsive. The good part is that we’re getting there, the hardware kit is a really nice, and I think the documentation and software should become much better in June, as FriendlyELEC has shown to be responsive to the community issues.

What? Python sucks? You can use C language with GPIOs too

If Python is not your favorite language, FriendlyELEC also provided some C languages samples in the C directory:

As we’ve seen above, Bakebit library appears to rely on WiringNP, and you’d normally be able to list the GPIOs as follows:

The utility is not too happy about seeing an Allwinner H5 board. But maybe the library in the board is not up-to-date, so I have built it from source:

and run the gpio sample again:

Excellent! It’s not quite a work-out-of-box experience, but NanoPi NEO 2 can be used with (most) GPIOs.

My adventures with NanoPi NEO 2 board are not quite done, as I still have to play with NanoHat PCM5102A audio add-on board, which I may end up combining with a USB microphone to play with Google Assistant SDK, and I’m expecting NanoPi NAS Kit v1.2 shortly. I’ll also update this post once PWM is working.

Top Programming Languages & Operating Systems for the Internet of Things

May 19th, 2017 3 comments

The Eclipse foundation has recently done its IoT Developer Survey answered by 713 developers, where they asked  IoT programming languages, cloud platforms, IoT operating systems, messaging protocols (MQTT, HTTP), IoT hardware architectures and more.  The results have now been published. So let’s have a look at some of the slides, especially with regards to programming languages and operating systems bearing in mind that IoT is a general terms that may apply to sensors, gateways and the cloud, so the survey correctly separated languages for different segments of the IoT ecosystem.

Click to Enlarge

C and C++ are still the preferred languages for constrained devices, and developers are normally using more than one language as the total is well over 100%.

Click to Enlarge

IoT gateways are more powerful and resourceful (memory/storage) hardware, so it’s no surprise higher level languages like Java and Python join C and C++, with Java being the most used language with 40.8% of respondents.

Click to Enlarge

When it comes to the cloud with virtually unlimited resources, and no need to interface with hardware in most cases, higher level languages like Java, JavaScript, Node.js, and Python take the lead.

Click to Enlarge

When it comes to operating systems in constrained IoT devices, Linux takes the lead with 44.1%, in front of bare metal (27.6%) and FreeRTOS (15.0 %). Windows is also there in fourth place probably with a mix of Windows IoT core, Windows Embedded, and WinCE.

Click to Enlarge

Linux is the king of IoT gateways with 66.9% of respondent using it far ahead of Windows in second place with 20.5%. They have no chart for the cloud, probably because users just don’t run their own Cloud servers, but relies on providers. They did ask specifically about the Linux distributions used for IoT projects, and the results are a bit surprising with Raspbian taking the lead with 45.5%, with Ubuntu Core following closely at 44.4%.

Click to Enlarge

Maybe Raspbian has been used during the prototyping phase or for evaluation, as most developers (84%) have been using cheap development boards like Arduino, BeagleBone or Raspberry Pi. 20% also claim to have deployed such boards in IoT solutions.

Click to Enlarge

That’s only a few slides of the survey results, and you’ll find more details about Intel/ARM hardware share, messaging & industrial protocols, cloud solutions, wireless connectivity, and more in the slides below.

Via Ubuntu Insights

Helios4 Personal Cloud DIY NAS Supports 3.5″ Hard Drives, RAID, and More (Crowdfunding)

May 11th, 2017 25 comments

A few months ago, we covered GnuBee Personal Cloud 1, a NAS that runs on open source software, and that supports up to six 2.5″ SATA drives. The crowdfunding has been successful – after lowering the funding target -, and backers should hopefully get the NAS right after summer. But at the time, some people complained about the  memory capacity (512MB),  the lack of support for 3.5″ drives, and a few other items. A new project called “Helios4 Personal Cloud” addresses many of those concerns. It comes with 1 to 2GB RAM, enclosure supporting four 3.5″ drives, supports RAID, and is powered by Marvell ARMADA 388 processor that has been specifically designed for this type of application.

Helios4 NAS specifications:

  • SoC – Marvell ARMADA 388 dual core Cortex A9 processor @ up to 1.866 GHz with RAID5/6 acceleration engines, security acceleration engines, etc…
  • System Memory – 1 or 2 GB DDR3L
  • Storage – 4x SATA 3.0 ports, 2x HDD power connectors for 3.5″ drives using the provided DIY enclosure; micro SD slot supporting SDHC/SDXC cards
  • Connectivity – 1x Gigabit Ethernet
  • USB – 2x USB 3.0 ports, 1x micro USB port for serial console only
  • Expansion – 14-pin GPIO header, 4-pin I2C header which can be used for an LCD screen & control buttons.
  • Misc – 2x PWM fan headers + 2x fans provided with DIY enclosure
  • Power Supply – 12V/8A via 4-pin jack

The basic kit comes with an Helios4 board (shown below), 4x SATA data cables, 2x Molex to dual SATA power cables, and a 12V/8A power adapter. The full kit adds a case available in black or blue, two 70mm PWM ball bearing fan, and a fasteners set.

The NAS will support Armbian Debian and Ubuntu images, OpenMediaVault open NAS solution, and SynCloud open source app server. The developers (Kobol Team), based in Singapore, also promise to release software and hardware design files for the project. For now, they have Armbian build scripts, as well as Linux and U-boot source code on Github. The board has been designed in collaboration with SolidRun, which has experience with Marvell via their MACCHIATObin / ClearFog boards and system-on-modules.

The project has just been launched on Kickstarter, where Kobol aims to raise 150,000 SGD ($106,000 US). All prices are in SGD, but I’ll use the USD equivalent going forward. An early bird pledge of $125 US should get you the basic kit with 1GB RAM, while $149 is required for the 2GB version. If you want a full kit with enclosure, you’ll need to pledge $139 (1GB RAM) or $169 (2GB RAM). Worldwide shipping adds $39 or $43 for respectively the basic and full kit, even if you are in Singapore. Delivery is scheduled for September 2017.

Packet 96-core Cavium ThunderX Baremetal ARMv8 Servers are Available for $0.50 per Hour, $372 per Month

May 6th, 2017 4 comments

Last week, I wrote about Scaleway ARMV8 cloud servers powered by Cavium ThunderX processors. They are very cheap, as low as 0.0006 Euros per hour or 2.99 Euros per month, but you only get access to 2 to 8 cores, so obviously you don’t get a baremetal server for that price.  If you want the latter has been offering just that since the end of last year with their Type 2A baremetal server with two Cavium ThunderX 48-core processors, 128 GB RAM, 384 GB SSD and 20 Gbps bandwidth.

Cavium ThunderX Dual Socket Motherboard – For illustration only, not necessarily the one used by

The servers can currently run Centos 7, CoreOS, Ubuntu 16.04 LTS,  with support for container platforms such as CoreOS Tectonic, Rancher, Docker Cloud, ContainerShip, StackEngine, Docker Machine, etc… You can check the status for other operating systems and features and the roadmap page.

They also have x86 servers, and I’ve included the hourly and monthly prices and features for all their servers for comparison. [Update: Type 2A monthly price is actually $372 per month, see comments]

Click to Enlarge

Visit Packet’s Type 2A product page for details.

Categories: Cavium, Linux, Ubuntu Tags: armv8, centos, Linux, server, ubuntu

SinoVoIP Releases $35 Banana Pi BPI-M2+ Board with Allwinner H2+ Processor

May 4th, 2017 10 comments

Banana Pi BPI M2+ board was first released with Allwinner H3 processor, but the same PCB can also be used with Allwinner H2+ and H5 processors since the processors are pin-to-pin compatible, and SinoVoIP intends to release three version of the board, and just launched BPI M2+ (aka BPI H2+) with Allwinner H2+ processor for $34.50 + shipping, $1.5 cheaper than the H3 version also listed on Aliexpress. If you shop around, and don’t order on the official SinoVoIP store, you may find cheaper price for the boards. As expected, the specifications have not changed apart from the processor:

  • SoC – Allwinner H2+ quad core Cortex A7 @ 1.2 GHz with an ARM Mali-400MP2 GPU up to 600 MHz
  • System Memory – 1GB DDR3
  • Storage – 8GB eMMC flash, micro SD card slot up to 64GB,
  • Video & Audio Output – HDMI with CEC support
  • Connectivity – Gigabit Ethernet, 802.11 b/g/n WiFi + Bluetooth 4.0 (AP6212)
  • USB – 2x USB 2.0 host ports, 1x micro USB OTG port
  • Camera – CSI Interface for 8-bit YUV42 CMOS sensor up to 1080p30
  • Expansions – 40-pin Raspberry Pi compatible header
  • Debugging – 3-pin UART header for serial console
  • Misc – Power, recovery, and u-boot buttons; Power and status LEDs, IR receiver
  • Power Supply – 5V/2A via power barrel (micro USB OTG port does not support power input)
  • Dimensions – 65mm × 65mm
  • Weight – 48 grams

The processors are not that different either, with Allwinner H3 supporting 4K video decoding and output up to 30 Hz, while H2+ is limited to 1080p60. The rest of the features look exactly the same. The company’s BPI M2+ page is all about the H3 version but most parts should be identical for the new boards. Supported operating systems include Android 4.4, Ubuntu 16.04 (Mate), Kano, Raspbian, Debian 8 and more according to the Download page, but none of them are likely to be working perfectly, and I’m not 100% sure they are working on the new H2+ board since they were all released last year, except Android 4.4 (Jan 2017). It might just be a case of updating the Device Tree (DTB) file however. [Update: I forgot the images are based on an ancient Linux 3.4 kernel, so not device tree here].

You may also wonder why Orange Pi Zero board with the same H2 processor sells for $7, while that new board goes for about $35… One of the reasons is that Banana Pi boards are  generally more expensive, but the price gap is mostly due to vastly different hardware specifications: 256 to 512MB DDR3, no eMMC flash, no HDMI output, Fast Ethernet, no camera support, smaller board, etc…

Cavium ThunderX based Scaleway ARMv8 Cloud Servers Go for 2.99 Euros per Month and Up

April 28th, 2017 21 comments

Scaleway launched 32-bit ARM server hosting services in 2015 for 10 Euros per month, before dropping the price to 2.99 Euros per month half-year later, and now the company has just launched a new offering with 64-bit ARM servers powered by Cavium ThunderX processor going for 2.99 to 11.99 Euros per month depending on configuration.

Click to Enlarge

The processors are equipped with DDR4 ECC memory, and all three services included unlimited transfer, so you don’t need to pay for any bandwidth fee. While the price is shown per month, you’ll be billed by the hour (0.006 Euro/h for ARM64-2GB), so if you are using those for development it may even cost less per month, as you can turn them off when not working.

All server are located in a Paris data center in France, and runs Ubuntu 16.04, but more operating systems and “InstantApps” will be added to the selection. More servers will soon be available in their Netherlands datacenters (AMS1).

You can add a new ARMv8 server in Scaleway dashboard to get started with the new servers. You’ll find a few more details on Scaleway Virtual Cloud Servers page.

Categories: Cavium, Linux, Ubuntu Tags: armv8, Linux, scaleway, server, ubuntu

CHUWI Lapbook 12.3 is a Windows 10 / Ubuntu Apollo Lake Laptop with a 2K Display, 6GB RAM, Up to 256 GB SSD Storage

April 27th, 2017 7 comments

I’ve reviewed CHUWI LapBook 14.1 laptop earlier this year with an Intel Celeron N3450 Apollo Lake processor, 14.1″ Full HD display and 4GB RAM, and found it to work reasonably well for the price in Windows 10, as well as Ubuntu 17.04. The company has been working on another model called CHUWI LapBook 12.3 with the same processor, but a smaller yet higher resolution 12.3″ 2K display, more memory (6GB RAM), 64GB eMMC flash, and support for M.2 SSDs up to 256 GB.

Click to Enlarge

CHUWI LapBook 12.3 specifications with highlight in bold showing differences against LapBook 14.1 model:

  • SoC – Intel Celeron N3450 quad core “Apollo Lake” processor @ 1.1 GHz / 2.2 GHz (Burst frequency) and 12 EU Intel HD graphics 500 @ 200 MHz / 700 MHz (Burst freq.); 6W TDP
  • System Memory – 6GB DDR3
  • Storage – 64 GB eMMC flash + micro SD slot up to 128 GB + M.2 SSD up to 256 GB
  • Display – 12.3″ display with 2736 x 1824 (2K) resolution; 3:2 aspect ratio
  • Video Output – 1x micro HDMI port
  • Audio – HDMI, 3.5mm audio jack, built-in stereo speakers and microphone
  • Connectivity – Dual band 802.11 b/g/n/ac WiFi, and Bluetooth 4.0. (Intel Wireless AC-3165 module)
  • Camera – 2.0MP front-facing camera
  • USB – 1x USB 2.0 host port, 1x USB 3.0 port
  • Power Supply – TBD
  • Battery – 8,000mAh / 7.6V (60.8 Wh) Polymer Li-ion battery
  • Dimensions – 300 x 223 x 16.7 mm
  • Weight – 1.44 kg (vs 1.74 kg for 14.1 model); all metal body

So apart from the extra memory, different display, a smaller battery, and of course, dimensions  and weight both laptops are pretty similar. CHUWI LapBook 12.3 will first sell with Windows 10, and later the company plans to offer an Ubuntu version.


Click to Enlarge

The laptop will be released in May for $349 which you can compare to the $260 for CHUWI LapBook 14.1. GearBest has already listed the laptop on their website, where you can register to get an arrival notice, once it is up for sale or pre-order.

Hardkernel ODROID-XU4Q is a Fanless Version of ODROID-XU4 Exynos 5422 Development Board

April 27th, 2017 9 comments

We had already seen ODROID-XU4 development board price drop to $59 earlier this year, but a frequent complain about the board remained: it requires a fan to operate at full speed, and makes noise while the fan turns. To address this issue, the company has now launched ODROID-XU4Q board with exactly the same specifications with Samsung Exynos 5422 octa-core processor, 2GB RAM, eMMC module support, Gigabit Ethernet, USB 3.0, HDMI 1.4 etc…, except the fan is replaced by a large heatsink.

ODROID-XU4 (left) vs ODROID-XU4Q (right) – Click to Enlarge

The company has also thoroughly tested both versions in different configurations such as setting the maximum frequency to 1.8 or 2.0 GHz, and found ODROID-XU4Q to be slightly slower under high load due to CPU throttling, as the large heatsink does not cool quite as well as the smaller heatsink in combination with a fan. However in many cases, the difference is minimal as shown by Antutu results (61,112 vs 60,283 points). Running sysbench at 2.0 GHz showed one of the biggest gaps in performance, with XU4Q taking 16% more time (420 seconds vs 362 seconds) to complete the test as shown below.

Click to Enlarge

If you run the board at 1.8 GHz, the difference decreases to just 6%. If you are using ODROID-XU4 as part of a build farm, you may want to keep using the actively cooled version, it takes take 25 minutes to build the Linux kernel against 30 minutes on ODROID-XU4Q.The company also found that if you don’t want throttling at all, you need to set the CPU frequency to 1.2 GHz.

The company also had to add a cut out line to ODROID-XU4(Q) cases to allow for the taller heatsink. If you have a ODROID-XU4 board with a fan, and would like to convert it into a quitet ODROID-XU4Q board, you can do so by purchasing a similar (but not exactly the same) heatsink for $4.90 + shipping. The price for ODROID-XU4Q board is the same as for ODROID-XU4 ($59 + shipping).

If you’re wondering when the next major update of ODROID board is coming, there is a clue in ODROID Magazine April 2017:

In 2017, we are planning another 64-bit ARM platform and a 64-bit x86 platform, and we are also considering an upgraded version of XU4.