1-wire usb interface and misterhouse glue
After installing misterhouse on my openwrt router I started adding devices. I plugged a 1-wire usb interface into my router and started playing around. There are at least two software programs that work for me in openwrt kamikaze 8.09
owserver
I installed the package owserver with the opkg command line tool
opkg -d usb install owserver
When the package was installed i started the owserver.
owserver – u -p 5555
On my desktop running ubuntu I installed owfs
sudo apt-get install owfs
which is the client for the owserver program and will create a filesystem whit all the sensors data.
sudo mkdir /mnt/ow
sudo owfs -s 192.168.1.1:5555 /mnt/ow
Works like a charm for me
drwxr-xr-x 1 root root 8 2009-03-16 21:28 .
drwxr-xr-x 22 root root 4096 2009-02-23 21:16 ..
drwxrwxrwx 1 root root 8 2009-03-19 15:59 10.096994010800
drwxrwxrwx 1 root root 8 2009-03-19 15:59 10.585394010800
drwxrwxrwx 1 root root 8 2009-03-19 15:59 10.6A6E94010800
drwxrwxrwx 1 root root 8 2009-03-19 15:59 10.A09B94010800
drwxrwxrwx 1 root root 8 2009-03-19 15:59 10.A77594010800
drwxrwxrwx 1 root root 8 2009-03-19 15:59 10.F77094010800
drwxrwxrwx 1 root root 8 2009-03-19 15:59 81.E74C2A000000
drwxr-xr-x 1 root root 8 2009-03-16 21:28 bus.0
drwxr-xr-x 1 root root 8 2009-03-16 21:28 settings
drwxr-xr-x 1 root root 8 2009-03-16 21:28 statistics
drwxr-xr-x 1 root root 30 2009-03-16 21:28 structure
drwxr-xr-x 1 root root 8 2009-03-16 21:28 system
drwxr-xr-x 1 root root 8 2009-03-16 21:28 uncached
Nice if you need to share your 1-wire data over the network but what i want is to have my temperature sensors values available in misterhouse that runs on the router as well.
So let’s go on to the next solution.
digitemp
Digitemp is another command line tool to interface a 1-wire network. To install type
opkg -d usb install digitemp
Let’s do a first test :
root@OpenWrt:~# digitemp_DS2490 -w
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 – http://www.digitemp.com
Found DS2490 device #1 at 003/004
Turning off all DS2409 Couplers
…….
Devices on the Main LAN
10A09B9401080052 : DS1820/DS18S20/DS1920 Temperature Sensor
105853940108009D : DS1820/DS18S20/DS1920 Temperature Sensor
106A6E9401080076 : DS1820/DS18S20/DS1920 Temperature Sensor
10096994010800BD : DS1820/DS18S20/DS1920 Temperature Sensor
10A77594010800AF : DS1820/DS18S20/DS1920 Temperature Sensor
10F7709401080053 : DS1820/DS18S20/DS1920 Temperature Sensor
81E74C2A000000A5 : Unknown Family Code
That’s good ! Next create a conf file.
digitemp -i
Now you can read a value like this
digitemp_DS2490 -t 2 -q -c /root/.digitemprc
Feb 08 22:09:23 Sensor 2 C: 21.00 F: 69.80
All that we need now is some perl code to read the sensors values and store them in a misterhouse variable. I came up with the following code.
use vars ‘$tempsensor1′;
if ($New_Minute){
$_=`digitemp_DS2490 -t 5 -q -c /root/.digitemprc`;
/\sC:\s(.*)\sF/;
$tempsensor1 = $1;
print_log “Temperatuur is nu $tempsensor1″;
}
This is just some test code but it proofs that it works so I am happy for now.
March 23rd, 2009 at 14:06
[...] a look at my 1-wire and K8055 code files for some working [...]