Sean Alcorn - Avion Sydney wrote: > > Hi Roman, > > > I believe it's the "ac mains zero crossing detector" > > application note that was discussed here on the > > list a while back. :o) > > Well that's different! I misread your original post as supplied from > the AC. > > But I have seen this zero crossing detect in a number of places. It's > in two circuits on pages 11 and 89 of "50 things to do with a PIC" by > Paul Benford - a 6M8 resistor is connecting GP5 of a PIC12C508 to the > "neutral" and a simple capacitor/resistor supply not unlike a circuit > one that I have used to supply PICs in a couple of commercial products. > > In the text he says; > > "The PIC devices are very good at handling high voltage. The majority > of I/O pins have clamping diodes both to Vdd and Vss. This means that > any voltage appearing on the I/O greater than the supply or less than > ground will be clamped to Vdd or Vss respectively. The instantaneous > current rating for these diodes is 20mA. This does not mean that they > will be happy sinking that current forever. The maximum continuous > current rating is 500uA. Therefore before applying any large voltage to > an input ensure that there is a current limiting resistor in series." > > He then goes on to say; > > "The value of the input resistor needs to be less than 10Mohms. [he > does not explain why] It needs to be high [enough] though to limit the > current to less than 50uA. This provides a safety margin of 10 over the > maximum continuous rating. The calculations fall out easy with: > > Vpeak = V2 x 240 = 339.5 Volts > Resistance = Vpeak/Ipeak = 339.5 Volts/50 uA > = 6.8 MOhms" > > A similar circuit also appears on page 100 of "The Greatest Little PIC > Book" by Gordon Macnee. This circuit has the neutral connected to GP4 > of a PIC12C508 via 2 x 4M7 resistors. > > Also on page 84 of the "PIC Cookbook - Volume 1" by Nigel Gardner and > Peter Birnie, a circuit shows Pin RA3 connected to neutral via 2 x 1M > resistors. > > I was quite seriously considering such a technique in my next project. > Can I assume that you do not think this is wise? No I don't like it at all. A series resistor does NOT isolate voltage. Now 2 resistors maybe. A resistor into a zener of known and testable properties yes. Add a capacitor across the zener and even better. I the Microchip lab which probably has isolation transformers and nice SMOOTH 120v ac mains it will probably work forever with just the resistor. Here in Australia with some of the dirtiest 240vac in the western world I wouldn't even consider it. People will argue that the PIC internal diode clamps the pin to never exceed 5.5v or so. This is AFTER the diode has properly turned on and saturated. With dirty mains you will get spikes of very high Dv/Dt and the pin voltage will rise to unknown high levels BEFORE the diode has fully turned on as that takes a finite time. Much better than a clamp diode is an external 5v zener, this will "break down" to provide the clamping, and I would always add a capacitor across the zener to further provide RC time constant so fast spikes no longer are an issue. Also remember resistors have a max voltage and when you get regular spikes into the kV range you need 2 or more resistors to be reliable with 240v systems. I've replaced a lot of "start" resistors in TV sets, typically 2 or 3 resistors in series about 470k each. With age these change value and the carbon ones especially do strange things. :o) -Roman -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body