In <33117BF3.2438@no.junk.email> Edward Cheung writes: >The purpose of this investigation is to replace the chip >inside an X-10 wall switch with a custom programmed PIC. This >would allow the user to custom program the behavior of the >wall switch. The ultimate goal is to enable the wall switch >to respond. I was able to obtain many results this week in >this project. Awesome post Edward. Many thanks! I've included the whole original as I added comp.arch.embedded and sci.electronics.design to the newsgroups. I'm also sending it to the pic mailing list. The more neurons the merrier. >First, I was able to port over my X-10 receiver code from my >home automation library, and I can now receive X-10 commands! >I also have a simple X-10 'command decoder' that can react to >these commands and turn a bulb connected to the wall switch >ON, OFF, and ramp its brightness with DIM and BRIGHT commands. >This accomplishes the first objective of this project, as my >bulb will now not come on full blast after an OFF command, but >brightens gradually with every BRIGHT command. >To accomplish this, the only mod to the circuit board so far is >the replacement of the 15 Volt zener for a 5.6 Volt unit. In >addition, I have removed the stock chip, and replaced it with an >IC socket. I plugged in a ribbon cable with a DIP header into >this socket, and that leads to a bread board, where I can have >room to work. >I also use the on board UART on the P16C74 coupled into a MAXIM >RS-232 driver (running off the wall switch power supply) to send >data to my battery powered sub notebook. Since the computer is >isolated, I reduce my chance of destroying the computer due to >the wall switch power supply riding on 120volts AC. I can now >get debug and status info from the PIC. >I next turned my attention to sending X-10 commands. Before I >discuss my results, I'd like to talk a little about the existing >circuit. There are two transformer/coil cans on the circuit. One >functions as the coil in an LC circuit and is used by the stock chip >in an oscillator circuit (I have arranged my PIC to use this tank >as well). The other is what I call the 'signal transformer'. It >is used to couple the 120Khz X-10 carrier from the powerline to >the stock chip's input. After examining the windings, and using >an ohmeter, I concluded that the turns ratio is about 13::1 (one >can refer to Barry Lankford's or Hans Attersjo's schematic at this >point). The side with the 13 windings (secondary) is towards the >chip, thus the transformer steps UP the carrier signal so the >chip can detect it. A mini controller plugged into the same >outlet as the wall switch can produce an X-10 carrier amplitude >of about 1 volt p-p on the secondary of the transformer. >My strategy to transmit is to use the same pin on the PIC that is >used for carrier detection, but reprogram it on-the-fly to be an >output, and then bit bang out the 120Khz carrier. The emphasis >here is to minimize hardware mods and use software to do the work. >To further increase power, I use the signal transformer in a >'bridged' arrangement driving both sides of the secondary. This >required my cutting a trace, removing the protection diodes that >clamp the carrier input line, and (as a test) remove the 33 pf >capacitor in series with the transformer secondary. By alternately >setting one side of the transformer to +5, and the other to ground, >I maximize the drive to the transformer. >After powerup, I had 9 to 10 Volt p-p on the transformer secondary, >which led to about 1 Volt p-p on the primary. Recall that the >secondary is toward the chip, and the primary connected to the >power line. The carrier was transmitted for one msec _every_ >60 hz crossing. This was simpler >to code up than the full protocol, but my purpose was to see if >I could get enough raw carrier on the powerline to jam all >transmission in my house. The result: I could jam >transmission only in the same outlet that the wall switch is >plugged into. I could not shut down X-10 in the entire house. >This was disapointing. I only had enough carrier power for a >short distance, but not enough for the whole house. One of the >problems is that my signal transformer is now stepping DOWN my >voltage from 10Vp-p to 1Vp-p. >I then dissected a mini controller, drawing its schematic. The >carrier output circuit is very similar to the TW523's. The signal >transformer used in this circuit is a KC1047, the same can used as >the oscillator in the wall switch. This transformer steps the voltage >down by a ratio of only 6::1, and a larger power supply voltage >(-18 to -30) volts is used. In sum, after the step down, the >voltage on the output side is 5-6 Volts p-p, several times higher >than my wall switch's. Odd that they use a step down to xmit. They must want the current gain. >I thus have two problems to overcome for more TX power: >1) better transformer >2) higher power supply voltage >To address 1) I can reduce the windings in the secondary of the >transformer, but this will cause my input sensitivity to suffer. Still, then you'd be transmitting :-) >I >can instead replace the transformer with one that has a center tap in >the secondary. This will cause my output to be stepped down by >about 6::1 (similar to the TW523's). The problem here is that the >full windings of the secondary (these are connected to the carrier >input) will see TWICE the voltage I am applying to the center tap. >The protection diodes will clamp this voltage to 5 volts, and >completely kill my output amplitude. Try running without the diodes or change their values? Add protection on the new circuit board. (i'm assuming you'll add a small pcb with SMD parts to the original uC location) >The real solution is to add >a SECOND signal transformer. One for transmission, the other for >reception. This agrees with the approach taken by the designers >of the TW523. Surely the thrifty X-10 designers would have used just >one transformer if they could get away with it.... I would not count on that. Look at all the megabytes of hindsight about X10 on usenet through the years. The design is not perfect. (not that I don't use and love the little beasties) There could possibly have been only one guy designing the hardware, no design review, no usenet or mailing lists to discuss things on ;-), etc. >To address 2) I will need to add another power supply to the wall >switch, one to power the output stage (-18 volts) and the other >to power everything else. Could you change your basic power supply to 20-30V and use a tiny regulator for the PIC? Are there microcontrollers that run off higher voltages (CMOS)? I think the PIC outputs can withstand 20V (if memory serves) >I have come to the conclusion that the above two measures are not >possible. There is simply no room for the two. This is really >disapointing because I see little benefit for anyone to have the >modified wall switch if it does not transmit. My thoughts are to >terminate this project at this point. Here's a few more ideas: Add a winding to the existing output xfmr. Would be a miracle if it worked but you never know. Center tap it. I opened up one of these switches to better see what you were talking about. What's the really big coil at the top (about 1" x 1/2 ")? Getting rid of that would give you a nice piece of real estate. You say that you removed a cap from the xmit xfmr. Perhaps you detuned it? I notice that it has a tuning screw. Perhaps adjusting it with a scope on the output? Or putting the cap back? Just some random thoughts. Hope they help. Thanks again for the post. Andy