Linux 1-wire measurement on openSUSE 12.1 32-bit

On this page I would like to demonstrate how to set up a  
Linux-server that can measure temperature through a 1-wire
system and present the data on a webpage.
The Linux distribution I use is openSUSE. I have been using it
since mid ´90s and it is a real great distribution.

You will need a bus master and a temp.sensor
I use a DSxxxx as bus master
The hardware to actually measure the temperature is: DS2401
that you can buy from this store: http://owfs.org/
The hardware is connected to a PC via USB/Serial.

I use owfs (One Wire File System) to read the temperature from a file.
To store and create a graph I use rrdtool (round robin database tool).
Round robin is similar to circular buffer in digital signal processing, but
the term Round Robin is more used in load balansing terms in network
routers and load balancing in servers.

I finally created shell-scripts and a php-based homepage to display the temperatures.
The webpage updates on reload and presents temperature graphs last hour and last 24 hour.

In opensuse you can download rrdtool but you will have to compile owfs (look futher down).
You also need to create a cronjob to read temperature every 5 minutes.
command:
crontab -e
enter this:
*/5 * * * * /srv/www/htdocs/logtemp_cron.sh

all source files in tgz-archive (untar in /srv/www/htdocs): webpage.tgz




Figure 1: temperature measurement webpage.

OWFS install in openSUSE 12.1 32-bit


1) install pre-req:
    fuse-development
    libusb-1_0-devel - USB Library
    libusb-compat-devel

2) Download owfs-2.9p8.tar.gz from http://owfs.org/

3) extract:
    tar -zxvf owfs-2.9p8.tar.gz

4) compile: and install
cd owfs-2.9p8/
./configure --enable-usb --enable-owhttpd
make
make install

5) create directory to store data and start measurement
    mkdir /mnt/1wire
    /opt/owfs/bin/owfs --device /dev/ttyUSB0 /mnt/1wire/ &
        OR
If you would like a webserver start owhttpd on portnumber p
    /opt/owfs/bin/owhttpd /dev/ttyUSB0 -p 4451
Start firefox and surf to:
    http://localhost:4451

temperature is stored in:
/mnt/1wire/alarm/28.B30AEF020000/temperature
/mnt/1wire/alarm/28.B30AEF020000/temphigh
/mnt/1wire/alarm/28.B30AEF020000/templow

6) Read the temperature to the console:
    more /mnt/1wire/alarm/28.B30AEF020000/temperature

Finished!