It's often necessary to have a PIC control things on the AC power line. Using photo-isolators makes this possible, but the PIC is still running on an isolated supply. Running the PIC on a transformerless, non-isolated supply works really well, and can make the PIC able to control certain triac thyristors directly, but the PIC is then not isolated from the AC supply, and any peripherals connected to it are "hot" as well.
Very often, you'd like to have isolated switches read by the PIC. I figured out two tricks for this. I was designing a PIC controller for turning a DC power supply on and off with a Triac on the AC. The PIC could not run from the controlled DC power supply, because it would be off when the power supply is. It could never turn the power supply on. So the PIC needed to run from the AC power line side.
This can be done with a few resistors, caps and diodes, but then the PIC is "hot" to the AC line, and any switches connected to it are also hot.
(1) Use LED/phototransistor isolators from the DC power supply side to sense switches. The isolated DC power supply runs the LEDs and the switches turn the LEDs on and off. The phototransistor side is attached to the PIC and pulled up by the PIC's non-floating power supply. The switches on the isolated side can be either normally open or normally closed.
(2) For sensing isolated switches without the DC power supply being on, you can use a 0.5"/12mm cube sized pulse transformer. A pulse on a transformer like this can be held up by the primary inductance for the 20-30uS needed to perform an A-D operation on the primary winding on the PIC side. On the secondary side, an open switch leaves the primary voltage at its full value, so the "off" condition can be sensed. A closed switch on the secondary holds the secondary AND primary windings to nearly 0V, so a closed switch can be sensed.
This can be extended to another switch or two on the isolated/secondary side of the transformer with a resistor in series with them. The resistor will cause the primary voltage to be limited to lower than it would otherwise be, and this can be very much enhanced by using a resistor on the primary side of the transformer. The primary voltage is then a function of the secondary resistance, and judicial use of the A-D can pick out different switches being made.
Find out how to setup your programmer's software and how to solve many common problems.
1 post • Page 1 of 1