Electronic – Zero-Cross detector problem

dimmerdimmingesp8266triaczero crossing

I am really in a tough situation and need very serious elaborative help with this. Almost like spoon-feeding.

It's been days I've been trying to get my zero cross detector (and the triac dimmer) to work properly but nothing works fine. I am trying to get my circuit to work but all in vain whereas there is another product (which I opened to reverse engineer) that uses the same triac and almost similar components but with few changes and sill works. I'll explain both cases to you.

I am using an H11AA1 optocoupler with a 150k resistor to use AC voltage to generate interrupts on my ESP8266 (esp-12e) micro-controller (integrated wifi). The circuit is as in image

enter image description here

But the problems that I face a numerous –

  • A 1/4W resistor gets too hot and burns if any lesser value is used.
  • The interrupts are for the RISING edge as there will be spikes when there is zero cross. The interrupt durations are (in milliseconds) are like — 10,9,0,0,1,9,10,0,0,0,10,0,0,10,9,9,1,0,0,1,1,10,……. and so on. WHY?!!? Why is it so jumpy? And the random values? I was suggested that the current on the AC side is less. But as I said lowering resistance burns it and increasing might spoil it more. Talk about paradox, huh?

Now about the product I was trying to reverse engineer –

enter image description here

Why that's a problem to me –

  • They are using a variant of the (almost) same opto-coupler, H11A1. And they use a "330k" smd resistor (x2 times higher) that's got to be 1/4W. Now obviously the 2 times higher resistance is the reason why it's not burning. But how's that giving enough current to generate the right interrupts?

Please help me here. With the current scenario there's pretty irregular flickering in the triac dimmer tested with incandescent light bulb. It's been days to understand why this is happening…

Big thanks in advance.. 🙂

Best Answer


A 150kΩ resistor on 220Vac is dissipating 0.32W and probably should be burning up.

A 330kΩ resistor on 220Vac is dissipating 0.147W, which is in the rated range.

As one of the commenters suggested, your math of 10x higher is a bit off. Maybe you should try a 330kΩ resistor?


Don't tell us the interrupt durations, show us the scope capture of the node on pin 5. If the scope capture checks out, then you know it is a firmware problem and you are describing a hardware problem. Please ensure that you have a hardware problem before describing it in terms of software.

Just speculating without a scope capture, but it could be that your pull-up is too strong? You have a lower resistance than the other. Maybe try a 10k? 20k? Again, post a scope capture.