This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MPPT code for MSP430

Hello,

I am interested to know if TI offers sample or demo code for solar cell max power tracking (also referred to as MPPT code) for the MSP430.

Thanks,

Todd

  • Hey Todd,

    Have you done much research for MPPT on IEEE or anywhere else?

    Im doing it for my thesis at uni. There are many different types of MPPTavailable for solar panels. The most commonly used is purturb and observe (P&O) from the hill climbing family.

    For P&O you sample the voltage and current at the terminals of the PV panel, times the Vand I together to give you the power, store that value then take another reading, you compare these two readings then change the duty  cycle of a converter between the panel and the output. This comparison of powers happens forever and you should settle the  power at the MPP of the panel.

    The algorith is pretty easy, so you just need to sample the input voltage and current, to the ADC, times the result, then alter the duty cycle.

    Pseudo code would be like this

    --------------

    Main,

    set up ADC

    set up PWM

    ----------------

    Recieve V and I from ADC

    ---------------

    Calculate power and compare with previous reading, increase duty cycle

    Calculate power again

    Is power bigger than last time Y/N?

    If Y increase duty again

    if N decrease duty cycle

  • I haven't seen any code examples from TI on this, and it's strongly depending on your goals in which way to implement this.

    I used for example an external adjustable buck converter with a digital potentiometer to set the output voltage. This was used to charge a lithium ion battery, so a higher output voltage resulted in a higher output power. Now you just measure the voltage and current from your solar cell, calculate the power, change the output voltage and see if you get greater power. Basically a P&O algorithm like Micheal described, but from a software perspective completely different.

    So I don't think it's any good to provide much sample code, as it's defined by your application. If you want to learn about different approaches to MPPT, there is an application note from TI on this, found as SLVA446.

  • Bernhard Weller said:
    I used for example an external adjustable buck converter with a digital potentiometer to set the output voltage. This was used to charge a lithium ion battery

    Hey Bernard,

    I'm using a buck-boost (with MPPT)  to charge a li-ion form a solar panel. Did you use a MSP430 to control the converter?

    Regards

    Michael Dalton

  • Yes, I used a voltage adjustable buck converter. In the feedback I placed a digital potentiometer (for best results use a 10-bit variant, but it also works quite well with 8-bit) and then I controlled the output voltage through varying the potentiometer using I2C from a MSP430.

    Of course you have to be aware of the danger of overcharge, so I  limited the output voltage to 4.2 volts. You have to include the tolerances of all your resistors to get it right though, and thats not very easy as digital potentiometers can have up to 30% tolerance on the end-to-end resistance. So I laid out the system to make it adjustable from the low end voltage of the battery to the mentioned 4.2 volts.

    Another approach is of course to stop the loading if a certain voltage is reached, but after doing some research on lithium accumulators  I finally found the information, that you can do a float charge, if your voltage stays very well regulated at the limits.

    In a short test between solar cell directly mounted to the lithium accumulator (DON'T do that in a product) and my crude implementation of a MPPT using the buck converter showed an improvement of up to 75% in average charging current. I guess it could even be more if a refined tracking algorithm was implemented, mine basically switched through every possibility and chose the one with the highest power every now and then, so it wasn't really a P&O implementation.

    Next idea was to use the MSP directly as the buck converter, but I never got around to try that.

**Attention** This is a public forum