How to you generate 50hz o/p using PWM?

Thread Starter

yan_c

Joined Jun 17, 2011
8
Hi, wondered if someone can help with this. I'm trying to generate a 240v 50Hz o/p, using a dsPIC33 and PWM from a sine LUT. After many wks work I've managed to get some basic code running that is giving what looks like the correct PWM o/p ie. a PWMh and a complementary PWMl signal.

Now the tricky bit. From what I can see for 240v I need to control 2pairs of IGBTs in a H-bridge and switch them on independently in pairs, but I only have one PWM pair of signals?

Is there an easier way than this?
Thanks
 

someonesdad

Joined Jul 7, 2009
1,583
You might get more people responding if you didn't use so many abbreviations. I have no idea what o/p or LUT mean...

In fact, this should be in the guidelines for newbie posters if it isn't already, as if a responder can't understand the question, he probably won't bother responding.

And if you answer "Go google it", then I'll send you to people skills 101... :p
 

Thread Starter

yan_c

Joined Jun 17, 2011
8
Sorry didnt mean to confuse anyone... Hopefully this will be a little clearer.

I am trying to initially generate a 240v 50Hz sine wave output, using a dsPIC33 and PWM from a sine Look Up Table. I've got some basic code running that is giving what looks like the correct PWM output ie. a PWMh and a complementary PWMl signal. and if I connect up a simple RC filter to my PWMh output this gives a basic sine wave output, but with no power.

If I want to supply power ie. connect a dc bus to a single phase output (or eventually 3ph), I think I will need to use 2 pairs of IGBT's connected as a H-bridge (& 3pairs for 3ph) and switch them on independently in complementary pairs. Currently I only have one PWM pair of complementary signals for the single phase output which are generated from the sine Look Up Table. I understand that I will need 3off sine Look Up Tables for each of the phases in a 3phase system, but how do I get the correct control signals for a 1 phase system from one complementary pair?

The code I have written just outputs one complementary pair PWMh and PWMl so if I want to supply power to my sine wave output is this the configuration I need? I want to eventually supply all 3ph's but single phase is the first step. For me at the moment its just trying to understand the concept of how to achieve each step..

Also how do I add the 120deg phase offset for the 3ph version ie. how do you convert 120deg to a value I can use in the code?

Is there an easier way than this?

Any help would be most appreciated....
 

guitarguy12387

Joined Apr 10, 2008
359
If you don't know what LUT or o/p means in the context, then you won't be any help answering the question anyway... these are industry standard terms for brevity and clarity. Would you prefer me to use, for example, Very High Speed Integrated Circuit Hardware Description Language instead of VHDL? I think not.
 

Markd77

Joined Sep 7, 2009
2,806
Actually I didn't know what LUT was althought I use them all the time, however water under the bridge.
To get 120 degrees phase difference you only need one table. If for example the table was for a full cycle then if you add 1/3 of the length of the table to the first phase position, you get another phase.
 

Thread Starter

yan_c

Joined Jun 17, 2011
8
Markd77, thanks for that.

So for a 120deg shift, I dont quite understand how I add this in code? If the table has 100pts, do I move to the value that is 1/3 way into the table and then start? If so maybe a 120pt or 90pt table would be better?

sine LUT att below.

Thanks again...



const int SineA[] = {512,544,576,608,639,670,700,730,759,786,813,838,862,885,907,926,944,961,975,988,999,1008,1015,1020,1023,1023,
1023,1020,1015,1008,999,988,975,961,944,926,907,885,862,838,813,786,759,730,700,670,639,608,576,544,512,
480,448,416,385,354,324,294,265,238,211,186,162,139,117,98,80,63,49,36,25,16,9,4,1,1,1,
4,9,16,25,36,49,63,80,98,117,139,162,186,211,238,265,294,324,354,385,416,448,480};
 

Markd77

Joined Sep 7, 2009
2,806
Sure, 1 phase would be SineA(x), another phase is SineA(x+33), the other SineA(x+67).
Obviously if x+33 or x+66 > 100 then subtract 100.
It might be worth making the table length a multiple of 3, or it might not make much difference, I'm not really sure.
 

Thread Starter

yan_c

Joined Jun 17, 2011
8
Cheers for that, I see now, was thinking a little too deep!

I'll have a play around with different table lengths to what effects I get...

Thanks
 

THE_RB

Joined Feb 11, 2008
5,438
A table that divides by 3 will be easy to generate the 3 phases, but it may be no longer able to generate exactly 50Hz from your PIC xtal.

One solution would be to have a table that divides by 3 AND also divides your xtal frequency exactly to (50Hz * table size). Maybe a 12MHz xtal (12MHz PIC timer) and 120 entry sine table, that will work as each table entry is 2000 timer counts. So 2000*120*50Hz = 12MHz.
 
Top