Arduino PWM Solar Charge Controller

Posted on 23/11/2015 by Adam

After building the Arduino based solar charge controller designed bu Julian Ilett of and laid out by the person behind I thought I’d like to look again at this project.

I’d had comments from people nervous about the soldering – which I too struggled with.  So many components in such a small space made it tricky.  I wondered if I could redesign the circuit board to make it a little easier.  I also wondered if I could reduce the number of components used in the design.

I came up with this version:

arduino pwm charge controller v2 veroboard v3
I also made a tiny adjustment to the sketch to change the PWM duty cycle indicator LED from digital pin 13 (which doesn’t do PWM) to digital pin 5 (which does).

const int setPoint = 13.5 * 20 / (20+82) * 1024 / 5 ;
int measurement = 0;
int pulseWidth = 0;
int difference = 0;
int stepSize = 0;

void setup() {
TCCR2A = TCCR2A | 0x30;
TCCR2B = TCCR2B & 0xF8 | 0x01;
analogWrite(11, 117);
analogWrite(3, 137);

void loop() {
measurement = analogRead(A1);
difference = abs(setPoint – measurement);
stepSize = difference;

if (measurement < setPoint) { pulseWidth += stepSize; if (pulseWidth > 255) pulseWidth = 255;
else if (measurement > setPoint)
pulseWidth -= stepSize;
if (pulseWidth < 0) pulseWidth = 0;
analogWrite(9, pulseWidth);
analogWrite(5, 255 – pulseWidth); // pwm to LED

You can see me building the charge controller and it working in this video.

Parts List

1x Arduino Nano Clone:
1x IRF3205 Mosfet:
1x 2N3904 NPN Transistor:
2x 2N3906 PNP Transistor:
4x 1N4148 Diode:
1x P6KE33CA TVS Diode:
1x 90SQ035 Schottky Diode 9A/35v (or similar):
2x 47nF 50v Ceramic Capacitor:
1x 1uF 50v Ceramic Capacitor:
1x 220pF 100v Ceramic Capacitor:
1x 470nF 10v Tantalum Capacitor:
2x 1uF 35v Tantalum Capacitor:
1x 82k 1% 0.25w Resistor:
1x 20K 1% 0.25w Resistor:
3x 220K 0.5w Resistor:
1x 4.7K 0.5w Resistor:
1x Prototyping PCB:

voltage regulator temperature There has been a good question on the YouTube video around the working temperature of the voltage regulator built into the arduino on 12 volts plus. I’ve borrowed a laser temperature sensor gun and found it to remain around 23 degrees Celsius. I’m not too worried about that; especially when Arduino pro mini clones are so cheap!