As a an owner of a narrow boat I wanted to get Humidity and temperature sensors working as a means of monitoring the conditions on the boat over winter. We leave low power oil filled (electric) radiators onboard to stop the boat freezing. We will also monitor the AC heating load via the Victron VRM.
Key words: i2c RaspberryPi Humidity (these do not seem to be available as article tags)
The following has been tested with Venus OS 2.42 on Rpi3B+ in Feb 2020.
I had found historic posts on the internet about how this might be difficult but it is certainly not difficult on Venus OS 2.42 once you have worked it out. Here are the steps:
Add the following line to /u-boot/config.txt
dtparam=i2c_arm=on
On reboot the i2c-dev module should be started but this did not appear to happen. As a work round add a file rc.local to the /data partition (or edit the file if it exists)
root@raspberrypi2:# cd rc.local
root@raspberrypi2:/data# nano rc.local
To include the following line.
modprobe i2c-dev
Ensure the rc.local file can be executed
root@raspberrypi2:~# chmod 775 rc.local
Then reboot
In Venus OS 2.42 i2c tools are already included (in /usr/bin) so the command i2cdetect should work to list the active i2c busses
root@raspberrypi2:~# i2cdetect -l
i2c-1 i2c bcm2835 I2C adapter I2C adapter
This shows that i2c bus 1 has been detected which is the arm i2c bus on the Rpi GPIO pins., the bus can then be polled to show connected devices:
root@raspberrypi2:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
This shows that the bus is working and that I have one device connected
Next steps
I'll post separately about driving specific i2c devices such as the am2315 temperature and humidity sensor.
I hope to look at publishing the data from i2c devices on the Venus OS d-bus and what can then be done with it.
If unable to use d-bus I can look at logging Humidity and Temperature in other ways.