Introduction: Solar 12V SLA Battery Charger

Some time ago, I came into possession of a "Lemon" of an side-by-side ATV. Suffice to say, there is a LOT wrong with it. At some point, I decided that "HEY, I should just build my own high-powered solar battery charger just to keep the cheap dead-as-a-door-nail battery charged while the headlights are running!" Eventually that evolved into the idea that "HEY, I ought to use that turd of a battery to power some remote projects I've been planning!"

Thus, the "Lead Buddy" solar battery charger was born.

Initially, I looked at deriving my design off of Sparkfun's "Sunny Buddy" (hence where I got the name), but by chance, I happened to notice that a component I was already using in another project, actually had an application note on use as a solar battery charger (that I had missed while skimming through the datasheet prior) - Analog Device's LTC4365! It doesn't have MPPT, but hey, neither does Sparkfun's "Sunny Buddy" (at least not true MPPT anyway...). So, how exactly do we fix this? Well, dear reader, you look through app notes!!! Specifically, Microchip's AN1521 "Practical Guide to Implementing Solar Panel MPPT Algorithms". Its actually quite an interesting read, and provides you with multiple different methods of implementing MPPT control. You only need two sensors, a voltage sensor (voltage divider), and a current sensor, and you need exactly one output. I happened to know about a special current sensor that can be used with an N-Channel MOSFET, called the IR25750 from International Rectifier. Their AN-1199 on the IR25750 is also an interesting read. Finally, we need a microcontroller to link the whole thing together, and since we only need 3 pins, enter the ATtiny10!

Step 1: Choosing Parts, Drawing Schematics

Now that we have our 3 primary parts, we must begin to chose the various other components which need to accompany our IC's. Our next important component are our MOSFETs, specifically, for this revision (see the last step for more info on that), I chose to use TWO SQJB60EP Dual N-Channel MOSFETs. One MOSFET is controlled exclusively by the LTC4365, and the other MOSFET is set up so that one FET acts as an "ideal low-side diode" intended for reverse input protection (If you search that in google, you likely wont come up with the application notes from TI and Maxim on the subject, I had to dig for it.), while the other FET is controlled by the ATtiny10's 16-bit PWM timer (or whatever resolution you choose...). Next come our passives, which are honestly not that important to list. They consist of resistors for voltage dividers/charger programming, and various bypass/storage capacitors, just make sure that your resistors can handle the power dissipated through them, and that your capacitors have reasonable temperature tolerances (X5R or better). It's important to note, that because of how this is designed, a battery MUST be attached to the board in order for it to function.

I have set up the LTC4365 to be able to charge either 12 or 24V batteries by switching a jumper (to provide the OV pin on the charger with 0.5V when the battery is charged to around 2.387V/cell for 12V batteries). The charger voltage divider is also temperature compensated through a 5k PTC resistor that connects to the board via a 2.54mm header and will connect to the side of the battery with either thermally conductive potting compound, or even duct tape. We do also have to use a couple of zeners throughout the design, namely for driving the reverse voltage MOSFET (as well as supplying power to the other FET in the case you dont install the MPPT components via a jumper pad) and for protecting the LTC4365's pins from overvoltage. We will be powering the ATtiny10 with a 5V automotive regulator rated for 40V input.


One important thing to note, is that you should ALWAYS have fuses on your inputs and outputs when it comes to battery chargers, and that you should ALWAYS use OV protection on high-current inputs (IE- battery). Low current inputs cant readily have OVP implemented (IE- crowbar circuits), as they often cant produce enough current to trip a breaker/fuse. This can lead to a fatal situation where your TRIAC/SCR will begin to overheat, potentially failing, causing either your components down the line to be damaged, or causing your project to explode in flames. You have to be able to supply enough current to actually blow the fuse in a timely manner (which our 12V battery CAN do). As for fuses, I decided to go with the 0453003.MR by Littlefuse. It's a fantastic fuse in a very small SMD package. If you decide to go with larger fuses, such as 5x20mm fuses, PLEASE, FOR THE LOVE OF WHATEVER HIGHER BEING YOU PRAY TO..... Don't use glass fuses. Glass fuses can shatter when they blow, sending bits of hot molten metal and sharp glass out all over your board doing all kinds of damage in the process. ALWAYS use ceramic fuses, most of them are filled with sand so that when they do blow, they don't fry your board, or your house (not to mention that the ceramic itself should also aid in protection, similar to the ceramic armor used to protect modern combat vehicles from shaped charge warheads/REALLY HOT JETS OF PLASMA). Being able to "See" that little wire in your fuse (that, you might not be able to see anyway, especially if you are nearly blind) is not worth having a smoldering pile of charcoal where your house used to be. If you need to test your fuse, use a multimeter to check it's resistance.

ESD protection

Long gone are the days where we relied exclusively on expensive $5-10 varistors to protect our electronic projects. You should ALWAYS throw in some TVS, or Transient Voltage Supression, diodes. There is literally no reason not to. Any input, especially a solar panel input, should be protected from ESD. In the event of a lightning strike near your solar panels/any-stretch-of-wire, that little TVS diode, combined with a fuse, can prevent your project from being damaged from any sort of ESD/EMP (which is what a lightning strike is, sorta....). They are not nearly as durable as MOV's, but they can certainly get the job done most of the time.

Which brings us to our next item, Spark gaps. "What are spark gaps?!?" Well, spark gaps are essentially just a trace that extends out into a ground plane from one of your input pins, that has the soldermask removed from it and the local ground plane and is exposed to the open air. Simply put, it allows ESD to arc over straight into your ground plane (the path of least resistance), and hopefully will spare your circuit. They cost absolutely nothing to add, so you should always add them where you can. You can calculate the distance you need between your trace and the ground plane to protect for some voltage through Paschen's Law. I am not going to discuss how to calculate that, but suffice to say that a general knowledge of calculus is advised. Otherwise, you should be OK with a 6-10mil space in between the trace and ground. Using a rounded trace is also advisable. See the picture I posted for an idea on how to implement it.

Ground planes

There is no reason to not use one large ground pour in most electronics projects. Furthermore, it is extremely wasteful to not use ground pours as all of that copper will have to be etched off. You are already paying for the copper, you might as well not have it polluting the waterways of China (or wherever) and put it to good use as your ground plane. Hatched pours have very limited uses in modern electronics, and are rarely, if ever used anymore to that effect as solid ground pours allegedly have better qualities for high frequency signals, not to mention that they are better at shielding sensitive traces AND can provide some bypass capacitance with a "live" plane if you use a multi-layer board. It is also important to note, that if you use a reflow oven or a hot air rework station, that solid ground plane connections to passive components are not advised, as they can "tombstone" when reflowed, as the ground plane has more thermal mass that has to be heated up in order for the solder to melt. You can certainly do it if you are careful, but you should use thermal relief pads, or what EasyEDA calls "Spokes" to connect your passive component's ground pad to. My board uses thermal relief pads, although since I am soldering by hand, it really does not matter either way.

On heat dissipation...

Our solar charger shouldn't dissipate too much heat, even at it's maximum designed current of 3A (dependent on the fuse). At worst, our SQJB60EP's on resistance is 0.016mOhm at 4.5V at 8A (SQJ974EP in my second revision, at 0.0325mOhm, see my notes at the end for more info). Using Ohms Law, P=I^2 * R, our power dissipation is 0.144W at 3A (Now you see why I've used N channel MOSFETs for our MPPT and reverse voltage "diode" circuit). Our automotive 5V regulator shouldn't dissipate too much either, as we are only drawing at most a couple dozen milliamps. With a 12V, or even a 24V battery, we shouldn't see enough power loss on the regulator to really have to worry about heat sinking it, however as per TI's excellent application note on the issue, most of your power dissipated as heat will conduct back into the PCB itself, as it is the path of least resistance. As an example, our SQJB60EP has a thermal resistance of 3.1C/W to the drain pad, whereas the plastic package has a thermal resistance of 85C/W. Heat sinking is much more effective when done through the PCB itself, IE- laying out nice large planes for your components that dissipate lots heat (thus turning your PCB into a head spreader), or routing vias to the opposite side of the board from a smaller plane on the top to allow for more compact designs. (Routing thermal vias to a plane on the opposite side of the board also makes it possible to easily attach a heatsink/slug to the back side of the board, or to have that heat dissipate through the ground plane of another board when attached as a module.) One quick and dirty way you can calculate how much power you can safely dissipate from a component is (Tj - Tamb) / Rθja = Power. For more info, I strongly encourage you to read TI's app note.

And finally....

If you want to have your project inside of a container, such as I plan on doing as it is going to obviously be used outside, you should always select your container/box prior to laying your board out. In my case, I chose Polycase's EX-51, and have designed my board as such. I also designed a "front panel" board, which connects to the solar input's castellated "holes", or more accurately, slots (that fit a 1.6mm thickness board). Solder them together, and you are good to go. This panel has waterproof connectors from Switchcraft. I havent decided on if I will use a "front panel" or a "rear panel" yet, but regardless, I will also need a "waterproof cable gland" for either the input or output, as well as for our battery thermistor. Additionally, my charger can also be installed on a board as a module (hence the castellated holes).

Step 2: Getting Your Parts

Ordering your parts can be an excruciating task, given how many vendors there are, and considering the fact that small parts will be lost from time to time (ie- resistors, capacitors). In fact, I lost the resistors for the 24V battery charging circuit. Thankfully, I wont be using the 24V charging circuit.

I chose to order my PCB from JLCPCB, because its dirt cheap. They have also seemed to switch to a "photo image-able" process, which leaves nice crisp silkscreens (and soldermasks) since I last ordered from them. Unfortunately, they no longer provide free shipping, so you either will have to wait one or two weeks to get it, or you have to pay $20+ for it to be shipped via DHL.... As for my components, I went with Arrow, as they have free shipping. I only had to buy the thermistor off of Digikey, as Arrow didnt have it.

Typically, 0603 sized passives are A-OK to solder. 0402 sized components can be difficult, and are easily lost, so order at least twice what you need. Always check to make sure that they sent you all of your components. This is especially important if they dont consolidate your order, and instead send you 20 different boxes through FedEx.

Step 3: Getting Ready...

Getting ready to solder.... You really dont need that many tools to solder. A cheap, moderately powered soldering iron, flux, solder, tweezers, and snips, are about all you need. You SHOULD also have a fire extinguisher at the ready, and you should ALWAYS have a mask ready to filter out airborne contaminants put off by the flux, which is cancerous/toxic.

Step 4: Putting It Together

Assembling your PCB is really simple. It's pretty much just "tin one pad, solder one pin to that tab, then 'drag solder' the rest of the pins". You don't need a microscope or a fancy rework station to solder SMD components. You don't even need a magnifying glass for anything larger than and 0603 (and sometimes 0402) components. Just make sure that there are no bridged pins, and that you dont have any cold joints. If you see something "funny", put a bit of flux on it and hit it with the iron.

As far as flux goes, you should probably use no-clean flux, as it's safe to leave on your board. Unfortunately it's a pain to actually clean it off of your board. To clean 'no-clean' flux, get as much of the big stuff off as you can with some high grade rubbing alcohol, above 90% concentration, and a cotton swab. Next, brush it well with an old tooth brush (old electric toothbrushes/toothbrush heads work beautifully). Finally, heat up some distilled water for a hot water bath. You could use some dish detergent if you'd like (just make sure it won't royally screw your board, it shouldn't damage any bare connections on your PCB as dish detergents are designed to "attach" to organic components through the hydrophobic component of the soap. The hydrophobic-hydrophillic action is provided by the polar/non-polar hydrocarbon/alkali structure of it's molecules, and can be washed off via the hydrophillic component. Really, the only issue is when it isn't rinsed properly with distilled water or if it is extremely corrosive). IFF by some miracle you actually do get all of the no-clean flux off with alcohol, and you probably won't, you can skip washing your board all together.

After 30 minutes or so, the hot water should break up the rest of the sticky residue on your board, then you can go to town with your toothbrush and get the rest of it off. Rinse well, and let it dry in a toaster oven set to the lowest setting, or let it dry at least 24hrs in the open air. Ideally, you should use either a toaster oven or a cheap hot air gun from Harbor Freight held far enough away to not fry anything. You could also used compressed air to the same effect.

As a side note, be careful when brushing your PCBs, as you can jar components loose. You dont need to press down very hard, just enough to get the bristles in between the components.

Step 5: Solar Panels...

In my case, I decided to connect my solar panels in series. You simply just have to take the cover off of the junction box, and solder your leads to their connections. Always put a bit of heat shrink on your wire where it enters the junction box, and then screw the clamp down tightly.

Step 6: FINISHED (and After-thoughts...)

FINALLY.... it's finished. It took a LONG time to design, and a lot of blood, sweat, and tears. Now, some afterthoughts - Programming the ATTiny10 turned out to be extremely difficult. When I finally DID get my programmer to actually program it, like.... two days later.... I took it out and tested it. Unfortunately, my 3.24Mohm resistor on the battery charging voltage divider had failed short at some point after I hooked it up. It potentially destroyed the LTC4365 as the voltage across it was well in excess of 6V, and I will have no way to know IF it did survive until I can get a new resistor for it of the proper value. It actually did operate for about one minute until it failed, but long before I could take any pictures of it. Eventually, I found my way to Analog Device's website, and I discovered that a higher voltage variant of the LTC4365 existed, called the LTC4367. Had I known that, I would've used the LTC4367 to begin with, and I would've used higher voltage MOSFETs along with it, such as the SQJ974EP. That change is reflected in my schematics.

As far as programming goes, which certainly would require a whole instructable of it's own, I decided to use over-sampling of the current sensor. Microchip has a wonderful app note on it called AVR121. Simply put, an AVR with an 8-bit ADC can manage to get 14 or 16-bit resolution via oversampling. Unfortunately, it doesnt work out that great when it comes to our solar charger. It is true, that our solar panel's voltage and current change slowly over time, however, I fear that having to take a quarter to a half second to measure the voltage off of the IR25750 (depending on our desired resolution and clock speed, it can actually be around (if I recall) 53ms at minimum for a 14-bit read) would be detrimental to it's performance. In retrospect, an op-amp would have been a better route, and is reflected in my updated schematics posted earlier on in this instructable. Regardless, as far as my one minute worth of testing went, it did actually work, albeit slowly and not as well as I had hoped. This is an important learning experience for anyone, as you will always make mistakes and you will always have to make revisions. Whether those mistakes are due to ignorance or overconfidence, everyone makes them. Don't feel disheartened if your project doesn't work, or if it starts spouting flames.

EasyEDA link to my battery charger.

PCB Contest

Participated in the
PCB Contest