Unidentified low frequency components around 50Hz in a dc-ac inverter

Discussion in 'Embedded Systems and Microcontrollers' started by hwgeek1221, Nov 21, 2015.

  1. hwgeek1221

    Thread Starter New Member

    Nov 21, 2015

    Im designing microcontroller based (cortex M3) dc to ac inverter based on unipolar PWM switching. The switching frequency used is 20khz and the sinusoidal frequency that I want to produce is 50hz with an amplitude of about 10V. The hardware consists of a microcontroller connected to some driver ( with bootsrap functionality ) that drives the 4 transistors of the full bridge. I have an LC low pass filter at the output of my full bridge transistor circuit. The dc bus voltage is stiff and is around 40V. As for the code, I have an infinite while loop running along with a timer that overflows/underflows every 50us. The unipolar PWM switching functionality is ran every 50us and is handled within the timer's function by updating 2 compare registers. Complementary outputs along with the deadtime feature are used. The sine wave reference used in the microcontroller is based on a table lookup and contains only pure a sine wave of 50hz [made of 400 points]

    When observing the output voltage im not able to get an exact 50hz signal. The signal produced contains additional 2 low frequency components at about 45 and 55 Hz however with smaller amplitudes (other than the 50Hz).

    Im unable to trace the reason of why im getting such a signal, though the amplitude that im targeting (10V) can be observed. However this 10V is not directly seen due to the superposition of the 45 and 55hz components.When removing the LC filter and observing the frequency spectrum of the voltage signal, more frequency components around the 50hz were observed. All the components were symmetrical to the 50hz and had smaller amplitudes as moving to the left or to the right of the 50hz component.

    I can't post the code neither the schematics because I don't have the soft version of the schematic and the console that im working on is not connected to the internet.

    Has anyone experienced something similar before?
  2. crutschow


    Mar 14, 2008
    If you post a schematic it would help greatly to understand your problem.
  3. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    Is your micro doing anything else, which has a 5Hz period?
  4. DickCappels


    Aug 21, 2008
    It could be timing jitter in ouputting your samples. When doing things like this (actually almost exactly this) I found that a two-stage interrupt removes a lot of jitter in outputting the samples.

    The keys are to have the controller always wake from sleep so that the interrupt latency is constant and output the sample value(s) immediately after waking up, using a value stored in a fixed location so that the delay between waking and outputting is constant. After the sample(s) has been output prepared (look up) the next sample value and put it in that fixed location so it can be quickly accessed next interrupt. Use straight-line coding, meaning no branching between waking and outputting the sample(s).

    It looks like this:

    (Controller comes her as a result of a timer interrupt that occurs shortly before the sample is to be outputted)
    Sleep the controller -to wake on next interrupt

    Wake on interrupt

    Output sample value from CPU register to DAC register

    Fetch next sample value to CPU register

    (Do anything else you want)

    Return from interrupt