Banana Pi

From Organic Design wiki
Revision as of 15:09, 19 September 2019 by Nad (talk | contribs) (Armbian headless installation)

Banana Pi is an open source hardware project lead by GuangDong BiPai technology co., LTD. It focuses on the open source hardware development board of ARM and MCU series, provides open software and hardware platform, and creates the basic technology development platform. Full series open source hardware products, complete integration of voice, data, video system platform. Developers can flexibly build various application platforms on the open source hardware foundation platform. It can be applied in the Internet of things, AI artificial intelligence, industrial Internet control, STEAM education and other aspects.

The Banana Pi boards are inspired by the Raspberry Pi project, and some of the models have an equivalent Raspberry version which is hardware compatible and exactly the same size so that they can work as drop-in replacements for projects that are designed around Raspberry Pi boards. The Banana Pi boards are more powerful than the Raspberry boards, and have more features, for example many Banana Pis such as the Banana Pi M1+ come with a SATA port. This means they can run off a proper hard drive rather than an SD card which has been the cause of a lot of reliability trouble with these single-board computers.

Note that the concept of a "drop-in" replacement only goes so far in the world of single-board computers, because OS images need to be built specifically for each board. The Debian-based Armbian project is very good for this because it's been designed to be able to quickly support new boards and OS releases as they come out, and it has a great tool for post-installation setup called the Armbian config utility. They currently support over 300 different boards including the whole Banana Pi series!

Banana Pi M1+ board layout

Banana PI M1+.jpg

External wifi antenna

The Raspberry Pi has an on-board micro antenna which actually works extremely well, the signal is a lot better than many home wifi routers. The Banana Pi boards don't come with this and so the wifi signal is extremely weak unless an external antenna is attached via the on-board U.FL micro-connector.

The Raspberry Pi 3's wifi micro-antenna
The Banana Pi M1+ wifi chip and it's U.FL antenna connector

Armbian headless installation

Armbian is a great source of up to date OS images with versions available for the Banana Pi series. But one problem with the default minimal server images is that they are not truly headless, you need to set a root password on the first boot before SSH logins will work. This is a big problem for us because we don't have keyboards and monitors lying around - occasionally we have TV available, but definitely not a keyboard since we only use laptops, phones and tablets. This is regularly being raised by users, but the developers won't budge on it because their perspective is that providing a fully headless version would lead to their OS being used in malicious bot-nets.

However, we do have access to the full OS file-structure, so we can use qemu and chroot to open a shell inside the OS while it's still on your main system, and then set the root password there before putting the card into the Pi (see this Debian wiki page and final comments in this Armbian forum post for more detail).

Here's how we can do it where OS_PATH (highlighted) is the path to your mounted SD card or Armbian image file (see this if you want to mount and modify the image file). You could also do any other basic setup you may wish to do here such as adding a public key and changing over to key-based logins, set up your networking details such as wifi access (in /boot/armbian_first_run.txt based on /boot/armbian_first_run.txt.template) etc.

apt install qemu-user-static
cp /usr/bin/qemu-arm-static OS_PATH/usr/bin
chroot OS_PATH
passwd root
...
exit
sync

Important: If you have an M1+ you need to add fdtfile=sun7i-a20-bananapi-m1-plus.dtb to your /boot/armbianEnv.txt file otherwise it will be recognised as a model M1 with no wifi!


You can then power up with the card scan for you device on your subnet as usual and ssh into it with the updated details you provided (use your own subnet details).

nmap -sP 192.168.0.0/24

When you ssh into the IP you'll be asked to create an initial non-root user.

Next it's a good idea to run through the awesome Armbian config utility to configure everything the way you want it. You can even choose to configure your wlan interface as a hotspot from here!

armbian-config

Useful commands

Monitor the power voltage:

while true ; do echo "$(awk '{printf ("%0.2f",$1/1000000); }' </sys/power/axp_pmu/ac/voltage)V"; sleep 1; done


What kind of device are you running?

sudo cat /proc/device-tree/model

This is especially useful if you have an M1+ which, by default, may think it's just a wifi-less M1. The output of the command above shows "Banana Pi BPI-M1-Plus" for an M1+, or "LeMaker Banana Pi" for a plain M1. See the note in the installation section above for how to fix this if it's showing M1 instead of M1+.

Banana Pi resources

See also