Introduction: Arduino Powered Solar Battery Charger

The following design is for a Solar battery charger ran by an Arduino Nano. It can handle a standard lead acid 12V battery, like for a scooter or a car. Furthermore the design has been tested and runs with 90% efficiency under 70ᵒC (158ᵒF). It can take up to 20V on the input site of the charger. Also in order to improve the efficiency a MPPT tracker is implemented in the code to ensure that the maximum power of the panel is being used.

Step 1: Basic Principle of Operation

The basic operation of our selected circuit can be represented by the block diagram. The design consists of a buck converter regulated by the Arduino that measures voltage and current in the system and the voltage of the battery. Based on the measurements the Arduino controls the duty cycle with which the buck converter is driven and so it calculates the current output to the battery.

Step 2: Circuit

Circuit (intro)

The indication is done by 4 LEDs as visible on the circuit schematics. Also there is a reset button pulled onto the front board for easy access, if the code gets stuck. This button was very useful during initial testing.

Also in this build for the current measurement an AD8212 current sensing OP-AMP is used. This device proved to be unreliable for the application and is recommended to be replaced with an ACS712 breakout board.

Description of circuit operation (refer to Charger circuit V1.pdf)

Q2 is the main switching MOSFET for the buck converter and Q3 is the synchronous switching MOSFET. The MOSFET are driven by U2 which is an IR2104 MOSFET driver. The IR2104 takes the PWM signal (Digital_pin_9) from the Arduino input on pin 2 and uses it to drive the switching MOSFETs. The IR2104 can also be shut down with setting pin 3 to low. Since Q2 is an NFET it needs a gate drive voltage that is 10V higher than the source voltage which is the solar input. So the IR2104 uses a charge pump circuit made of D2 and C6 to boost the gate drive voltage to turn on the high side MOSFET. D3 is a fast switching diode that should start conducting before Q3 and in that way increase the efficiency (Increase of 1-2%).

Q1 keeps the battery from being discharged at night. Q1 turns on when Q2 is on from voltage through D1. R4 drains the voltage off the gate of Q1 so it turns off when Q2 turns off.

L1 is the main inductor that smooth’s the switching current and along with C8 smooth’s the output voltage.

In order to measure the battery and solar panel voltages R2, R3, C1 and R6, R7, C9 are set as voltage dividers. In this case the capacitors C1 and C9 smooth any pulses in the signal and give a clean measurement to the ADC. C4 is the input filter capacitor that smooth’s any input current pulses.

In order to read the current in the system there is an Rshunt resistor. The voltage drop across is amplified 100 times by U1 and fed to the ADC of the Arduino.

The 3 LEDs are connected to the digital pins of the microcontroller and serve as an output interface to display the charging state.

Charging Data Serial Monitor

The current code is designed so it can display the data on to the Arduinon serial monitor. It will display the input voltage of the panel the current voltage of the battery and the Current that the charger is currently drawing.

In V2 a I2C 16x2 line display is added to display the data.

Parts list

The parts list for the entire circuit with the designators is contained within the "Parts list V1" file.

For the micro controller any arduino running on the AtMega168/AtMega328/32u4 (Arduion Uno, Nano, Micro) can be used, as long as it runs on a 5V logic level and at at least 16Mhz. An Arduino Mega can be used however the core for the timer will need to be rewritten so the MOSFETs in the circuit run at 10khz frequency.

All of the components can be ordered from Farnell / RS online / or your favorite hobby shop. Furthermore some components like mosfets and the Arduino board can be bought very cheaply on Ebay.

For the current sensing as mentioned before a ACS712 hall effect sensor will provide more linear and stable data compared to the OP-AMP. Also a breakout board won;t be necessary since the chip is easily sold-arable on a proto shield.

Furthermore a I2C display like this can be used for displaying the measured data. An I2c display is necessary since on a standard Adruino UNO there will be not enough available pins.

Step 3: Heat Calculations


In order to ensure that the mosfets will stay within proper operation temperature and handle the power passing trough them a heat sink is required. In the current case a single heat sink of 5.5C/W is used for the 3 MOSFETs.

Step 4: Code

The code works a a simple state machine. The flowchart describes the basic principle of operation.

For the MPPT the program basically compares the current power output to the previous one, in the previous iteration of the code. The power is calculated based on the current and voltage measured from the arduino. If the voltage is then too big, compered to the current, the duty cycle decreases and vice versa.

Important note: The maximum duty cycle is set to be 99.9%, due to the charge pump in the mosfet driver which needs a frequency to operate.

For the switching frequency timer 1 is used tithe the timer library included in the code. This is needed to achieve the frequency of 10kHz. Furedermore in the Charger code archive file the two libraries for the LCD are included. The I2C LCD needs to be connected to analog pin 4 and 5 of the Arduino and the Serial.print statements in the code need to be changed to lcd.print.

I am also uploading the main ino file as a request, separately. Note that you will need the libs requested in order to for it to compile and run.

Step 5: BOX

For the current prototype a custom box was designed and build using a laser cutter. However since a laser cutter is not easily available everywhere, it is better for a standard hardware box to be used. Example box . The size can be as big as you want as long as the circuit fits inside.

It is important for the circuit to be protected from accidental touch, since it handles quite a large amount of power and could cause bodily harm if not handled properly and if something goes wrong. Furthermore the heat sink can get quite hot at high power.

Step 6: Testing the Charger

Solar Panel Test

The build circuit was tested with an actual solar panel, in order to ensure that the it can handle the power of 50W.

Temperature Test

The temperature test was carried out in a small temperature chamber at 70 ⁰C. The charger setup was placed in the chamber and turned on. The circuit was in operation until the chamber reached 70⁰C. After that the charger was left to operate at 70⁰C for 30min. After the test the temperature of the heat sink was measured with a laser thermometer that showed a temperature of 77.2⁰C (IMAGES).

User Manual

Finally an user manual is available in the attached PDF files.

Step 7: Final Toughs

The final build functioned perfectly, although there were many issues during the development processes and more that a few burned parts :).

As mentioned before a few improvements can be made, mainly in the displaying of the charge data on a display.

Finally this is a good project for anyone that wishes to get some experience with power electronics and arduino programing.

Tech Contest

Participated in the
Tech Contest

Microcontroller Contest

Participated in the
Microcontroller Contest