Belena Cloud + Balena sense + RPi3 is Sense Hat Supported?

Followed instructions on balenaSense v2: Updated temperature, pressure, and humidity monitoring for Raspberry Pi

I have RPi3 sense hat https://www.raspberrypi.com/products/sense-hat/

From the logs to me the Sense hat it is not supported?

sensor OKStarting mqtt client, publishing to mqtt:1883
sensor Using MQTT publish interval: 8.0 sec(s)
sensor Initializing sensors…
sensor ======== Searching i2c bus for devices… ========
sensor Found device at 0x1c
sensor Found (busy) device at 0x46
sensor Found device at 0x5c
sensor Found device at 0x5f
sensor Found device at 0x6a
sensor ======== Removing existing devices from the i2c bus… ========
sensor Deleting device found at 0x1c.
sensor sh: 1: echo: echo: I/O error
sensor Delete device 0x1c exit code: 256
sensor Deleting device found at 0x46.
sensor sh: 1: echo: echo: I/O error
sensor Delete device 0x46 exit code: 256
sensor Deleting device found at 0x5c.
sensor sh: 1: echo: echo: I/O error
sensor Delete device 0x5c exit code: 256
sensor Deleting device found at 0x5f.
sensor sh: 1: echo: echo: I/O error
sensor Delete device 0x5f exit code: 256
sensor Deleting device found at 0x6a.
sensor sh: 1: echo: echo: I/O error
sensor Delete device 0x6a exit code: 256
sensor ======== Unloading any existing modules… ========
sensor Device at 0x1c not in known supported drivers.
sensor Device at 0x46 not in known supported drivers.
sensor Device at 0x5c not in known supported drivers.
sensor Device at 0x5f not in known supported drivers.
sensor New active: [106]
sensor ======== Loading devices found… ========
sensor Loading device mcp3422 on address 0x6a.
sensor sh: 1: echo: echo: I/O error
sensor New device 0x6a exit code: 256
sensor Loaded 1 of 5 device(s) found
sensor initializing reading
sensor IIO context created: local
sensor Backend version: 0.16 (git tag: v0.16)
sensor Backend description string: Linux 07a08cd5b068 5.10.31-v7 #1 SMP Fri Apr 23 15:16:49 UTC 2021 armv7l
sensor IIO context has 1 attributes:
sensor local,kernel: 5.10.31-v7
sensor IIO context has 0 devices:

Plus when I open Grafana there is no dashboards?
dashboard Interim dashboard sync skipped: No schema found.

Hi,

I am not sure whether the project you are referring to supports the Sense Hat. It would not surprise me if not, since it took a bit of fiddling to get it to work (at least for me). Here is a project I am using to interact with the Sense Hat - GitHub - hferentschik/balena-sense: balenaCloud project with Raspberry Pi 4 and Sense Hat. I use it mainly to display messages on the display which I post via a REST API. However, the temperature sensor is wired up as well.

The tricky bit was to prepare the container to be able to install the sense-hat Python library to interact with the Sense Hat. See balena-sense/Dockerfile at master · hferentschik/balena-sense · GitHub.

Hope that helps,
Hardy

1 Like

@hardy I was checking the project that I am using, base on the blog it is not supported. So will try to use your project and I let you know how it goes.

Thanks for the response
Oscar

1 Like

Great. Fingers crossed it works without too much hassle. Happy to help if you run into any problems.

–Hardy

1 Like

@hardy nice work and thanks for sharing! We dropped sense hat support in version 2 of our project because it was holding us back from an approach we wanted to take to support many other sensors so that’s awesome to see you’ve supported it again. I’ll be sure to direct anyone else looking for this to your project :+1:

Have you considered listing the project on balenaHub?

Hi,

nice work and thanks for sharing!

Thanks

We dropped sense hat support in version 2 of our project because it was holding us back from an approach we wanted to take to support many other sensors so that’s awesome to see you’ve supported it again.

I fully understand and would have done the same. It was really fiddly to get working and the only way it worked for me was to use the sense-hat Python library. The API of sense-hat is actually really good, the rub is that the library is terribly out of date (last commit from 2017) and I am forced to compile some needed dependencies as part of the Docker build. Unfortunately, the compilation is really slow. But it works :slight_smile: !

Ideally, someone would bring python-sense-hat up to date. The Sense HAT is really a great board to experiment with your Pi.

In the meantime, I might push some pre-compiled base images for Raspberry Pi 3 + 4.

I’ll be sure to direct anyone else looking for this to your project :+1:

Please do

Have you considered listing the project on balenaHub?

I have it on my to-do list. I’ll post it here when I get around to doing it.

–Hardy

Hi, It did not work :thinking:. Here is what i did.

most of the services throwing this error
standard_init_linux.go:211: exec user process caused "exec format error"

I also tested a simple python project trying to find something wrong with my settings but it works, just thinking if I need use another Balena OS version?

here the main screen if it helps

The RPi is connected using WiFi

Thanks in advance!

Which device type / OS version do you use? The project is using 64bit arm since I am running on a Raspberry Pi 4. I think it works for Raspberry Pi 3 as well, but you will make sure that you use/flash the "Raspberry Pi 3 (using 64bit OS) image.

If you want to use the Raspberry Pi 3 with 32 bits, you will need to go through the Dockerfiles and update the images to use the right (32bit) versions of the various containers.

I have an open issue to enhance the project to support multiple OS types. Balena has support for it, but so far I always just build for the OS type I am actually using.

Hope this helps.

–Hardy

To be more concrete. These are the base images I mean (from the Dockerfiles):

FROM balenalib/raspberrypi4-64:buster

and for a Raspberry Pi 3 (32 bit) it should probably be:

FROM balenalib/raspberrypi3:buster

–Hardy

Hi,

@chrisys, fyi I added sense-hat to Balena Hub - balena-sense-hat.

–Hardy

1 Like

Did more tests with no luck. The last test I switched to OS 64 plus docker files changes to use raspberrypi3-64. Attached the logs from the last test.

Error in sensor service:
Traceback (most recent call last):
File “measure.py”, line 2, in
from sense_hat import SenseHat
File “/usr/local/lib/python3.7/dist-packages/sense_hat/init.py”, line 2, in
from .sense_hat import SenseHat, SenseHat as AstroPi
File “/usr/local/lib/python3.7/dist-packages/sense_hat/sense_hat.py”, line 7, in
import numpy as np
File “/usr/local/lib/python3.7/dist-packages/numpy/init.py”, line 150, in
from . import core
File “/usr/local/lib/python3.7/dist-packages/numpy/core/init.py”, line 48, in
raise ImportError(msg)
ImportError:

Error in messenger:
Error: While importing ‘messenger’, an ImportError was raised.

balena-sense_blue-dinner-15.01.22_16_56_43_(+0200).txt (71.7 KB)

Are the other containers up now? Is it just the messenger throwing errors? Was there an error in the Docker build for the messenger container?
You could also try to use the messenger Dockerfile as is without changing to ‘raspberrypi3-64’. I think that might work.
I will need to find an Raspberry Pi 3 to test this myself. ATM, I am using a Raspberry Pi 4.

–Hardy

Yes you are right the docker build was not right. I try again with these images.

all containers are running now

still errors in sensor
balena-sense_blue-dinner-15.01.22_20_47_05_(+0200).txt (67.1 KB)

I give up for today, maybe you can try with RPi3 and I can also check if a friend can borrow a Pi4

  • Oscar, Thanks for the help

I’d use ‘balenalib/raspberrypi4-64:buster’ for the sensor as well. With the switch to the ‘Raspberry Pi 3 (64 bit)’ OS you should be able to use the Dockerfiles as they are.

There might be a slight difference in the base libraries between ‘balenalib/raspberrypi3-64:buster’ and ‘balenalib/raspberrypi4-64:buster’.

It seems otherwise you are getting there.

You can also delete the whole ‘cron’ directory and its reference in ‘docker-compose.yml’. This container was just an experiment of mine to work around some Wifi connectivity issues I had. I removed this service from my repo as well. I think eventually I will create a Balena Block for it.

–Hardy

Nice work @hardy!

1 Like

Hi,

so I tried with a Raspberry Pi 3, and you can leave all the images as they are. The only pre-condition is that your flash the Raspberry Pi 3 64 bit OS. Then the setup works for both Pi 3 +4.

At least for me :wink:

–Hardy

:cry: did not work for me

I am using Raspberry Pi 3 (using 64bit OS)
balena-sense_blue-dinner-24.01.22_21_36_42_(+0200).txt (89.1 KB)

How odd. Did you make any progress afterwards or have you given up?

I do not have another device to test, still same result

Just as an observation and from experience trying to get these older libraries to work, what I’d consider trying is using the raspberrypi3 device type for all the containers. These will run fine on both Pi3 64-bit and Pi 4 64-bit as well as working on Pi 3 32-bit. I’ve had better luck in the past running older software within 32 bit containers even if it’s on a 64-bit device.