|
The RPI1 is designed to work with the 1-Wire driver built into the Linux kernel. To get it to work you need to ensure you have a kernel with the w1_gpio module 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:
You should then be able to do the following:
The four directories starting with 28- in this example are four DS18B20 temperature sensors. To read the temperature from one of the sensors you can do the following:
In this example the temperature being reported by that sensor is 18.812C. When writing software to read this data it is recommended to check the crc gives a "YES" response or sanity check the value is within the expected range (or both) before accepting it as you do sometimes get readings that are way out. |