OK, let's install DS9490R 1-wire USB adapter on Ubuntu 9.04. Connecting adapter to my laptop, shows dmesg this:
$ dmesg
[1553881.079000] Driver for 1-wire Dallas network protocol.
[1553881.121233] usbcore: registered new interface driver DS9490R
[1553882.700959] w1_master_driver w1_bus_master1: Family 81 for 81.0000002d0f1d.39 is not registered.
I choosed a
owfs to read sensors. To install it, I use Tomasz Korwel's
guide.
1. Let's install packages needed for compiling owfs.
# apt-get install automake autoconf autotools-dev gcc g++ libtool libusb-dev fuse-utils libfuse-dev swig python2.4-dev tcl8.4-dev php5-dev
2. Download, extract and compile owfs
Download owfs from
owfs Source Force download page. Extract it. Open terminal and cd into directory where owfs-2.7p26.tar.gz (or whatever version you download) was extracted.
$ cd Desktop/
$ cd owfs-2.7p26/
$ ./configure
If you get after ./configure something like this:
Current configuration:
Deployment location: /opt/owfs
Compile-time options:
Caching is enabled
USB is enabled
I2C is enabled
HA7Net is enabled
W1 is enabled
Multithreading is enabled
Parallel port DS1410E is enabled
TAI8570 barometer is enabled
Thermocouple is enabled
Zeroconf/Bonjour is enabled
Debug-output is enabled
Profiling is DISABLED
Module configuration:
owlib is enabled
owshell is enabled
owfs is enabled
owhttpd is enabled
owftpd is enabled
owserver is enabled
ownet is enabled
ownetlib is enabled
owtap is enabled
owside is enabled
owmon is enabled
owcapi is enabled
swig is enabled
owperl is enabled
owphp is DISABLED
owpython is enabled
owtcl is enabled
...where USB is enabled, then it's all OK.
Now, let's compile and install it.
$ make
$ sudo make install
If everything went well, then software should be installed. Let's try out.
$ sudo mkdir /media/1-wire
$ sudo /opt/owfs/bin/owfs --allow_other -u /media/1-wire
DEFAULT: ow_ds9490.c:DS9490_sub_open(552) Opened USB DS9490 adapter at 002/009.
DEFAULT: ow_ds9490.c:DS9490_detect_found(412) Set DS9490 002/009 unique id to 81 1D 0F 2D 00 00 00 39
-u key means USB and "/media/1-wire" is mountpoint and --allow_other means that non-root users can read 1-wire directory.
So, if you can see something like this in 1-wire folder...
$ ls -lah 1-wire
drwxr-xr-x 1 root root 8 2009-09-30 20:38 .
drwxr-xr-x 7 root root 4096 2009-09-30 20:30 ..
drwxrwxrwx 1 root root 8 2009-09-30 20:39 81.1D0F2D000000
drwxr-xr-x 1 root root 8 2009-09-30 20:38 bus.0
drwxr-xr-x 1 root root 8 2009-09-30 20:38 settings
drwxr-xr-x 1 root root 8 2009-09-30 20:38 statistics
drwxr-xr-x 1 root root 30 2009-09-30 20:38 structure
drwxr-xr-x 1 root root 8 2009-09-30 20:38 system
drwxr-xr-x 1 root root 8 2009-09-30 20:38 uncached
... then software is installed and you can proceed to hardware.
Now, let's try to connect hardware. A temperature sensor DS18S20. I wired it to use a parasite power. That means that I only use 2 wires, ground and data, and power comes also from data wire. Anyway, connect RJ11 to adapter and wait a little bit and look at 1-wire folder again.
$ ls -lah 1-wire
drwxr-xr-x 1 root root 8 2009-09-30 21:12 .
drwxr-xr-x 7 root root 4096 2009-09-30 20:30 ..
drwxrwxrwx 1 root root 8 2009-09-30 21:22 10.0FC3ED010800
drwxrwxrwx 1 root root 8 2009-09-30 21:22 81.1D0F2D000000
drwxr-xr-x 1 root root 8 2009-09-30 21:12 alarm
drwxr-xr-x 1 root root 8 2009-09-30 21:12 bus.0
drwxr-xr-x 1 root root 8 2009-09-30 21:12 settings
drwxrwxrwx 1 root root 8 2009-09-30 21:22 simultaneous
drwxr-xr-x 1 root root 8 2009-09-30 21:12 statistics
drwxr-xr-x 1 root root 30 2009-09-30 21:12 structure
drwxr-xr-x 1 root root 8 2009-09-30 21:12 system
drwxr-xr-x 1 root root 8 2009-09-30 21:12 uncached
As you can see, there is now new folder - 10.0FC3ED010800. This is my DS18S20 sensor. In this folder, there is temperature file. In that file, there is a temperature in celsius.
$ cat 1-wire/10.0FC3ED010800/temperature
20.0625
And putting sensor in front of my laptop fan, I get reading...
$ cat 1-wire/10.0FC3ED010800/temperature
45.5
I noticed that this file is always 12 bytes long, numbers is aligned to rights and it does not have new-line character at the end.
So, next thing is to create a script that will log a temperature reading and I will try to do a nice graph of it.