Is widgetlords compatible with BalenaOS + raspberry?

Hello, thanks for the great platform first of all.

I am working with the boards and libraries to read and write from raspberry 3b+ through SPI with a series of 7 boards: 2 x 2DAO, 2 x 8DI, 2 x 8DO, 1 x KO.

I have tested the widgetlords libraries for the SPI IO boards with Raspbian, and everything is ok. I am getting 5 SPI devices to show up (spidev0.0 up to spidev0.5, it looks like the widgetlords library emulates the devices not based on numbers but on type) and i can read from and write to each of them. in order to do it, i had to install the python libraries as described in the " Getting Started with PI-SPI Libraries" section on the web site of the maker.

in order to get the widgetlords libraries to work, there are a few steps, among which:

  1. in raspbian, to add the widgetlords library, do the following:
    a. sudo raspi-config
    b. Select “5 Interfacing Options”.
    c. Select “P6 Serial”
    d. Answer no for a serial-accessible login shell.
    e. Answer yes for enabling serial hardware.

  2. add the dtoverlay to the /boot/config.txt file
    a .sudo nano /boot/config.txt
    b. Scroll to the bottom of the file.
    c. For the PI-SPI series add the following line:
    d. dtoverlay=pi-spi

in order to do the above in balenaOS, i have changed the dtoverlay fleet environment variables in such a way that, when i start the docker container, I get the following:

Applying boot config: {“dtoverlay”:[“pi-spi,pi3-miniuart-bt”],“dtparam”:[“i2c_arm=on”,“spi=on”,“audio=on”],“avoid_warnings”:“1”,“disable_splash”:“1”,“enable_uart”:“1”,“gpu_mem”:“16”}

In theory, it should be the same, but when i try to list the devices, i only get the first two SPI devices. All the others have disappeared. What am i doing wrong?

Hi tommaso

your problem might be due to the value of dtoverlay being “pi-spi,pi3-miniuart-bt” rather than “pi-spi”. If you want to specify both values for dtoverlay you have to separate them using double quotes, for example: “pi-spi”,“pi3-miniuart-bt”

You can find additional examples in this doc:

Best regards


1 Like

Hey Fede,
thanks for the reply. I tried changing the overlay as you mentioned, and now this is what the logs are showing.

02.12.19 16:52:19 (+0100) Applied boot config: {“dtoverlay”:[“pi-spi”],“dtparam”:[“i2c_arm=on”,“spi=on”,“audio=on”],“enable_uart”:“1”,“avoid_warnings”:“1”,“disable_splash”:“1”,“gpu_mem”:“16”}

still no luck though :frowning: . The interesting thing is that it looks like devices are being picked up, but just two of them, not all of them. Does this mean some of the GPIOs are being taken up by another resource? How does balena handle serial login shell?

Hi tommaso
Thanks for updating us on your progress. Are you by chance running a development build of balenaOS? If so the serial console is enabled. If that is the case you can disable it using systemctl disable serial-getty or install a production build instead.

To permanently disable the serial console on balenaOS development builds do:

  1. First disable read-only rootfs:
    # mount -o remount,rw /
  2. Then mask the serial getty service:
    # systemctl mask serial-getty@serial0.service
  3. reboot.

Do you still have the raspbian image? If so it might be useful to compare it’s config.txt with the balenaOS version.


Hi James,
thank you for the support.
I am using a production build, since I had read about the serial console issues that you are mentioning in the dev build in the documentation. The one below is the content of the /boot/config.txt file in raspbian.

# For more options and information see
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border

# uncomment to force a console size. By default it will be display's size minus
# overscan.

# uncomment if hdmi display is not detected and composite is being output

# uncomment to force a specific HDMI mode (this will force VGA)

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display

# uncomment for composite PAL

#uncomment to overclock the arm. 700 MHz is the default.

# Uncomment some or all of these to enable the optional hardware interfaces

# Uncomment this to enable infrared communication.

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)

# Enable DRM VC4 V3D driver on top of the dispmanx display stack


Something i have noticed is that the image file of the raspbian image has 6 spidev0.X dtbo files in the overlay container, while the balena os only has 3. Does that mean that BalenaOS cannot support more than 3 devices?

Thanks for the info @tgirotto. What are the overlay names you see in raspbian?

We’d like to compare them with what you see on balenaOS.

that’s what i see from the overlays folder. It’s really just the raspbian buster image i got from the raspberry web site, nothing special :slight_smile:

Hi @tgirotto, it looks like we need to update the SPI overlays on balenaOS for the Pi’s. We created an issue to address this, you can keep track of the progress here. You will also get notified on this forum thread once the issue is closed.

thanks a lot. Will keep checking!

Hey @tgirotto,

We have updated the SPI overlays and it has been merged. It will be available for download in the next release of the os.


We will let you know you once the os is available for download in the dashboard.


We wanted to inform you that BalenaOS 2.46.1+rev1 is now available for download in dashboard for the RPI3.


thanks. i will try it!

Hi @tgirotto , did this solve your problem? I am having issues communicating with more than two widgetlords SPI devices as well.

  • Production mode
  • balenaOS 2.47.0+rev1
  • dtoverlay=vpe-2701c (per instructions here as I’m using PI-SPI-DIN series boards)

hey @mstanton, for now we took a step back and are just focusing on getting the logics to work on raspbian. I will update here as soon as I know whether the SPI DIN series works.

Hey @mstanton welcome to the forums!

I just wanted to check that you had added the vpe-2701c overlay to the overlays folder in the boot partition of the OS? That one is not included by default in balenaOS nor in Raspbian, so they appear to be installed via the libwidgetlords package. The difference is that if you install that package within a container the overlays won’t be available to the host OS at boot time.

If you plug a balenaOS SD card into a computer, you’ll be able to see the boot partition, within which there’s an overlays folder, you can add the dtbo files here. You can extract those from the .deb file package without installing it if necessary, for example using ar -x libwidgetlords_2.0.0_armhf.deb on macOS, after which they’re available within the data.tar.xz file under data/boot/overlays.

I hope this helps; let us know how you get on.

Thanks for the replies!

@chrisys thanks for the pointer; that fixed the issue. I did not have the overlay in the boot partition of the OS. Everything just started working once I copied it there.

Is there a better way to manage custom dtbo files? I plan on deploying ~30 boards in an industrial setting. It’s more just a matter of curiosity as once I copy the file to the /boot/overlays folder, I don’t expect to have to update it again.

I appreciate the help.

Hi there, thanks for letting us know the suggested approach helped resolve the issue.

In terms of managing this going forward in bulk, it would make sense to script the process using balena-cli, in a similar way described here:

This will allow you to programatically download the image, make changes to it (i.e. inject files into /boot) and then reseal the image to flashing to the fleet. Please let us know if you have any further questions.

@chrisys I confirm that the widgetlords SPI series works on balena using your advice. Thank you!

1 Like