Shop OBEX P1 Docs P2 Docs Learn Events
Zero-crossing PIC style? — Parallax Forums

Zero-crossing PIC style?

K2K2 Posts: 693
edited 2010-05-03 17:49 in Propeller 1
If this has already been addressed, I couldn't find it using the forum search feature.

For zero-crossing detection of AC mains using a PIC processor, a simple method sometimes used is to connect an input pin of a PIC through a 20M resistor directly to 120VAC, relying on the input protection diodes of the pin to prevent latch-up. Can the Propeller can be used in this manner?

Obviously there are other ways to do this. And obviously there are other issues that arise when no dc isolation is present. But my question today deals just with the feasibility of a high-value resistor between the hot lead of an AC outlet and a Propeller pin.

If the pin isn't guaranteed against latch-up when used in this manner, I suppose I could use two Schottky diodes to protect the input. But I'd rather avoid the expense and the additional junction capacitance, albeit small.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The early bird gets the worm but the second mouse gets the cheese.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-05-03 16:50
    This should work in that the Propeller does have input protection diodes rated at 500uA and the amount of current involved is well below that under normal circumstances. The problem is that you can have brief transients much higher than 120VAC although 20M should keep even those under the maximum current allowed. A PIC is usually much cheaper than a Propeller and a failure of this protection mechanism could be expensive. High ambient moisture would be enough to compromise this. It all depends on what risk you want to accept. A safe way would be to use an optoisolator with a series resistor or capacitor. That's quite a few parts. If you really want to use a high value series resistor, consider using several in series rather than a single resistor. Seriously consider some kind of transient suppressor across the input. You're obviously going to have to isolate the whole circuit since logic ground will have to be AC ground as well. There are risks also there with transients potentially coupled into the logic.
  • K2K2 Posts: 693
    edited 2010-05-03 17:49
    Thanks for the answer, Mike. You've brought up some good points, moisture especially! Thorough cleaning and drying of the pcb containing the resistors would certainly be in order, and perhaps I ought to follow that with a thin coating of paraffin or epoxy.

    Two resistors were going to be used, but you have me thinking that possibly more might be in order.

    I certainly agree with your assessment of the need for isolation inasmuch as the circuit will be riding on the neutral leg.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The early bird gets the worm but the second mouse gets the cheese.
Sign In or Register to comment.