XRaCS, the X10 Radio Control System
by Chris Arndt
(This is the unedited text, and runs 3.9K. I'll add the figures soon.)
While the X-10 power line control system is a useful way of controlling lights and other devices around a home or business, there just isn't a handy way to operate X-10 controls from a distance. The original system sold in the early 1980s had a handheld ultrasonic remote control. It was only good for line of sight in the same room as the control box, and anyone trying to use it spent a lot of time waving that thing around in the air to get the command to take.
Now you can buy a few different radio remote controls that will fit in your hand, or hang on a key chain. In my experience, the range of these is limited, the number of different units you can control is limited, and if you are trying to control something you can't see, you never really know if the radio command was received by the base unit. What it lacks is some sort of feedback.
I sort of solved this problem a while ago with an X 10 server I built out of an old Apple ][+ computer. You can call it on the phone, and it answers in a synthesized voice. DTMF (Touch Tone) commands tell the computer which X 10 signals to send, and the computer responds with vocal feedback, telling you the name or unit number of the device, and the control command sent down the AC line.
That was pretty cool, but it has its own set of limitations. It's not really useful on a single phone line, unless you wanted to call from work to turn on the hot tub, don't having anything else like an answering machine on the same line, and you don't care if other callers heard the computer answer.
I did wind up using the Apple server in our new house, but it only became useful after we installed a phone system (ref SEPT 96 INK p. 66). The X10 server is on a dedicated extension of the phone system, so an X 10 control console is as close as the nearest phone.
Having the Apple X10 phone server hooked up made X10 control around the house better, but what I really wanted was something that combined the convenience of the wireless ultrasonic or radio controls with the voice feedback of the computer control, had more range, and could control more X10 modules.
A cordless phone works with the phone based controller, but still suffers from limited range; constantly moving the handset from ear to view as I push buttons and listen to the computer is a pain; and it's still not suitable for someone with a single line and no phone system. I needed a better handheld unit, one with some range, a DTMF pad, and a speaker, rather than an earpiece.
The New Generation X10 Remote Control
As an amateur radio operator, I realized I already had the basic field controller at hand, as it were. (photo 1) Almost all modern handheld VHF or UHF ham radio transceivers have a built in 16 button DTMF pad on the front. All I needed was the equivalent of my Apple computer, the modem for DTMF detection and X10 interface, and a speech synthesizer all connected to another radio on the other end. That didn't seem like too much to ask.
When I discovered that the Parallax Basic Stamp 2 had an X 10 output command, I realized that the hardest part was over, the X 10 signal generation. In the Apple system, the X10 zero crossing detection and command generation was handled by machine language subroutines. I had some DTMF receiver chips left over from my Apple project, and I scrounged and retuned a UHF Motorola telemetry radio to an appropriate portion of the amateur 440 band.
The Basic Stamp 2 has 16 I/O pins, and I had a feeling I was going to need most of them for this project.
The DTMF Receiver
The DTMF receiver is a Teltone M-957. (Figure 1) It requires a color burst crystal, a couple of capacitors for bypassing and DC blocking on the input, 5 to 12 volts DC, and an audio source. It outputs the DTMF digit as a 4 bit parallel nibble and a separate "valid data" strobe. It can be set to decode only the 12 common DTMF digits, (0-9, *, and #), or all 16, (the common 12, plus "A", "B", "C", and "D"). The DTMF receiver uses 5 pins of the Stamp.
I strapped the chip for all 16 digits by grounding the 12/16 pin, and for minimum sensitivity by grounding the "A" and "B" pins.
The Stamp's XOUT X 10 command uses 2 of the Stamp's I/O pins, and connects to an X 10 TW523 interface that plugs into any 120 volt AC outlet. While the TW523 looks like a wall wart power supply, its only function is to safely send the zero crossing signal of the AC line to the controlling X 10 device, in this case the Stamp, and safely couple the 120 kHz X 10 signal onto the power line.
The Radio Transceiver
The radio transceiver is a Motorola Rnet 450. It was originally used as a telemetry radio in the 450 mhz band. I purchased new crystals for it and retuned it into the 70 cm amateur band.
This radio unit runs on 12 volts DC, and the transmitter has a nominal output power of 2 watts. This is just about right for this project. I wouldn't necessarily choose this transceiver if I was shopping for a new one. New, it is a bit expensive for a project such as this, and better deals on equivalent units are available from other manufacturers, if the application is commercial.
For amateur radio use, this project could be adapted to almost any hand held, mobile, or base transceiver where this type of auxiliary operation is allowed by the FCC rules. However, I got a good deal on this transceiver used, and it works fine. A bonus is its small size. the entire transceiver is contained in a housing 3.75" x 2.75" x 1.75".
Keying the transmitter in the radio requires grounding the PTT (push to talk) line of the transceiver. This takes another pin on the Stamp. I decided to use a MOSFET to amplify the output of the Stamp pin to the level necessary to activate the transmitter.
Telling the Stamp when to expect digits is a little involved. I could have just had it monitor the valid digit pin on the DTMF receiver, but this lacks any security. The radio has a "carrier detect" pin that changes state when the receiver hears an on-frequency radio transmission. Using this as an activity indicator is worse than the "valid digit" pin, and I found its operation on this particular transceiver to be erratic, anyway.
What The Heck is Tone Coded Squelch?
One of the ways that many different radio users can share a common frequency without having to listen to each others radio conversations is through something called Continuous Tone Coded Subaudible Squelch or CTCSS . CTCSS, sometimes known as "PL" for the Motorola trademark "Private Line", impresses a selected audio tone onto the transmitted audio.
The tones are between 67.0 and 203.5 hz which is lower in frequency than the 300 hz or so low frequency audio cutoff of the receiver. A tone detector in the receiver prior to the audio filters listens for the correct tone and keeps the speaker muted unless the right tone is detected. In this way, several different users, like a plumber, an electrician, and a carpenter, all with different CTCSS tones, can share a common radio channel without having to listen to each other's conversation.
Add-on encoder/decoder boards are available for radios that do not already have one installed. This radio did not include one, and I realized that an add-on CTCSS decoder would give me a little security, and a solid indication to the Stamp to look for incoming DTMF data. Adding one to the Motorola unit required a little investigation of the schematic, to locate the right part of the receiver to connect it to, so that the received tones would be present.
The usual place to connect a CTCSS decoder is at the output of the demodulator. In an FM receiver, this is the discriminator output, before any audio filtering.
The decoder I chose is the Communications Specialists TS-32P. It is a 1.25" x 2.0" board, will run on 9 to 18 volts, and has a DIP switch to select the desired CTCSS tone. There a several different control output options. There is also an audio output that can be connected to the transmitter audio input for adding the selected CTCSS tone to a transmitted signal.
I connected the input of the TS-32P to the discriminator of the radio transceiver and the tone output to the modulator. That way, outgoing transmissions are encoded, and CTCSS decode can be used at the operator's end, also. I used the low going detected tone option for connection to the stamp.
What About the Voice?
Now, we have the Basic Stamp 2 as a controller, a DTMF chip for input, the TW523 for X 10 output, and the radio and CTCSS board for radio reception and transmitting. What's missing? The voice feedback!
I was originally going to use the Digitalker chip set from National. This has a dedicated vocabulary of up to a few hundred words and numbers. I got a set of the chips and a data sheet. The hardware and software interfacing wasn't as easy as I'd hoped, it was going to take a lot of Stamp pins (maybe more than I could afford), and the vocabulary was really limited.
Then, in the back of an issue of Circuit Cellar Ink, I saw an ad for a single board text to speech generator. The RC Systems V8600 (FIGURE 2) will take TTL serial, parallel, or bus ASCII text input, and output an audio synthesized voice speaking the input text . It will add inflection, has adjustable levels of digit and punctuation interpretation and even has an on board audio amplifier to drive a local speaker. This was just what I'd been looking for. It was quite a bit more expensive than the Digitalker, but the ease of use more than made up for it.
To save Stamp pins, I decided to use the serial input option. This takes another stamp pin to output the text to the board, and one more from the SYNC pin on the speech board back to the Stamp, so the Stamp will know when the board is done talking. The SYNC pin goes high as the board starts speaking, and goes low when it is done.
The whole hardware assembly is shown in Photo 2 and the schematic in Figure 3. It all fits on a 7" x 9" aluminum panel that mounts in an 8" w x 10" t x 4" d steel cabinet. I used adhesive backed hook and loop tape to mount the CTCSS board and the speech synthesizer.
The Program
The Stamp program (Listing)is divided into two main sections,and several subroutines. The first section performs some setup and testing of the attached hardware. It initializes the speech board, setting the communications baud rate, and slowing down the speed of the spoken text. Then a test message is transmitted by the radio, thereby confirming that the transmitter works, and the voice card has been setup properly.
Then a test X10 command is sent. I use a different house code than the ones we normally use at home, so it doesn't interfere with any other modules. The X10 test sends a House Code A Unit 1 ON command, pauses a second, and then sends an OFF command. A small incandescent light plugged into an X10 lamp module set to house code A, unit 1 near the controller is enough of a visual indication that the X10 system is working.
A note about the Basic Stamp 2 and the XOUT (X10) command. The command requires the use of two pins on the stamp, one to detect the zero crossing of the AC line voltage, and one to send the X10 signals to the TW523 for interfacing to the power line. To properly time the sending of the X10 commands, the Stamp waits for for the zero crossing signal from the interface. If the Stamp isn't connected to the TW523 interface, or the interface is not plugged into a live AC outlet, the program will hang.
To keep this from happening during initial startup, or after a hardware reset, the program uses the Stamp Basic PULSIN command to look for the AC zero crossing signal and if is not there, jumps to a routine that announces the fact over the radio.
Once the initialization has been completed, the program enters its main loop, the supervisor. At this time, all the supervisor really does is look for low on the Stamp pin connected to the CTCSS board, indicating that a valid sub audible tone has been received. When this occurs, the program goes to the X10 routine. After this, the sub audible tone isn't checked for again except in the transmitter keying subroutine until we return to the supervisor routine. The initial tone detection acts as a key to unlock the X10 features.
The supervisor routine is there so that other features can be added to the program in the future, without having to rewrite major portions of it.
A complete X10 command in this program consists of sending a single digit for the house code, two digits, 1-16, for the unit code, and a DTMF letter; A, or B, for an action command. "A" for ON, and "B" for OFF. "C" for BRIGHTEN, and "D" for DIM are reserved for a future enhancement. The DTMF "*" is a universal reset character if you lose your place, and the "#" is unused.
This particular 3 digit address scheme for a given X10 module means that 160 module addresses out of the total of 256 are available by radio control, if the programming for all of the house codes is added. (10 digits available for house codes on a DTMF keypad x 16 module codes = 160 module addresses). At this point I really only need 32.
After the unit code digit is sent, the Stamp replies by voice over the radio with the equivalent house code letter; after the unit code, it echoes the number; and after the action, that is also echoed over the radio. Then the program loops back to the supervisor routine.
The X10 routine consists of calls to a DTMF digit grabbing subroutine, and actions taken on those digits. The first digit is looked up as a house code. To keep consistency with the old Apple program still running on the phone system, a DTMF "1" represents house code "K", and "2" equals house code "L". Since house code "A" was already declared and used in the Stamp program, I equated it to "3".
Once a complete X10 sequence is sent, the program jumps to the identification routine, and then loops back to the supervisor.
Transmitting and Speaking
I couldn't figure out an easy way to pass text strings from one part of the program to another, so I split the transmitting and speaking subroutine in two, and call the two parts before and after sending the serial message text to the speech board.
KEY is a subroutine that waits for the CTCSS I/O pin to go high, indicating that the radio of the person sending the commands has stopped transmitting and is ready to receive. It then turns on the transmitter and pauses for a short time to allow the CTCSS decoder on the other end to open the audio on that receiver.
The KEY subroutine returns, the message text is sent to the speech board., and DKEY is called. The speech board takes a little time to raise the SYNC pin to indicate that vocalization has started. DKEY waits for this pin to go high, and then drop when speech has ended. Then the transmitter is deenergized and the program continues.
"Glue" Stuff
Most of the connections between the subsystems are direct, and there are not a lot of "glue" parts required to stick it together and make it work. The transmitter keying requires a MOSFET to match the Stamp to the (PTT) line of the radio. The DTMF receiver needs 2 capacitors and a color burst crystal. During development, I added an LED indicator to the CTCSS decoder output and another to the PTT driver, so I could keep track of the program execution visually.
The radio and the CTCSS board work on 12 volts DC, so I added a 5 volt regulator for the V8600 speech synthesizer and the Stamp carrier board. The speech board has an on board amplifier, so I added a miniature phone jack so I could plug in a speaker and listen during testing.
Identification
One requirement of the FCC is that radio amateurs identify themselves at least once every ten minutes and at signoff. Since this particular project is used in the amateur service, I needed a way to keep it legal. There are published Morse Code routines for Basic Stamps, but since I have the voice synthesizer integrated into the project, it's easier to just have my callsign spoken.
I didn't include any clock or timer, and since this is a low use device, the easiest solution is to transmit the identification after every complete X10 sequence.
Safeguards and Precautions
The CTCSS adds some security from casual hacking of the system. A DTMF password would add more. The radio transceiver has an integral time out timer to kill the transmitter if the program should lock up with the transmitter keyed..
Even though there is audio feedback that the command was sent down the power line, there is no feedback that it actually took effect. A failure here could be caused by interference or collision on the power line with another X10 command.
Project Wrap Up
I'd like to thank Jeff Martin of Parallax, and Jon Williams for their comments, suggestions, and help with a couple of sticky parts of the program. I hope that this article serves more as a catalyst than a project to be duplicated. I really only touched on the individual components. Any of the major subsystems (radio, CTCSS, DTMF decoder, Basic Stamp, V8600, or X10) have been or could be the subject of an article by themselves.
The radio can be substituted, or omitted and the controller added to an existing radio system. If I hadn't scrounged this particular Motorola unit, I would have used something else, rather than buy this model new. It has its limitations with the "carrier detect" action, and would cost more than the rest of the parts added together. With the elimination of the CTCSS board, this could be build to plug into the speaker mike jack of most commercial or amateur hand held or base transceivers, using the radio's internal CTCSS decoder, and the valid digit pin on the Teltone DTMF receiver.
The speech board can be substituted or even eliminated, if you could live with some sort of beep-boop style feedback.
That RC Systems speech board has a wide range of programmable intonation and inflection. Right now, "he" sounds really bored when he speaks. I need to work on the board initialization and message punctuation to liven him up a little.
This project wound up taking 11 of the 16 pins on the Basic Stamp. There are 5 left over just sitting there waiting to be used for something. I did have a serial LCD display on one pin during debugging. If I added it back in, then the last few commands sent could be displayed for review.
Another use for those pins might be some sort of feedback, if knowing the status of the AC device controlled by an X10 module was critical.
One of my thoughts is to use the spare pins to monitor some switches or serial ADCs. Any change could then be announced by radio and/or used to activate an X10 device. This would be great for intrusion alerts, low temperature alarms, or other similar needs.
One way to increase security would be to use the stamp to control the CTCSS decoder board. The frequency selector on the board is a DIP switch. Leaving one or more switches open, and using pins on the Stamp to control those inputs would allow for some sort of remote or rolling CTCSS tone change to decrease the likelihood of someone hacking their way in.
A serial real time clock would add time of day event scheduling, time announcements, or another way of increasing security, using change of day to change CTCSS, or to change an added DTMF password.
Bio:
Chris Arndt, KD6DSI, has been a licensed amateur since 1991. He
builds his projects in San Luis Obispo, CA, when he's not working
as the Telemetry and Instrumentation Technician for the City of
Can Luis Obispo. He can be reached at carndt@slonet.org.
Sources:
Basic Stamp 2
Parallax, Inc.
3805 Atherton Road
Rocklin, CA 95765
916 624 8003
Motorola RNET 450 Tranceiver
Motorola Inc.
Portable Products Div
8000 West Sunrise Blvd.
Ft. Lauderdale, FL 33322
TS-32P CTCSS Decoder Encoder
Communications Specialists, Inc.
428 West Taft Avenue
Orange, CA 92665
714-998-3031 or 800-854-0547
Teltone M-957 DTMF receiver
Teltone Corp.
22121 20th Avenue SE
Bothell, WA 98021
206-487-1515 or 800-426-3926
V8600 Text to Speech board
RC Systems
1609 England Avenue
Everett, WA 98203
X10 TW523 Interface
Available from home automation dealers such as:
Home Automation Systems, Inc.
151 Kalmus Drive #L4
Costa Mesa, CA 92626
714-708-0610 or 800-762-7846
CAPTIONS:
PHOTO 1
The Yaesu FT-51R is a dual band 144mhz/440mhz handheld tranceiver. Among its many features, it had a full 16 button DTMF keypad, and CTCSS encode and decode, both important for operating XRaCS.
PHOTO 2
The assembled XRaCS fits on a 7" x 9" panel. The radio is the black box at the top left, with the TS-32P CTCSS board secured to it. The Basic Stamp, DTMF decoder, and PTT circuitry are on the Parallax BS2 carrier board at the top right. Below the Stamp board is the RC Systems V860 text to speech board, and below the radio is a 3 terminal 5 volt regulator for Stamp and 8600 power. The whole unit is powered by 12 volts DC. Off to the right of the panel is the X10 TW523 interface.
FIGURE 1
The Teltone M-957 contains almost all of the necessary circuitry to decode DTMF signals. The only external parts needed are a bypass capacitor and a 3.58 mhz crystal.
FIGURE 2
The V8600 is a complete text to speech processor. It will accept parallel or serial input, and has line level and amplified outputs. It's pronunciation rules can be modified by the user for personal preference, or to speak a different language.
FIGURE 3
The XRaCS is assembled from 5 main subsystems: the Basic Stamp 2, the DTMF decoder, the radio, the CTCSS board, and the voice synthesis board. There are few extra parts required to mate these systems together.
The XRaCS program initializes the speech board and tests it,
the radio, and the X10 interface before dropping into the supervisory
routine.