Getting the Linux 1-wire file system owfs to work
I followed the installation instructions on the Ubuntu wiki but got stuck on the line where we try to get owfs to talk to the 1-wire network. This worked for me:
sudo /opt/owfs/bin/owfs u -m /var/lib/1wire
I have a Dallas Semiconductor DS1490F 2-in-1 Fob, 1-Wire adapter. Also, after installing, I found that the Navitron forum has a discussion on owfs.
All I want to be able to do is log temperature data to a text file. I think I’ll write a simple C++ app to log the temperature data to a text file and then use gnuplot to plot graphs.
In Python, I found I was getting the following error:
>>> import ow
>>> ow.init('u')
DEFAULT: ow_ds9490.c:(255) Unclear what <> means in USB specification,
will use first adapter.
DEFAULT: owlib.c:(201) Cannot open USB bus master
DEFAULT: owlib.c:(54) No valid 1-wire buses found
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/dist-packages/ow/__init__.py", line 224, in init
raise exNoController
ow.exNoController
This turned out to be a permissions issue. Running python as sudo fixed
the problem, but this clearly isn’t a good solution. Luckily, a kind
person gave a guide on how to make the 1-wire USB adapter usable for
non-root users. I
modified the file very slightly. All you have to do is to create a file
called /etc/udev/rules.d/owfs.rules
which looks something like this:
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="owfs_rules_end"
# DS2490 1-Wire adapter
SYSFS{idVendor}=="04fa", SYSFS{idProduct}=="2490", MODE="660", GROUP="fuse"
LABEL="owfs_rules_end"
Unplug and plug your USB adapter back in. If that doesn’t work then
check that you’re a member of the fuse
and
idVendor
with
GROUP:="fuse"
. If that still doesn’t work then try
replacing SYSFS
). For more info on udev, and for a
description of how I got udev to work with my Current Cost USB cable,
see this blog post.
Here’s a simple little Python script for logging every temperature sensor reading once a minute:
And here are some handy links to the owfs documentation: owpython and owserver.
The next things to do are to connect up some more temperature sensors so I can see the temp drop across our UFH, and tinker with some graphing utilities like matplotlib and Google’s Chart Tools API; and tinker with sending data to pachube.
Update 24th Feb 2012
My owfs Python code (including code to send the data to Pachube) is now on github - please see github for the latest code.