I’m trying to get a Yahboom RGB Cooling HAT to work with my rpi4B with balenaOS.
I have tested this HAT with Raspbian OS 64-bit (here) and it works but I cannot seem to get it to work on balenaOS.
I asked for help in another thread here but nothing.
Doing a little research, it looks like I could do this if I can prepare it for use with balena CLI.
Using the balena python hello world sample, I copied my script over into the project and pushed the change.
I had a look at balena’s documentation and I gather that i2c is enabled by default with balenaOS (from here), so I don’t need to do anything to get that part functioning.
Just trying to get the fan script to work, I keep hitting an error:
Restarting service 'balena-hello-world sha256:944ea72ca402c28d953331a66cc9ead117e43ea8e57bd3e98c53956e3959cbd9'
[balena-hello-world] Traceback (most recent call last):
[balena-hello-world] File "/usr/src/app/src/app.py", line 1, in <module>
[balena-hello-world] import smbus2
[balena-hello-world] ModuleNotFoundError: No module named 'smbus2'
Service exited 'balena-hello-world sha256:944ea72ca402c28d953331a66cc9ead117e43ea8e57bd3e98c53956e3959cbd9'
My Dockerfile.template looks like this:
FROM balenalib/%%BALENA_ARCH%%-python:latest-run
RUN install_packages apt-utils
RUN install_packages i2c-tools
RUN install_packages python3-smbus
WORKDIR /usr/src/app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . ./
CMD ["python","-u","src/app.py"]
requirements.txt is empty at the moment.
app.py looks like this:
import smbus2
import time
bus = smbus.SMBus(1)
addr = 0x0d
fan_reg = 0x08
while True:
bus.write_byte_data(addr, fan_reg, 0x01)
time.sleep(1)
Has anyone got experience getting HATs to work over i2c with BalenaOS on 64-bit?
Is there an RPI4B base image I can use instead of whatever this is so I can just do it like on my working RPI4Bs?
Also, does anyone else experience about ~18-30seconds of lag with balenaSound? My devices are overheating and I suspect that to be the main issue.