This solution uses LPC5536 as the main control. The control block diagram of the system is shown in the figure below. In the control path, the photovoltaic panel is used as the input of the system, and the MPPT control is realized through the BOOST circuit. The output terminal is connected to the load or battery to consume the power from the photovoltaic panel. Among them, the function of the MPPT/CC/CV control algorithm is to convert the input/output voltage and input/output current data collected by the ADC into PWM control parameters through calculation, and finally achieve the goal of system control. In addition, the system is equipped with a human-computer interaction module, which can perform parameter configuration and status monitoring functions through buttons and LCD, and can also achieve the same function through the FreeMASTER host computer, and complete real-time tracking and collection of data.
The software solution is divided into the following parts for introduction:
Basic control loop
State machine
MPPT/CC/CV control algorithm
Human-machine interface (buttons and LCD)
FreeMASTER host computer
1.1 Basic control loop
Through the test in the previous article, the PWM control frequency is finally set to 50kHz, which is used as the basic frequency of control. In LPC5536, the FlexPWM* module is used to generate PWM waves. At the same time, the trigger input of ADC* is configured as the FlexPWM used through INPUTMUX*, so that an ADC interrupt is generated in each PWM cycle to complete the ADC data collection. The control frequency of the CC/CV control loop is set to 5kHz, that is, control is performed once every 10 ADC sampling cycles. The control frequency of MPPT is set to 100Hz, as shown in the figure below.
*: For detailed information about related modules, please refer to the Reference Manual of LPC5536 and the related Application Note 1.2 State Machine
The MPPT state is divided into 5 types, as shown in the figure. When powered on, the MPPT is in the MPPT_INIT state to initialize related parameters. After initialization, it enters the MPPT_READY state and performs a certain delay and user-defined operations. Then, it enters the MPPT_WORK state and performs related voltage/current detection. If everything is normal, turn on the DC/DC control switch, run the control program normally, and continue to run in this state. If the input voltage is detected to be too low, it may be that the photovoltaic panel is not connected or it is night, and enter the MPPT_IDLE state, waiting for system input, and re-enter the MPPT_INIT state after returning to normal. When the output terminal is connected to the battery, if the output voltage is greater than the limit value or the output current is reduced to the limit value, the battery may be fully charged and enter the MPPT_IDLE state. Wait for the battery voltage to drop to a certain value before re-entering the MPPT_INIT state. If an overcurrent/overvoltage event is detected during operation, enter the MPPT_OFF state and turn off the DC/DC control switch. At this time, you need to check the circuit problem. After confirming that it is correct, you can manually switch to the MPPT_INIT state and restart the program.
1.3 MPPT/CC/CV control algorithm
The MPPT control algorithm is based on the perturbation observation method. For the specific process, please refer to the first article in the series. In order to achieve faster MPPT tracking, a variable step control strategy is used. A parameter table is established according to the different states of the input voltage and PWM output, and the perturbation step is controlled by the table lookup method.
In actual applications, MPPT is only one of the working modes, and it can also be switched to CC/CV mode according to needs to meet different application scenarios.
When the output terminal is connected to a load, different mode switching strategies are shown in the figure below, where VCV is the constant voltage working point, ICC is the constant current working point, and different colors correspond to different working states. In actual normal operation, the voltage and current will not exceed the constant voltage and constant current points too much, and when the system is in an abnormal state (current or voltage is too large), the protection will be triggered by the state machine described above, which is not reflected in this figure. At the junction of different modes, there will be a problem of repeated mode switching, which can be avoided by adding a certain offset between the mode switching point and the actual operating point.
When the output terminal is connected to a battery (for lithium batteries), the mode switching strategy is shown in the figure below, which is similar to when connected to a load, except that a trickle charging mode (TRICKLE) and a non-charging mode (OFF) are added. Among them, V1, V2, V3, and V4 are the judgment points for switching between modes, which are closely related to the battery properties.
For lithium batteries, there is a suitable working area. When the voltage is too low or too high, that is, less than V1 or greater than V4, the battery may have been damaged, or there is a problem with the battery parameter setting, and the battery needs to be stopped from charging. At the same time, in order to better charge lithium batteries, battery charging can be divided into three stages: trickle charging (TRICKLE), constant current fast charging (CC), and constant voltage charging (CV). Among them, V1 is the starting judgment point of trickle charging, V2 is the starting judgment point of constant current charging, V3 is the starting judgment point of constant voltage charging, and V4 is the upper limit of the battery voltage. During the constant voltage charging process, the charging current will gradually decrease. When the charging current drops to the set value, the charging will stop, and wait for the battery voltage to drop to the set value before charging again.
1.4 Human-computer interaction interface (buttons and LCD)
The entire system can be set up through buttons and LCD. First, you can choose different modes to meet different application requirements. There are 3 modes to choose from in the mode selection interface:
At the same time, you can set the system's input and output related parameters. The parameters set in different modes are slightly different. The parameter setting interface is as follows:
The most important function of the human-computer interaction module is to display the system's operating status and various indicators. As shown in the figure below, the top layer is the system name and software and hardware version information, the upper left part shows the working mode and the state machine operating status, the upper right part shows the temperature, the middle part shows the input and output parameters, the lower left corner is the PWM output, and the lower right corner is the DC/DC operating efficiency. At the same time, you can also switch modes and set parameters in this interface by long pressing the relevant buttons:
1.5 FreeMASTER host computer
The system uses FreeMASTER to build a host computer and communicate with the MCU through UART. The main interface is shown in the figure below. The main part is the introduction and guidance of the system:
Similar to the human-computer interaction system composed of LCD and buttons, FreeMASTER can be used for mode selection, parameter setting and status monitoring:
In addition, FreeMASTER can easily display data waveforms and capture waveforms for analysis. As shown in the figure below, click on the relevant data on the left to display the corresponding waveform. At this time, the waveform of the output voltage is displayed above the picture, and the waveform of the output current is displayed below:
System test
In order to understand the actual performance of the system, relevant experiments are designed to test the system. The test is divided into two groups: one group tests the performance when the output end is connected to the load, and the other group tests the performance when the output end is connected to the battery.
2.1 Electronic load test
In this test, the output end is connected to the electronic load and set to the constant resistance mode. The MPPT/CC/CV modes are tested respectively. The final test results are shown in the figure below:
1. The DC power supply output configuration corresponds to the maximum power. Before reaching the maximum power, it is a constant voltage output (the current gradually increases), and after reaching the maximum power, it is a constant current output (the voltage gradually decreases). The MPPT performance can be observed by tracking the maximum power of the DC power supply
2. There are three operating modes: MPPT maximum power point tracking, CC constant current, CV constant voltage, and MPPT main operating mode. When the constant current/constant voltage conditions are reached, it is converted to the corresponding mode
3. Output voltage/current peak value after stabilization
4. Efficiency = output power/input power, data collected by MPPT control board
2.2 Battery charging test
In this test, the output end is connected to a 24V lithium battery, and the MPPT/CC/CV modes are tested respectively. The final test results are shown in the following table:
1. The DC power supply output configuration corresponds to the maximum power. Before reaching the maximum power, it is a constant voltage output (the current gradually increases), and after reaching the maximum power, it is a constant current output (the voltage gradually decreases). The MPPT performance can be observed by tracking the maximum power of the DC power supply
2. There are three operating modes: MPPT maximum power point tracking, CC constant current, CV constant voltage, MPPT as the main operating mode, and convert to the corresponding mode when the constant current/constant voltage conditions are reached
3. The battery voltage gradually increases in MPPT and CC modes, here is the initial mean value of the battery voltage -> the final mean value of the battery voltage; the battery voltage changes less in CV mode, here is the peak-to-peak value of the battery voltage
4. The charging current changes slightly in MPPT and CC modes, and here is the peak-to-peak value of the charging current; the charging current gradually decreases in CV mode, and here is the initial average value of the charging current -> the final average value of the charging current
5. Efficiency = output power/input power, data collected by the MPPT control board
Summary
This article introduces the software design part of NXP's LPC5536 photovoltaic MPPT solution, and tests the system's related performance, hoping to bring some inspiration to everyone. Since then, the introduction of the entire system has ended, thank you for your continued attention.