Go Down

Topic: Zero crossing detection (Read 17164 times) previous topic - next topic

taurian

#15
Mar 12, 2012, 11:36 pm Last Edit: Mar 13, 2012, 04:58 pm by taurian Reason: 1
Quote
Is Your zero crossing detection schematic working?
I got my dimmer working.
I'm using Arduino Mega 1280.
Here is my code, hope You understand:


Here is my circuit
I could send the complete program to compile.
I wanted to calculate the frequency of a signal and take samples in the same period when the frequency change in the middle of taking the samples have to cancel these samples ..



Thanks Gil

taurian

I'm not able to place an image. how can I do?

Thanks Gil

Techone

@taurian

Thank for the explaination. Alright, my schematic amd my code will work for that purpose. My zero crossing circuit use the output of a wall wart <-- extract / harvest transformer - reduce the AC secondary voltage , use op-amp as a comparator, when it cross the zero volt line, the state change, and the pulse is convert to TTL level and goes to a transistor - switch on / off and into a digital pin.

Check this tread.  http://arduino.cc/forum/index.php/topic,93205.0.html

Techone

@Ragnar

I also did a dimmer using the Arduino. I use the same schematic <-- the zero level , but I rectify in full mode to produce positive pulse only, not positive and cut for 1/2 of 60 Hz. It produce two positive pulse from the 60 Hz, a full wave rectifier. I use the comparator to cut close to the zero to produce a 120 Hz very short pulse, and it is going into an digital / interrupt pin. And from it, it produce a PWM pulse, depending of the reading of the potentiometer, and send a turn off into the opto coupler, and the rest a turn on, the other side , opto and traic take care of the AC wave being cut properly and time right.

Here the tread. http://arduino.cc/forum/index.php/topic,91274.15.html


raxz

I use this schematic: 

Only problem is that dimmer is working, if requestValue is somewhere between 1 and 216.
I checked with oscilloscope and it gave me from full wave to zero between those values.

I have 8 channels of dimmer and I'm going to dim house lights with returning light switches or impulse light switches or however you call it. Holding switch down dims up, after release it dims down. Short click turns full on or full of etc...

nickgammon


I'm not able to place an image. how can I do?

Thanks Gil


Expand "Additional Options". There is an option there to attach a file (eg. a PNG file).

However to imbed it in the middle, some of us just upload the images to wherever (our own server, or an image host) and put an "image" link to it in the body of the post (see the buttons above the text entry box).
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

taurian

This is my electronic circuit in Proteus

thanks Gil

taurian

I think I already know but the less as I do already have my detecter circuit to the zero crossing as you pass by my zero external interruption is activated and will activate a timer and so I'll take samples until a new interruption ..

thank Gil

Techone

@taurian

Can you print out the schematic, scan it, and re-post it here. The problem is. I don't have Proteus, and I am not the only one.

@Ragnar

Hmm... Simple. But I don't feel comfy about connected 230 VAC into a opto-coupler. More protection is needed, in my opinion. The pulse output will be only 50 Hz, so I assume your code will take care of it, to sync with the AC main.  My design is safer, the sync is taking care of the circuit to give me a 120 Hz pulse <-- I live in North America, and my code will take care of it.

If your code and your circuit work just nice, than I salute you. It will be nice to share your schematics and code, so others may make the same thing or use as a example.  

raxz

Well, I already posted my code at the end of previous page.
And on this page I posted ZC schematic I used.
230VAC is not doing any harm, if you are smart enough to use precaution. Of course it's safer to use transformer and then opto, but it doesn't matter as long as I don't touch it. :P
My system is in the middle of final assembly. It will be used to control and dim lights.
Picture of work in progress: http://www.upload.ee/image/2159720/IMAG0094.jpg
Board with blue terminals is for switches and there is schematic to take away any sparkling noise from switches. I press the button and it holds output high from 0 to 600ms. I set them to about 100ms. If you hold longer than 200ms, then you start dimming the lights.
The one on the right is relay board. There will be 8 random fire solid state relays and 16 normal relays.
Solid state relays need zero crossing detection and I use the code I posted before to drive them.

taurian

This is my circuit for detecting zero crossing..


thank Gil

taurian

Quote
I got my dimmer working.
I'm using Arduino Mega 1280.
Here is my code, hope You understand


I do not know much is still setting the timers. when it detects the interruption timer reset to zero right?


thank Gil

raxz


Quote
I got my dimmer working.
I'm using Arduino Mega 1280.
Here is my code, hope You understand


I do not know much is still setting the timers. when it detects the interruption timer reset to zero right?


thank Gil

Yes, at every interrupt it sets counter to zero and starts again counting up from 0 to 255 (in reality it is 1 to 216 or smth near this number and 216 is full OFF and 1 is full ON).
If counter value is same as I requested with requestValue, it sets output high and triac holds itself up until the end of half period.

taurian

Quote
Yes, at every interrupt it sets counter to zero and starts again counting up from 0 to 255 (in reality it is 1 to 216 or smth near this number and 216 is full OFF and 1 is full ON).
If counter value is same as I requested with requestValue, it sets output high and triac holds itself up until the end of half period


If I sign my period is 20ms as I set my timer to take a sample of 2 seconds in 2 seconds


thank Ragnar

taurian

#29
Mar 13, 2012, 11:38 pm Last Edit: Mar 14, 2012, 12:55 am by taurian Reason: 1



Where can I get the libraries to be able to run your code?

If you please.

thank Ragnar

Go Up