??? 05/03/10 18:27 Read: times |
#175631 - Why you should not do this... Responding to: ???'s previous message |
Arun said:
i am using AT89S52 in a dimmer project and iam using a ZCD directly from mains without isolation. The 230V Mains hot side is connected thru a 1Meg resistor to the external interrupt pin P3.3 and neutral is connected to circuit Gnd thru another 1Meg resistor. i got this from an AVR application note and thought i could use this on 8051 which too has internal clamp diodes on I/o pins. I think you refer to this one: http://www.avrfreaks.net/modules/F...oc2508.pdf You will find the following passage in it: AVR said:
The series input resistor is a 1 MΩ resistor. It is not recommended that the clamping diodes are conducting more than maximum 1 mA and 1 MΩ will then allow a maximum voltage of approximately 1,000V.
Any voltage higher than 1,000V would probably be spikes or surges. The clamping diodes are able to handle spikes for a short period of time but not surges. The application note will not go into how to protect against surges, but simply recommend implementing protection against surges in the design. By these lines the authors admit, that their circuit cannot withstand "surges"! And they don't want to disclose how to enhance the design to be able to withstand surges. The last sentence is sheer cynicism, especially as this article addresses hobbyists, who usually don't know how to properly handle mains voltage. Let me remember, that short overvoltages on mains up to 6kV can be found quite often. Only very special resistors, like the VR25 from Vishay, can withstand such high voltages, best two of them in series. And, of course, these spikes shouldn't be allowed to flow directly into the protection diodes of microcontroller, but must be shunted into separate protection diodes. Not because the built-in diodes couldn't withstand the currents, but because the involved components and the layout provide enough stray capacitance to inject unsane spikes into the micro directly from mains! The consequences are latch-up, lock-up or even destruction. Never wondered why these thingies are damaged after a few months?? So, connecting mains directly to the microcontroller via unsuited low cost resistors is worst design practise and results in a time bomb. And, the best, the authors themselves explicitely say, that you shouldn't do that... Kai Klaas |