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!

What Others Are Saying

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

    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?


    • 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.

    • Adam 25/05/2016 at 12:33

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

      Thanks for pointing that out.

  3. Jonadab 05/08/2016 at 00:16

    My email is PLEASE my friend send me the complete layout of the board connection with the Arduino pins in my case I will use a one Arduino. Thank you.

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

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

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

    Could you sell me such a controller

  6. jason 23/06/2017 at 22:57

    ya would love to buy one from you as well. please let me know. also what about one with a display showing incoming and out going etc ?

    • Adam 27/06/2017 at 15:42

      Sorry – I’m afraid I don’t have the time for my own projects let alone building them for others. It isn’t too hard to do it yourself but does take a bit of time. Cheers

Leave a Reply

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