please dont rip this site

PIC Isolated Key/Switch Input

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.


file: /Techref/microchip/isolatedswitches.htm, 3KB, , updated: 2016/11/15 14:30, local time: 2024/12/26 15:53,
TOP NEW HELP FIND: 
18.227.52.111:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/TECHREF/microchip/isolatedswitches.htm"> PIC Isolated Key/Switch Input</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .