Zero cross detector isn't working

hello ,
i am in the process of making an AC dimmer circuit , the problem i encountered is that the zero cross detection section isnt working , it works well on isis proteus but in practical it only shows a a direct voltage of 1v in the oscilloscope .
here is the schematic and the result that it shows :



any help would be great, we're out of ideas.
best regards,

Hi,
Why are you using a sine AC supply voltage on the output of the 4N35?
It should be a DC voltage suitable for the controller to have as its input.

This might help.

Tom.. :smiley: :+1: :coffee: :australia:

thank you TOM , i tried it and it worked . it now gives me a square signal wich i can use in my program with attachinterrupt(0,zerocross,CHANGE).

Never mind, you happy, I'm happy.


Could you back out bit and show a complete schematic?

This is the kind of thing I see when I google to learn more:

TIA

a7

this is the same schematic i work with now just the value of the resistance in the left is 1k ohm

Can't see which pins U1 and U2 are connected to.
Please post a screen capture of the entire circuit or a pdf

1 Like

volatile int dimming = 128;

attachInterrupt(0,acon,CHANGE); waits for interrupt on pin 2 on Uno/Nano/Mini.

are you sure you want a go high, then stay low pulse?

Also, you should use RISING on interrupt, change will trigger it twice.

here is the whole schematic

the signal the zero cross gives me is square so i used change to have itriggered twice with every rising and falling edge

yes the triac only needs a small pulse until the next zero is detected

Your code outputs the pulse on pin 3 but you have the TRIAC connected to pin 8

1 Like

Please post an image that shows the entire schematic

yes that was a mistake on my part i did change the code to pin 8 but forgot to change it in the code . i now re examined both and put it on 3

So is there now a signal on pin 3?

I guess you have a "square" pulse of <1ms of length. Why would you want to trigger it twice?

The reverse voltage on that 4N35 emitter is pretty low.

i am using an oscilloscope to display the signal from pin 3 but it shows nothing . the zero cross signal is delivered without a problem

beacause every edge signals a zero cross

does that mean i should decrease the value of the resistance ?