Which PIC are you using ?
Hi there,
Which PIC are you using ayway and how are you detecting the zero cross.
It is also important if you are detecting every or alternate zero crosses.
If you are using an interrupt based routine then do the following
1. Play with Timer0 and reset it every zero cross. All turn off the outputs. Its best to do it in assembly.
2. Thus your timer functions as a digital ramp generator now use to loop to detect if the timer has reached the desired value. In this way you do not have to care about the glitches.
3. A 5us time might be not enough. It is best to keep the outputs latched till the next zero cross. This will also let you use low loads under the latching current of the SCR.
Regards
Sougata
How would you like your outputs to be controlled
Hi there,
Having the opto-triac driven till the zero cross would take care of inductive loads also.
Provide me with the following :
1. How the outputs would be controlled? (Internal timer /push button etc)
2. Your line frequency
I would try to play with the interrupt part simulate it.
Regards
Sougata
I will be posting the code tomorrow.
Hi,
Understood. The only problem is that I don't have 16F84 ready. However it should work. Do you have a PIC18F452 ready? This is where I am most comfortable. I also have 16F676, 16F73, 16F619 handy. BTW you don't need five PICs.
Regards
Sougata
I am working on a simplified version
Hi Everybody,
It is possible to trigger n numbers of SCRs within the 10ms(50Hz) time frame. My DMX Dimmer handles 48 of them. There I use a bubble sort algo and actually different interrupt sources. One for syncing the timer with ac, one for firing, listening to USART, fader read and so on. All this handled by two PICs 18F452 @ 40MHZ. The second one is mainly for the download and running of pattern or randomizing them.
I am working on a simplified version using a PIC16F84A (Yes I found one) and trying to acheive a 100% PBP code using the On-Interrupt function. I have no idea about the latency till I get my code running tomorrow and checking on scope. Even the asm interrupt would be quite easy.
You see with a clock frequency of 8MHz--> 2MHz(Fosc/4) / 128 (prescale) / 100 (reset every 10miliseconds), the timer0 would count 156 (50Hz) or 130(60Hz max). Compare this constantly in a loop with preset or increasing / decreasing values and fire the appropriate port.On interrupt
1. Clear all outputs
2. Reset Timer0
3. Return
Thats it. It will be done before the new cycle begins!!!!!!!!!2MIPS
I am working on a two channel version and let you all guys out there juice it up.
BTW most of the PICs have an inbuilt Schmidt Trigger on input ports so the interfacing is pretty easy. I use a couple of resistors a diode bridge and an optocoupler to derive the zero cross sync. It is accurate without any phase latency (as in the case of transformer based).Direct AC feed through high value resistor is also possible and practical but the circuit becomes live and is not recommended for experimenters.(I use it in my remote controlled fan/light dimmer to keep costs under control. It retails for about 18USD!!!!)
The toughest part is possibly randomizing the paterns or using pschychedelic effect with beat detection within the scope of the chosen processor (clock code space, instruction set).
We are having Diwali (the festival of lights) and a holiday to work with a fun project. The entire town is having myriads of lighting displays so why not doing one for the forum. Happy Diwaly to guys out there.
It is midnight now and I can get my hands on the PIC only tomorrow when I get the lunch break. So till then....
Bye!!
Regards
Sougata
2 Attachment(s)
Can somebody please test this thing?
Sorry guys although I did a testing for a single channel version, I couldn't test the five channel one. I am posting the circuit and the code. I request the PIC gurus to have a look at the code and point the flaws. Please do read the notes.doc file for important information.
Regards
Sougata
This doesn't look right.....
Reven,
I've not used that circuit or code you are reffering to but by just looking at your waveforms it seems that the triac is triggered at the same phase angle in case 1, 2, 3 & 4.
The triac only needs a short pulse on the gate and will then hold itself 'on' untill the AC-line crosses zero, at which point it will turn 'off'. That short pulse should be delayed a certain amount of time from the zero crossing.
On your scope pics the triac seems to be triggered exactly 1div from the zero crossing in all cases except full on and full off.
/Henrik Olsson.
Pulse position, not pulse length !!!
Hi, reven
Henrik is right ...
Here, the pulse length is not the thing to be variable.
but you must vary the time between zero voltage detection and triac gate firing ...
Long time = weak light
short time = full light
remember once the triac is turned on it stays turned ON until current becomes null.
Alain
Here, you had programmed a ... DC Dimmer !!!
Pulse position, not pulse length...
I think you have right...
As Henrik says ,now the triac is triggered at the same phase angle in all cases.
I must change my code to put the pulse position in a variable.
Thanks all of you!
I will inform you about my progress!
BTW, take a look at the code,bacause I checked it many times and I could not find where the problem is.
http://www.picbasic.co.uk/forum/atta...0&d=1103787743
Thanks again,
Reven