A Review of the Banana Pi M2 Zero Running openHAB

bananapi
Tags: #<Tag:0x00007f51db6c3408>

(Rich Koshak) #1

I’ll start with the disclosure that the good folks at BPI sent me a free BPi M2 Zero to perform these tests. I believe my review is fair and unbiased but want to be upfront about that fact.

Introduction to the Hardware

image

The Banana Pi BPI-M2 Zero has impressive specifications when compared to the Raspberry Pi Zero W. Below are the specifications that are relevant to openHAB.

Feature BPI-M2 Zero Raspberry Pi Zero W
CPU quad-core cortex -A7 H2+ 1GHz, single-core CPU
RAM 512MB DDR3 SDRAM (shared with GPU) 512MB RAM (shared with GPU)
Wifi 802.11 b/g/n 802.11 b/g/n
Bluetooth BT4.0 Bluetooth 4.1, BTLE
GPIO 40-pin, same numbering and layout as the Raspberry Pi Zero W 40-pin HAT compatible

To summarize, they are pretty much the same device only the BPI-M2 Zero has a much better CPU and the Raspberry Pi Zero W has a more recent Bluetooth.

image

The above shows the BPI-M2 Zero (upper right) , a Raspberry Pi Zero W (bottom right) and an original Raspberry Pi 1 on the left for scale. There are some minor cosmetic differences but all the ports appear to be in the same spots. However, flip it over and you will see that the BPI-M2 Zero has a whole lot of components on the underside of the board.

image

Consequently the BPI-M2 Zero will not fit into the “official” Raspberry Pi Zero case. I didn’t have another case to try. I’m also not thrilled by the placement of the stickers over the GPIO holes. But that is minor.

One nice feature worth mentioning though is the BPI-M2 Zero does have to tiny buttons, one to reset the computer and one to power it on/off. That could come in handy when trying to run a server like OH.

The BPI-M2 Zero only supports SD cards up to 64 Gig and this is where I hit my first roadblock. The Raspberry Pi can support cards 64 Gig and larger if you format the card as FAT-32 first but as far as I can tell, the BPI-M2 will not support this larger SD card at all.

But I thought I’d give it a try and see what happens. If it works the worse case is it won’t use the whole card. If it doesn’t then I’ll just have to wait for the new SD card. I tired. It didn’t work.

Operating System

A trip to the office supply store for an overprice SD card later I can get started.

The BPI-M2 Zero can run either Android or Armbian officially. It might be able to run Raspbian as they do claim it should be feature complete with the Raspberry Pi, but I didn’t want to spend the time in case it didn’t work.

There are several builds to choose from. If not choosing Android, it appears one can choose between a build of Ubuntu 16.04 or Debian Jessy. I opted for one of the Ubuntu builds as it was the most recently built image and it was the only one that did not have “desktop” in the name.

I will say it is rather confusing choosing the image as all of them say “preview” so I don’t know how stable of an OS I’m going to get. Further reading shows this is the one I want as it is based on Ubuntu Server. We will see how stable it is.

Documentation https://bananapi.gitbooks.io/bpi-m2-/content/en/

Sadly, Armbian does not support headless config for wifi and since there is no onboard ethernet I have to do the initial setup using monitor, keyboard, and mouse.

One notable difference from raspbian is you must log in as root with the default password of 1234. But it makes you immediately change the root password and then immediately creates a new user account. The root login is not disabled. :frowning:

The first thing I ran was armbian-config to set up the wifi and make other configuration changes. The options provided are lower level than one finds in raspi-config but there are a few intriguing options like freezing the kernel version, automated install to SATA, eMMC, NAND, or USB, and enabling a virtual read-only root filesystem. I didn’t do any of them.

Setting up the wifi was simple enough but the raspbian way of dropping a wpa-supplicant.conf into the boot partition makes things way easier. I went ahead and installed BT t this point too for future experiments. I also did the update/upgrade from the tool as it was convenient.

After the reboot I ran into my first major problem.

Thermal thermal_zone0: critical temperature reached (109 C), shutting down

It may have a fast processor but it looks like it needs a heat sink.

I also see a CRC check problem during boot but it seems to work OK so far so I’m not going to look into it right now.

Next, I set the usual settings like hostname, (I have a Norse and Greek Mythology creatures theme so we went with chiron for this host) and fixed a static IP in pfSense.

Next, I set up my ssh certs so I could login without password. I’m lazy and just copy the same .ssh folder around.

We are now ready to get openHABian and see how/whether we can get OH to run.

openHABian

To start, based on the very useful information printed when logging into the machine, it is running with 10% available and 493 MB of RAM in use. This is going to be close.

Next step, install openHABian following the Manual steps.

Note, please continue to apply the appropriate modification tio your system,?

I performed a full openHABian install, executing each step in order. If this doesn’t work (i.e. not enough RAM, I may need to use a more minimal install. I dd not install any Optional Components though.

GPG error during install of OH from openHABian, had to install OH manually.

Could not get zulu-8 installed, had to install openjdk8. openHABian did not appear to attempt to install java.

Oops, I should have skipped down to 60 Manual. That appears to be working and I now have OH installed and confured with Zulu.

There were lots of ssh hangups during the install.

After install, 84% RAM in use and 8% of swap.

openHAB Config

First I selected Expert because I want to minimize what gets installed to preserve memory. I was surprised to see that it installed a bunch of the UIs for me despite choosing Expert. That’s right, Expert does noe equal minimal. I should have gone straight to addons.cfg.

Next I checked runtime.cfg against my runtime.cfg and made the edits so they match. These configs are coming from an older OH 2.2 SNAPSHOT so I wanted to make sure the config file hasn’t changed. These could have been set in PaperUI as well.

Next I copied over my addons.cfg which will install all my used add-ons. This will uninstall those that I am not using and install all the add-ons I am using. Again I edited the new one to match just to be sure there were no changes with the upgrade. I also ommitted some add-ons that I’m not actively using like HABPanel, REST Docs, IoT Market, and the Experimental Rules Engine.

At this point I’m already starting to see some problems. The swap is starting to be used according to htop, and I am starting to see some major lag and delays editing these files using vim.

Watching the logs shows that it takes a surprisingly long period of time to install/uninstall all the add-on. On my Docker deployment, it only takes one or two minutes at the most. It took about 10 minutes to just uninstall the unused bindings that got installed with the Expert package. Also, watching the CPU temp showed it jump from 42 degrees C to 52 degrees C. It didn’t get to shutdown temp but it is definitely in the red.

The feature installer threw an error trying to install influxdb for some reason so I had to futz with addons.cfg bit to get everything installed. Once everything was installed memory usage grew by about 6% but the swap space usage did not grow.

Initial observations:
There are definite lags and latency across the system. Multitail does not update immediately all the time, PaperUI takes a longish time to populate the list of add-ons, other commands sometimes take longer than expected to complete. These all point to low memory.
Despite these user noticeable problems, OH seems to be running OK. We will see how rules behave.
The CPU runs hot. If you plan on running OH on this definitely look into getting a heat sink. One designed for an OrangePi ought to work. It might also be worth looking into whether the CPU can be underclocked. It seems more than powerful enough to afford being dropped in speed.

First lets configure Network and Astro. I copied over the relevant .things files and watched the logs and saw everything I expected to see. There was a warning though indicating that it took more than 500ms to initialize the handler for one of my Network Things.

Next to configure is http so I copied over my http.cfg file.

Following that I did nma.cfg.

Now I start to copy over some of the .items files linked to the Things and bindings already configured. The first one I copied over, linked to Astro and http generated a ton of NoClassDefFoundError exceptions for ItemMapper. However, subsequent edits to the file do not generate errors. The same occurs every time I copy any Items files over.

I copied over the Rules and rest of the Items and transformation files and sitemap.

At this point, the machine completely froze. When I managed to get it to partially respond the reported CPU temp was 59 degrees C.

Conclusion

The Banana Pi M2 Zero is an impressive machine for the size but I would not say it is suitable for an openHAB server. I was certain that the low amount of memery was going to be the problem but it turns out the CPU heat is the problem. I personally would not want to run on a machien that freezes every time I update the config. Perhaps with a heat sink it might perform better.


Anyone like to test openHAB on banana pi?
How much RAM does OH Use For You?
OpenHAB on an Android TV box running Armbian (Setting it up)
(gino) #2

Can you attach a heatsink to the CPU and see if that resolves the heat issues that you were seeing? I think this would be something that readers would be interested in.


(Rich Koshak) #3

I don’t have a great sink and I’m not certain what the right one to get would be. There isn’t a whole lot a room to get one that is too big and I don’t have the time or money to find the right one by trial and error. If you know the proper one I’ll look into it, though I must say the BPi is no longer booting for me after sitting idle for a month or so and I have to figure out why that happened as well.


(Igor) #4

One mistake in the text. There is no official support for this board by Armbian. It has to exists here: https://www.armbian.com/download Only user-build can exists. Armbian does support headless config, only documentation is placed badly https://github.com/armbian/build/blob/master/packages/bsp/armbian_first_run.txt.template


(Rich Koshak) #5

The “officially” I was referring to here was this is what the Banana Pi company’s docs were saying, not an official Armbian statement. Banana Pi offers custom builds of Armbian, Android, et. al. for the Banana Pi M2 Zero here. At the time of the OP writing, Banana Pi only officially offered Android and Armbian. They now have a large number of new images on offer.

I was unaware of the headless config option. That is good to know, especially since I’m about to rebuild the machine. It fell off the network and now won’t boot so I’m hoping that a rebuild of the SD card will get it back online. I want to repurpose it for another small project.