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

0 Members and 1 Guest are viewing this topic.

Offline treez

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: gb
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 15, 2018, 01:01:09 am by treez »
 

Offline kony

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

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 1590
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #2 on: April 15, 2018, 01:00:48 am »
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 15, 2018, 01:05:35 am by Andy Watson »
 
The following users thanked this post: treez

Offline treez

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: gb
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #3 on: April 15, 2018, 01:03:32 am »
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 15, 2018, 01:06:44 am 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 15, 2018, 01:04:19 am »
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: treez

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 1590
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #5 on: April 15, 2018, 01:19:37 am »
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: treez

Offline treez

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: gb
Re: Can we damage PIC16F18856 by doing zero cross detection of the mains?
« Reply #6 on: April 15, 2018, 01:22:24 am »
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