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.
@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.
@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
Have you considered listing the project on balenaHub?
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 !
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
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.
I notice error logs I collect some, at this point no even Grafana is running sensehat-RP3.log (121.6 KB)
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?
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.
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.
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.
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.
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.
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.