Software requirements for MPPT controller V3.1
Draft by Keith Hungerford, updated 12th September 2015
The charger operates in one of several charging states, depending on the sunlight level.
Charger OFF state
At nil or low sunlight levels, as indicated by solar voltage below battery voltage + 0.5 Volts, the charger state is OFF.
Transition from the OFF state occurs when
a) if battery voltage is greater than 11.5 volts and solar voltage rises above battery voltage + 0.5 Volts
b) if battery voltage is less than 11.5 volts and solar voltage rises above 12.5 volts.
When either of these voltage conditions is met the charger goes into one of the following states:
i) Float state if the battery voltage is greater than the Float voltage;
ii) Boost state if the battery voltage is less than the Float voltage and the Boost time since the last night time is less than [1 hour];
iii) Bulk state if the battery voltage is less than the Float voltage and the Boost time since the last night time is greater than [1 hour]
In all 3 cases initially the controller will use the DCM charging algorithm.
Boost DCM and Bulk DCM states
When in the Boost DCM or Bulk DCM state, the charger can go to OFF state if the solar voltage falls below (battery voltage + 0.5 Volts).
The charger can go to Boost CCM or Bulk CCM state if the Solar Power rises above 10% of the rated power.
The charger can go to the Float state if Battery voltage rises above Float.
The charger can go from Boost DCM to Bulk DCM if the Boost time since the last night is greater than Boost duration.
Boost CCM and Bulk CCM states
When in the Boost CCM or Bulk CCM state the charger can go to Boost DCM or Bulk DCM if the Solar Power falls below 10% of rated power.
- The charger can go from Boost CCM to Bulk CCM if the Boost time since the last night is greater than Boost duration
The float state is functionally the same as Bulk state when the battery voltage reaches Float.
When in Float state the charger keeps just sufficient current flowing to the battery to maintain the battery voltage at Float.
Continuous Current Mode (CCM) applies when the available solar power is more than 10% of the rated power (strictly, when the current in the inductor always flows towards the battery, but this is difficult to measure directly in the software so we use the power level as a proxy estimate).
In this mode, the PWM period is set at 12 microseconds. The PWM duty cycle is set either at a value that achieves maximum power, or to meet the charging voltage required by the battery (see battery management conditions below). When it is required to reduce the charging rate so as to limit the battery voltage, the PWM duty is reduced, thereby increasing the panel voltage above the maximum power point and reducing the current accordingly.
The Fast PWM mode of the Arduino is used to generate this PWM. The PWM period of 12 microseconds is 192 clock cycles at 16 MHz. The PWM period is divided into a Panel Connect phase followed by an Earth Connect phase. The length of the Panel Connect phase is controlled by PWM Duty.
When maximising power, the power level is measured approximately every 0.5 milliseconds and is compared to the previous power level measurement. The PWM duty cycle is changed up or down by 1 CPU clock cycle after every measurement. After the first measurement, the PWM duty cycle is increased. On subsequent measurements, if the power level is increased or is the same as the previous measurement, the PWM duty cycle is changed in the same direction as in the previous cycle. If the power level is decreased from the previous cycle, the PWM duty cycle is changed to go in the opposite direction to that in the previous cycle.
When tracking the allowable battery voltage, the battery voltage is measured approximately every 0.5 milliseconds and is compared to the target value. If the new value is within +0.1 volts of the target value, the PWM duty is left unchanged. If the new value is...
Read more »