First time poster and new to Balena OS in general so I apologize in advanced if this topic isn’t in the right place. I’m having trouble getting a Raspberry Pi 4 setup with a 1-wire ds18b20. After setting up a simple circuit I followed the instructions here https://www.balena.io/docs/learn/develop/hardware/i2c-and-spi/ to enable the 1-wire interface.
Nothing is showing in the /sys/bus/w1/devices folder and it seems like the config.txt file never saves the appended line dtoverlay=w1-gpio - I’ve tried powering off the Pi and editing the resin-boot/config.txt file directly on a different computer and I have also tried with the Pi powered up, remounting the filesystem with read+write and editing the config.txt that way too.
The circuit with the ds18b20 has been tested on a Raspberry Pi 3 and Raspberry Pi zero both running Rasbian Buster and it worked fine for both of these devices, and also worked fine when running Balena OS, just not the RPi4 while running Balena OS. I understand Balena somewhat recently started supporting the RPi4 so maybe this interface isn’t completely configured yet? I should mention too when running modprobe w1-gpio && modprobe w1-therm there is no output so those modules seem to be enabled ok, just not showing any w1 devices.
Thanks for the reply. I don’t currently have the RPi4 setup with balenaCloud, didn’t think that was a requirement. Below are the contents of my DockerFile and docker-compose.yml
Hi, thanks for sending the Dockerfile.
It seems the first problem that you mention is not being able to modify the config.txt file with the DT overlay.
You should be able to do this without being connected to BalenaCloud my mounting the SD card on a different computer and editing /resin-boot/config.txt and adding the following line:
dtoverlay=w1-gpio
Remember to cleanly unmount the SD card so that the change gets written to disk. You can try to re-insert the SD card into the reader to verify that the file was modified.
On boot, you should be able to see the change by doing:
Thanks for that info. I did try all of that already and it seems like my changes are being removed on boot? Here’s exactly what I did, I powered off the RPi4 and removed the SD card. Inserted SD card into my Ubuntu machine and made the edits like you mentioned on /resin-boot/config.txt
I saved the file, closed the file, safely removed the SD card. Re-inserted SD card to check my changes were still there and they were. So far so good, but when I went to boot and run the cat command I get this:
I did this process 3 times before I wrote this reply to you so I’m sure I didn’t do anything wrong. I’m not sure why my changes are getting removed after I boot up the Pi.
garethtdavies thanks for this I missed that part of the docs. I did a fresh install using Etcher, made my changes to the config.txt file and all is working now with the ds18b20. Thanks again to the balena team for helping me out with this.