keen-geofex-
Says:
Two tricks for reading AC-line isolated
switches
I was recently presented with a design that required
me to power a PIC directly from the AC power line, but to sense switches
isolated from that power line.
One of the things being controlled by the PIC was
an isolated DC supply, so it was easy to sense what was happening on that
supply. If the PIC had it turned off, nothing would happen on the isolated
side, but during the time the power was on, I needed to sense a number of
switches on the isolated side.
Solution: use LED/phototransistor isolators
backwards, with constant power from the isolated power supply running
the LEDs, and sensing the state of the phototransistors on the non-isolated
PIC side. This gave me the ability to monitor either normally open or normally
closed switches isolated by several thousands of volts. It also let me have
the primary-side PIC turn AC power to the power supply off based on sensing
switches on the isolated DC side.
The other issue was harder. I found I needed to pick
out switch changes isolated from the AC power line, and also isolated from
the DC supply, so I could not rely on the DC supply to run LEDs.
It took most of a day thinking, but I realized that
I could use a PIC output pin to drive the primary of a pulse transformer,
about a 12mm cube, to put voltage on the primary and secondary windings for
a few microseconds before the transformer inductance "leaked" the voltage
down. The same volts per turn must appear on all windings of a transformer,
so a switch clamping the secondary would hold the primary to 0V too.
Driving the primary through a 100R resistor let me
power the transformer primary from a PIC pin and read the primary voltage
from another pin as an analog input. So I picked a transformer that would
hold up a 5V applied input to over 2.5V for at least 20uS, the charge time
for the A-D converter.
I could then read the voltage on the transformer
primary, and tell the difference between the secondary being open and shorted
by a switch. The switch state would be sampled for 20-50uS with a pulse
on the primary, which would then be allowed to relax for some long period
of time. Sampling the switch at 500hz to 1khz is pretty easy.
That's OK as far as it goes, but it's an expensive
way to sense isolated switches. I realized that an additional switch could
be added with a resistor in series with it on the secondary. The volts-per-turn
equality still holds, and a secondary with a resistor and switch cause a
voltage divider action to appear on the primary side as well. So the A-D
can pick off more than one isolated switch by careful reading of the analog
voltage on the primary of the transformer during the on-time.
Using different resistors to read many switches through
an A-D isn't new, but this is the first time I've seen it applied across
a transformer. It takes some careful work to get the transformer charge time
and relax time right, but it got me out of having to make up an isolated
DC power supply for the PIC.