Create an Arduino Controlled Battery Charger

An Arduino and attached charging circuit can be used to monitor and control the charging of NiMH rechargeable batteries, here's how:

The finished device
Rechargeable batteries are a great way to power your portable electronics. They can save you a lot of money and when properly recycled, they are much better for the environment. In order to get the most out of your rechargeable batteries, they need to be properly charged. That means that you need a good charger. You could spend a lot of money on a commercial charger, but it's much more fun to build one for yourself. So here is how to build an Arduino controlled battery charger.
First it is important to point out that there is no universal charging method that is appropriate for all rechargeable batteries. Each type of battery uses a different chemical process to make it work. As a result, each type of battery needs to be charged differently. We can’t cover all the battery types and charging methods in this article. So for simplicity, we are going to focus on the most common type of AA rechargeable battery, Nickel-Metal Hydride (NiMH).

Materials:

Parts in order from left to right
Arduino Microcontroller
AA Battery Holder
NiMH AA Battery
10 ohm Power Resistor (rated for at least 5 watts)
1 Mohm resistor
1 µF Capacitor
IRF510 MOSFET
TMP36 Temperature Sensor
5V Regulated Power Supply
Prototyping Breadboard
Jumper Wires

How to Charge NiMH AA Batteries

Increasing the C-rate will charge the battery faster, but will increase the risk of damaging it
There are a lot of different ways that you can charge a NiMH battery. The method that you use depends mostly on how fast you want to charge your battery. The Charge rate (or C-rate) is measured relative to the capacity of the battery. If your battery has a capacity of 2500mAh and you charge it with a current of 2500 mA, then you are charging it at a rate of 1C. If you charge it with a current of 250 mA, then you are charging it at a rate of C/10.
When charging your battery quickly (at a rate higher C/10), you need to carefully monitor the battery’s voltage and temperature to make sure that you don’t overcharge it. This can seriously damage your battery. However, when you charge your battery slowly (at a rate of C/10 or less), it is much less likely to damage our battery if you accidentally overcharge it. Because of this, slow charging methods are generally considered to be safer and will help maximize battery life. So for my DIY battery charger, I decided to use a charge rate of C/10.

The Charging Circuit

The circuit design for this charger is a basic Arduino controlled power supply. The circuit is powered by a 5 volt regulated voltage source such as an AC adapter or an ATX computer power supply. Most USB ports would not appropriate for this project because of the current limitations. The 5V source charges the battery through a 10 ohm power resistor and a power MOSFET. The MOSFET sets how much current is allowed to flow into the battery. The resistor is included as an easy way to monitor the current. This is done by connecting each terminal to analog input pins on the Arduino and measuring the voltage on each side. The MOSFET is controlled by a PWM output pin on the Arduino. The pulses of the pulse width modulation signal are smoothed out into a steady voltage signal by a 1M resistor and a 1 µF capacitor. This circuit allows the Arduino to monitor and control the current flowing into the battery.



The Temperature Sensor

The temperature sensor prevents the battery from overcharging and causing a safety hazard

As an extra precaution, I included a TMP36 temperature sensor to monitor the temperature of a battery. This sensor outputs a signal voltage that directly corresponds to the temperature. So it doesn’t require calibration or balancing like a thermistor does. The sensor is mounted in place by drilling a hole in the back of the battery housing and gluing the sensor in so that it sits against the side of the battery when installed. The pins of the sensor are then connected 5V, GND, and an analog input pin on the Arduino.


The AA battery holder before and after being placed on the breadboard


The Code


The code for this project is reasonably straight forward. There are variables at the top of the code that allow you to customize your charger by inputting the values of the battery capacity rating, and the exact resistance of your power resistor. There are also variables for the safety thresholds of the charger. The maximum allowable voltage of the battery is set to 1.6 volts. The maximum temperature of the battery is set to 35 degrees Celsius. The maximum charge time is set to 13 hours. If any of these safety thresholds is exceeded, the charger is turned off.
In the body of the code, you will observe that system constantly measures the voltages of the terminal of the power resistor. This is used to calculate both the terminal voltage of the battery and the current flowing into the battery. This current is compared to the target current which is set to C/10. If the calculated current is different from the target current by more than 10 mA, the system automatically adjusts the output to correct it.
The Arduino uses the serial monitor tool to display all the current data. If you wish to monitor the performance of your charger, you can connect the Arduino to the USB port on your computer, but this is not necessary as the Arduino is powered by the 5V power supply of the charger.


You can find a downloadable version of the full code below:

 

Now that you have the knowledge, you can get started on a charger of your own. Be sure to monitor your charge rate and use safety protocols, as excessively charging a battery can be dangerous. 
Previous
Next Post »
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.
Related Posts Plugin for WordPress, Blogger...

Label

KITAIFA NEWS KIMATAIFA MICHEZO BURUDANI SIASA TECHNICAL ARTICLES f HAPA KAZI TU. LEKULE TV EDITORIALS ARTICLES DC DIGITAL ROBOTICS SEMICONDUCTORS MAKALA GENERATOR GALLERY AC EXPERIMENTS MANUFACTURING-ENGINEERING MAGAZETI REFERENCE IOT FUNDAMENTAL OF ELECTRICITY ELECTRONICS ELECTRICAL ENGINEER MEASUREMENT VIDEO ZANZIBAR YETU TRANSDUCER & SENSOR MITINDO ARDUINO RENEWABLE ENERGY AUTOMOBILE SYNCHRONOUS GENERATOR ELECTRICAL DISTRIBUTION CABLES DIGITAL ELECTRONICS AUTOMOTIVE PROTECTION SOLAR TEARDOWN DIODE AND CIRCUITS BASIC ELECTRICAL ELECTRONICS MOTOR SWITCHES CIRCUIT BREAKERS MICROCONTROLLER CIRCUITS THEORY PANEL BUILDING ELECTRONICS DEVICES MIRACLES SWITCHGEAR ANALOG MOBILE DEVICES CAMERA TECHNOLOGY GENERATION WEARABLES BATTERIES COMMUNICATION FREE CIRCUITS INDUSTRIAL AUTOMATION SPECIAL MACHINES ELECTRICAL SAFETY ENERGY EFFIDIENCY-BUILDING DRONE NUCLEAR ENERGY CONTROL SYSTEM FILTER`S SMATRPHONE BIOGAS POWER TANZIA BELT CONVEYOR MATERIAL HANDLING RELAY ELECTRICAL INSTRUMENTS PLC`S TRANSFORMER AC CIRCUITS CIRCUIT SCHEMATIC SYMBOLS DDISCRETE SEMICONDUCTOR CIRCUITS WIND POWER C.B DEVICES DC CIRCUITS DIODES AND RECTIFIERS FUSE SPECIAL TRANSFORMER THERMAL POWER PLANT cartoon CELL CHEMISTRY EARTHING SYSTEM ELECTRIC LAMP ENERGY SOURCE FUNDAMENTAL OF ELECTRICITY 2 BIPOLAR JUNCTION TRANSISTOR 555 TIMER CIRCUITS AUTOCAD C PROGRAMMING HYDRO POWER LOGIC GATES OPERATIONAL AMPLIFIER`S SOLID-STATE DEVICE THEORRY DEFECE & MILITARY FLUORESCENT LAMP HOME AUTOMATION INDUSTRIAL ROBOTICS ANDROID COMPUTER ELECTRICAL DRIVES GROUNDING SYSTEM BLUETOOTH CALCULUS REFERENCE DC METERING CIRCUITS DC NETWORK ANALYSIS ELECTRICAL SAFETY TIPS ELECTRICIAN SCHOOL ELECTRON TUBES FUNDAMENTAL OF ELECTRICITY 1 INDUCTION MACHINES INSULATIONS ALGEBRA REFERENCE HMI[Human Interface Machines] INDUCTION MOTOR KARNAUGH MAPPING USEUL EQUIATIONS AND CONVERSION FACTOR ANALOG INTEGRATED CIRCUITS BASIC CONCEPTS AND TEST EQUIPMENTS DIGITAL COMMUNICATION DIGITAL-ANALOG CONVERSION ELECTRICAL SOFTWARE GAS TURBINE ILLUMINATION OHM`S LAW POWER ELECTRONICS THYRISTOR USB AUDIO BOOLEAN ALGEBRA DIGITAL INTEGRATED CIRCUITS FUNDAMENTAL OF ELECTRICITY 3 PHYSICS OF CONDUCTORS AND INSULATORS SPECIAL MOTOR STEAM POWER PLANTS TESTING TRANSMISION LINE C-BISCUIT CAPACITORS COMBINATION LOGIC FUNCTION COMPLEX NUMBERS ELECTRICAL LAWS HMI[HUMANI INTERFACE MACHINES INVERTER LADDER DIAGRAM MULTIVIBRATORS RC AND L/R TIME CONSTANTS SCADA SERIES AND PARALLEL CIRCUITS USING THE SPICE CIRCUIT SIMULATION PROGRAM AMPLIFIERS AND ACTIVE DEVICES BASIC CONCEPTS OF ELECTRICITY CONDUCTOR AND INSULATORS TABLES CONDUITS FITTING AND SUPPORTS CONTROL MOTION ELECTRICAL INSTRUMENTATION SIGNALS ELECTRICAL TOOLS INDUCTORS LiDAR MAGNETISM AND ELECTROMAGNETISM PLYPHASE AC CIRCUITS RECLOSER SAFE LIVING WITH GAS AND LPG SAFETY CLOTHING STEPPER MOTOR SYNCHRONOUS MOTOR AC METRING CIRCUITS APPS & SOFTWARE BASIC AC THEORY BECOME AN ELECTRICIAN BINARY ARITHMETIC BUSHING DIGITAL STORAGE MEMROY ELECTRICIAN JOBS HEAT ENGINES HOME THEATER INPECTIONS LIGHT SABER MOSFET NUMERATION SYSTEM POWER FACTORS REACTANCE AND IMPEDANCE INDUCTIVE RESONANCE SCIENTIFIC NOTATION AND METRIC PREFIXES SULFURIC ACID TROUBLESHOOTING TROUBLESHOOTING-THEORY & PRACTICE 12C BUS APPLE BATTERIES AND POWER SYSTEMS ELECTROMECHANICAL RELAYS ENERGY EFFICIENCY-LIGHT INDUSTRIAL SAFETY EQUIPMENTS MEGGER MXED-FREQUENCY AC SIGNALS PRINCIPLE OF DIGITAL COMPUTING QUESTIONS REACTANCE AND IMPEDANCE-CAPATIVE RECTIFIER AND CONVERTERS SEQUENTIAL CIRCUITS SERRIES-PARALLEL COMBINATION CIRCUITS SHIFT REGISTERS BUILDING SERVICES COMPRESSOR CRANES DC MOTOR DRIVES DIVIDER CIRCUIT AND KIRCHHOFF`S LAW ELECTRICAL DISTRIBUTION EQUIPMENTS 1 ELECTRICAL DISTRIBUTION EQUIPMENTS B ELECTRICAL TOOL KIT ELECTRICIAN JOB DESCRIPTION LAPTOP THERMOCOUPLE TRIGONOMENTRY REFERENCE UART WIRELESS BIOMASS CONTACTOR ELECTRIC ILLUMINATION ELECTRICAL SAFETY TRAINING FILTER DESIGN HARDWARE INDUSTRIAL DRIVES JUNCTION FIELD-EFFECT TRANSISTORS NASA NUCLEAR POWER SCIENCE VALVE WWE oscilloscope 3D TECHNOLOGIES COLOR CODES ELECTRIC TRACTION FEATURED FLEXIBLE ELECTRONICS FLUKE GEARMOTORS INTRODUCTION LASSER MATERIAL PID PUMP SEAL ELECTRICIAN CAREER ELECTRICITY SUPPLY AND DISTRIBUTION MUSIC NEUTRAL PERIODIC TABLES OF THE ELEMENTS POLYPHASE AC CIRCUITS PROJECTS REATORS SATELLITE STAR DELTA VIBRATION WATERPROOF