|
The RPI2 is designed to work with the Linux kernel I2C drivers and is supported by OWFS. To get it to work you need to ensure you have a kernel with the I2C drivers in it. Most of the kernels available for the Raspberry Pi have this support already built in. To load the modules required do the following:
If you want Linux to load these modules automatically at boot time, add the module names to the end of /etc/modules. If this has worked you can probe the I2C bus as follows:
If you don't have i2cdetect installed you can get it by running: " sudo apt-get install i2c-tools".
If you have an early RasPi you will have to " i2cdetect -y 0" as the I2C busses were swapped around between Rev1 and Rev2.
This is showing the DS2482-100 I2C device as device ID 0x18 which unless you have altered J1 or J2 is where it should be. Next, if you've not got it already, install OWFS:
Then you will need to edit /etc/owfs.conf to tell OWFS to use the i2c device on the RPI2. To do this open the file with your favourite editor and comment out (by putting a # at the beginning) the line that says " server: FAKE = DS18S20,DS2405".
Then below it add the following line " server: device=/dev/i2c-1"
(if you have an early Pi then you will need to put i2c-0 instead).
Now restart owserver:
If this has worked you should now be able to:
In this example there are three devices in class 28 (DS18B20 temperature sensors) and one device in class 26 (a DS2438Z, in this case it is one of our SWE3 humidity sensor modules). Here we can see one of the DS18B20s and then the humidity sensor being read using owread:
In this example the DS18B20 is reading just over 19C and the SWE3 is showing a relative humidity reading of just under 60%. The echo at the end is just to make the output easier to read as owread does not put a newline at the end of its output.
If you want to use python to read your sensors one of the users of an RPI2 has sent me this script that might help you. Before it will work as well as a running owserver you will need the packages "python-ow" and "python-scipy" installed. The script is here |