# Charge controller project

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I'm building a solar MPPT charge controller based on the FreeChargeController.com open source project which is in turn based on Tim Nolan's project. Their system uses the Arduino for the processing part, but I'm going to build mine using a Raspberry Pi.

## Voltage and current measurement

We need to have real-time voltage and current sensing of the solar array to determine the optimal voltage and current to draw from it that delivers the maximum power (the maximum power point tracking, MPPT). And we need to also measure the voltage of the battery to know what kind of charging requirements it has, and finally the current on the load needs to be monitored so that we can graph our power usage over time.

The voltage measurement simply involves a very low current potential divider to ground set such that the maximum voltage the divided point can have is not higher than the maximum input of the system's ADC's.

Current measurement is a little more complicated and involves a shunt resistor (very low value with high precision) placed in the circuit segment requiring measurement, then taking the voltage measurement across this shunt resister and using ohms law to calculate the current. Since the shunt resistor's value is so low (to ensure minimal voltage drop) the voltage across it needs to be amplified using a current-sense amplifier chip which is basically an op-amp designed for single ended configuration rather than requiring a feedback system. See this current-sensing tutorial for more detail.

One issue with this is that there isn't any analogue inputs on the Pi, but that can be done with a single chip solution such as the MCP3008 which gives eight analogue channels and connects directly into the SPI port. See Analogue Inputs for Raspberry Pi Using the MCP3008 for more details.

## MPPT algorithm

I'm not 100% clear on the way this works yet, but I think it's like this: the DC-DC converter's output voltage is forced to what the battery wants, but may be set to an overall preconfigured value.

The duty cycle of the PWM which is set by the processor based on its solar power detection is effectively alternatively opening and shorting the solar input, but due to a reasonably big capacitor this works as a means of varying the current drawn between zero (always open) and the maximum the panels can deliver (always closed). The processor can then determine whether to draw more or less current based on the effects on the power output that the last change had.