Introduction: DIY X-10 AC Power Sensor

I built this sensor to monitor my X-10 controlled pool pump. Because X-10 controls are normally open loop and not 100% reliable, the pump sometimes fails to activate or sometimes turns on by itself. This sensor provides feedback to indicate when the pool pump is actually on.

The basic idea is that the sensor monitors the AC power going to a device and transmits an X-10 signal that corresponds to the device power state. At the other end, appliance module is set to respond to the monitor signal so that an indicator lamp (a night light style bulb plugged into an a outlet in my kitchen) goes on when the device is on.

The sensor is not limited to just monitoring a pool pump. It can monitor any single phase or split phase device, and the device can be manually controlled or automatically controlled (e.g. by
X-10). The indicator is not limited to an appliance module; it can be a lamp module or another system that can receive X-10 signals (some security systems have this capability). I like to use an appliance module because it makes a nice loud “click” sound when it goes on.

In order to minimize the cost, a stock X-10 mini-controller unit (about $13) is modified to interface to the device to be monitored (the pool pump) power circuit. You should be able to build the complete sensor for less than $20.

Step 1: Get Some Parts

part list, sensor
(1) X10 "mini controller" known as model PHC01, MC460, etc. (this is a discontinued product, but it's still available).
(1) PIC12F508 microcontroller
(2) 6N139 opto-isolator
(2) 1N4004 400V diodes
(2) 47K 1/2W resistors
(3) 10K 1/4W resistors
(3) 1K 1/4W resistors
(1) 2N3906 PNP transistor
(2) 2N3904 NPN transistors
(1) 78L33 3.3V 0.1A voltage regulator
(1) 0.1uF 10V capacitor
(-) hookup wire, 300V
(24”) hookup wire, 26ga, low voltage
(1) PCB or hand-wired board, 0.82" by 2.34"

part list, indicator
(1) X-10 appliance module
(1) Incandescent light bulb style night light, manually controlled (not an automatic sensor type).

Step 2: Sensor Board Assembly

Assemble the circuit shown in the schematic. This can be done using a PCB (as shown) or with a hand-wired board.

You might want to use a socket for the microprocessor because it can’t be programmed in-circuit, so it might be nice to be able to remove it easily to implement any code changes.

Use the 300V hookup wire for the AC power connections (labeled M1a, M1b, M2a, M2b on the schematic) and leave enough wire length to connect to the device that you want to monitor.

Use the low voltage hookup wire for the X-10 controller connections (Vcc, SW, GND) and make the wires about 8 inches long.

Step 3: Microcontroller Programming

The PIC12F508 microcontroller must be programmed independently (not in-circuit). This can be done using a programmer & board combination such as the Microchip PICkit 2 Starter Kit. Load the “.hex” file into the programmer software and burn the chip. To change the software, use the Microchip MPLAB software. The complete source project files are available at www.FearlessNight.com/4701 .

The microcontroller code works by monitoring the AC input signal from the opto-isolators. The signal AC signal appears as pulses at a 60 Hz rate, which is averaged over time to convert it to a DC signal, which is then debounced. When a debounced signal (or loss of signal) is detected the appropriate output (on or off) is triggered for ½ second. The outputs pull the X-10 mini-controller switch contact, which is normally floating, to Vcc or ground. Some additional logic prevents the outputs from switching at more than once every 5 seconds in order to prevent flooding the X-10 control system.

PIC12F508 Hex File:
:020000040000FA
:1000000025006600090C0600DF0C0200670068008E
:100010006900410C2A006B006C004C0C2F004B0C4B
:10002000300047056705E706190AE107130AE705E7
:10003000130AE106130AE70404000607AB02660789
:10004000AC02EA02570A0F0C8B000307330A3C0C80
:10005000880143063B0AA8023C0C880143073B0A7F
:10006000C705A6053B0A280243063B0AE8004307EA
:100070003B0AC704A6040F0C8C0003074B0A3C0C78
:1000800089014306530AA9023C0C89014307530A1C
:10009000A7058605530A29024306530AE9004307C8
:1000A000530AA7048604410C2A006B006C00C707A2
:1000B000A7065E0A8707620A8704610A8706620A42
:1000C000870567052707710AEE02930AED02930A76
:1000D00026044604270447054C0C2F004B0C300027
:1000E000930A47077E0AF002930AEF02930A470435
:1000F000D60C3100930C3200A40C330067078C0A35
:1001000067048706850A4605860A26052705070C23
:100110002D00A10C2E00930AF302930AF202930A17
:08012000F102930A800A130AA0
:0401280000080008C3
:0203FE008C0C65
:021FFE00EE0FE4
:00000001FF

Step 4: X-10 Mini Controller Modification

BE SURE TO UNPLUG THE X-10 CONTROLLER FIRST!

Open the X-10 mini controller by removing the (4) small Philips screws in the bottom. With the controller face down, remove the back then lift out the PCB.

Connect the low voltage wires to the mini-controller PCB. The Vcc and GND wires should be connected to the 1000uF capacitor (C2). Be sure to connect Vcc to the capacitor "+" side and GND to the capacitor "-" side. The SW wire should be connected to pin 21 of the 24 pin IC, which corresponds to switch "4.8". The SW wire can be connected to any pin that corresponds to a switch (i.e. pins 18,19,20,21) if desired.

Remove the selector switch. This causes the unit number addresses to be 13,14,15,16 instead of the usual 1,2,3,4 or 5,6,7,8. If you want to use the normal unit numbers, then leave the selector switch in place.

Use a hobby knife to cut a notch in the back of the bottom shell of the X-10 mini controller near the AC power cord entry point so that the AC sensor wires can be brought out of the case without crushing them.

Assuming that you made the board size to the dimensions in the parts list, it should fit nicely into the front area of the X-10 mini-controller as shown in the photograph.

In my model, I installed a couple of inline fuses (the black head-shrinked objects) in the AC power sensor wires; this is not required.

Carefully reassemble the X-10 mini-controller.

Step 5: Indicator Setup and Test

Set the X-10 mini-controller house code (the rotary selector) for your house. If you don't have any other X-10 devices, then you can use any house code.

Set the appliance module house code to match the X-10 mini-controller setting. Set the appliance module unit number to 16 (or to match whatever switch you wired the sensor to). Plug the appliance module in and plug the night light into the appliance module. Make sure the night light switch (if any) is on.

You can test the X-10 settings by pushing the X-10 mini-controller "4.8" switch on/off to verify that the indicator lamp turns on/off.

Test the sensor by connecting either set of the sensor leads to AC power. When either of the AC sensors are connected to power, the indicator lamp should turn on within a few seconds. When power is removed from both sets of leads, the indicator lamp should turn off within a few seconds.

Step 6: Sensor Installation

Attach the AC sensor wires to the device to be monitored. The sensor is designed to monitor both phases of a 230VAC pool pump where "ON" means that either phase has power. So if you are connecting to a split phase device, connect one set of AC sense wires to each phase. If you are connecting to a single phase device, then connect just one of the sets of AC sense wires to the device.

Because the sensor connects directly to the AC power, in order to comply with building construction code requirements the entire sensor assembly should be contained in a UL rated grounded metal enclosure. This will take care of any electrical shock or fire hazard risks in case of a malfunction. For my pool pump monitoring application I put everything inside the existing pool pump control box.


Conclusion

Like all X-10 devices, this power sensor is susceptible to false signals. As a result the indicator lamp may sometimes turn on or turn off by itself instead of responding to the sensor control signals. But this is rare and because the sensor resends the X-10 control every hour the indicator lamp will eventually be reset to the correct state.

The complete set of design files for this project can is available for download at www.FearlessNight.com/4701 .

WARNINGS:

Shock Hazard - use caution when working with this device when the X-10 controller is plugged in and/or it is monitoring a powered AC device. The X-10 controller is a non-isolated design and so touching anything inside the controller while it's plugged in could cause an electrical shock.

Fire Hazard - this device could potentially burn your house down if it malfunctions. The entire assembly (the X-10 controller and the monitored device connections) should be kept inside a grounded metal electrical box to prevent shock and fire hazards.

Use in a dry environment only.


Troubleshooting

Verify that the X-10 settings are correct as described in Step 4 with both the sensor and the indicator plugged into the same electrical outlet.

The sensor circuit presents debugging outputs on microcontroller pins 2 and 3. Pin 2 indicates when a AC power is detected the M1a/M1b lines; pin 3 indicates when a AC power is detected on the M2a/M2b lines. When power is detected on either of sensor line sets, a ½ second pulse should appear at pin 6. When power is removed, a ½ second pulse should appear at pin 5.

If everything checks out but it doesn’t work when it’s installed, then the problem may be that the sensor and the indicator are on different power phases. If this is the case, then you will need to install a X-10 bridge so that the X-10 signals can travel throughout your electrical system and appear on both of the power phases. It’s also possible that sensor and the indicator are too far apart (such that the X-10 signal just doesn’t make it) or that there is electrical interference that is causing the X-10 signals to be lost. A X-10 bridge/repeater may also help in this case too because it regenerates the X-10 signal.

Comments