Fig. 1 Charger circuit using 12-volt DC relay. While it can handle a
lot of current, too many on/off cycles will wear down the contacts.
Solar Panel Charge Controller Using Arduino Microcontroller
by Lewis Loflin
To see the Picaxe version of this page see Solar Panel Charge Controller Using PICAXE Microcontroller
Fig. 2 Charger circuit using PNP power transistor switch.
This is a good circuit for fairly low charging currents. I used a 2SA1803.
Purpose: to cycle to charge voltage on/off and to check other aspects such as solar panel input voltage when charging lead-acid batteries.
The LED1 indicator 'bad' meaning the input voltage below the charging voltage when on.
DP11 turns on charge switch transistor. Can use PWM or a simple timing routine. Will blink on/off with charge cycle. (Charge enable)
LED2 indicator fully charged battery. (DP10)
A 10-bit analog-to-digital converter (ADC) has a step voltage of about 4.9 mV over a 5-volt range. This relates to the charge point (CP) variable.
To measure input voltage from the solar panel and the voltage on the battery we use a voltage divider to drop the voltage below 5-volts.
This uses two resistor voltage dividers (15k and 2.2k) which produces a voltage of about 1.7 - 1.9 volts when fully charged. This equates to about decimal 346 - 400 from the ADC and is compared to the charge point variable CP.
Note line "chon = CP - y * 1000" when uncommented the charge 'on' time will decrease gradually as battery is more charged. When fully charged the charge voltage is disabled.
The variables chon (charge on time) and choff (charge off time) can be preset to any value.
One can experiment with this CP value. Too small, battery won't fully charge. Too large, battery will over charge.
The voltage input is connected to AD0 while the voltage on the battery is monitored at AD1.
This same circuit can be used with a 24-volt system by changing the 15K to 27K, and using a 24-volt relay.
The power for the Arduino itself can be obtained from the battery bank under charge through a 5-volt regulator or separate supply. Note if the battery bank is completely dead the circuit won't function with no power to the Microcontroller. A separate source for the controller is recommended.
This circuit will also work using a power supply instead of a solar panel as a simple battery charger.
I used this circuit to protect my solar panel charging system. The solar panel can produce a maximum current of 500mA. A really drained lead-acid battery can look like a dead short so this safely limits the current to protect the panel from possible damage.
The formula is Iout = 1.25V / RE. For 500mA RE = 2.5 Ohms.
See Introduction to Constant Current Circuits
Download code solar.cpp
- Added June 8, 2012:
- Introduction to Constant Current Circuits
- AC Power Control with PICAXE and a Dallas DS18B20 1-Wire Digital Thermometer
- Connecting the Dallas DS18B20 1-Wire Digital Thermometer to the PICAXE
- Main Listing of Electronics Projects:
- My YouTube Channel on Electronics
- Raspberry Pi & Linux
- Arduino Micro-controller Projects
- General Electronics Projects
- Microchip PIC18F2550 in C++
- Microchip PIC16F628A in Assembly
- PICAXE Micro-controller Projects
- How I got into Electronics