Arduino Battery Charge Controller
This is a simplified version of my Solar Panel Battery Charge Controller Using Arduino. One can easily add the ideas from that project to this one.
Above is a generic Arduino Nano, but the code will work on any Arduino style microcontroller. The 5V regulator is build into the unit I used and if not use a separate 5V supply.
The battery voltage is measured from the TP1. The 10V Zener diode drops 10V leaving a voltage value of 0v-5V at TP1. Normally the battery/charge voltages range from 12V-14V. The Arduino ADC returns a 10-bit value from 0-1023 based on an input voltage of 0V-5V. A value of Vin should return an ADC number of about 600 based on a 12.7 volt input. The idea is if the battery voltage drops below 12.6V turn on the charge current from the solar panel, turn off the current then wait, then measure again.
A HIGH from DP2 switches on Q1/Q2. Q1 is a PNP bipolar transistor. In addition by adjusting the value of 1K resistor on Q1's base we can introduce current limiting in addition to acting as a power switch. See Introduction to Constant Current Circuits. Note in the video I was charging a 12-volt lead-acid sealed gel-cell type battery.
This is for small applications and if trying to charge a 1000-watt battery bank buy a commercial unit. Add a heat sink to Q1 if needed - other PNPs will work if they have sufficient collector current. See the following on various types of switching transistor circuits:
- Constant Current Circuits with the LM334
- Basic Transistor Driver Circuits for Micro-Controllers
- Tutorial Using TIP120 and TIP125 Power Darlington Transistors
- Driving 2N3055-MJ2955 Power Transistors with Darlington Transistors
- Understanding Bipolar Transistor Switches
- N-Channel Power MOSFET Switching Tutorial
- P-Channel Power MOSFET Switch Tutorial
The above uses a transistor switching circuit to turn on the Zener diode circuit to do a voltage measurement. This prevents the small, but steady discharge of the battery. You will have to add that to the following code.
Download the Arduino code solar_charger.txt.
The above program will produce this out on the Arduino serial monitor.
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.
- Quick navigation of this website:
- Basic Electronics Learning and Projects
- Basic Solid State Component Projects
- Arduino Microcontroller Projects
- Raspberry Pi Electronics, Programming
- Comparator Circuits:
- Comparator Theory Circuits Tutorial
- Comparator Hysteresis and Schmitt Triggers
- Voltage Comparator Information And Circuits
- Looking at Window Comparator Circuits
- Analog Battery Charger Uses Comparators
- Battery Charger related:
- Solar Panel Charge Controller Using Arduino Microcontroller
- Solar Panel Charge Controller Using PICAXE Microcontroller
- Solar Panel Battery Charge Controller Using Arduino
- Solar Panel Battery Charge Controller Switching Circuit
- Solar Battery Charger videos:
- Solar Panel Battery Charge Controller Operation
- Solar Panel Battery Charge Controller Circuitry
- Solar Panel Battery Charge Controller Programming
- Tutorial Arduino Measure Current with ACS712 Hall Sensor
- My YouTube Videos on Electronics
- Introduction to the Arduino Microcontroller
- Part 1: Programming Arduino Output
- Part 2: Programming Arduino Input
- Part 3: Arduino Analog to Digital Conversion
- Part 4: Using Arduino Pulse-Width-Modulation
- Zero-Crossing Detectors Circuits and Applications
- Zero-Crossing Circuits for AC Power Control
- In Depth Look at AC Power Control with Arduino
- Micro-controller AC Power Control Using Interrupts
- YouTube Video for Arduino AC Power Control
- Photo Detector Devices:
- LM334 CCS Circuits with Thermistors, Photocells
- Photodiode Circuits Operation and Uses
- Photodiode Op-Amp Circuits Tutorial
- Photo Voltaic Tutorial MOSFET Output Solid State Relays
- Photodiodes and How they Work
- Photodiode Op-Amp Circuits
- Using Photovoltaic MOSFET Drivers
Web site Copyright Lewis Loflin, All rights reserved.
If using this material on another site, please provide a link back to my site.