Installing Dallas 1-Wire

Dallas Semi DS9490R USB adapter

I needed to install the Dallas Semiconductor (now Maxim) 1-Wire system (OWFS - One Wire File System) for a project to monitor my central heating boiler's water input, water output, flue gas and ambient air temperature. The software is packaged as owfs. The online instructions seemed a bit vague to me, but the following steps appear to work. As a test, I used the DS9490R USB adapter and a DS1820 thermometer chip.

The project was to replace a PC-based system that used a Velleman K8055 I/O card and a set of DS18S20s - all that is described here.

Step 1

Use apt-get update to download any package updates and to then write the changes to the local package cache. How long it takes depends upon how recently you ran the command previously and also how many new packages there are.

sudo apt-get update

Step 2

Use apt-get install to install the owfs package and all of its dependencies.

sudo apt-get install autoconf libtool libusb-dev libfuse-dev

Step 3

Now enter the following commands to load, configure, compile and install the software. This may take some time - see the approximate timings below:

cd /usr/local/src

sudo wget http://sourceforge.net/projects/owfs/files/owfs/2.8p15/owfs-2.8p15.tar.gz/download

sudo tar zxvf owfs-2.8p15.tar.gz

cd owfs-2.8p15

sudo ./configure      # takes about <3m

sudo make             # takes about <28m

sudo make install     # takes about <1m

Step 4

You now need to create a directory under /mnt so that the 1-Wire devices' directories can be created and mounted there:

sudo mkdir /mnt/1wire

Step 5

Plug in your DS9490R USB adapter and run the following program:

sudo /opt/owfs/bin/owfs --allow_other -u -m /mnt/1wire

The owfs program should display two messages similar to those below, though the bus master address may be different and the unique serial number of the adapter will be different:

DEFAULT: ow_usb_msg.c:(295) Opened USB DS9490 bus master at 1:5.

DEFAULT: ow_usb_cycle.c(191) Set DS9490 1:5 unique id to 81 57 C7 30 00 00 00 3A

Step 6

Each 1-Wire device has its own directory created in the directory you specified above, in this case, /mnt/1wire. Use ls -l to view the sub-directory names. They will look similar to:

drwxrwxrwx 1 root root 8 Apr 28 19:13 10.207F3D00000
drwxrwxrwx 1 root root 8 Apr 28 19:13 81.57C73000000
.
etc.

The directory names use the format ff.ssssssssssss where ff is the device family identifier and ssssssssssss is the device's unique serial number. The two hexadecimal check digits are not part of the directory name In each directory there are various files that contain information about the device. Depending upon the device type, not all files may be present. These files are:

As an example, if you have a DS18S20 device, the full pathname to its temperature and type files will be respectively:

/mnt/1wire/10.207F3D000000/temperature
/mnt/1wire/10.207F3D000000/type

If you're writing a program in C you'll need to open, in read-only mode, the value files that you need in each device's directory. You can either write your program to discover what directories exist and then load the required files, or use a configuration file to specify exactly what devices you expect to find.