Hardware hackers rejoice!
Brian Fahrlander
brian at fahrlander.net
Mon May 28 19:02:04 UTC 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
(Or, "More fun things to do with Ubuntu")
I have a 'life project', http://CounterMoon.org, where I'm building
a trailer in which I intend to spend the rest of my life on the road.
And ya just KNOW I'm not going there without Ubuntu Linux...
So I'm working on the controls; there are questions that will
naturally arise while on the road:
How much time is left on the batteries?
How much 110V power am I pulling?
Doesn't it seem [hot|cold] in here?
Rather than blow thousands on an A/D card (and the expensive cabling
to get those values the length of the trailer without noise or loss) and
[shudder] using anything with Microsoft, I found the 1-wire system from
Maxim/Dallas Semiconductor.
You start with Ubuntu, Feisty and Dapper both work. Then get a
handful of parts from http://Hobby-Boards.com that connect to your USB
or serial port, add the One-Wire FileSystem (OWFS), and start reading
values and writing to relays! It's fun, challenging, and useful.
Cheap, too.
The OWFS provides directories like /sys where you can read and write
to these devices as easily as reading and writing kernel parameters.
The code to check on things can be in anything you're comfortable with,
I chose Perl.
Here's a clip:
# Polling sensors
# Interior ambient temperature
$temp = &getvar("/var/1wire/10.BB434D010800/temperature");
# Interior ambient relative humidity
$humidity = &getvar("/var/1wire/26.AFBBA8000000/humidity");
# Making changes
sub vent_fan {
# Given 0, the fan is off. 1, the fan is on.
open(FAN, ">/var/1wire/1F.38C704000000/main/05.880032000000/PIO");
printf FAN ($_[0]);
close(FAN);
}
Just turn on the fan (the relay for it) with: vent_fan(1). Turn it
back off with vent_fan(0).
We all like our systems; but at the end of the day they don't *do*
many things. Here, we can direct the air conditioning to the warmer
rooms, turn on the sprinklers when they actually _need_ it, create
keypad locks, or turn on the dehumidifier on in the NOC when the server
room's steamy.
Enjoy!
- --
------------------------------------------------------------------------
Brian Fahrländer Christian, Conservative, and Technomad
Evansville, IN http://Fahrlander.net/brian
ICQ: 5119262 AOL/Yahoo/GoogleTalk: WheelDweller
------------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGWycs6PLtRzZbdhYRAkrXAJ96rslBqeHccBoiOFAjxM99KHGBqACfWNGn
Pwj1N9ThFMucuu/vn+NL8kE=
=1xXJ
-----END PGP SIGNATURE-----
More information about the ubuntu-users
mailing list