![]() |
Monitoring/controlling with Linux on the cheap
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: Code:
# ./configureFollow the directions in the INSTALL file. From the command line: Code:
# ./configure --prefix=/opt/owfsCode:
#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/Code:
[root@x24 1wire]# ls -lThe directory structure of a DS18S20: Code:
[root@x24 1wire]# cd 10.26CC4F000800/Code:
[root@x24 10.26CC4F000800]# cat temperatureCode:
#Code:
[root@x24 1wire]# cd 12.6A497D000000/Code:
[root@x24 12.6A497D000000]# echo "1">PIO.ACode:
[root@x24 12.6A497D000000]# echo "0">PIO.A |
To make your life easier, you may want to create sym links to the 1-wire devices. Repeating the above directory structure:
Code:
[root@x24 1wire]# ls -lCode:
[root@x24 mnt]# cd /mntNow, all you need to do is write some scripts (in whatever language you're comfortable with) that does something useful with the above. Enjoy, and YMMV. :) |
Nice write up!
I've been thinking of doing the same and using a ti launchpad instead of an adapter. Its $4.50 plus you get some additional IO. |
Excellent! I have started using a 1-wire sensor system with windows and it would be nice to have a Linux option.
I applied for a "free" DS2406 recently and they wanted to charge me $75 for a kit?? Not sure I did it right, but will try again. I kind of made it look like I was interested for my wife's company, who does electronic R&D... I may play with this info and see what I can do. Might be bugging you for some script help in the future! |
Well, I must have done something wrong last time. I was easily able to order a sample for the switch this time. Sweet!
|
Homercidal,
You did nothing wrong last time - they sell a developer kit too. The link above is to a different area (as you have already found out). The nice thing about using owfs is that it exposes 1-wire devices as a file system, which, takes almost all the work out of playing with those devices - no bit twiddling. It's frightening simple once it's all setup. Last I checked, owfs wasn't quite ready for prime-time on Windows - it might be worth a checking into though. Scripting... with owfs, anything that can interface with the file system, can do 1-wire. Bash, python, perl, php, etc. For example, my ferm fridge (Fermilab) is controlled by a simple bash script that gets fired up once every 2 mins by cron. I'm currently working on expanding this control mechanism to a HERMS system, but I'm not done with that yet... |
I have done a bit of bash scripting in college. I don't think I still have the Unix reference book, but I'll check. LOTS of information on scripting online though.
After seeing how it's done a little bit, it's starting to make some sense and really does seem very simple. I'm mostly interested in using it for controlling, since my temp monitor is already basically set up and working well. What I can see happening is using this to not just control a ferm chamber, but maybe 2 or more AND sending the temps to a file for reference. I should get all my friends to order samples for me... |
Quote:
|
Quote:
|
Here is some PHP code that plays with the device names I used in the examples above. You can run it from the command line, or from a web server. If your language of choice can open, read, write and close a file, it can do 1-wire via owfs:
PHP Code:
|
| All times are GMT. The time now is 12:59 AM. |
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.