Controlling Boost Converter

Discussion in 'The Projects Forum' started by brunounreal, Jan 20, 2012.

  1. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    Hello,
    i'm having problems with the control algorithm for a step up converter.
    i have this project with consist i designing and buid a step up , and insted of using big capacitor to reduce the ripple after the rectification , we are asked to build a software (in C language, we are using a arduino for the taks) that when the Vout is lower than Vref it will increase the duty cicle and when Vout is higher it will drecrease the duty cile to mantain a stable output.
    the ripple i have to compensate is aprox 10V at 100hz.
    i've tryed the simples algorithms like
    e=yr-y
    u=Dref+Kp*e
    but it didnt worked.
    if anyone who have experience in this area could help me out i will be very gratefull
    In attachement i send the code I wrote so far, with definition of timers, ADC readings, and serial port (the latter using the Arduino functions)
     
  2. crutschow

    Expert

    Mar 14, 2008
    13,000
    3,229
    Post a schematic of the circuit.
     
  3. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    You need capacitors on both the input and the output of the converter. They don't ask you to control the ripple voltage with software but the DC (average) value of the output voltage.
     
  4. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    This is the power circuit.
    after the rectifier and the capacitor e have aprox 5V ripple.
    the reference voltage is 56V, so when i have 56 V at Vout i have 2.5V at the arduino adc.
    i have 2 polypropylene capacitor ( 10u//22u) at the output to filter the high frequency riple.
     
  5. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    What is your ADC resolution and its reference voltage?
     
  6. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    10 bits resolution and 2.5V reference ( or 512 because im working directly with the value from adc )
     
  7. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    The adc reference is internal 5V.
     
  8. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Then you can use this:

    D=(512+(512-ADC0)*Kp)*d

    if (D>max duty cycle)
    {
    D=max duty cycle;
    }

    if (D<0)
    {
    D=0;
    }

    where:
    D=duty cycle
    Kp=error gain
    d=duty cycle gain depending on your duty cyclle maximum value.

    Another easy solution is this:

    if (ADC0>512)
    {
    D--;
    }

    else if (ADC0<512)
    {
    D++;
    }

    If it is unstable with this method, put this in an interrupt every 100Hz.
     
    brunounreal likes this.
  9. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    about the first solution , how may i find suitable d values? just start with d=1 and keep slowly increasing the value ? or is there any method to find a good value ?
     
  10. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    What value in the dudy cycle register gives you 100% duty cycle?
     
  11. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    400 in the OCR1A register gives me 100% DC!
     
  12. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    You can use this formula for operation in CCM:

    OCR1A=(1-Vin/Vout)*400+(512-ADC0)*Kp

    Where:
    Vin=DC voltage after the rectifier
    Vout=desired output DC voltage
    Kp=proportional gain

    You can start with Kp=1 and then increase it to decrease the error on Vout from the desired value.


    If it opearates in DCM, then it is better you use the second way I posted for a start. Use it without any interrupt to see what happens.


    Note that the proper way to do this is to use a PID or PD controller.
     
  13. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    The easiest way, which works for both CCM and DCM, is this:

    if (ADC0>512)
    {
    D--:

    if (D<0)
    {
    D=0;
    }

    }

    else if (ADC0<512)
    {
    D++;

    if (D>350)
    {
    D=350;
    }

    }

    I set max D to 350 since if it goes up to 400 the MOSFET will not be able to turn off, hence no energy will be transferred to the output.
     
  14. crutschow

    Expert

    Mar 14, 2008
    13,000
    3,229
    I believe you will need some form of compensation in the feedback loop to cancel the resonance of the output inductor and capacitor, such as PID, to avoid oscillations at the resonant frequency.

    Another way generate a stable system, besides a PID loop, is to use a Fuzzy Logic controller. It uses a series if IF-THEN-ELSE statements to control non-linear as well as linear feedback systems in an intuitive manner. It's generally easier to understand the operation of a digital Fuzzy Logic system and tweak it to obtain stable operation then it is a PID loop, which is derived from analog pole-zero feedback control theory.

    Edit: Basically for Fuzzy Logic control you would add extra IF-THEN-ELSE statements to those suggested by mic3 to make the feedback sensitivity somewhat proportional to the error level between the desired output voltage and the actual output voltage. Thus, for example, if the error is large, you make a large correction to the PWM duty-cycle, and if the error is small, you make a small correction to the duty-cycle. The number of IF-THEN-ELSE statements required is largely determined by the output error and ripple you can tolerate and the required response speed of the system.
     
    Last edited: Jan 21, 2012
    brunounreal likes this.
  15. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    I'm using a 2kHz sample frequency. is that enough? i'm using this because if i increase this frequency too much im afraid that e get interference from de 40khz comutations ripple. the riple i want to compensate is at 100Hz.
     
  16. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    If i understood correctly, the fuzzy logic will create something like diferent zones, for example, instead of having a fixed Kp ( or fixed d, since de Vin/Vout constantly change ) , i should devide the ripple into small parts and use the fuzzy logic to change the kp value for something more suitable according to the zone ?
    but wouldn't this make the system slower?
     
  17. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    Vin/Vout isnt a fixed vallue! is that a problem?
    This is the simullation without any control from the Vin, Vout and Vin/Vout.
    Maybe if i sample both Vin and Vout i can have more acuracy for that value! is it a good idea?
     
  18. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    I think it is somethign like this:

    if (ADC0>512)
    {
    D=D+(512-ADC0)*Kp:

    if (D<0)
    {
    D=0;
    }

    }

    else if (ADC0<512)
    {
    D=D+(512-ADC0)*Kp;

    if (D>350)
    {
    D=350;
    }


    Or in a more compact form:

    D=D+(512-ADC0)*Kp;

    if (D<0)
    {
    D=0;
    }

    if (D>350)
    {
    D=350;
    }
     
  19. brunounreal

    Thread Starter New Member

    Apr 23, 2010
    26
    0
    i've already tryed that and didnt worked.
    I use part of that to limit the maximum and minumum values i can put on the compare register to limit the duty cicle betwen 10% and 62.5%
     
  20. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Post your code and the values of the feedback resistors.

    What is the demanded output voltage?
     
Loading...