unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile-controlled house
@ 2002-03-19  7:03 Steve Tell
  2002-04-03  6:23 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Tell @ 2002-03-19  7:03 UTC (permalink / raw)



Anyone else interested in (or already using) guile for home automation?

Announcing "guilfred," guile's answer to Alfred the butler.   

I've finally wrapped autoconf+automake around the code I've been working
on and running nearly two years now, done a lot of cleanup (still more to
be done) and got things running with guile-1.5.6.   In spite of lots of
cleanup, its still quite crufty in places.

It really does control a number of fun things around my house.  For
example, this binds the button "off 7" on the wireless X10 keypad set to
housecode "L" to skip the MP3 server to the next song:
	(x10-bind-key #\L x10:off  7 (lambda () 
                               (if livingroom-wants-mp3
                                   (mp3-skip mp3svr))))
More guile binds the "rotated clockwise" keycode from the rotary encoder
in a hombrew controller to "increase volume on audio amplifier driving
the speakers on the deck."  A "software thermostat" module controls
auxiliary heat in the master bathroom, on cold winter mornings, with a bit
of help from an outdoor temperature sensor and cron-like time-driven
events.


By posting periodic snapshots, I'm hoping to find somebody else out there
interested in such things to share code and design ideas with.

http://www.telltronics.org/software/guilfred/guilfred-20020319.tar.gz

Of course, it won't do much without some hardware (supported devices
listed below). A supplied example will run, but it just results in a guile
in a daemon that you can connect in a somewhat secure manner with an
included remote-repl utility.

BTW, what's the longest-running guile process anyone has?  guilfred seems
to mysteriously die every four to six weeks.   I think the problem's in
my C code though, not guile.

Steve
--
Steve Tell  tell@telltronics.org 


Part of the README:


Guilfred is a guile-based system for home automation.  
It is still under development.

Features:

Most high-level abstractions and all scripting and configuration done in guile
Cron-like system for scheduled events
bind procedures to keypresses on X10 or hardwired keypads
temperature and main HVAC runtime logging
software thermostats for spot heating and ventilation fans
control of MP3 server - control audio playback from any keypad in house
event logfiles
Status display on serial terminal or linux-like virtual console


Hardware devices supported:

"Lynx10" rs232 to X10 powerline-control gateway, http://www.marrickltd.com/

"Omnistat" series of intelligent communicating HVAC thermostats
from Home Automation Inc. http://www.homeauto.com/

Multidrop rs485 network of my own design, linking low-cost 8-bit
embedded microcontrollers.   Nodes can include various combinations of
these peripherals:
	digital thermometer (dallas semiconductor DS1820)
	up to 20-key matrix keypad
	LCD display
	status LEDs
	rotary encoder knob ("volume control")
	solid-state or mechanical relays
	phase-angle incandescant lamp dimmer
	contact-closure inputs
More details on the embedded hardware comming soon.


Future plans:

easier changing of key and event bindings without restarting system
better abstractions for lighting control, including preset scenes
www-based status and control interface
menus and screens for satelite LCD screens
use of palm pilot for wired or wireless control/status nodes
security system integration
Still lots more cleanup to be done.  This was my first guile-based program,
and it shows.
Now that goops is starting to stabilize and has some documentation, I
may start learning about it for rethinking some of the scheme APIs.







_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: guile-controlled house
  2002-03-19  7:03 guile-controlled house Steve Tell
@ 2002-04-03  6:23 ` Thien-Thi Nguyen
  2002-04-04  4:13   ` Steve Tell
  0 siblings, 1 reply; 3+ messages in thread
From: Thien-Thi Nguyen @ 2002-04-03  6:23 UTC (permalink / raw)
  Cc: guile-user

   From: Steve Tell <tell@telltronics.org>
   Date: Tue, 19 Mar 2002 02:03:51 -0500 (EST)

   Anyone else interested in (or already using) guile for home
   automation?

   Announcing "guilfred," guile's answer to Alfred the butler.  [...]

are these devices "real-time" in any sense?

thi

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: guile-controlled house
  2002-04-03  6:23 ` Thien-Thi Nguyen
@ 2002-04-04  4:13   ` Steve Tell
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Tell @ 2002-04-04  4:13 UTC (permalink / raw)
  Cc: guile-user

On Tue, 2 Apr 2002, Thien-Thi Nguyen wrote:

>    From: Steve Tell <tell@telltronics.org>
>    Date: Tue, 19 Mar 2002 02:03:51 -0500 (EST)
> 
>    Anyone else interested in (or already using) guile for home
>    automation?
> 
>    Announcing "guilfred," guile's answer to Alfred the butler.  [...]
> 
> are these devices "real-time" in any sense?

Many device nodes have low-leveldealings with external hardware with
real-time constraints, such as the Dallas one-wire interface and
other serial protocols.  That's all handled in embedded 8051
assembly-language firmware.

I suppose the whole system of guile code, C support, and connected
device nodes could be considered soft real-time:

- events relates to the wall clock; if a cron entry says to call a
procedure at 17:05, it isn't the end of the world if it gets called at
17:05:01, but it is wrong if it happens at 17:06.  

- several user-interface inputs must trigger their guile procedures and
the results of those take effect soon enough that it appears
"instantaneous" to the user.  I've got a node called "keyled" which has 8
pushbuttons, each with an integral LED.  When the user pushes the button,
the embedded micro debounces the button, and stores the keycode in a
buffer.  Guilfred is continually polling all such keypad nodes, asking if
they have any buffered keycode.  When keycodes are found, the procedure
bound to that keycode is called.  Typicaly, at least two messages end up
being dispatched: one to turn on the LED in the button, and another to
turn on the associated lamp or other device.  I generally can't see any
noticable lag, but if I did, I'd set about redesigning and recoding so I
didn't.  But if one time in a hundred it took 250 milliseconds instead of
50, that would probably be OK.

But so far I'm not taking any particular measures to keep things
real-time.  I've been running guilfred as a user process on a linux box,
not even rtlinux nor even scheduling priority for the process.  
The same Pentium 166 cpu does other things too, serving web pages and
playing MP3 files.

When I started this a couple of years ago, I was worried about overhead of
using any scripting language, but subjectively guile has performed
admirably.  I have constrained it a bit: the C core is in charge and owns
the select loop.  It calls guile procedures or hooks on timer events and
external-input events.  Guile code isn't allowed to do anything that could
possibly block (although I'm not enforcing that by hiding "dangerous"
libguile procedures yet).


I've put some pictures some of the user interface devices at
http://www.telltronics.org/software/guilfred/hw-pictures/
Photos of nodes controlling some lights and the in-floor radiant heat will
have to wait until next time I climb into the attic.

Steve







--
Steve Tell  tell@telltronics.org 


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-04-04  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-19  7:03 guile-controlled house Steve Tell
2002-04-03  6:23 ` Thien-Thi Nguyen
2002-04-04  4:13   ` Steve Tell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).