Saturday 30 January 2010

Installing and configuring OWFS under Ubuntu Karmic Koala (9.10)

Just after the very cold spell in early January 2010, I read a boards.ie post by a guy called Dave (ravydavygravy) in which he queried the use of 1-wire systems in weather monitoring.
Having an interest in this subject, I read up on this system and was immediately interested in it's capabilities. I have often looked for a simple method of measurement and control and this 1-wire system coupled with owfs seems to offer it. Of course it's early days yet, but I placed an order for a couple of parts online and set about getting this working on Ubuntu 9.10. Here's how...

I ordered the following from homechip in the UK :
6x DS18B20 1-wire temperature sensor
1x DS9490R - USB 1-Wire / iButton Adapter (RJ11)
and a few RJ11 crimp-plugs.

I tested the basic 1-wire system on a breadboard and I used the software test-tool which Maxim supply to initially, and very simply, read the temperatures from a couple of sensors.
OneWireViewer Demo

All functioning, I set about getting it running under OWFS, which proved a test of my limited bash skills.

Instructions came from the ever helpful community.

Generally, I'm not into having to build applications at all under Linux. Having had a bad run-in or two with kernel builds in RedHat 6.2; having to type 'make'-anything left a taste in my mouth. :)
I find that there is variance in Linux/Ubuntu builds, hence it's never a straight-forward process.

So I set about installing the packages to support building 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'


I got 404's on some packages and a hint from apt that Ubuntu may be short a couple of updates. I realised at this point that my test system hadn't been booted in 4 or more months, so apt wasn't up to date.
So, I ran 'apt-get update' and then re-ran the apt-get as above again. All worked OK this time.

I moved the downloaded source code into directory /usr/src as directed.
Then onto the simple matter of extracting the files:
'tar zxpf owfs-2.7p26.tar.gz'


Move into the /usr/src/owfs directory and then start the process of building in earnest.
'./configure'


While ./configure passed off without issue, I remembered from the past that I had problems with permissions when running the 'make' part of the process, so I sudo'd the command just to be sure.
'sudo make && make install'


Unsurprisingly, to myself anyhow, I got an error:
'/bin/mkdir: cannot create directory `/opt/owfs': Permission denied'.

So, I did a ...
'make clean'
And then retried 'sudo make && make install'

It failed with the same errors.

Rereading over the readme notes which were included with the .tar, it mentioned installing the USB DS9490R controller before running make. So, I attached the USB dongle as instructed and ran:
'sudo make && make install'

This time, it builds OK and installs.

(Note here that in the owfs readme, it mentions running 'make install' as opposed to 'make' and then 'make install'. Try this if you still have issues.)

Then onto the home-run... or so I thought...
'sudo mkdir /var/lib/1wire'


Then I ran
'modprobe fuse'

And I got "FATAL: Module fuse not found."

I reinstalled fuse from apt again but the same error returned. I simply ignored the step and continued on regardless.

I created a directory in mnt called 1wire and used that in the statement instead of the /var directory.

On running :
'/opt/owfs/bin/owfs -U -F /var/1wire'

as per the instructions in the 'community', it gave:
'./owfs: invalid option -- 'U''

I checked the man for owfs and found that the command 'owfs -U -F...' should use a small u instead of a capital U.
Tried this and got a more postive response.

Running
'sudo ./owfs -u -F /mnt/1wire/'

gave:
'DEFAULT: ow_ds9490.c:DS9490_sub_open(552) Opened USB DS9490 adapter at 006/002.
DEFAULT: ow_ds9490.c:DS9490_detect_found(412) Set DS9490 006/002 unique id to 81 D0 3C 2C 00 00 00 A9'

Now
'sudo ls /mnt/1wire' shows:
'28.2F8B87020000 81.D03C2C000000 bus.0 simultaneous structure uncached alarm settings statistics system'

So above, I see a number of devices attached to the USB dongle - one reporting a '28.x' family name.
You can lookup the family names here http://owfs.org and you'll see that 28 is a thermal sensor.
So, I've got the devices reporting on the bus, that's enough for the moment...

No comments:

Post a Comment