 |
Home Automation
|
Climbing up into the attic to run wires all over the place isn't something
to look forward to doing. X-10 products use the house's electrical wiring to
transmit commands during that brief part of the AC cycle when there's no voltage
present. While it would seem much more elegant to transmit the feedback signals
via the same electrical wiring or to use radio signals, I've opted to go with
the least attractive attic method for a couple of reasons:
- AC wiring communication means that you'd be dealing with 110
volts directly, bringing it in to PC boards that you've made - this creates
innumerable opportunities for you to shock the stuffing out of yourself or
burn the house down. X-10 products are housed in plastic enclosures, making
it extremely difficult to shock yourself (aside from during the actual wiring
of wall switches or outlets), and they're tried & true, so [unmodified]
they aren't likely to cause any electrical fires.
- Even if you're careful and avoid the dangers of 110, you're placing
command and feedback signals on the same line. This opens up the possibility
of data collisions and miscommunications.
- Radio frequency circuits are finicky at best, and aren't much
fun to work with unless you have the test and calibration equipment necessary
to deal with them. Further, the FCC might have a few words on the subject,
as well as your neighbor if you wind up tromping all over his/her evening
news reception.
- 'Hard-wired' circuits are the least prone to noise, and the easiest to immunize
against noise.
So we're going to bite the bullet and crawl around in the attic, taking great
care to not damage the house we're trying to automate - no falling through the
ceiling or electrical fires, ok? Any time you do deal with the 110, you're going
to turn off the appropriate breakers and take any other appropriate precautions.
This is as good a spot as any to bring up the inevitable "you're responsible,
I'm blameless" disclaimer. I am not responsible in any way for any damage
you do to yourself, others, or property. The circuits presented here have been
tested, but are "as-is" - use at your own risk. In and of themselves
they can only, at worst, blow themselves up. However, once you hook them to
bigger circuits, larger havoc can be wreaked. Since I can't look over your shoulder
to supervise your work, I have no way of verifying your implementation of these
circuits/projects. Have someone else look over your work before you apply electricity.
And look carefully at the electricity you're about to apply - I've burned myself
more than once on a really hot voltage regulator that was pissed because my
target circuit was hooked up backward. Even small voltages can find ways to
bite you - have you ever grabbed ahold of one of those little novelty shocker
pens? One single 1.5 volt battery can actually be hooked up in a way that'll
light up your eyes.
Microcontrollers
A dizzying array of microcontrollers is available on the market today. Selecting
one, or a family, can actually be quite a time-consuming task. Motorola's 68HC11
family has long been a favorite among hobbyists, and I gave serious thought
to using them for these projects. However, I finally settled on Microchip PICmicro
controllers for several reasons:
- Chip versions begin at $1.50ish
- Development software is free
- A programmer can be built for under $20
- They have a wide operating voltage range
- They have a wide operating frequency range, and several have
internal oscillators
- They have a wide range of capabilities
I'm a hardcore C programmer but assembly language doesn't scare me and the
PIC's instruction set is effective, geared toward embedded control (which is
what we're doing here). You can purchase a C compiler for it, but I haven't
tried that since I'm so happy with their assembly language. If you're adament
about programming in C or BASIC and your wallet is itching to volunteer, you
could easily implement any of these projects using Rabbit Semiconductor's rabbit
modules or the BASIC stamp modules. You can also obtain C and BASIC compilers
for the Motorola 68HC11 family.
To work with PICs, you need:
- A PIC controller
I favor the flash versions because they're electrically
erasable and can be reprogrammed many times. They're all feature-rich and
are to a certain extent interchangeable. The projects list the chips they
use, but if you want one to play around with I'd suggest the PIC16F88 or
the PIC16F672, available for around $3-5 from
Digikey.
- A PIC programmer
You can either build your own or purchase one
for as little as $12. I built a 'Tait Classic' but probably spent more than
$12 (but under $20). If you type 'pic programmer' into a search engine you
can find a number of designs, many of which are very similar. You might
want to choose your programmer software first, then select hardware which
is supported by the software. Microchip has an application note at their
site which shows you how to build their AN589 programmer. I chose the Tait
because his regulates the programming voltage 'onboard', while the AN589
expects to be supplied with 13 volts. Whichever design you choose, add a
power switch.
- Assembler software
MPLab is a free download from
Microchip. If you want to get up and running
as quickly as possible with the least botheration, you might want to purchase
one of their development packages which includes a programmer such as the
PicStart or Pro Mate. MPLab supports those programmers directly.
-
- Programmer software
I use
ProPic. It leaves power on to the chip, which
irritates me because I have to keep unplugging the power from my programmer
(which is why I recommend a switch above). Other than that, it's great software
and is easily extensible - you can add newer chip versions in its INI file.
As with the hardware, if you type 'pic programmer' into a search engine,
you'll be able to choose from several. Choose one which supports several
chip versions, however; a great number only support the 16C84, which is
a fine chip but is growing outdated - the folks at Microchip don't seem
to spend much time sitting on their laurels.
Continue