Getting Started with balenaFin Developer Kit, balenaOS and balenaCloud

balena Fin is a carrier board for Raspberry Pi Compute Module 3/3+ designed specifically for industrial applications leveraging fleet management services provided by Balena. I received balenaFin developer kit last month, and in the first part of the reviewed shows how to assemble the kit.

I’m now had time to spend more time with the kit, as well as BalenaOS Linux based operating system optimized for running Docker containers on embedded devices, and balenaCloud services to manage a fleet of devices from a web dashboard.

I’ve mostly followed the instructions in the getting started guides here and there, and will document what I had to do to prepare the image, flash it to the board, and load a sample docker application locally, and through balenaCloud.

Downloading and Configuring BalenaOS for balena Fin

You’ll find BalenaOS in the download page. While we are using hardware based on a Raspberry Pi Compute Module, make sure to select “Fin” instead of “Raspberry Pi”.Balena Fin BalenaOS I initially downloaded the “Production” release instead of the “Development” one, but in hindsights better go with the latter first, I’ll explain why later on.

Once we get our file, we can unzip the firmware:


The next step is to install Balena CLI, a node.js based command line tool used to develop balenaOS based application containers. First we’ll need the latest version of node.js & npm which we’ll install using nvm (Node Version Manager) script:


Exit the current terminal, and restart one to install node:


and finally we can install balena-cli itself:


Note that I had to run the two chown commands to avoid the following type of permission issues:


I first tried to install npm via apt, but I got into various issues, so I recommend sticking with nvm.

With most embedded devices, you’d flash the image, then boot the device, and configure everything on device, but with BalenaOS it’s a little different, We can first configure balenaOS image to connect to the WiFi network, configure the board hostname, and disable persistent logging to lengthen the life of the eMMC flash from the host computer:


I had to add env “PATH=$PATH” to the command line, or balena command would be found by sudo. Running as a normal user would fail too.

Flashing balena.img firmware with balena Etcher

Now that our image is ready, we can flash it over USB using balena Etcher GUI program. I thought installing the program via apt would be a good idea:


But then I realized this currently installs balena Etcher v1.4.9, and Raspberry Pi CM3+ flashing was only added to version 1.5.0. So instead, I downloaded the Linux x64 “AppImage” to get the latest v1.5.19 on my system.

After connecting the board to your computer via the micro USB port and provided USB cable (the power supply is not needed for this step),

balenaFIN USB programming
Click to Enlarge

we can select the image (balena.img), and should be able to select the Compute Module in balena Etcher, except we couldn’t.

The board is indeed properly detected.


So I decided to open a terminal, and launch the tool with sudo:


and.. success!

balena etcher raspberry Pi compute module
Click to Enlarge

It will take a few seconds to initialize the Compute Module, and after it will show as a 7.82 GB storage device, and we can finally click on Flash to complete the installation which took around 4 minutes here.

The board will not run by being powered from the USB port, so we need to connect it to the provided power supply to have it up and running, and then we can try to ping it after a few seconds:


Good that mean the board could connect to the WiFi router automatically. In theory, we should also be able to ssh directly to the board with:


But this did not work for me:


So I tried an alternative command without sudo:


But same result, and after some research, I found out this may only work with the Development version of BalenaOS.

So I repeated the steps above with the development version of balenaOS, and I could finally login to the system, and run a few commands:


I had a few more challenges to overcome that I would have expected just to install the image, but it’s finally done.

Running a Container in balena Fin

Now we can clone a demo project in our host computer:


Enter the directory, and issue a command to build and load the demo into the board:


Note that we need to use the IP address instead of the hostname (i.e. cnxsoft-balena.local).

Here’s the output for my first try:


Some timeout which have been caused by network issue, but I still restarted the command with DEBUG=1:


and this time it could complete:


so we really just had a network issue previously. Click here for the full log.

The application creates a plot of our device’s CPU load average and memory usage, which can access in a web browser by simply typing the IP address or entering the hostname in the address bar.

CPU Load Multicontainer Demo
Click to Enlarge

Managing balenaFin from balenaCloud

Using balenaCloud is optional, but it’s really convenient since you have easily work on an application push it to the cloud, and have it pushed to all your devices over the air.

After signing-up for a balenaCloud account (free for up to 10 devices), we can click on the Create application button, fill an application name (e.g. multicontainer), select Balena Fin (CM3) device type, as well as Starter application type before clicking on Create New Application button.

balena create application
Click to Enlarge

Now click on Add Device, request the development edition, enabled Ethernet+WiFi (if you plan to use WiFi), enter the WiFi credentials, and click on Download balenaOS button.  After the download is complete, we can flash it to the board as we’ve done previously. There’s also an option to download the configuration file, and this may have been a better option in our case since we already flash the OS previously. I think we can just push the file to /boot/config.json (over SSH) to update the board (TBC).

Now we can go back to our multicontainer-getting-started directory which we checked out from Github in the previous section to upload it to our balenaCloud account:


Where <username> is your balenaCloud account username, and applicationname the name of your application defined in the dashboard, and in this case “multicontainer”. That command took a little over a minute and ended up successfully:


After a little while, we should see our balena Fin board being updated with our docker application right in the dashboard.

balenaCloud multicontainer demo
Click to Enlarge

Once this is done, we can click on the device name “ancient-tree”,  to access more information, and enable the “PUBLIC DEVICE URL”

balenacloud device dashboard
Click to Enlarge

Click on the rising blue arrow right next to it, to open a new browser window showing the CPU load average & memory usage.

balenacloud multicontainer demo web interface
Click to Enlarge

The idea with balenaCloud is that you can add all the devices from your fleet link them to specific applications as needed, and you can transparently update them all easily once the initial configuration is done.

To go further, you can study the documentation to help you develop, deploy and manage docker applications with Balena ecosystem.

The balena Fin developer kit reviewed here sells for $199.00 plus shipping on balena store. If you don’t need the DIN rail enclosure you can save $20 by selecting “no case” option.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
0 Comments
oldest
newest
Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...