There are numerous controller solutions on the market. Some of them are really, really nice, but, they aren't cheap either. With this economy and a kid in college, it has to be cheap (or free) before I will consider it. While I don't have a pile of cash sitting around (thanks to UF), I do have a few old POS laptops that have nothing to do but reminisce of days gone by. Rather than collect dust, I'm putting one (or more) of them to work.
This article requires the following:
I did this on a fresh install of Fedora 14. However, these procedures should work on most any distribution. Before you install anything though, check to make sure it's not already installed by your distribution (no need to have it twice).
All source that was downloaded was extracted into /usr/src as typical.
Download and install FUSE: http://fuse.sourceforge.net/
Follow the directions in the INSTALL file. From the command line:
Download and install owfs: http://sourceforge.net/projects/owfs/files/owfs/2.8p8/
Follow the directions in the INSTALL file. From the command line:
You can run owfs in a number of different ways (google it), but I choose to run the client/server model. Since I want all this mess started and mounted on startup, I edit my /etc/rc.local file to achieve that as such:
Adjust the /dev/ttyS0 term to match the serial port your 1-wire adapter is plugged into (/dev/ttyS0 is serial port #1, etc). You can use any port you want - I chose 1961 because that's my birthyear.
Now you are ready to attach some 1-wire devices. As mentioned above, you can buy them, or, you can make them yourself. I can't say how "hard" it is - only you can decide that. I'd say it's about "medium" on the hard scale. I'm not that good with a soldering iron - I can manage, but I don't do a pretty job of it. It works, but it ain't pretty.
Use these schematics for making your own:click
The DS18S20 temperature sensors are very easy to hook up and use. Two pins to ground, the other to the 1-wire bus line. The DS2406 is a bit more involved, but doable. I used this schematic for my DS2406 switches as I already had those parts laying around here. Aside from the DS2406, these parts are CHEAP. Once you have that circuit working, attach the +/- 5 volts output to a SSR rated to handle your intended load.
Once you have the 1-wire devices connected, cd to the mount point of your 1-wire. For me it's /mnt/1wire:
Get a directory listing:
The entries that begin with "10" and "12" are four 1 wire devices that I have hooked up at the time of this writing. Devices that begin with "10" are DS18S20 and those that begin with "12" are DS2406. Those are the "family" id values (the rest of that number is it's address).
The directory structure of a DS18S20:
To read the temperature, "cat temperature":
In the above example, the temperature is 66.9875 degrees (in my fermentation fridge). Here's how you get to that value in a bash script:
The DS2406 shows up a bit differently in the file system:
To turn the DS2406 switch "on", you do this:
and to turn it off:
The TO-92 package of the DS2406 has only one switch line, so PIO.B is not usable on this device.
This article requires the following:
- A working install of Linux.
- A working knowledge of Linux. You don't need to be an expert, but you do need to understand mounting file systems and what not. This is not a tutorial on how to use Linux.
- A 1-wire adapter. I'm using the serial port version (DS9097U-XXX), but there are USB versions that work with this also. I recommend buying at least two (to have one for "play").
- 1-wire temperature sensors and switches. I'm using DS18S20 for temperature sensors, and DS2406 for switching. You can buy them most anywhere (Jameco, Digi-Key, etc). Make sure you order the TO-92 packaging unless you have ninja soldering skills. If you don't want to make your own sensors/switches, you can order them pre-assembled from numerous sources (here, here, here). That (assembled) 8 relay board from Hobby Boards for ~$70 is one heck of a deal.
- You can get a few free ones from Maxim: here. Enter the part number (DS18S20), click GO, then select the "Sample Now" button on the items you're interested in. Do the same for the DS2406 and any other 1-wire device you want a free sample of. Not all items are available for sample so poke around. Don't be greedy - accept the default quantity of 2 and be happy.
I did this on a fresh install of Fedora 14. However, these procedures should work on most any distribution. Before you install anything though, check to make sure it's not already installed by your distribution (no need to have it twice).
All source that was downloaded was extracted into /usr/src as typical.
Download and install FUSE: http://fuse.sourceforge.net/
Follow the directions in the INSTALL file. From the command line:
Code:
# ./configure
# make
# make install
Download and install owfs: http://sourceforge.net/projects/owfs/files/owfs/2.8p8/
Follow the directions in the INSTALL file. From the command line:
Code:
# ./configure --prefix=/opt/owfs
# make install
You can run owfs in a number of different ways (google it), but I choose to run the client/server model. Since I want all this mess started and mounted on startup, I edit my /etc/rc.local file to achieve that as such:
Code:
#
# fire up the 1-wire stuff
#
/opt/owfs/bin/owserver -d /dev/ttyS0 -F -p 1961
/opt/owfs/bin/owfs -s localhost:1961 -m /mnt/1wire -F --allow_other
Adjust the /dev/ttyS0 term to match the serial port your 1-wire adapter is plugged into (/dev/ttyS0 is serial port #1, etc). You can use any port you want - I chose 1961 because that's my birthyear.
Now you are ready to attach some 1-wire devices. As mentioned above, you can buy them, or, you can make them yourself. I can't say how "hard" it is - only you can decide that. I'd say it's about "medium" on the hard scale. I'm not that good with a soldering iron - I can manage, but I don't do a pretty job of it. It works, but it ain't pretty.
Use these schematics for making your own:click
The DS18S20 temperature sensors are very easy to hook up and use. Two pins to ground, the other to the 1-wire bus line. The DS2406 is a bit more involved, but doable. I used this schematic for my DS2406 switches as I already had those parts laying around here. Aside from the DS2406, these parts are CHEAP. Once you have that circuit working, attach the +/- 5 volts output to a SSR rated to handle your intended load.
Once you have the 1-wire devices connected, cd to the mount point of your 1-wire. For me it's /mnt/1wire:
Code:
[root@x24 1wire]# cd /mnt/1wire/
Get a directory listing:
Code:
[root@x24 1wire]# ls -l
total 0
drwxrwxrwx. 1 root root 8 Apr 20 11:39 10.26CC4F000800
drwxrwxrwx. 1 root root 8 Apr 20 11:39 10.E1B64F000800
drwxrwxrwx. 1 root root 8 Apr 20 11:39 12.50547D000000
drwxrwxrwx. 1 root root 8 Apr 20 11:39 12.6A497D000000
drwxr-xr-x. 1 root root 8 Apr 20 00:59 alarm
drwxr-xr-x. 1 root root 8 Apr 20 00:59 bus.0
drwxr-xr-x. 1 root root 8 Apr 20 00:59 settings
drwxrwxrwx. 1 root root 8 Apr 20 11:39 simultaneous
drwxr-xr-x. 1 root root 8 Apr 20 00:59 statistics
drwxr-xr-x. 1 root root 30 Apr 20 00:59 structure
drwxr-xr-x. 1 root root 8 Apr 20 00:59 system
drwxr-xr-x. 1 root root 8 Apr 20 00:59 uncached
[root@x24 1wire]#
The directory structure of a DS18S20:
Code:
[root@x24 1wire]# cd 10.26CC4F000800/
[root@x24 10.26CC4F000800]# ls -l
total 0
-r--r--r--. 1 root root 16 Apr 20 00:59 address
-r--r--r--. 1 root root 256 Apr 20 00:59 alias
-r--r--r--. 1 root root 2 Apr 20 00:59 crc8
drwxrwxrwx. 1 root root 8 Apr 20 11:42 errata
-r--r--r--. 1 root root 2 Apr 20 00:59 family
-r--r--r--. 1 root root 12 Apr 20 00:59 id
-r--r--r--. 1 root root 16 Apr 20 00:59 locator
-r--r--r--. 1 root root 1 Apr 20 11:42 power
-r--r--r--. 1 root root 16 Apr 20 00:59 r_address
-r--r--r--. 1 root root 12 Apr 20 00:59 r_id
-r--r--r--. 1 root root 16 Apr 20 00:59 r_locator
-r--r--r--. 1 root root 12 Apr 20 00:59 temperature
-rw-rw-rw-. 1 root root 12 Apr 20 11:42 temphigh
-rw-rw-rw-. 1 root root 12 Apr 20 11:42 templow
-r--r--r--. 1 root root 32 Apr 20 00:59 type
[root@x24 10.26CC4F000800]#
To read the temperature, "cat temperature":
Code:
[root@x24 10.26CC4F000800]# cat temperature
66.9875
[root@x24 10.26CC4F000800]#
In the above example, the temperature is 66.9875 degrees (in my fermentation fridge). Here's how you get to that value in a bash script:
Code:
#
# the device name of the DS18S20 temperature sensor
#
fermilabDev="/mnt/fermiTemp/temperature"
#
# read (and log) the temperature of the fridge
#
fermilabTemp=$(cat $fermilabDev | tr -d ' ')
logger -t fermilab "$fermilabTemp degrees"
The DS2406 shows up a bit differently in the file system:
Code:
[root@x24 1wire]# cd 12.6A497D000000/
[root@x24 12.6A497D000000]# ls -l
total 0
-r--r--r--. 1 root root 16 Apr 20 00:59 address
-r--r--r--. 1 root root 256 Apr 20 00:59 alias
-r--r--r--. 1 root root 12 Apr 20 11:48 channels
-r--r--r--. 1 root root 2 Apr 20 00:59 crc8
-r--r--r--. 1 root root 2 Apr 20 00:59 family
-r--r--r--. 1 root root 1 Apr 20 11:48 flipflop.A
-r--r--r--. 1 root root 3 Apr 20 11:48 flipflop.ALL
-r--r--r--. 1 root root 1 Apr 20 11:48 flipflop.B
-r--r--r--. 1 root root 12 Apr 20 11:48 flipflop.BYTE
-r--r--r--. 1 root root 12 Apr 20 00:59 id
-rw-rw-rw-. 1 root root 1 Apr 20 11:48 latch.A
-rw-rw-rw-. 1 root root 3 Apr 20 11:48 latch.ALL
-rw-rw-rw-. 1 root root 1 Apr 20 11:48 latch.B
-rw-rw-rw-. 1 root root 12 Apr 20 11:48 latch.BYTE
-r--r--r--. 1 root root 16 Apr 20 00:59 locator
-rw-rw-rw-. 1 root root 128 Apr 20 00:59 memory
drwxrwxrwx. 1 root root 8 Apr 20 11:48 pages
-rw-rw-rw-. 1 root root 1 Apr 20 11:48 PIO.A
-rw-rw-rw-. 1 root root 3 Apr 20 11:48 PIO.ALL
-rw-rw-rw-. 1 root root 1 Apr 20 11:48 PIO.B
-rw-rw-rw-. 1 root root 12 Apr 20 11:48 PIO.BYTE
-r--r--r--. 1 root root 1 Apr 20 11:48 power
-r--r--r--. 1 root root 16 Apr 20 00:59 r_address
-r--r--r--. 1 root root 12 Apr 20 00:59 r_id
-r--r--r--. 1 root root 16 Apr 20 00:59 r_locator
-r--r--r--. 1 root root 1 Apr 20 00:59 sensed.A
-r--r--r--. 1 root root 3 Apr 20 00:59 sensed.ALL
-r--r--r--. 1 root root 1 Apr 20 00:59 sensed.B
-r--r--r--. 1 root root 12 Apr 20 00:59 sensed.BYTE
-rw-rw-rw-. 1 root root 12 Apr 20 11:48 set_alarm
drwxrwxrwx. 1 root root 8 Apr 20 11:48 T8A
drwxrwxrwx. 1 root root 8 Apr 20 11:48 TAI8570
-r--r--r--. 1 root root 32 Apr 20 00:59 type
[root@x24 12.6A497D000000]#
To turn the DS2406 switch "on", you do this:
Code:
[root@x24 12.6A497D000000]# echo "1">PIO.A
Code:
[root@x24 12.6A497D000000]# echo "0">PIO.A
The TO-92 package of the DS2406 has only one switch line, so PIO.B is not usable on this device.