Smart Battery Charger (no Soldering!)

15K23415

Intro: Smart Battery Charger (no Soldering!)

Many AA or AAA battery chargers charge batteries in pairs, but plenty of devices use 1 or 3 batteries, meaning that some of your batteries get overcharged and some get undercharged. NiCd and NiMH batteries also benefit from an occasional full discharge, which most normal battery chargers won't do.

If you're anything like me you'll end up with a lot of rechargeable batteries, none of which end up being charged properly, and some of which turn out to be completely unusable. It'd be perfect if you had a low-power battery charger that you could leave on all the time, that would charge your batteries individually, automatically discharge them, and give you an idea of their real capacity. That's what you'll make in this tutorial!

Note: To make this nice and easy, the charger uses Espruino's GPIO pins to directly charge and discharge the batteries. This means it can't charge batteries very quickly (it can take days to charge and discharge them!). NiMH batteries benefit from an occasional fast charge/discharge, which this charger can't provide without some extra components - so it's not perfect, but it is easy to build and will make sure your batteries are always topped up.

STEP 1: What You Need...

You just need:

  • One Espruino Pico
  • A long Breadboard
  • A Nokia 5110 (PCD8544) LCD display
  • Some patch wire (normal solid core wire is fine)
  • 4x 100 Ohm resistors
  • AA or AAA battery holders with pins (available from Rapid Electronics: AA or AAA)

STEP 2: Wiring Up

  • Place the breadboard with the `-` row of pins right at the bottom, and the `+` row right at the top.
  • Plug the Espruino Pico into the breadboard as far left as it will go (as in the picture)
  • Add a wire from Espruino's `GND` pin straight down to the bottom `-` row of pins
  • Plug the LCD display into the breadboard below the Pico, with 2 pins sticking out to the right of the Pico (it should overlap the GND wire)
  • Take a patch wire and connect from pin `B1` on the Pico to the top of a column 5 pins to the right of the Pico (see the picture)
  • Fold a 75 Ohm resistor, cut it to length, and add it diagonally between the 5th column right of the Pico and the 6th.
  • Now add 3 more sets of wires and resistors, from pins `A7`, `A6` and `A5`, to new columns, each with 7 columns of pins between it and the last. Note: This works for AAA batteries - for AA you will need to space the columns out a bit more.
  • Cut the pins on your battery holders down so they'll fit in the breadboard, and then place the battery holders in the breadboard at an angle: With the `+` contact relative to the resistor (as shown below), and with the `-` contact in the bottom `-` row of pins on the breadboard.
  • Now add 2 wires for the LCD: `B10` to the pin nearest the Pico, and `B13` to the pin right on the edge.

And you're done!

STEP 3: Software

Plug the Espruino Pico into your computer, start the Web IDE, connect, and update the firmware (see Espruino's Quick Start tutorial for more information on this).

Then download the attached file and open it in the Web IDE. Click the 'upload' button, and when that's done click on the left-hand side of the IDE and type `save()` and press Enter.

The screen should show "Loading...", and 2 seconds later will start showing the charging status of the 4 batteries.

STEP 4: Using the Charger...

Just plug in your batteries and they'll be recognised. The LCD will show the current voltage, and `DIS` next to the battery to mark that is is discharging (at around 20mA - this could take a few days!).

  • The top counter will show roughly how much power has been drained from the battery so far (in something close to mAh).
  • When the battery reaches 0.8v, Espruino will start recharging it. The top counter will now give you some idea of the cell's capacity (in something close to mAh)
  • Espruino will keep recharging the battery at around 20mA while it is displaying `CHG`, and the second counter will show how much power has been added to the battery (in something near mAh). Both NiMH and NiCd batteries are fine with being 'trickle charged' at this level for long periods of time.
  • You can press the Pico's button to swap all cells between charging and discharging. If you want to swap just one cell, disconnect it for a few seconds and reconnect it.

14 Comments

I noticed that in your initial specs you say 100 ohm resistors and in the text you say 75 ohm resistors.

75 is what I had handy - if the battery isn't totally dead the current put into it will be roughly 2.5 divided by the resistance maximum - so 100 ohms = 25 milliamps. 75 Ohms would be 33 - it's not that different, but probably 100 is more kind to the microcontroller (having said that, mine's been running for 2 years non-stop and is still ok)

This charging setup will result in longer lasting batteries!
Trickle charging is the way to go with these batteries.

Simply no!

There's been quite extensive research on this topic and the conclusion is, that consistent trickle charging is the method that gives the least lifetime. First get them to the dV/dt point of close to -5mV for NiCd and 0mV for NiMH, then you can trickle charge for cell balancing with around C20 (or less) for up to a day or so - To keep them from slow cooking in an "always on the ready" (float) charger, trickle current should be around C300! Further, with trickle charging, it's very important to keep the End of Charge voltage steady at a precise voltage (depending on type NiCd/NiMH and temperature).

Have a nice day :)

Do you have a link to any of that research? When doing this I had a quick Google, and the places I looked at didn't show any warnings about trickle charging with small currents - including Energiser's datasheet for their NiMH batteries.

Energiser's datasheet recommends 0.025C or less, so 20mA is about spot on for an 800mAh NiMH AAA, and well under for a 2500mAh AA.

Even so, as the whole charging process is written in JS code it'd be easy to tweak it to do whatever is considered right (I could change the code posted up here?). It would be better to have some extra hardware so it could do a faster charge at first though.
It is not really any cutting edge research any more but a well known fact. This info is available on the datasheets that every Ni Cd/MH battery manufacturer provides. Do not trickle charge those batteries unless it is a one off thing.

Hi,

The issue with trickle charging as the only charge method is, besides possible overcharging, that you'll get voltage depression (what many people erroneously call "Memory"), which worsen over time. Fast charging and occasionally fast discharges is the remedy to that.

I wish that I could point you to something specific, but my old laptop died not so long ago and I haven't gotten around to transfer the HD of that (which has got more research papers than you'd probably like to read anyway), I can point you to e.g. Energizers Application Manual for NiMH

And look at their chargers

Their slowest charger is 8 hours and the fastest is 15 minutes (I wouldn't recommend anything faster than ~4 hours as your only charger though). Wonder while they don't sell a 15 hour charger, if that was the best for the cells?

Secondary cells isn't something that you get to know from a quick Google, which seldom gives you the good stuff anyway - Sadly, Google web search have been going downhill for years, when it comes to giving good search results.

About the C-rate as used when talking charge/discharge. While it's not mathematically wrong how Energizer uses e.g. 0.025C, there's a convention that says that nnC means nn times C and if less than one, you write it as Cnn, meaning C divided by nn. While this may seem pedantic, there is a reason to uphold that convention: 0.025C isn't as immediately understood as C40, although they both means the C rating divided by 40.

If you want to change something, consider adding a power stage to each I/O you use - you should newer attach anything like this unbuffered and you'd need something like a half bridge with tristate ability for each cell, to be able to charge, discharge and stay idle (tristate/high impedance)

If you further add voltage and current monitoring for each cell (using Kelvin monitoring for the voltage) you're on your way to a good setup. and you'll be able to log charge/discharge curves, measure internal resistance and act on discrepancies and test out a variety of charge profiles and protocols. I'm working on/off on a similar setup, as I think my, otherwise really good, Ansmann charger is playing tricks on me - I always get a single cell die fast in my cam batteries (in two different sets) and it's a bummer when you just charged them and they die on you when you're out shooting.

If you have questions about some of this, I'll be happy to help.

Have a nice day :)

Thanks - yes, I'd guessed about the C40 and 0.025C. I'm aware that this charger isn't the best (I'll update the text to make that clearer), but it *is* very simple and easy to make, which was kind of the idea - and I still think that it's better for cells than if you stuck a charged + uncharged cell as a pair into a fast charger.

It should be able to log charge and discharge curves as it is, but yes - ideally you'd have the ability to put a bit more power into the batteries - it just means a bit more complexity in the hardware.

Hi,

I didn't mean to put your project down at all, I merely reacted to the false statement from muddog15.

I think it would be a nice feature if you include logging. It doesn't have to have a very high sample rate, every 5th or 10th minute would give a very good time resolution and it could be even lower than that without suffering.

If I put a flat cell and a half charged cell in my charger, they come out full and nothing more, as in smart chargers, each cell is handled selectively - I can even drop cells in while another cell is almost full and a third is half full. It's like having four separate chargers (although I have a weak suspicion that one of the slots is playing hookey on me). All smart chargers I know of handles the cells separately and charge termination is done several ways: Delta-V/delta-T, temperature and time, so if a cell gets too hot before the dV/dT terminates, it is terminated anyway and likewise if it takes longer than the allowed time. When a cell is put in the charger, there's a test procedure, where it checks if the cell is OK and it's not a primary (non-rechargeable) cell. There's a reason they're called smart chargers :)

Making your own smart charger from the button up, enables you to develope and test alternative charge methods and it won't be hard to make it for all the chemistries you may like to charge, as long as you know the specifics of each.

Have a nice day :)

Nice idea, but for charging NiCD batteries the charge rate is dV/dT, and for NiMH the charge rate is dT/dT (time over temperature). When charging NEW cells/packs, the industry standard is 14-16 hours, then after, normal charging regimens apply. I commend the effort, but a little more research will improve this project.

It's not really about that - as I said right at the start of it this isn't the perfect way to charge batteries. I could have filled the breadboard full of FETs and temperature sensors, but this is about getting something that works and is useful in about the simplest way possible.
can i charge 18650 Li-ion batteries?
Not with this setup, no... The Espruino will only produce and measure up to 3.3v, and the batteries need around 4.2v. You could add some extra components to make it work, but to be honest it's probably safer to buy a special LiPo charger board - they're pretty cheap and reliable.