Go Down

Topic: Arduino-based opensource NiMH battery charger (Read 15463 times) previous topic - next topic



first post here. I'm developing on an Arduino-based NiMH (for AA or AAA) battery charger, I'm calling it Quite Smart Charger (or QSC). Eventually the project would allow to easily build a DIY smart battery charger that is fast but does not wear the battery through overcharging. Right now I have two sketches, one for discharging and one for charging. However the same circuit handle both charging and discharging so switching between the two is only a software issue (they can be integrated in a single sketch). So far only a single cell is supported. For charge termination I implemented 3 methods: negative delta V, timeout, overvoltage. The negative delta V method is a bit tricky since a 5-10mV voltage dip must be detected. This is the reason I use both HW and SW filtering. Optional temperature dT/dt sensing is on plan. The battery is "sensed", so, to start charging, you just push the battery in, to pause you pull the battery out. Led on 13 pin is ON while waiting for a battery.

I'm trying to keep the number of components to a minimum. However an external (at least 1A) powersuppply is compulsory for fast charging. The circuit I implemented uses an LM2941 (that includes a nice ON/OFF pin) to provide a constant current--see the attached schematic and picture. It uses 3 arduino PIN, 2 digital IO to control charge and discharge (pwrPin, dischargePin), and an analog input to monitor the battery voltage (inputPin). The circuit charges when pwrPin is LOW (and dischargePin LOW). Discharges with dischargePin HIGH (and pwrPin HIGH).

I do heavy filtering both hardware (1k-22uF LPF) and software averaging 8 voltage reads, once a second. 60 voltage acquisitions (1 minute) are stored in a circular buffer and averaged to have a stable reading once a minute to detect the negative delta V or overvoltage.The voltage acquisition is sent once a second to the serial port for logging. Additional info are on the header comment on the sketch file.

The discharge takes place at a constant current monitoring the cumulative energy (in mAh) being discharged.

So, please provide feedback, suggestions or additional ideas/contributions. Also would be nice to have some charge logs (serial dumps) for different cells in order to optimize the charging process.

Eventually we can get the best NiMH charger based on opensource hardware/software ;).

PS: For NiMH charging info you can refer to:
and linked documents.


Feb 15, 2012, 07:34 pm Last Edit: Feb 15, 2012, 07:37 pm by Tritemio Reason: 1
I just noticed that to run the discharge sketch you need a tiny library: Voltmeter. I attach it now. Please copy those files in the sketchbook/libraries/Voltmeter folder.


This is a great project.  I just started a similar project for 1 to 10 cells.  I have started my experiments with a simple voltage divider consisting of 2 resisters.  This is exciting.  Hopefully I can help contribute to the project!


Do you have pictures or schematics?

How is your project going?



What is the IC called out it seems you have labeled as an LM2961 but I have a hard time finding a datasheet or even a chip with that designation, can you help me out?




I was also thinking of making this project but it is not in the priority list right now.
I was just thinking to use the Arduino to measure the charging current and voltage in the battery and program it to stop charging after sensing a certain voltage or current level (indicate that NiMH is full), or may be do a trickle charge.

Good Luck, and keep us posted.


Hi everybody,

I didn't had time to develop further the QSC (Quite Smart Charger) project and unfortunately I'm quite busy right now, but I would gladly give guidance to anybody wants to take over the project.

Actually I was prompted to came back to the forum by a PM (since I have email notification), so if I don't answer please send me a PM and will be much more likely I'll notice it.

@jaydie: you can do the charger as you said (and the overvoltage feature on QSC does exactly that) but I noticed that, during charging at high current (>300mA), the NiMH voltage can reach values as high as 1.8V in some cells, or 1.6V on others. So with a fixed value you will either overcharge some cell or undercharge others. That's why I implemented the negative delta V method, that is not perfect either. So there is a timeout and an overvoltage protection also.

@wwbrown: the IC is the LM2941 low-dropout 1A voltage regulator. The nice thing about this IC is that it has  ON/OFF pin. The LM2941 in TO220 should not be hard to find. You can also build the circuit with a more ubiquitous LM317, that is not low-dropout (you need minimum 2 V between IN and OUT) and does not have an ON/OFF pin, so you need an additional power MOS to shut it down.

@pavels (PM):
1. The charging current is constant and determined by R* value. The only practical way to make the current software programmable in a range of values is using a DC/DC. Or using 2 or 3 different resistors values and select the level that you want with some power-MOS with low Rds-ON.

2. For R* selection you can use 2 0.5W resistors of 3.3 or 4.7ohm in parallel to obtain a current of 760mA or 530mA respectively. I didn't had big problems finding the resistors.

3. As you noticed, the discharge current is not at constant current as it across a resistance. The voltage though is quite constant when the cell is charge. When the voltage begins to go down there is a small energy left. The voltage-time curve is knee-shaped with an almost constant part (of several hours) and a sharp decrease of voltage (in few minutes) once the stored charge is finishing.

4. To charge multiple batteries indipendently you need to duplicate the circuit and the arduino controller.

5. In principle the mot efficient way of charging would be with a DC/DC or even better with a dedicated IC that takes care of the charging like the MAX712, MAX713. But since all the charging logic is implemented by the IC there is no need for the arduino anymore (except if you want to do some fancy display or USB communications).

Hope this information can be helpful.



Hi Antonino, thanks for sharing this interesting project.

Since renewable energy can only grow in importance, and I believe it will become very important, I am looking at your project as a good starting point for an "Open Source Battery Charger" project, which I think can be part of a kind of "Open Source Renewable Energy Toolbox" project/iniatiave…

My current thinking is to use QuiteSmartCharger as the charger MODULE together with a SOLAR MODULE and a BATTERY MODULE (could be 1 single 1.2V Cell), working as some kind of Renewable_Solar_Power_Unit (and also later, as Renewable_Wind_Power_Unit, etc)…

Solar Module + QSC + Battery Module = Renewable_Solar_Power_Unit

What I am thinking is the creation of a "Desktop Renewable Solar Unit", simple enough and cheap enough for the common citizens to use, manipulate, adapt, etc… where "desktop" means personal scope, small size, stuff that can be manipulated by the individual (like a desktop computer) using a single desk as the "workshop", and also, because the design is intended to be something to work with personal computers and Arduinos, Raspberrys and microcontrollers...

So, the word "desktop" just means "around the scope of a personal desk", like the PC (personal computer), that took computers from big scientific and industrial arenas and made its benefits available to common citizens...

This is a good way to look at this possibility:
i) Mainframe Computer <==> Big Power Utility Companies
ii) Mini Computer <==> Hundred of thousands Dollars solar farms and wind turbines
iii) Desktop PC <==> (kind of) "DESKTOP" RENEWABLE ENERGY TOOLS

QSC, at least in my point of view, looks a very interesting project to consider for this "category"...

I still learning about the subject of recharging batteries (Ni-Cad, Ni-MH, etc), so I am going to get a LM2941 and build QSC and do some experiments first… after that, I am thinking about experimenting also with LM317 with a MOSFET switch, since the LM317 is a popular IC, easy to get and very cheap…

For this first round of learning, I am reading a lot of information before going to the practical side of it, and I have some question that I like to ask, perhaps the answers can also help others…

If you can, or anybody that has experimented the (QSC) circuit/software, or anybody with enough knowledge, please give us a little input on the following questions:

1. What is the minimum (stabilized) IN-Voltage needed for the charger-circuit to work, considering just one 1.2V Ni-MH cell as target?

2. On the photo, are you using 2R7 Resistor for R* and also for Rd?

3. As for Resistor Rd (discharge resistor), 2 resistors of 0.5 Watt in parallel will fit the job?

4. For the discharge circuit (target 1.2V single cell), does it work with 1Amp, N-Channel, Low Rds-ON, (Power) MOSFET, or do I need to use something with higher Power capability like 5Amps, 20Amps?

5. Does the discharge MOSFET(s) need heat-sink?

[3 extra questions]
a) Is it correct to "break" your scheme into the "charger block", "discharge block" and "voltage reader block" according to these picture I am posting below?

b) Is the LM317 circuit below enough to work as an equivalent constant-current charger, so that we can adapt/use it with QSC software (preferable keeping both options with minor change in the soft)?

c) I am seeing some information about a new (?) Ni-H2, nickel hydrogen, type of batteries, does this new (?) type have, more or less, the same features as the Ni-Cad and Ni-MH, so that we will be able to use QSC hard/soft with them, as well?

Thanks all,

PS [Dedicated IC(s) versus MCU Controlled]
As you pointed, a dedicated IC can take care of every important aspect, so that the job can be accomplished without us having to worry about all these aspects, but I want to go on the direction of microcontroller basic designs because they offer much more in terms of flexibility, easy to modify, simplicity to understand, higher capacity to provide information (in digital form) and the ability to respond to control in a wide variety of forms, which means that they are much more "intelligent" in relation to the environmet... so, even with initial cost higher and using more complex set of hard/soft than the dedicated ICs, the MCU based design can EVOLVE (in the OpenSourcistic fashion) and adapt to a wide range of needs, thus justifying the initial cost and a little complexity...

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131