help with AC phase control

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
jose
Flowcode V4 User
Posts: 26
Joined: Sat Nov 01, 2008 12:11 am
Has thanked: 7 times
Been thanked: 10 times
Contact:

help with AC phase control

Post by jose »

Hi to all,
I'm trying to program a thyristor controller using external interrupt on RB0 INT attached to photocoupler to detect AC zero-cross, and then, maybe use timers/pwm to create the pulse t2 and adjustable delay t1 until max t3 on the picture
Any help please...
Thanks
Attachments
ACWave.png
(65.89 KiB) Downloaded 7000 times
Last edited by jose on Sun Jul 03, 2016 4:08 pm, edited 2 times in total.

jose
Flowcode V4 User
Posts: 26
Joined: Sat Nov 01, 2008 12:11 am
Has thanked: 7 times
Been thanked: 10 times
Contact:

Re: help RBO INT plus TMR0...

Post by jose »

Hi
the following arduino example works fine and i will like to implement it in flowcode but i still can't get it to work because i don't know how to deal with the timer / comparator functions yet...
I'm sure this will be "kid's stuff" for some of you, i will be grateful for any tips to do this
thanks
Attachments
4.txt
(2.4 KiB) Downloaded 505 times

jose
Flowcode V4 User
Posts: 26
Joined: Sat Nov 01, 2008 12:11 am
Has thanked: 7 times
Been thanked: 10 times
Contact:

Re: help with AC phase control

Post by jose »

Hi again,
This is the way i find to get it work.
Basically, after zero detection, we set the timer with a starting value for the delay angle...now is easy!
The flowchart is commented
Any suggestions / improvements are welcome
Regards
Attachments
ac_phase_control.fcf
(11.47 KiB) Downloaded 540 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: help with AC phase control

Post by medelec35 »

Hi jose,
Do you want to see if attached flowchart works any better?

Martin.
Attachments
ac_phase_control2.fcf
(12.29 KiB) Downloaded 531 times
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: help with AC phase control

Post by medelec35 »

I'm only using two different simulators.
The other simulator this attached flowchart works best.

I would be better if you can attach a circuit diagram since results is going to be dependent on input AC waveform.
Attachments
ac_phase_control2a.fcf
(12.29 KiB) Downloaded 548 times
Martin

jose
Flowcode V4 User
Posts: 26
Joined: Sat Nov 01, 2008 12:11 am
Has thanked: 7 times
Been thanked: 10 times
Contact:

Re: help with AC phase control

Post by jose »

Hi Martin, thank you!
The pulse is contained inside half cycle now, but sometimes randomly I see an extra pulse.
To discard any ADC problem I used a fixed number but get same results. I will continue testing...

jose
Flowcode V4 User
Posts: 26
Joined: Sat Nov 01, 2008 12:11 am
Has thanked: 7 times
Been thanked: 10 times
Contact:

Re: help with AC phase control

Post by jose »

I just see and test your new file. It look stable
For zero detection I'm using a TLP620 like picture below, in my case with 2k2 resistor to 24Vac and the other side a 10k resistor connected to RB0 and 5V that gives a pulse about 600us. Also some oscilloscope screens shots
Phase = x * 7 / 10 + 74 i have an idea but can you please explain?
Thanks
Attachments
tlp620.jpg
tlp620.jpg (11.82 KiB) Viewed 10604 times

jose
Flowcode V4 User
Posts: 26
Joined: Sat Nov 01, 2008 12:11 am
Has thanked: 7 times
Been thanked: 10 times
Contact:

Re: help with AC phase control

Post by jose »

now the screen shots...
ch1 yellow - zerocrossing at RB0
ch2 blue - pulse out
Attachments
DS0003.jpg
DS0003.jpg (25.95 KiB) Viewed 10602 times
DS0002.jpg
DS0002.jpg (25.76 KiB) Viewed 10602 times
DS0001.jpg
DS0001.jpg (22.83 KiB) Viewed 10602 times

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: help with AC phase control

Post by Steve001 »

Hi Jose

Sorry for the delay here is scanned pages as promised

PLEASE READ THE DISCLAIMER ON THE FIRST PAGE

Regards

Steve
Attachments
scaned pages.pdf
(440.88 KiB) Downloaded 476 times
Success always occurs in private and failure in full view.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: help with AC phase control

Post by medelec35 »

jose wrote:Phase = x * 7 / 10 + 74 i have an idea but can you please explain?
Thanks
The reason for that is I had determined the range to load timer interrupt should be no higher than 252 or will be hogging resources and no less than 74 (from testing with a simulator) as you need a trigger a little after zero crossing)
That's what the formula does.
Converts ADC (0 - 255) to (74 - 252)

To find the ideal values, you could:
Temporarily disable formula and use Phase = x
Send the value of x to a LCD or via RS232 while adjusting pot and make a note of the ideal range.
Post the range then a new formula can be derived.
Alternatively if not got LCD or UART to RS232 converter then just measure the voltage as accurately as possible on the ACD pin of microcontroller of the min and max ideal setting.
Post that and I can derive a new formula for you.

Martin
Martin

Post Reply