2 It was so close to perfect grammatically I couldn't help myself :D

# what's What's a good set of pwmPWM values to make sine waves for a 3 phase motor?

I'm building a synchronous rotating spark gap for a tesla coil. I have a working mcu (Kinetis K64F) driving a 230volt inverter board and it spins a 3 phase synchronous motor. The motor is a synchronous type itself, and the power I give to it must be as well: synchronized to the ac line. That's why I chose to build my own hardware. I can compare the performance of my running drive with a commercial one and I see that mine is underpowering the motor.

The store bought 3-phase inverter kicks the motor right up to speed, into a sync that slowly shifts to one side with no way to control it. Whereas my drive takes more than a minute of wobbling sound to come up to speed and then it's dead steady with the line frequency. I can move it to either side one degree at a time. That's what I need.

So I think it must be the data I'm sending to the 6 pwm channels. My naive solution for this has been to fill an array with sine values at startup. I make 2 positive half cycles like this:

int angle; double param; extern double hold[370];

 for (angle=0; angle<=179; angle++) {
param  = 255 * sin (angle*PI/180);
hold[angle] = param;      // fill first half of the array
hold[angle+180] = param;  // fill second half with duplicate data
}


Then in a periodic interrupt I read out that array of sine values like this:

    if (angle1 < 180) { PWM1_SetRatio8(hold[angle1]); }
else if (angle1 == 180) { PWM1_SetRatio8(0); }
else if (angle1 > 180) { PWM2_SetRatio8(hold[angle1]); }
if (angle1 >= 360) { angle1 = 0; PWM2_SetRatio8(0); }

if (angle2 < 180) { PWM3_SetRatio8(hold[angle2]); }
else if (angle2 == 180) { PWM3_SetRatio8(0); }
else if (angle2 > 180) { PWM4_SetRatio8(hold[angle2]); }
if (angle2 >= 360) { angle2 = 0; PWM4_SetRatio8(0); }


and so on for angle3, all of which are 120 degrees apart from each other. I see now that 180 per half cycle is too many so I divided it down to as low as 20 but with no change in the motor output.

I lock my 360 value internal array with a precision zero crossing pulse from the outside to keep them in sync.

So I read up about Magic Sine Waves and that sounds good. But I would have to rewrite a lot of code to use it, and I need to cover speeds from 58 to 62hz62Hz which is what the power companies present me with. If I filled an array of Magic Sine values I think I would get crossover distortion when I shifted to the different line frequencies.

Then I read about triangle wave modulating the sine values and adding in some extra 3rd harmonic to get more power. That sounds like the way forward. I can read in a bunch of pre computed values at run time and away I go. Does anyone have experience with building a data set like this? orOr can give me some pointers on how to do it?

# what's a good set of pwm values to make sine waves for a 3 phase motor?

I'm building a synchronous rotating spark gap for a tesla coil. I have a working mcu (Kinetis K64F) driving a 230volt inverter board and it spins a 3 phase synchronous motor. The motor is a synchronous type itself, and the power I give to it must be as well: synchronized to the ac line. That's why I chose to build my own hardware. I can compare the performance of my running drive with a commercial one and I see that mine is underpowering the motor.

The store bought 3-phase inverter kicks the motor right up to speed, into a sync that slowly shifts to one side with no way to control it. Whereas my drive takes more than a minute of wobbling sound to come up to speed and then it's dead steady with the line frequency. I can move it to either side one degree at a time. That's what I need.

So I think it must be the data I'm sending to the 6 pwm channels. My naive solution for this has been to fill an array with sine values at startup. I make 2 positive half cycles like this:

int angle; double param; extern double hold[370];

 for (angle=0; angle<=179; angle++) {
param  = 255 * sin (angle*PI/180);
hold[angle] = param;      // fill first half of the array
hold[angle+180] = param;  // fill second half with duplicate data
}


Then in a periodic interrupt I read out that array of sine values like this:

    if (angle1 < 180) { PWM1_SetRatio8(hold[angle1]); }
else if (angle1 == 180) { PWM1_SetRatio8(0); }
else if (angle1 > 180) { PWM2_SetRatio8(hold[angle1]); }
if (angle1 >= 360) { angle1 = 0; PWM2_SetRatio8(0); }

if (angle2 < 180) { PWM3_SetRatio8(hold[angle2]); }
else if (angle2 == 180) { PWM3_SetRatio8(0); }
else if (angle2 > 180) { PWM4_SetRatio8(hold[angle2]); }
if (angle2 >= 360) { angle2 = 0; PWM4_SetRatio8(0); }


and so on for angle3, all of which are 120 degrees apart from each other. I see now that 180 per half cycle is too many so I divided it down to as low as 20 but with no change in the motor output.

I lock my 360 value internal array with a precision zero crossing pulse from the outside to keep them in sync.

So I read up about Magic Sine Waves and that sounds good. But I would have to rewrite a lot of code to use it, and I need to cover speeds from 58 to 62hz which is what the power companies present me with. If I filled an array of Magic Sine values I think I would get crossover distortion when I shifted to the different line frequencies.

Then I read about triangle wave modulating the sine values and adding in some extra 3rd harmonic to get more power. That sounds like the way forward. I can read in a bunch of pre computed values at run time and away I go. Does anyone have experience with building a data set like this? or can give me some pointers on how to do it?

# What's a good set of PWM values to make sine waves for a 3 phase motor?

I'm building a synchronous rotating spark gap for a tesla coil. I have a working mcu (Kinetis K64F) driving a 230volt inverter board and it spins a 3 phase synchronous motor. The motor is a synchronous type itself, and the power I give to it must be as well: synchronized to the ac line. That's why I chose to build my own hardware. I can compare the performance of my running drive with a commercial one and I see that mine is underpowering the motor.

The store bought 3-phase inverter kicks the motor right up to speed, into a sync that slowly shifts to one side with no way to control it. Whereas my drive takes more than a minute of wobbling sound to come up to speed and then it's dead steady with the line frequency. I can move it to either side one degree at a time. That's what I need.

So I think it must be the data I'm sending to the 6 pwm channels. My naive solution for this has been to fill an array with sine values at startup. I make 2 positive half cycles like this:

int angle; double param; extern double hold[370];

 for (angle=0; angle<=179; angle++) {
param  = 255 * sin (angle*PI/180);
hold[angle] = param;      // fill first half of the array
hold[angle+180] = param;  // fill second half with duplicate data
}


Then in a periodic interrupt I read out that array of sine values like this:

    if (angle1 < 180) { PWM1_SetRatio8(hold[angle1]); }
else if (angle1 == 180) { PWM1_SetRatio8(0); }
else if (angle1 > 180) { PWM2_SetRatio8(hold[angle1]); }
if (angle1 >= 360) { angle1 = 0; PWM2_SetRatio8(0); }

if (angle2 < 180) { PWM3_SetRatio8(hold[angle2]); }
else if (angle2 == 180) { PWM3_SetRatio8(0); }
else if (angle2 > 180) { PWM4_SetRatio8(hold[angle2]); }
if (angle2 >= 360) { angle2 = 0; PWM4_SetRatio8(0); }


and so on for angle3, all of which are 120 degrees apart from each other. I see now that 180 per half cycle is too many so I divided it down to as low as 20 but with no change in the motor output.

I lock my 360 value internal array with a precision zero crossing pulse from the outside to keep them in sync.

So I read up about Magic Sine Waves and that sounds good. But I would have to rewrite a lot of code to use it, and I need to cover speeds from 58 to 62Hz which is what the power companies present me with. If I filled an array of Magic Sine values I think I would get crossover distortion when I shifted to the different line frequencies.

Then I read about triangle wave modulating the sine values and adding in some extra 3rd harmonic to get more power. That sounds like the way forward. I can read in a bunch of pre computed values at run time and away I go. Does anyone have experience with building a data set like this? Or can give me some pointers on how to do it?

1

# what's a good set of pwm values to make sine waves for a 3 phase motor?

I'm building a synchronous rotating spark gap for a tesla coil. I have a working mcu (Kinetis K64F) driving a 230volt inverter board and it spins a 3 phase synchronous motor. The motor is a synchronous type itself, and the power I give to it must be as well: synchronized to the ac line. That's why I chose to build my own hardware. I can compare the performance of my running drive with a commercial one and I see that mine is underpowering the motor.

The store bought 3-phase inverter kicks the motor right up to speed, into a sync that slowly shifts to one side with no way to control it. Whereas my drive takes more than a minute of wobbling sound to come up to speed and then it's dead steady with the line frequency. I can move it to either side one degree at a time. That's what I need.

So I think it must be the data I'm sending to the 6 pwm channels. My naive solution for this has been to fill an array with sine values at startup. I make 2 positive half cycles like this:

int angle; double param; extern double hold[370];

 for (angle=0; angle<=179; angle++) {
param  = 255 * sin (angle*PI/180);
hold[angle] = param;      // fill first half of the array
hold[angle+180] = param;  // fill second half with duplicate data
}


Then in a periodic interrupt I read out that array of sine values like this:

    if (angle1 < 180) { PWM1_SetRatio8(hold[angle1]); }
else if (angle1 == 180) { PWM1_SetRatio8(0); }
else if (angle1 > 180) { PWM2_SetRatio8(hold[angle1]); }
if (angle1 >= 360) { angle1 = 0; PWM2_SetRatio8(0); }

if (angle2 < 180) { PWM3_SetRatio8(hold[angle2]); }
else if (angle2 == 180) { PWM3_SetRatio8(0); }
else if (angle2 > 180) { PWM4_SetRatio8(hold[angle2]); }
if (angle2 >= 360) { angle2 = 0; PWM4_SetRatio8(0); }


and so on for angle3, all of which are 120 degrees apart from each other. I see now that 180 per half cycle is too many so I divided it down to as low as 20 but with no change in the motor output.

I lock my 360 value internal array with a precision zero crossing pulse from the outside to keep them in sync.

So I read up about Magic Sine Waves and that sounds good. But I would have to rewrite a lot of code to use it, and I need to cover speeds from 58 to 62hz which is what the power companies present me with. If I filled an array of Magic Sine values I think I would get crossover distortion when I shifted to the different line frequencies.

Then I read about triangle wave modulating the sine values and adding in some extra 3rd harmonic to get more power. That sounds like the way forward. I can read in a bunch of pre computed values at run time and away I go. Does anyone have experience with building a data set like this? or can give me some pointers on how to do it?