Can we damage PIC16F18856 by doing zero cross detection of the mains? - Page 1
Forum section: electronics / general

author: ocset
author_rank: Super Contributor
timestamp: April 14, 2018, 01:37:49 pm
content: Hello, Will we potentially damage our PIC16F18856 by setting it up to do mains zero crossing detection as in the attached schem?We have a 40W offline , non-isolated LED lamp. We have a PIC16F18856 in it which has circuitry to do zero crossing detection (ie circuitry inside the micro itself) . Therefore, we set it up as in the attached schem to do mains zero cross detection.However, we are not sure if this is OK?...after all, the Microchip datasheet and App Note examples never show mains zero crossing detection…but only show examples where the AC source that’s being “zero-cross-detected” has the same reference ground as the PIC16F18856.……In our case, the AC source being “zero-cross-detected” is the mains, and obviously its not referenced to the same ground as the PIC16F18856.Do you think we could potentially damage our PIC16F18856 by connecting up the PIC16F18856’s zero cross module in the attached shown way that we have?My post on the microchip forum about the Zero crossing detector inside the PIC16F18856…http://www.microchip.com/forums/m1006813.aspxPIC16F18856 datasheet(ZCD module on page 305 )http://www.microchip.com/wwwproducts/en/pic16f18856Microchip App Note on ZCD module….http://ww1.microchip.com/downloads/en/AppNotes/90003138A.pdf

author: kony
author_rank: Regular Contributor
timestamp: April 14, 2018, 02:51:24 pm
content: R1 && R2 type and body size? Also where is your input filtering cap?Offline mains powered does not give full description of how your power input is looking for the device. Care to elaborate?

author: Andy Watson
author_rank: Super Contributor
timestamp: April 14, 2018, 03:00:48 pm
content: Assuming you have cleared the ZCDDIS configuration bit. Microchip's app note says: "Clearing this bit ensures that ZCDxIN will be kept at a regulated and safe voltage as soon as the device is powered on." - so they've obviously thought about this problem, i.e. the PIC should be protected at all times.Have you allowed for the fact that the bridge rectifier effectively doubles* the voltage on the sense resistors?Also,Quote from: treez on April 14, 2018, 01:37:49 pmhow is it referenced? Remember that the reference must be able to both source and sink the 300\$\mu\$A that goes through the sense resistors. Sinking shouldn't be problem - the current will flow back through the bridge diodes. However, sourcing current will require supplying 300\$\mu\$A to the PIC as well as a significant capacitance to maintain the reference.edit: * Actually, "doubles" is wrong, it depends on how you've defined the reference voltage.

author: ocset
author_rank: Super Contributor
timestamp: April 14, 2018, 03:03:32 pm
content: Thanks, the R1 and R2 are special 400V rated 1206's.The attached shows how we have it working (as a sim in ltspice).

author: ovnr
author_rank: Frequent Contributor
timestamp: April 14, 2018, 03:04:19 pm
content: If it's connected as you showed - with a full bridge rectifier straight across the mains, the PIC ground tied to the negative end of the rectifier, and the ZCD pin tied via a sufficiently large (breakdown/wattage) 1M resistor to the positive end of the rectifier:It'll be fine. Even if you have a transient on the mains line, you'd need to se 20 kV before you exceed the ESD diode max rating, and during normal operation you'd see a few hundred µA flow.

author: Andy Watson
author_rank: Super Contributor
timestamp: April 14, 2018, 03:19:37 pm
content: How have you defined the reference/ground for the PIC? If it is coupled as directly as your sketch indicates then D5 will negate most of the advantage of using this fancy zero-cross-detector. D5 prevents the negative half-cycle from reaching the PIC - at best it's going to see a negative voltage of one diode-drop - it's surprising that it works at-all.

author: ocset
author_rank: Super Contributor
timestamp: April 14, 2018, 03:22:24 pm
content: Thanks Andy, sorry i should apologise, i updated the pic to show a 5k6 resistor that we put in to mitigate the problem that you kindly describe.