sine wave inverter.

hey guys. I'm working on a project, a sine-wave inverter for powering home appliances. Its mostly just to learn from, if i wanted something reliable and easy i would just buy one. My setup is a boost converter converting 12 Vdc to 170Vdc. this feeds a small capacitor bank of around 900 or so microfarads. this feeds into a mitsubishi PS11036 IPM (6 igbt's with drives in an integrated device). im using some simple code to feed a sine wave pwm into it. two igbt's one one pwm, two igbt's on the other. this forms an h-bridge where an increase in one creates 170vdc, and an increase in the other creates -170vdc. the trouble I'm having is filtering out high frequency noise from the output, and im also having alot of signal distortion when running resistive loads (40 watt light bulb) and inductive loads (36 watt shaded pole motor fan). These are the oscilloscope traces taken from a 9 volt ac step down transformer (i dont have any good probes). https://picasaweb.google.com/118171524369413679019/SineWaveInverter?feat=directlink#

you can see that the wave is severely distorted and there is much high frequency noise. I've read that a combination of inductors and capacitors can filter out this kind of noise, but i would like to hear the opinion of someone who has worked with this kind of filtering before. Thanks-Andres

and here is the code i am using, its pretty simple. im using a teensy++2.0 board. im setting one pwm output to feed my boost converter, the voltage regulation is handled in hardware. the other 2 pwm outputs feed the h-bridge. and while i realize this code could use a ton of optimization (like taking the sine table out of ram, and cutting it in half), its just a basic program for testing.

byte sine[181] = {0,4,8,13,17,22,26,31,35,39,44,48,53,57,61,65,70,74,78,83,87,91,95,99,103,107,111,115,119,123,127,131,135,138,142,146,149,153,156,160,163,167,170,173,177,180,183,186,189,192,195,198,200,203,206,208,211,213,216,218,220,223,225,227,229,231,232,234,236,238,239,241,242,243,245,246,247,248,249,250,251,251,252,253,253,254,254,254,254,254,255,254,254,254,254,254,253,253,252,251,251,250,249,248,247,246,245,243,242,241,239,238,236,234,232,231,229,227,225,223,220,218,216,213,211,208,206,203,200,198,195,192,189,186,183,180,177,173,170,167,163,160,156,153,149,146,142,138,135,131,127,123,119,115,111,107,103,99,95,91,87,83,78,74,70,65,61,57,53,48,44,39,35,31,26,22,17,13,8,4,0};
int i = 0;

int dly = 44;
 
void setup()
{
  TCCR0B = TCCR0B & 0b11111000 | 0x03; //pwm pin 0 messes with delay?
  TCCR3B = TCCR3B & 0b11111000 | 0x02; //pwm pin 14 15 16

  
  analogWrite(0,200); //driving frequency for the boost converter
  pinMode(15,OUTPUT);
  pinMode(14,OUTPUT);
  // the two opposite legs of the h-bridge are connected to the same control line. a low on one side give -170 volts, a low on the other gives +170 volts.
  digitalWrite(14,HIGH); //h-bridge is active low, so this grounds both sides and shuts the output off.
  digitalWrite(15,HIGH);
}

void loop()
{
  /*
  digitalWrite(14,LOW);
  delay(30);
  digitalWrite(14,HIGH);
  delay(70);
  digitalWrite(15,LOW);
  delay(30);
  digitalWrite(15,HIGH);
  delay(70);
 */
  
 i = 0; 
while (i < 182)
{
  analogWrite(14,255-sine[i]);
  delayMicroseconds(dly);
  i++;
}
digitalWrite(14,HIGH);
 delayMicroseconds(100);
 i = 0;
 
 while(i < 182)
 {
   analogWrite(15,255-sine[i]);
   delayMicroseconds(dly);
   i++;
 }
digitalWrite(15,HIGH); 
delayMicroseconds(100);
  
  
}

i just realized i had some capacitors plugged into the output, ill take some more scope traces without them, it still looks like it needs high frequencies cleaned up, but alot of that distortion is gone.

What we need is a look at the schematic.
In particular the filtering round the PWM output but the whole thing is needed.

okay, off to schematic land i go.