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 256.uk and laid out by the person behind arduined.eu 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);
Serial.begin(9600);
}

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;
}
Serial.println(pulseWidth);
analogWrite(9, pulseWidth);
analogWrite(5, 255 - pulseWidth); // pwm to LED
delay(10);
}

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

Parts List

1x Arduino Nano Clone: https://goo.gl/lgAAdC
1x IRF3205 Mosfet: https://goo.gl/eepYsc
1x 2N3904 NPN Transistor: https://goo.gl/dbsFjG
2x 2N3906 PNP Transistor: https://goo.gl/Ju6JQ7
4x 1N4148 Diode: https://goo.gl/Dz58VA
1x P6KE33CA TVS Diode: https://goo.gl/4JNAxH
1x 90SQ035 Schottky Diode 9A/35v (or similar): https://goo.gl/c9W9Mn
2x 47nF 50v Ceramic Capacitor: https://goo.gl/XXsRcx
1x 1uF 50v Ceramic Capacitor: https://goo.gl/d6S8Vg
1x 220pF 100v Ceramic Capacitor: https://goo.gl/H3jQpw
1x 470nF 10v Tantalum Capacitor: https://goo.gl/32leQJ
2x 1uF 35v Tantalum Capacitor: https://goo.gl/zpBuUy
1x 82k 1% 0.25w Resistor: https://goo.gl/yvhjPA
1x 20K 1% 0.25w Resistor: https://goo.gl/1hdms1
3x 220K 0.5w Resistor: https://goo.gl/MQYTwH
1x 4.7K 0.5w Resistor: https://goo.gl/phf1uD
1x Prototyping PCB: https://goo.gl/hSqjwP

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!