Using H11AA1 zero-crossing detector opto-isolator

Thread Starter

cognas

Joined Feb 24, 2017
52
Hi Folks, I needed a zero-crossing detector, and decided to use the H11AA1, and bought a couple. The datasheet says maximum input current is 60mA, so I thought that if I drove the diodes with 20mA peak, that would seem "safe". However, I wanted to use the 240VAC (340v peak) as an input, so with 0.02A peak, the resistance required would be 17k, but that would dissipate 4.8W, which seems a bit excessive. So I decided to base the resistance on a dissipation of 0.5W, and calculated a resistor value of 180k, and hooked it up. Max instantaneous current is 1.9mA, so that should be OK.
It works, but the zero crossing pulse that I'm getting is 1mS wide, which is not what I'd hoped for - 10% of the 10mS period of a 50Hz half-wave. I have looked at a number of application circuits that have equal-value resistors on the live and neutral wires. Is there any good sense in that, apart from giving more dissipation from 2 resistors than you can get from one?

upload_2017-4-1_15-0-23.png

Timebase is at 2mS per division.

I have a 22k resistor from the collector to +5V, and the emitter is grounded. I used a 10k at first, but the pulse was 40% wider. When I tried touching another 10k across it to momentarily give 5k, the pulse on the scope got wider still, so I put the 22K resistor in, which improved things marginally.
Should I be driving the diodes harder? Is there any way of getting a pulse that says "This is the moment of zero crossing", rather than "The zero crossing happens round about now"?
The pulse will be used to trigger the interrupt pin of a micro-controller, so I could put 5mS compensation into that, but it would be so much more elegant to have a zero-crossing detector that detects zero crossings.
 

MaxHeadRoom

Joined Jul 18, 2013
19,014
I have used a couple of circuits for input to a Micro, one with isolation transformer and one without, both give a sharp square wave at crossing at around .7ms to 1.2ms.
In the no-isolated version I use a 5v zener for the micro supply.
There is Fairchild AN-3006, picmicro AN954, AN958 also.
I have used the jpg version with a dropping resistor.
Max.

Zero cross.jpg
 
Last edited by a moderator:

AlbertHall

Joined Jun 4, 2014
8,330
I wanted to use the 240VAC (340v peak) as an input, so with 0.02A peak, the resistance required would be 17k, but that would dissipate 4.8W, which seems a bit excessive.
You could use a capacitor instead of the resistor. 0.22uF would give about 20mA. You should include a 1k resistor in series as well to restrict the surge when switching on.
 

Thread Starter

cognas

Joined Feb 24, 2017
52
Thanks, Max. I had been thinking along the lines of ...
upload_2017-4-1_17-6-10.png
The comparator would go true during positive half-cycles, false during negative ones, and each time it switched, its output would be sent to an XOR gate, along with a slightly delayed version of itself. During the delay, the XOR would have different inputs, so would give a pulse with the leading edge coincident with the zero-crossing. I know - I could do a bit better than a simple voltage divider on the +ve leg of the comparator, but you get the idea.

I was attracted to the opto-isolator because of its opto-isolation, but I had also been thinking of developing power for the MCU by feeding mains through a capacitor and rectifying it, so the MCU would only be isolated from the grid by the cap. If it ever broke down, the MCU would fry, so there's probably no real call for opto-isolators. If I wanted to play it safe(er) I could use a transformer, and that would give me the possibility of driving the diodes in the H11AA1 up to 20mA, through resistors that wouldn't have much voltage dropping to do, so wouldn't dissipate much. As I already have the chips, I think I may order a transformer and give it a go.

However - if this sparks any good ideas in your mind, I'd value your thoughts.
 

Thread Starter

cognas

Joined Feb 24, 2017
52
You could use a capacitor instead of the resistor.
Thank you, but wouldn't the capacitor introduce a phase shift? I want to detect when the zero crossing is happening. A bit after that wouldn't cut the mustard.
 

bertus

Joined Apr 5, 2008
20,048
Hello,

The circuit that @MaxHeadRoom showed you in post #2 ,has isolation due to the transformer.
As this site does not allow transformerless powersupplies and mains powered leds, I would suggest you use this circuit.
On the collector of Q1 in that circuit the zero crossing pulses will arise.

BTW In what circuit will the zero crossing circuit be used?

Bertus
 

MaxHeadRoom

Joined Jul 18, 2013
19,014
I was attracted to the opto-isolator because of its opto-isolation, but I had also been thinking of developing power for the MCU by feeding mains through a capacitor and rectifying it,
I'd value your thoughts.
So far I have used the method in AN-2006 and the JPG one that shows a Transformer, I have also used a combo of both using the JPG version with a resistor and bridge.
The AN3006 does not require the inverter transistor if using a Micro.
If you are concerned with the width of the zero crossing pulse The above circuits result in a definite square wave and using the rising edge and extending it to 2ms width internally results in fast turn on , if a delay is required, then this can be added with counter or timer.
Max.
 
Top