2 or 1 Zero Detection per AC cycle

Status
Not open for further replies.

skmdmasud

Member
Hi
If i do zero detection using this method will i get 2 interrupt per AC cycle or 1. Interrupt set at Rising edge.
e.g 1 interrupt at 0 degree and another interrupt at 180 degree or only 1 at 0 degree





Regards
 
I hope by mains you mean an input from an AC tranformer, not actually connecting anything straight to mains.

You will get one interrupt, but it won´t be anywhere near zero crossing.
 
The cited AVR app-note says that there will be one zero-crossing detect per cycle.
It also deprecates the very technique it describes;
 
Hi,

If you show your power supply circuit for the AVR we can come up with a better solution, which will also provide for two interrupts per cycle instead of just one.
 
Hi,

If you show your power supply circuit for the AVR we can come up with a better solution, which will also provide for two interrupts per cycle instead of just one.
Hi, my power supply is from a switching power supply (mobile phone usb charger) to keep things small and compact.
 
If you connect direct to the AC supply you will get one interrupt very close to zero crossing. If you use a transformer then it will be further away. A 5V transformer will be almost 90 degrees out. If you connect direct to mains then treat the whole circuit as live.

Edit, before anyone get's their knickers in a twist, even 250V through a 1M resistor is safe. A current of 0.25mA never killed anyone. Simply heatshrinking the live side of the resistor should be adequate.

Mike.
 
I am not worried about isolation. It is directly connected to AC 220.
How close will i be when it is directly connected to AC220?
 
See my edit above.

You should be within a few degrees of zero. I don't know the switching voltage of AVRs so can't calculate it.

Mike.
 
Results are in....things not looking good
My uC is running at 16mhz, I am using 8bit timer to pwm with prescale of 1024 and changing my duty cycle to vary ceiling fan speed. Pwm signal goes to optical isolator which turns runs the triac.

Software- zero detection fires interrupt routine which turns on the pwm timer. When top value is reached pwm interrupt is fired and pwm timer is switched off. This repeats.

My result
Ceiling fan turns very slowly up to 90% duty cycle then suddenly goes to almost full speed.
 
You should have specified 'ceiling fan' at the start... phase-control is not he way this is usually done.
Take a look: http://ww2.justanswer.com/uploads/EE/EENorm/2013-02-04_172912_fan_switch_diagram_3.gif
Hi take a look at the traditional fan regulator that we use


and the ceiling fan we have



I understood what you tried to say with the diagram, the AC fan has different coil for different phase its not like a light bulb.

So how can i solve my problem, or do i need a different approach.
I found one mistake in my code which is my variable should be volatile i will change it and see what happens.
 
Last edited:
You can still control the fan with a triac and microprocessor.
I recall that fan-controls using triacs have a very non-linear relation of potentiometer position to speed.
You could attach the speed-demand pot to an ADC-input, and control triac-firing using a linearized timing table.
 
Can you please explain a bit more on how to do it.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…