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!

What Others Are Saying

  1. Alen 15/05/2016 at 08:35

    Hello,
    i was wondering how much Volts/Amps/Watts can this solar charger handle ?
    Im planning to buy few smaller panels. up to 50W,
    will this work if i combine small wind turbine and solar panel?

    Regards,
    Alen

    • Adam 25/05/2016 at 12:47

      This is designed for 12 volt systems so a 12 volt battery and a suitable panel with an open circuit of 20-22 volts lets say. The original design Julian created could handle 6 amps at 12 volts. So typically you could use up to a 100 watt panel (as they are rated at their maximum power point so 100 watts at 17.5 volts is ~5.7 amps).

      Wind power is a different matter and mixing the two takes a specialist controller. For a start you’d need a dummy load for a wind turbine in high winds to prevent damage to your system.

  2. Adrian 20/05/2016 at 13:53

    Um… shouldn’t the three be 220K resistors? You show them as 220 ohm.
    Typo?

    • Adam 25/05/2016 at 12:33

      Well spotted. I’ll have that all updated shortly.

      Thanks for pointing that out.

  3. kikiloaw 01/12/2016 at 17:26

    any replacement for this
    P6KE33CA Diode
    90SQ035 Schottky Diode (Actually I used a 10SQ050)
    ???

  4. Alex 27/04/2017 at 09:05

    Could you sell me such a controller

Leave a Reply

Your email address will not be published. Required fields are marked *