AC mains into PIC pin
Russell McMahon email (remove spam text)
> the safest way is to use an opto-coupler.
> I have vast experience in this field (dimmers in professional lighting
> and if you only knew what comes down those AC lines...... you'd use an
> Nicest way of doing it is to put the INT pin via a zener and res after
> step-down trafo, separated by a diode from the main storage caps.
> Microchip say you can do it with just a resistor, and that it will be ok (
> reasoning is: high impedance resistance.. a few megs, capacitance of pin
> slew limit, maximum current through pin is ok and clamps to PSU rail, due
> certain circumstances use 2 diodes to strap the pin to v+ and 0V ). I tend
> agree with them. The diodes internally vary from port type to port type so
Microchip's mother wears army boots and dresses it funny too, in this
Although, a laaaaarge enough value resistor approaches reasonableness.
Just because one of the manufacturer's people says it's OK doesn't mean it
is. The same applies if its written in an app note. In the operating
conditions section of a spec sheet SHOULD be different. (In the absolute
maximum section doesn't count).
When they put it in a data-sheet as a guaranteed spec you can *try* and hold
them to it - even then it still won't work if it breaks the laws of physics.
*IF* they actually suggest, as you say they do, that using external diodes
may be necessary, it proves they have found out by experience that the
internal catch diodes DON'T always work well and take you too near the
ragged edge and are taking you SOMEWHAT further away from the edge.
Consider, the internal diodes are standard silicon devices with a nominal
0.6v forward conduction voltage. Adding another silicon diode in p[arallel
externally MAY reduce internal currents significantly, and may not. Adding
external SCHOTTKY diodes is another story - that will work as the Scottky's
will conduct before the internal silicon diodes. If that is what they are
recommending then I apologise about the army boots comment. Shame about the
> This is also documented in the Microchip AppNotes.
> The safest way of doing it is via an opto-coupler, which needs a reverse
> diode accross the internal LED, and suitable current limit resistor so as
> to get too much delay on the sync relative to the 0 point on the wave.
Yes. Or someother "proper" isolation system. Note that even optos have their
limitations in very high rise time situations, but that's not liable to be
much of a problem here.(very bad input transients may need to be
It IS possible to design a resistive input mains interface that doesn't
violate IC input specs and which handles reasonably probable transients
well. It may be cheaper than using an opto but will not be safe for human
http://www.piclist.com hint: To leave the PICList
See also: www.piclist.com/techref/power.htm?key=ac
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the