Arduino Source Code/Program

We can use Arduino IDE to write the MPPT Solar Charge Controller Project Code. The code has all the parameters and functions to measure Solar Panel Voltage, Current, Power, Battery Voltage, Charger state, SOC, PWM duty cycle, load status. The 20×4 LCD Display will show the real-time status of this parameters.

The code requires I2C LCD Library and also the TimerOne Library for compilation.

Copy the following code and upload it to the Arduino Nano Board.


Testing the Arduino MPPT Solar Charge Controller

Now let us do the final testing of our Arduino MPPT Solar Charge Controller project and find out how efficient it is.

Initially you need to calibrate the ACS712 Current Sensor so that it can measure the current accurately. The ACS712 sensor reads the current value and converts it into a relevant voltage value. You can download the ACS712 Calibration Code if you want to calibrate the sensor.

In case you are okay with the calibration then you can upload the main source code above. After uploading the code, the LCD will display the following parameters.

MPPT Solar Charge Controller Arduino Testing

The LCD will display all the voltages as 0 as, we didn’t connect the Solar Panel, Load, Battery currently.

If we expose Solar Panel outside, it gives a voltage of almost 20V.

When we connect the Solar Panel to the input terminal of the circuit, the LCD will display the value of Solar panel voltage, Current and Power in the first column.

When we connect the Battery to the circuit, the LCD will display Battery Voltage, Charger state, and SOC in the 2nd column.

MPPT Solar Charge Controller using Arduino Design

At last, we can connect any load to the load terminal for testing the status. The LCD will show the PWM duty cycle and load status on the 3rd column.

The Red, Green and Yellow LEDs are used to indicate the battery voltage level.

  • Low Voltage — > Red led
  • Normal Voltage –> Green Led
  • Fully Charged –> Yellow Led



While testing we can notice that the voltage to the solar panel increases initially, if the output power increase, the voltage continually increases until the output power starts decreasing. Once the output power starts decreasing, the voltage to the solar panel decreases until it reaches maximum power. This process is continued until the MPPT is attained. This result is an oscillation of the output power around the MPP.

This is how you can design and develop your own MPPT Solar Charge Controller using Arduino. We can do a lot of modifications and design the circuit with additional features to increase efficiency with better results.


Video Tutorial & Guide

DIY MPPT Solar Charge Controller using Arduino | 24V Solar Panel, 12V Battery, 50 Watt