The Improved Wall Switch Project (Spring 1997)
IntroductionThe purpose of this project is to see if its possible to replace the microchip inside an X-10 WS-467 wall switch with a custom programmed microprocessor. The reason is that the stock wall switch exhibits some undesirable behavior. One example is that the switch turns the lamp on full bright when you send it a DIM command when the wall switch is off. The more desirable trait would be to brighten up from off gradually.
Inspection of several wall switches showed that the chip bore markings from the Microchip corporation, fueling the suspicion that it is possible to replace it with a PIC micro (from Microchip). A unit with an A/D converter is needed since the X-10 carrier is fed unamplified to the stock chip, and can have amplitudes in the tens of millivolts.
Results of the investigationAfter removing the stock chip, and soldering in a socket, I was able to plug in a ribbon cable leading to a solderless breadboard. This allowed me room to work and experiment.
My initial attempts were successful, I was able to port my X-10 receiver from my home automation library and was able to receive X-10 commands. These commands were succesfully used to control the attached light bulb. The only modifications needed to the circuit board were the replacement of a zener diode and of course the microchip.
I then attempted to send X-10 commands from the wall switch, but the low operating voltage of the PIC and the inadequate signal coupling transformer made this not possible. Specifically, I directly connected both sides of the signal transformer's secondary to the PIC, and drove them in a complementary 'bridged' fashion. This applied 10 Volts peak-peak to the secondary. Due to the 10::1 ratio, this voltage appears as 1 Volt peak-peak on the primary and the power line. As a comparison, a mini controller plugged into the same outlet as the wall switch, produced 5 Volts peak-peak at the signal transformer's primary. Thus we need about a five fold increase in transmit amplitude.
Another issue is the fact that the PIC can sample no faster than 50kHz, while the X-10 carrier is at 120kHz. Since we will thus be subsampling, the apparent frequency of the X-10 carrier in the sampled data will be aliased down to the frequency Tr:
Tr = Tx - nTs, where n is an integer such that: 0 < Tr <= Ts
Thus if Tx is an exact multiple of Ts, the apparent frequency will be zero, and the carrier will not be detected. Since the sampling rate is 12.6khz, the carrier needs to shift by +/- 6.3kHz to cause this.
Finally, since the PIC is not frequency selective, burst of noise by nearby TRIACs can cause the carrier to be distorted compeletely. A better detection algorithm can address this, or analog hardware needs to be added to provide frequency selectivity.