Author Topic: Can we damage PIC16F18856 by doing zero cross detection of the mains?  (Read 1497 times)

0 Members and 1 Guest are viewing this topic.

Offline ocsetTopic starter

  • Super Contributor
  • ***
  • Posts: 1516
  • Country: 00
Hello, Will we potentially damage our PIC16F18856 by setting it up to do mains zero crossing detection as in the attached schem?  :scared:  :scared:

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.  :-/O

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?   :scared:

My post on the microchip forum about the Zero crossing detector inside the PIC16F18856…  :blah:
http://www.microchip.com/forums/m1006813.aspx

PIC16F18856 datasheet
(ZCD module on page 305 )
http://www.microchip.com/wwwproducts/en/pic16f18856

Microchip App Note on ZCD module….
http://ww1.microchip.com/downloads/en/AppNotes/90003138A.pdf
 8)
« Last Edit: April 14, 2018, 03:01:09 pm by treez »
 

Offline kony

  • Regular Contributor
  • *
  • Posts: 242
  • Country: cz
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #1 on: April 14, 2018, 02:51:24 pm »
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?
« Last Edit: April 14, 2018, 02:57:24 pm by kony »
 
The following users thanked this post: ocset

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2082
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #2 on: April 14, 2018, 03:00:48 pm »
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,
 
and obviously its not referenced to the  same ground as the PIC16F18856.
how 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.
« Last Edit: April 14, 2018, 03:05:35 pm by Andy Watson »
 
The following users thanked this post: ocset

Offline ocsetTopic starter

  • Super Contributor
  • ***
  • Posts: 1516
  • Country: 00
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #3 on: April 14, 2018, 03:03:32 pm »
Thanks, the R1 and R2 are special 400V rated 1206's.
The attached shows how we have it working (as a sim in ltspice).
« Last Edit: April 14, 2018, 03:06:44 pm by treez »
 

Offline ovnr

  • Frequent Contributor
  • **
  • Posts: 658
  • Country: no
  • Lurker
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #4 on: April 14, 2018, 03:04:19 pm »
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.
 
The following users thanked this post: ocset

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2082
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #5 on: April 14, 2018, 03:19:37 pm »
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.
 
The following users thanked this post: ocset

Offline ocsetTopic starter

  • Super Contributor
  • ***
  • Posts: 1516
  • Country: 00
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #6 on: April 14, 2018, 03:22:24 pm »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf