Build a Solar Battery Charger For Ni-MH Batteries

March 16, 2016 by Jacob Smith

Build a simple solar powered battery charger for Ni-MH batteries.

You could buy a solar powered battery charger, but it's cheaper and more fun to make one yourself.

If you're like me and you like to spend a lot of time in the backcountry, this means you don't have any way to charge you devices. You could go look at a commercial solar battery charger, but for popular brands, these can easily cost $100 or more. So why not build one yourself?

In its simplest form a battery charger applies a voltage, or current, to the positive terminal of a battery. This will cause the battery to charge and its voltage will increase. The only time I know of anybody charging a battery with such a simple system is jump starting a car. Just applying a voltage to a battery may charge it, but it has no system to protect the battery. Every battery's chemistry has unique properties, including but not limited to; nominal voltage, max voltage, energy density, self-discharge rate, internal resistance, and life cycle. Because of the unique requirements of each battery chemistry, it is important to first specify which battery chemistry we want to use.


Charging a Single AAA Battery


Battery Selection

Currently, there are 3 common rechargeable battery chemistries used for consumer devices. We have lithium ion, nickel metal hydride(Ni-MH), and nickel cadmium(NiCd). So let's start with the nominal voltage for lithium ion. It varies from 3.2 V to 3.7 V, Ni-MH is 1.2 V, and NiCd is also 1.2 V. Because most consumer devices use either internal batteries, AA, or AAA batteries. Let's eliminate the lithium ion because its nominal voltage is over twice the voltage of AA or AAA batteries. If we then compare the energy density of Ni-MH and NiCd, we find that Ni-MH has an energy density of 140-1,000 Wh/L and NiCd has an energy density of 50 - 150 Wh/L. So I'm going to use Ni-MH for the better energy density.

Battery Charging Methods

There are details in charging methods for all battery chemistries, and I recommend finding a good source of information for whichever chemistry you choose to work with. For Ni-MH, Panasonic and Energizer have both made excellent materials available.

In order to charge a battery fast (in under a few hours) a microcontroller is normally used to monitor both the battery voltage and temperature. If voltage begins to drop, then the battery has reached a state of overcharge and the charger shuts down. If temperature begins to rise rapidly, it could mean damage to the battery, or that a state of overcharge has been reached and the charger shuts down. 

If time isn't a concern, another method is to slowly charge the battery with a timer to shut it down after 12 to 14 hours. To avoid overcharge, the battery charger requires that batteries have a minimum capacity. But if the batteries have a greater capacity than the minimum that the charger was designed for, they will not be fully charged. A simple solution but almost requires battery capacity to be specified by the charger.

Another option is to trickle charge the batteries. To fully charge an empty battery following Energizer's recommendations would take 60 hours. Not very practical for fully charging a battery, rather it is often used as a secondary charge method. Once the batteries are full, a trickle charge is started to keep the batteries "topped off". 

Let's consider what might be the best method for our solar charger. The trickle charge will take too long, so let's discount it. The time-based charger also quickly runs into problems; if the solar charger lost power, the timer would reset, resulting in overcharging. This could be solved by adding a battery for just the timer. However, if power was lost, then the timer would still be going, but not charging the batteries, resulting in a battery that was not charged. Because of the long charge time of the timer method, it will almost always lose power. So the timer method is out. Using a microcontroller seems like a good choice, but it's a much more complex system. It will have to have a thermistor for each battery slot, and one to measure the ambient temperature. We also then have to measure voltage on every battery, and it may not be able to do the fast charging because of power limitations from the solar panel. 

Every one of the presented methods seems to have limitations that cause concern. Instead of just using one of these methods, I propose a method that takes components of the timer and microcontroller methods. We use a comparator to monitor voltage and prevent overcharge, but use the low charge rate of the timer to protect the battery. This does present some limitations but offers a simpler design that is easy to scale; a system that does not need continuances power and is safe.


Because this device will not be in a temperature controlled environment, I recommend all components have a maximum operating temperature of at least 70C and a minimum of at least -25C. Although 70C is higher than any expected air temperature, the charger will be sitting in the sun, pushing the device temperature higher and could easily reach temperatures over 50C. 

First, we need to select a solar panel. I selected a 5 W panel, it has an open circuit voltage(Voc) of 22 V and a short circuit current(Isc) of 300 mA. The high voltage of this panel allows it to be used to charge 12 V car batteries, something I thought desirable. It was also pretty affordable. The 300 mA current does limit the number of batteries we can charge simultaneously to a couple small batteries or one large one.

We talked about battery chemistry earlier, but we didn't talk about capacity or form factor. You probably have a form factor(AA, AAA, etc.) in mind as you probably have a particular device that you would like to recharge batteries for. I will be designing mine for 1100 mAh AAA Ni-MH, but the chemistry and capacity really define the electric characteristics. As a general rule of thumb, the larger the battery, the greater the capacity. However, subtle differences in the packaging and technology mean that one AAA may have a different capacity than another AAA.

We have a power source, and batteries to charge, so let's start the rest of the design work. I mentioned earlier that I would be using a comparator which means we need a reference voltage. Often, this can be done with a voltage divider, but because our power supply is highly variable, I chose to use a voltage regulator. The LM317 is a common voltage regulator, easy to use, inexpensive, and has a high operating temperature. The output voltage is controlled by 2 resistors. I will use a second Second LM317 to make a 12 V line that I will use as VCC for the rest of circuit.


Lm317 configured for an output of 1.47V


Lm317 configured for 12V output

For the transistor for the LED, I used a 2N3904, the emitter was connected to a current limiting resistor and LED in series. This gives an indication of when the battery is charging and when our battery is full.

For the transistor that controls the battery current I used a IRF840 power transistor. It exceeds the specifications and is inexpensive, but could be replaced with a power transistor of your choosing. The transistor is connected in series with a  current limiting resistor and the battery.

Now this will charge your battery, but I decided to go a little further, and add another system to limit the current. I added another power transistor and connected the gate to a 555 timer. The 555 timer is configured to have 80% duty cycle with a frequency of 1KHz. This limits the average current, but it also guarantees that the indicator LED will have some time with sufficient current to run bright enough to see under a bright sun.


555 timer configured for 80% duty cycle at 1KHz

I constructed a prototype of the circuit on a breadboard with space to charge a single AAA battery. Time-averaged current flow to the battery was measured at 90 mA on a sunny winter day. I discharged and then charged four batteries with the solar charger, and then charged four with a commercial charger made by Duracell. Voltage was measured on each battery to make a limited comparison.

Battery Voltages


The Solar Charger batteries had an average voltage of 1274mV and the Duracell Charger batteries had an average Voltage of 1295mV. The slightly lower voltage is not surprising because the solar charger was designed to end the charge cycle 30mV under max voltage. You now have the complete design for your own solar charger.


Solar charger schematic for a single battery


Suggestions For Next Steps

Add more batteries
Add an indicator LED for power to the charger
Add a trickle charger after primary charge


Give this project a try for yourself! Get the BOM.

  • B
    belspb March 16, 2016

    Why use another IRF840 where you have already one for the same purpose.

    Like. Reply
    • J
      Jacob Smith March 17, 2016
      Each IRF840 can turn off the battery, but it takes both on to charge the battery. The IRF840 being driven by the 555 timer is to be used to tune the current to the battery. The second IRF840 is controlled by the comparator and will shut down the charger when fully charged. If multiple batteries are to be charged each battery will need its own comparator and IRF840. How ever the IRF840 being driven by the 555 timer can be shared among multiple batteries.
      Like. Reply
      • Abrar01113005 February 23, 2020
        Hi, I am beginner would you please let me know how we can share the IRF840 (M2) driven by the 555 timer for multiple batteries? Thank you
        Like. Reply
  • tonyr1084 March 18, 2016

    On the comparator; the power in, there’s a capacitor (looks like C3).  It goes from Vp to the power in on the comparator.  Yet, there’s also a direct line to Vp.  Doesn’t this short C3?  If so, C3 is doing nothing for the circuit.  Am I missing something or is there an error in the schematic?

    Like. Reply
    • J
      Jacob Smith March 18, 2016
      It should be from vp to ground, I'll try to fix that this weekend. The bypass capacitor provides stability, at dc the comparator would probably works fine without it, but I can't confirm that.
      Like. Reply
      • tonyr1084 March 18, 2016
        Both C1 & C3 are 0.1µF. Wouldn't C3 be redundant at this point? You already have filtration at the output of the 12 v regulator. Also, can you publish a parts list?
        Like. Reply
      • J
        Jacob Smith March 21, 2016
        R5 and C1 are needed for the comparator to function correctly. Did you mean C3 and C2? If so they are somewhat redundant, because wires are really transmission lines it is preferable to add a capacitor as close as possible to the power terminals of most IC's. If you want to save a few cents you could remove one. In reality this is functioning pretty close to DC and you could probably remove both capacitors. But I never tested it, and won't promise that it won't effect performance.
        Like. Reply
  • J
    Jacob Smith March 21, 2016

    I have submitted an updated schematic to correct the short on C3. I also submitted a parts list to be added, but that may take a few days so until then.

    Ref. Mfg. Part No. Description

    C1——capacitor, 10µF
    C2——capacitor, 100nF, 25V
    C3——capacitor, 100nF
    C4——capacitor, 1µF
    C5——capacitor, 10nF
    C6——capacitor, 100nF
    D1—D diode
    M1—IRF840 MOSFET
    M2—IRF840 MOSFET
    Q1 NXP 2N3904 bipolar transistor
    R1——resistor, 470
    R2——resistor, 4K
    R3——resistor, 220
    R4——resistor, 39
    R5——resistor, 10
    R6——resistor, 56K
    R7——resistor, 330
    R8——resistor, 820
    R9——resistor, 270
    U1 LM317
    U2 LM317
    U3 1100 mAH NiMH battery
    U4 LM2901
    U5 NE555 TIMER

    Like. Reply
  • dougp01 March 25, 2016

    Nice design and we’ll thought out. I need something like this for my solar circuit used for a gardening darkness detector. I especially like the pulsed charging.

    In the interest of reducing circuit complexity and physical size, why don’t you simply get rid of one MOSFET, and route the comparator output to pin 4 of the 555 timer chip. When the cells are charged the astable simply turns off. 

    Best, doug

    Like. Reply
    • J
      Jacob Smith March 25, 2016
      Thank you for the complement. For a single battery you could use pin 4 of the 555 timer, but if you plan on adding multiple batteries you can't do that. And I designed this with the plan to be able to charge 4 AAA and 4 AA simultaneously.
      Like. Reply
      • H
        hhiginio April 08, 2016
        Hello Jacob if I want to connect multiple batteries 4 AAA which changes should I do in the circuit? 4 baterrias must connect in series or in parallel? and what changes in the circuit please, thank you very much for your answer.
        Like. Reply
      • J
        Jacob Smith April 14, 2016
        for 4 batteries they need to be in parallel. you should add another 3 irf840 transistors, as well as another 3 resistors and 3 capacitors for the outputs of the comparitor. Then you should add another power limiting resistor for each battery. Hope that helps.
        Like. Reply
  • P
    pascor2 April 08, 2016

    This article forgot to mention this charger will destroy any NiMH battery in time. Rechargeable batteries are required to be overcharged in order to maintain their health. Chargers *must* have “intelligence” to sense the correct fully-charged condition.

    Like. Reply
    • J
      Jacob Smith April 14, 2016
      Almost all batteries have memory, and this will shorten the life span of the batteries. How ever NiMH the memory is not consider significant. I have seen the expect life under optimum charge and discharge conditions to be just 2 years by one manufacture. And of the documentation I have read I have not found one article or manufacture that mentions the memory has a concern with NiMH. If you have a source that states the memory to be a major concern I would love to read it.
      Like. Reply
  • P
    picopi April 10, 2016

    Sorry, I can’t see the point of building a low power setup like this, when I can buy an already-made one, for half the price.
    These dim-a-dozen articles are plenty. I’d like to see some one brave it and write a DIY article on how to make something real useful that would also save you money.
    A programmable 1KW solar/wind SLA/Lipo charger, using an Arduino? Now that’s something worth writing and reading about.

    Like. Reply
    • J
      Jacob Smith April 14, 2016
      I'm sorry this article didn't meet your expectations, and perhaps in the future I will do an article similar to what you suggest. Or you could help out the writers here and design one and post it up, I would love to see another design about using renewable resources.
      Like. Reply
      • Xenophon April 15, 2016
        I liked it and appreciated it. This is about my level and will help me learn a few things along the way.
        Like. Reply
  • tranzz4md September 18, 2016

    While not quite as disappointed as another member, I’m looking for something a bit better than can be had from 5w solar.  My lack of familiarity with these components leads me to ask you, how much larger a solar panel do you feel this charger could actually handle?

    Like. Reply
    • J
      Jacob Smith September 18, 2016
      The design is limited by the voltage regulator and the power transistors. Get a voltage regulator designed for more current and you could scale it up to handle a lot more power. Same story for the power transistors. But the design is for charging small NiMH batteries, you could apply the same method for larger NiMH. But if you wanted to power appliances or different battery chemistries you would need a new design.
      Like. Reply
  • S
    Sdsaibot September 26, 2020

    Hello. Thank you for the design, I look forward to trying it out!!  I was wondering though could it be used to charge a larger voltage battery, say 6v??  If so, what components need to be changed to accommodate the larger battery?? Any info appreciated.

    Like. Reply