Learn how to build a solar-powered charger for 2 AAA NiMH batteries

this solar panel powered battery charger is another module in the Nifty Hobby Projects for LEDs and Solar series

Written by team-member Mark Ridley

photo of the completed project with the switch compartment removed so you can see inside
completed project with switch compartment removed so you can see inside

This tutorial shows you how to build a charger for 2 AAA NiMH batteries. You decide on which two battery capacities you want to be able to charge with it and there’s a switch to let you flip between them.

Set up your circuit for the 2 lowest capacity batteries you have and they’ll take one sunny day (10 hours) to charge. Then any higher capacity batteries can still be charged without harm – they’ll just take longer.
For example, I’ve set mine up to charge 800 or 1000mAh batteries but I’ve got some 1100mAh batteries and they’ll happily charge in just over a day on the 1000mAh setting.


Using renewable energy is really important as we try and counter the effects of global warming and this a fantastic and practical project for it – every household needs at least one!

If your kids (or you are a kid) have already shown interest in saving the planet, this could be a great project for them to get involved with. Who knows where it might lead?

On a more practical note, using a solar panel to charge your NiMH AAA batteries means you’ll always have some fully charged and ready to be used. Perfect for TV remotes, toys and other battery operated goodies.

Features of Module

Here’s the main things your charger will do:

  • fully charge your batteries in one sunny day (10 hours)
  • battery box switch allows 2 different battery capacities to be charged
  • you choose the capacities you want charged – you can charge higher capacity batteries than your chosen ones but they’ll take longer than the 10 sunny hours
  • green LED indicates when enough charging volts from the solar panel are present
  • red LED indicates when batteries are fully charged (and charging volts are present)
  • manufacturers’ recommended C/10 charging used so leaving them on charge once they’re fully charged won’t cause any harm

Circuit Diagram

schematic showing the circuit for a solar charger for 2 NiMH batteries
schematic for solar charger for 2 NiMH batteries
(click to see larger in new tab)

With the values shown for R1 in the schematic you’ll be able to charge either 2 x 800mAh (R1-1) or 2 x 1000mAh (R1-2) batteries, as selected by the battery box switch.

Circuit notes

The circuit is split into two parts:

  • a constant current section for charging the batteries
  • a voltage monitor section for indicating when the batteries are charged

Contant current section

This gets its power from the attached solar panel when the sun is shining and uses an LM317 chip to convert the power to a constant current for charging the batteries.

When there’s enough power available from the solar panel to put charge into the batteries, the green LED will be on. If it’s very dim, then you’ll only be getting maybe 10 or 20 milliamps into your batteries but at normal brightness, all is good.

The values of R1 used in the schematic limit the current to either 78mA (R1-1) or 96mA (R1-2). That’s just under the highest recommended charging current for 800mAh and 1000mAh NiMH batteries (C/10).

Voltage monitor section

This section uses a TLV431 adjustable shunt regulator chip to turn on the red LED when the voltage set by the values for R3 and R4 is reached.

With the values given in the schematic, the red LED will switch on when the battery voltage reaches 2.89V.

A fully-charged 1.2V NiMH battery is 1.5V, so 2 in series will be 3V. This means that when the red LED comes on, they’ll be at maybe 96% or so of full charge.

Note that leaving them charging once they’ve reached full charge won’t cause any damage because the current is limited to C/10, as recommended by battery manufacturers.

About the solar panel

As this charger is for 2 batteries, the voltage of the solar panel you’ll need is 6V. The solar panel power (watts) you need depends on the highest capacity of the batteries you want to charge. See the table at the end for details of the required solar panel wattage for common NiMH battery capacities.

NB If your solar panel includes a diode, it’s not needed so short it out. That way the panel’s full voltage will be delivered to the circuit and give the LM317T the headroom it needs.

Components list:

  • LM317LZ (TO-92 package – needed to fit in the available space) Adjustable Regulator for the constant current source
  • TLV431 Shunt Regulator for the charge completion detection
  • 1 x Green LED
  • 1 x Red LED
  • R1-1: Given here as 13Ω for a 1000mAh battery capacity
  • R1-2: Given here as 6.8Ω for a 2000mAh battery capacity
  • R2: 3.3kΩ current limiter for green LED
  • R3: 6.8kΩ
  • R4: 5.1kΩ
  • R5: 20kΩ
  • R6: 150Ω current limiter for red LED
  • hookup wire
  • 1.6mm diameter heatshrink tubing

Tools etc. you’ll need:

  • 18 Watt soldering iron, 25 Watts at a push
  • “Helping Hand” – invaluable aid while soldering or gluing
  • Wire strippers covering 26 to 16 AWG
  • Side cutters
  • Small snipe-nose / needle-nose pliers
  • Glue gun for insulating components and wires and fixing everything in place
  • UV glue for letting LED light shine through the battery box
  • Small hobbyist drill with a 2mm, 3mm, 4mm and 5mm drill bit

Preparing the battery holder

The circuit fits neatly into one battery slot in a standard AAA battery box so for this setup you’ll need a 3 AAA battery box.

In particular, you’ll need one with a switch compartment like the one shown in the photos below. The reason is that it is going to be used to house R1-1 and R1-2, so you need the room that this type gives.

Preparing the battery box

The goal here is to leave one battery slot empty for the stripboard holding the circuit and to shift the positive connector over one slot and place it at the other end.

After that you’ll be soldering the C/10 charge current resistors to the terminals of the exposed battery box switch.

removing the switch compartment cover

The first step is for you to carefully prise off the cover of the switch compartment. If it’s stubborn, you may have to use a small screwdriver to break where they’ve heat-sealed the tops of the plastic pillars to the cover.

switch compartment cover removed

In the next step, you’ll remove the positive connector from its retaining slots and the two-in-one connector at the other end, ready to be move the positive connector to its new position.

photo showing the removed connectors and so freeing up the spare battery box slot
removing the connectors to free up the spare battery box slot

Don’t throw that two-in-one connector away – put it in your box of bits as it might come in handy for you to use for something else in the future.

You can now put the positive connector into its new position as shown below.

placing the positive connector in its new position

Leave things as they are for now. You’ll be returning to it later to solder to the switch terminals the C/10 charge current resistors for the battery capacities you want to charge.

Stripboard layout

Here’s the stripboard layout of the circuit.

drawing of stripboard layout for circuit, also showing the battery box switch and C/10 charging current resistors
stripboard layout for circuit also showing the battery box switch
and C/10 charging current resistors
(click to see larger in new tab)

Because space in the spare battery slot is so tight, the resistors that set the C/10 charging current need to be placed separately. As mentioned before, there’s just enough room for the resistors in the little compartment at the top of the battery box which houses the switch.

Preparing to solder the wires and C/10 charging current resistors

First, you have to disconnect the existing negative terminal and the black wire from the switch:

photo showing the negative terminal and black lead that are to be disconnected from the switch
disconnecting the negative terminal and black lead from the switch

With them desoldered and disconnected you can now temporarily remove the switch and solder R1-1 and R1-2 and the yellow and orange (looks red on my monitor) wires as shown below.

It makes sense to me to use the left switch position (the one marked ‘off’) for charging the lower capacity batteries and vice versa. That said, I still got it wrong (R1-1 should be where R1-2 is and vice versa), as the observant reader will notice!

Build the stripboard and add the wires, making them a bit longer than needed to allow for mistakes. It’s easier to trim them down to size than to desolder and add new ones.

I use some heat shrink tubing to keep the various pairs together so I don’t lose track.

photo showing the C/10 charging current resistors R1-1 & R1-2 soldered to the battery box switch
C/10 charging current resistors R1-1 & R1-2 soldered to the battery box switch

With those soldered and your stripboard built (as per the layout diagram above), you can replace the switch in the battery box.

Next, solder a black wire to the negative battery box spring connector before putting the connector back into its retaining slots. Make sure it’s seated properly so it doesn’t stand proud and get in the way of the compartment cover when you come to replace it.

Now you can put the put the positive connector into the retaining slots at the opposite end (and one battery slot over) from where it came from. I had to snip a little off the top edge of the connector as it was standing a little proud, even though it was seated correctly.

photo showing everything in place in the battery box
the battery box with everything in place ready for routing the wiring

Connecting the wires

Connect up the wires to the stripboard, cutting their lengths almost down to size – better to err on the long side:

  • battery box negative (black)
  • battery box positive (red)
  • switch centre (orange but looks red in the pictures!)
  • C/10 charging resistors where they connect together (yellow)
  • twin leads for solar panel (red and black)

With that done you can now bunch all the wires from the stripboard together and fit them neatly into the slot as shown above. Finally, run the wires for the solar panel to the hole where they’ll exit from the battery box.

I’d recommend using a 2.1mm dc power connector socket on the solar panel wires so you can easily connect and disconnect the solar panel. Many of them come with a 2.1mm plug and if yours doesn’t, it’s easy enough to solder one on.

That should have finished the build, now on with testing.


Before final assembly, test that everything works ok:

  • connect the solar panel
  • flick the switch to the correct position for the battery capacity you’re charging
  • put in 2 AAA rechargable batteries
  • leave the solar panel where it gets full sunlight

The green LED should come on indicating that enough volts are present for charging the batteries. Now give it a few hours and, as long as the batteries weren’t really drained, the red LED should come on indicating that they’re fully charged.

If the batteries were really drained you’ll have to wait up to 10 hours (full sunlight) for them to reach full charge.

Final assembly / finishing touches

Once tested and you’re sure it’s working, apply some hot glue to hold the wires in place (see the photo at the very top). Also apply some around where the wires for the solar panel come out and fill the hole next to it as well.

With the battery box cover in place, how do you see the LEDs? Simple, you drill a couple of 5mm holes in the case to line up with them.

When you’ve done that, put a piece of sticky tape on the inside to cover the holes. Then turn over the cover, make sure the holes line up and put a few drops of UV glue into each hole (the sticky tale stops it running out).

You can now set the glue and remove the sticky tape leaving you with a great finished project.

If you misplace the holes (like I did) turn them into a slot and fill that with UV glue instead. The slot takes a lot more glue, so don’t do as I did!

Remember the old adage, “measure twice, cut once“!

The last thing I did was to plug the hole in the cover (that’s how it comes) with some black hot-glue.

And in conclusion

Thanks for having followed along and, even if you haven’t built the project, I’m sure you’ve learned a few things on the way.

I’d love to hear what you think, so please drop off a comment. If you did build it, let us all know how it went.


Battery capacities, resistor value(s) and solar panel power for C/10 charging

Find the 2 battery capacities you’ll be charging in the table below to get the values for R1-1 and R1-2. Remember, once you’ve done that, you can still charge higher capacity batteries – they’ll just take longer.

The minimum wattage of the solar panel you’ll need depends on the charging current needed for the highest capacity of those batteries (plus a little extra for the green LED). But never mind that, just get a 6 Volt 2 Watt solar panel and it will cover everything here and give you some spare capacity for days when it’s not quite so sunny.

Battery Capacity (mAh)C/10 current (mA)Nearest R1 value (Ω)Charging current using R1 (mA)6V Solar Panel (Watts)
resistors, charging currents and solar panel watts

Resistor calculation

If you need to, you can calculate the value of R1 yourself using the formula:

R1(Ω) = 12500 / battery capacity (mAh)

Solar Panel power calculation

I wouldn’t bother with this. As mentioned above, I’d just get a 6 Volt 2 Watt solar panel that will cover everything here and give some spare capacity so that it still charges on not-so-sunny days.

But if you want to calculate the solar panel power yourself, it’s given by:

Solar Panel Watts = Solar Panel Volts x (actual charging current for highest capacity battery as given by R1 + green LED current)

For 2 batteries and a 1000mAh battery (actual R1 charging current is 96mA), it’s:

Watts = 6V x (96mA + 10mA) = 0.636W

The next highest commonly-ish available Solar Panel is 0.7W

Other projects in the Nifty Hobby Projects for LEDs and Solar series (so far, more to come very soon):

Read all about NiMH rechargeable batteries on the Wikipedia Nickel-metal hydride battery page (opens in new tab / window)

Leave a Reply