Zero-Crossing Detector problem

Thread Starter

Se7en Axis

Joined Jan 10, 2019
10
Greetings everybody,

I am experiencing an issue with the zero-crossing detector, I use a 4N35 to send a signal to my arduino at every zero crossing of the AC to control a load, the issue is everything works 100% fine while the arduino is wired to my PC, but once I disconnect the USB and instead use the 5V supply I have to power the arduino the zero-crossing detector doesn't seem to work, I don't have an oscilloscope to check the pulse but with a multimeter i get abnormal voltage between the ZCD pin and ground flickering between 350mV to 450mV while when it's plugged in I get a steady 500mV and does trigger the triac as it should, so could the supply be bad? it does output 4.85V DC but I noticed it also outputs 400mV AC despite having the smoothing capacitors.

It's also worth mentionning the arduino seems to power on properly on the 7805 supply, I can still trigger the triac but I get nothing from the zero-crossing detector however.

Schematic information:
U1 = 4N35 U2 = MOC3021 U3 = 7805
It's worth mentionning I have added a diode before R1 to separate the 120Hz unfiltered signal from the powersupply or else it wouldn't work, I also removed R11.
 

Attachments

drc_567

Joined Dec 29, 2008
703
... Do you have a dedicated wire going from the Arduino card ground to the 5 volt supply ground?
 

Thread Starter

Se7en Axis

Joined Jan 10, 2019
10
yes I do my apologies I forgot to include that in the schematic as well, it's going from the output of 7805 to 5V in of my arduino mega
 

Thread Starter

Se7en Axis

Joined Jan 10, 2019
10
I was just out of ideas and desperately added another 0.1uF capacitor between the 5v and gnd and what do you know now it works, what in the actual there was already a 0.1uF at Vin of 7805 and a 0.33uF at Vout of 7805, adding another 0.1uF at Vout of 7805 (gnd and 5v pin) fixes it??? what the heckers
 
Last edited by a moderator:

drc_567

Joined Dec 29, 2008
703
... breadboard? Occasionally the wire sockets don't make good contact ... not enough tension, a little dirt or corrosion on the wire ... who knows.

... This circuit looks like something that an oscilloscope might be appropriate for. The interesting aspect is that jt has AC and DC constituents. Sometimes that presents a problem. ... Just saying ... if you ever get a,scope, see this video first in order to avoid any surprises.
... posted sometime today, as I recall.
 
Last edited:

Sensacell

Joined Jun 19, 2012
2,433
Your Zero Crossing Detector scheme makes little sense to me.

The voltage regulator U3 will be dropping out every cycle, due to the tiny little .33 uf cap on the input.
The opto isolator is totally unnecessary as the output side shares the ground- it provides no isolation.

Since your transformer provides the isolation, why not just connect one leg of the transformer secondary to ground, then connect the other leg to the MCU through a 100 K resistor? The input protection diodes on the MCU will clamp the signal between the rails.
120 uA into the input protection diodes will be fine.

R11 makes no sense? that's a schematic error, right?

You can eliminate 50% of the parts.
 

Thread Starter

Se7en Axis

Joined Jan 10, 2019
10
... breadboard? Occasionally the wire sockets don't make good contact ... not enough tension, a little dirt or corrosion on the wire ... who knows.

... This circuit looks like something that an oscilloscope might be appropriate for. The interesting aspect is that jt has AC and DC constituents. Sometimes that presents a problem. ... Just saying ... if you ever get a,scope, see this video first in order to avoid any surprises.
... posted sometime today, as I recall.
Thanks for the replies, the circuit is on a PCB already therefore the connection issue would of been out of question as the soldering is ok, I have to agree 100% that the oscilloscope would of made it so much easier, I am still baffled as to how adding a secondary capacitor to the output would of fixed the issue, especially as the AC on the output still is 400mV.
 

Thread Starter

Se7en Axis

Joined Jan 10, 2019
10
Your Zero Crossing Detector scheme makes little sense to me.

The voltage regulator U3 will be dropping out every cycle, due to the tiny little .33 uf cap on the input.
The opto isolator is totally unnecessary as the output side shares the ground- it provides no isolation.

Since your transformer provides the isolation, why not just connect one leg of the transformer secondary to ground, then connect the other leg to the MCU through a 100 K resistor? The input protection diodes on the MCU will clamp the signal between the rails.
120 uA into the input protection diodes will be fine.

R11 makes no sense? that's a schematic error, right?


You can eliminate 50% of the parts.
Thanks for replying,

Do you suggest I should remove the .33uF capacitor on the input therefore? I am a little confused as to how this would cause the 7805 to drop
after each cycle, I thought the input/output capacitors were simply to prevent oscillating/reduce ripple therefore the values wouldn't be that important(0.33 and 0.1 seemed like a standard on most 7805 datasheets)

And indeed the R11 resistor was a schematic error my apologies for making this more confusing than it should be.

I am unsure as to how the optoisolator could be removed, just to clarify you are talking about U1 (4N35) or U2(Moc3021)?
 

ericgibbs

Joined Jan 29, 2010
8,715
hi s7,
One problem could be fixed by:
Add a diode in series from the bridge output to the 0.33uF cap.
This will isolate the smoothing effect of that cap it is having on the Opto emitter, where you need a clean full wave rectified waveform.
Add a 470uF in parallel with the 0.33uF, this will give a smoothed Vdc input the regulator.

E

Also add a 470R across C3 cap to ensure a least a 5mA load current, keep the Vreg loaded.
 

Attachments

Last edited:

Sensacell

Joined Jun 19, 2012
2,433
U2 is essential, it isolates the low voltage portion of the circuit from the AC line.

U1 does not serve any useful purpose as connected- eliminate it.

Following that logic... the regulated DC power supply seems to power only the U1 circuitry, if you ditch U1, then you can eliminate the entire power supply- EXCEPT for the transformer, as this provides needed isolation from the AC line.

You can use the transformer output voltage direct into an IO pin for ZCD functionality, just use a large value (100K) resistor to protect the input.
The input protection diodes will harmlessly clamp the excess voltage.
 

ericgibbs

Joined Jan 29, 2010
8,715
hi s7,
This is LTSpice sim of the front end of the ZCD circuit with the diode and resistor mods.
It has not been optimised.
E
Added a plot without the mods, for comparison
AA1 04-Mar-19 09.18.gif
 

Attachments

Last edited:

cmartinez

Joined Jan 17, 2007
6,440
Hree's the best zero-crossing detector circuit I've seen so far. It's extremely reliable and simple. It was designed by someone who's webpage, sadly, no longer exists. And yes, I've actually built and tested the thing, and it works perfectly.

ZC-schema.gif

 

Attachments

Top