A DIY 12V 3-stage PWM solar charge controller to accurately charge 12V lead-acid batteries from 12V panels up to 130W, and easily scalable to handle larger charge currents.
Many of us aspire to power our remote monitoring stations, radio equipment, or camping equipment in remote locations free from grid supplied power.
The ‘go to’ solution is typically a battery based technology or a generator for larger loads. In spite of the proliferation of Lithium battery technologies, the ubiquitous lead acid battery is still around and remains a cost effective choice in many remote applications. However, they are prone to premature failure. This is typically a consequence of incorrect charging or more commonly, insufficient charging.
Compared to charging Lithium or NiMH batteries, the charging regime for a lead acid battery is surprisingly complex. Failure to correctly charge these devices will result in reduced service life and considerable cost for replacement batteries.
Many commercial chargers and solar controllers do not perform their task well and simply charge at a fixed voltage.
This will have two consequences. Either the battery will overcharge, resulting in electrolyte loss and “drying” of the cells. Alternatively, undercharging causes the formation of lead sulphate crystals on the lead plates. This “sulphation” drastically reduces the storage capacity and service life of the battery. This is why you should never completely flatten a lead acid battery.
Interested readers can refer to the attached text box regarding the correct charging requirements for lead acid batteries (flooded, AGM, and GEL).
Fortunately, the realisation of a quality solar charge controller is well within the capabilities of most makers with a minimal financial cost.
The Broad Overview
After working with commercial Solar charge controllers for many years it occurred to me that this would be a useful and interesting project to apply my newly learnt “Arduino” skills. It also provides an opportunity for us to explore the amazing capabilities of these devices and build something comparable to a commercial unit.
My interest was further encouraged by the excellent YouTube channels of Jullian Illet and Adam Welch who have both presented PWM based solar charger designs on their channels.
Most of the designs presented on the internet charge the 12V battery at a fixed voltage, typically around 13V. This will work but will also result in a reduced battery service life. Our design would, therefore, need to incorporate a proper 3-stage charging regime, be relatively easy to construct, and provide some feedback to the user on the battery state.
PWM VS. MPPT
Some readers may be wondering why we have not opted for the MPPT design.
- The PWM design is simple to build and it expands on the previous discussions within this magazine on our “Choppy” PWM controller (see Issue #9)
- The design of an efficient MPPT buck converter capable of handling over 10A is a challenging project and involves considerably more complexity both in terms of the software and the hardware resources.
- Switching frequencies are much higher on an MPPT converter ruling out photovoltaic optocouplers.
- The yield from a PWM controller is actually comparable with a MPPT unit when panel temperatures are high (as they are in Australia). The additional complexity and cost of an MPPT unit was therefore considered unwarranted.
For those readers interested in an in depth comparison of PWM and MPPT charge controllers, I encourage you to refer to the Victron White Paper cited in the references at the end of this article.
How it works
Note: The following details refer to the main build that uses the ATtiny, not the prototype that uses an Arduino Pro Mini.
The MOSFET is essentially operated as a PWM switch with the duty cycle (and therefore the battery voltage) controlled by the ATtiny85 microprocessor. Check out Issue #9 of DIYODE if you are unsure how PWM works.
The ADC pin (A1) on the ATtiny is connected to the potential divider at the left of the circuit diagram. This allows the ATtiny to sample the battery voltage and switch the various outputs accordingly.
To begin, let us assume that the controller and a solar panel is initially connected to a partially discharged 12V battery.
Stage one - Bulk charge
The ATtiny senses that the battery voltage is low and outputs 5V on pin 5 (100% PWM duty cycle) that drives the TLP190B internal LED, thereby switching it on. The optocoupler outputs around 10V which is sufficient to fully switch on the MOSFET, allowing the maximum solar panel current to flow through the MOSFET and into the battery.
The blue LED is also illuminated at this time, indicating charging is taking place. After some time (typically several hours), the battery voltage rises to the “Bulk” voltage setpoint (14.4 volts), and the blue LED is now flashing. The PWM duty cycle is reduced to maintain a steady 14.4V on the battery. This voltage is also referred to as the absorption voltage in some texts. The battery has reached the Bulk (Absorption) voltage and it is approximately 80% charged.
Stage two - Absorption charge
The ATtiny maintains the battery voltage at the Bulk voltage(14.4V) and starts the absorption timer. During this time, the battery receives its final 20% charge.
After the absorption time has elapsed (30 mins), the battery is considered to be 100% charged, and further charging is counterproductive, particularly with larger solar arrays.
Stage three - Float charge
The ATtiny then regulates the charge voltage to the float setting (13.5V). The float setting is then maintained as a trickle charge and the battery may be safely left in this mode indefinitely.
If there is subsequently a load on the battery that exceeds the solar charge current the battery voltage will slowly fall until it eventually reaches the Bulk restart voltage (13 volts). At this point, the ATtiny restarts the bulk charging cycle (14.4 volts), and the whole process repeats. Finally, if the battery voltage drops even further to the Low Battery (RED 11.5 volts) setpoint, the red battery discharged LED is illuminated and a bulk cycle is also repeated. No more pondering and engineering notes on envelopes, it was time to build a prototype!
Battery Charge Cycle
- The charge cycle starts with a “Bulk” charge. As its name suggests this is where the bulk of the charge is completed, charging the battery to around 80% capacity. During this phase our controller will allow the solar panel to push as much charge into the battery as it can generate. During this time the battery will accept its rated charge current with no problem.
- As the battery charges its voltage slowly increases until it reaches a point where further bulk charging is unproductive (Further bulk charging would cause heating, gassing and drying of the active chemicals within the cells). This is called the Absorption voltage and is specified by the battery manufacturer. Our solar controller will regulate the charge at the absorption voltage for a predetermined time called the absorption time.
- After the Absorption time has elapsed the solar controller drops the charge voltage to the “Float” setting. Manufacturers will also specify a recommended float voltage. The lower float voltage is designed to maintain the battery in a fully charged state without overcharging. The battery can be left in this state indefinitely to ensure it is fully charged when it is needed. Examples of batteries left on float charge include alarm batteries, NBN backup batteries, UPS, and "standby" services.
- The timings are highly dependent on the size of the battery and the solar array that is charging it. Shorter bulk charge cycles are possible with higher charging currents.
The Prototype Build:
Parts Required: | Jaycar | ||
---|---|---|---|
1 x Veroboard | HP9540 | ||
1 x Arduino Pro Mini or compatible | - | ||
1 x LP2950CZ-5.0 5V Regulator | ZV1645 | ||
1 x TLP190B Optocoupler | Element 14: 1684602 | ||
1 x IRF3205/IRF1405 N-Channel MOSFET | ZT2468 | ||
1 x 3mm Blue 6000mCd LED | ZD0132 | ||
1 x 3mm Green 6500mCd LED | ZD0124 | ||
1 x 3mm Red 2800mCd LED | ZD0104 | ||
1 x 1µF 50V Electrolytic Capacitor | RE6032 | ||
1 x 4.7µF 50V Electrolytic Capacitor | RE6058 | ||
1 x 100µF 50V Electrolytic Capacitor | RE6150 | ||
1 x 100nF Capacitor | RM7125 | ||
1 x 220pF Ceramic Capacitor* | RC5328 | ||
1 x 150Ω Resistor* | RR0552 | ||
3 x 220Ω Resistor* | RR0556 | ||
1 x 20kΩ Resistor* | RR0603 | ||
1 x 82kΩ Resistor* | RR0618 | ||
1 x 470kΩ Resistor* | RR0636 | ||
1 x MBR20100CL Schottky Diode | ZR1039 | ||
1 x TVS | ZR1177 | ||
1 x Battery Fuse | SZ2040 | ||
1 x Fuse 15A | SF5028 |
* Quantity shown, may be sold in packs.
Notes:
- Core Electronics provides some of the values we need in large multi-value resistor packs.
- High brightness LEDs from Jaycar were used in the build. Altronics and Core parts specified may be lower brightness
- The P30N06LE or STB36NF06L from Core should be suitable substitutes. IRLB8721PBF should also be suitable, but marginal for 24V systems.
- The L4931-5.0 from Core suits a 12V system but at 20V max it doesn't suit a 24V system.
A number of prototypes were built over the past 12 - 15 months. The initial design used an Arduino Uno with a solderless breadboard and jumper leads connecting the components together.
Note: I do not recommend this solderless breadboarding method, as I encountered a number of dodgy joints with the jumper leads which resulted in many frustrating hours tracing faults. Also, the jumper leads and protoboards are not designed to carry more than a few hundred mA. Subsequently, all of the remaining prototypes were constructed on “veroboard” with soldered joints. These proved to be far more reliable and one prototype is still working fine today without problems.
I only owned one Uno at the time and wanted that for another project. Subsequent prototypes were therefore built with 3.3V Arduino Pro-mini boards carefully grafted onto “veroboard” which also accommodated the other components including the SMD optocoupler.
Various configurations for the switching FET were considered. Placing the FET in the “high side” is preferable as it allows the PV and battery to share a common negative earth. Also, this configuration allows us to use N channel enhancement mode FETs, which tend to have lower forward resistance (usually only a few milliohms) compared to similar P channel or depletion mode devices. This will make our controller as efficient as possible.
Importantly, the N channel FETs are familiar to most readers and are readily available at low cost from local suppliers.
The photovoltaic optocoupler
One of the features that makes this project unique is the use of a photovoltaic optocoupler which I have not seen used in a project before.
Internally, the device encompasses an infrared LED optically coupled to an array of series connected photodiodes. When the internal LED is illuminated, a DC voltage appears on the output pins.
You may be wondering why we are using this device.
This is all about elegantly driving the power MOSFET in the “high side” configuration which can be a challenging proposition. The TLP190B considerably simplifies implementing this configuration.
Referring to the circuit drawing, the MOSFET source is connected to the positive terminal of the 12V battery. In order to make the FET conduct and allow charge current to flow from the solar panel through the FET, we need to drive the gate voltage more positive than the source. To drive the FET into full conduction, we need at least 6V above the battery voltage on the gate. Normally, we would need to have additional circuitry to generate a voltage higher than the battery voltage in order to switch the MOSFET gate.
For those readers interested in learning more about driving MOSFETs I refer you to an excellent discussion of this topic in DIYODE Issue 43.
Fortunately, the TLP190B is capable of supplying sufficient voltage (typically 10V) to fully drive the MOSFET gate. As our MOSFET exhibits a very high gate resistance, it does not draw current from the optocoupler so the 10µA or so generated by the TLP190B is adequate.
In the prototypes, the output of the optocoupler was connected directly to the gate of the MOSFET with a resistance in parallel to discharge the small gate capacitance. However, one of the observations noted on the prototype units was that the FET was not running as cool as expected.
Assuming we are using the IRF3205, the Drain - Source resistance is around 8 milli-Ohms when we apply 10V to the base.
To calculate the power dissipated in the device:
P = I2 x R
Assuming the MOSFET is conducting 6A, we get:
P = (6 x 6) x 0.008 = 0.28 W
We would, therefore, expect that the FET would be relatively cool to touch. After some detective work with an oscilloscope, the reason for the increased dissipation was traced to the FET being only partially switched on for much of the duty cycle. This is due to the gate capacitance of the FET and also the slow response of the TLP190B, particularly when it is switching the FET gate low.
This is the purpose of the PNP transistor in the gate circuitry of the FET. It is there to speed up the switching transitions and, therefore, reduce the FET power dissipation. It is particularly helpful for instantly discharging the FET gate capacitance when switching the FET off. The oscilloscope traces above illustrate the improvement achieved by including the PNP transistor in the gate drive circuit.
Finally, there are a number of comparable devices made by other manufacturers that should also work fine in this application. The Toshiba device was chosen because it is available online for around $2.50.
The MOSFET
The choice of power MOSFET is not critical, except that it must be an N channel enhancement mode device.
Things to look for are a low Rds, less than 30 milli-ohms is preferable as this will minimise the power dissipation while the device is conducting.
The voltage rating (Vds) of the device needs to be sufficient to support the voltage of the solar array and the battery. The FET is exposed to the maximum array voltage (Voc) less the battery voltage. With a 12V panel and battery, this is not an issue as most power MOSFETS will comfortably handle 15 - 20V.
Finally, ensure that you do not exceed the maximum Vgs voltage of the FET. Again, most will comfortably withstand the 8-10V output from the TLP190B.
For minimum device dissipation, you will need to exceed the gate threshold voltage by at least 200% to ensure the device is fully switched on.
Suitable devices include IRF1405, IRF3205, IRFZ44, IRF540N or similar.
Schottky Diode
The dual Schottky diode is theoretically required to prevent the battery from discharging through the solar array at night. From a safety viewpoint, it should be present, particularly in larger arrays. You will see it included in some solar regulators and in many solar panels. If you are lucky, it will already be included in your solar panel and you can omit it.
Contrary to popular opinion, my advice is to avoid using one in this controller if you possibly can. Most texts suggest that the voltage drop across these diodes is around 0.3V. However, this is only when conducting less than 1A forward current. At the rated current, our measurements (and datasheet) show that this voltage drop is actually around 0.6 - 0.8V, depending on the temperature and current.
Assuming our solar panel is producing 10A, the device is dissipating:
P = I x V = 10A x 0.7V = 7 Watts
This will make the heatsink hot and the device will not sustain this current without a heatsink. I found that even with 1.0A passing through the diode without a heatsink, it was too hot to touch. In contrast, when driven correctly, the MOSFET will comfortably carry 6A without a heatsink. As you have probably guessed, the problem becomes worse when we connect larger solar arrays with higher output power.
For this reason, the current capacity of the controller is 6A when you retain the Schottky diode and a small heatsink.
If you bypass the diode, the controller will charge at 15A with only a small heatsink on the MOSFET (see the image of final design). We have worked hard to minimise losses and maximise the controller’s efficiency. Losses incurred by the Schottky diode should, therefore, be avoided if at all possible. Fortunately, in many cases, we can omit the Schottky diode. Particularly if you are using the recommended “12Volt” panels.
The simplest way to find out if you can omit the Schottky diode is to measure the reverse leakage current at night with a multimeter. I have measured several 12V panels and found that the leakage is negligible, less than 10mA.
In summary, the solar cells on your panel are a series connected array of diodes. At night they are actually in a forward biased configuration, and if sufficient voltage was applied, then a substantial current would indeed flow.
However, in order to produce enough voltage to charge a 12V battery, 36 of these cells are typically connected in series to fabricate a 12V panel. Each of these cells (diodes) requires around 0.6V to forward bias them and make them conduct. This equates to a total series voltage of around 18V. Fortunately, our battery is only supplying around 13V (when fully charged) and, therefore, it does not bias the diodes into full conduction. It is only the small forward leakage current that flows through the array.
Finally, you may be wondering why we don't simply switch the MOSFET off at night. You may remember that the FET has a built-in protection diode across the source and drain. Unfortunately, this internal diode is also forward biased at night and effectively bypasses the FET!
Note: Another simple solution is to use two MOSFETs in a back-to-back configuration, effectively eliminating the parasitic diode effect.
If you are still uncomfortable bypassing the Schottky diode, please refer to the Reading and Resources section for an alternative solution using a MOSFET to create an “ideal diode”.
ATtiny85
After some further encouragement from reading the ATtiny discussion within Issue 9 of DIYODE, it became clear that the ATtiny85 device would be ideal for this application.
With its ADC and 5 remaining I/O pins, the ATtiny85 can measure voltages, drive our PWM FET, and illuminate LEDs. It even incorporates a timer that we can use to implement an absorption timer.
After successfully developing the code on an Arduino Pro-mini, the sketch was ported to the ATtiny85.
Apart from adding ATtiny support to your Arduino IDE, the I/O ports were remapped to reflect the ATtiny85 pin assignments. Some fiddling with clock speeds was also required to make the “millis” function work as expected.
Note: Instructions for programming the ATtiny can be found on page 68 in DIYODE Issue 9.
Finally, the voltage divider ratio (R1 - R2) was adjusted to accommodate the higher 5V supply.
As discussed in an Atmel application note, the ATtiny chips require thorough decoupling of the 5V supply on the Vcc pin. Initially, I chose to ignore this advice and subsequently spent several hours dealing with unexplained resets and erratic operations.
I can now confirm that they were not kidding, and both capacitors are indeed mandatory and need to be as close to the Vcc pin on the chip as possible.
The 100nF capacitor(C4) on the ADC pin is a precautionary measure to filter any noise spikes on the ATtiny ADC input.
Remaining components
The remaining components will be familiar to most readers. The only issue I encountered was the wide variation in LED brightness, so try to select LEDs with comparable brightness. The power consumption of the final build was 7.8mA with no LEDs lit. You can increase the values of (R4, R5, R6) to optimise power consumption when they are lit.
R3 and C5 provide an orderly reset when the ATtiny is first powered up.
The LP2950 provides a stable 5V supply for the ATtiny. Check that it supplies an accurate 5V, as this voltage is also used as a reference for the inbuilt ADC. I found that the setpoints were remarkably accurate providing the 5V supply was bang on.
How the software works
From perusing the included sketch, you can probably guess that I am not an accomplished C++ programmer. However, the sketch works as intended without any of those annoying “failed to compile” errors. Those readers more proficient at Arduino programming (and less prone to swearing) are welcome to suggest improvements.
The sketch starts by declaring all of the constants and variables. In particular, the first four variables define the setpoints of the controller. They can be amended to change the voltage setpoints to suit your battery.
If you can tolerate working through the maths, each setpoint results in an integer value which is then compared with the ADC read value on A1 to trigger an action.
The “Abtime” unsigned long Integer variable sets the absorption time.
Moving on to the Setup routine, the LED pins and variables are set to their initial values.
The void loop begins with a sampling of the battery voltage. It is compared with the setpoint and the PWM output on pin 5 drives the TLP190B, and the blue LED is illuminated by PWM on pin 3. The “difference” and “stepSize” variables allow faster PWM tracking of the setpoint value.
What follows is a series of conditional “IF” statements which are only executed depending on the battery voltage, the status of the boolean variable “Absorb” and the status of the absorption timer variable (Absorbstart).
If the conditions of an “IF” statement are not met, the program jumps to the next conditional “IF” routine.
The appropriate setpoint is implemented and corresponding LEDs are illuminated within each “IF” routine.
After working through the conditional “IF” statements, the program loops back to again read the battery voltage and repeat the whole process again.
I initially included several serial print commands so that I could track what was going on.
The Main Build:
After almost a year of tinkering and testing, it was time to settle on a final design. In order to protect the unit from inexperienced users incorrectly connecting the battery cables, D3 was added to protect the regulator and the ATtiny supply from reverse polarity damage. D1 was also added to prevent reverse voltages appearing on the voltage sensing ADC pin.
A single Schottky diode on the battery positive line would have also worked but was dismissed for the same reason the Schottky diode on the PV input was deemed undesirable. Notwithstanding this, I decided to include the Schottky diode on the PV side, simply as an additional precaution against reverse connection of the array. Makers can simply bypass it if they want to maximise efficiency.
A TVS surge suppressor is included on the PV input to protect the unit from random voltage spikes. This component is optional and will not impact the controller’s operation. A blue LED indicates that the unit is charging. This LED will flicker as the unit approaches the setpoint voltage indicating that the absorption voltage has been reached. The flickering will approximate the duty cycle of the PWM waveform.
The green LED indicates when the unit switches to “Float” mode. This will occur after the absorption time has elapsed. At this point, the battery is fully charged.
Should the battery voltage subsequently drop below the “bulk reset voltage”, the controller will drop out of the float mode and return to the bulk mode. The absorption timer will be reset. A yellow LED was originally used to indicate the absorption stage has been reached, however, it was felt that a low battery indication would be more useful. Accordingly, another “if” loop was added to the sketch which illuminates the red LED when the battery voltage drops below the low voltage “Red” setpoint.
Parts Required: | ID | Jaycar | ||
---|---|---|---|---|
2 x 4.7µF 50V Electrolytic Capacitors | C1, C2 | RE6058 | ||
3 x 100nF Capacitors | C3, C4, C5 | RM7125 | ||
2 x 1N4148 Diodes* | D1, D2 | ZR1100 | ||
1 x 1N4004 Diode* | D3 | ZR1004 | ||
1 x MBR20100CL Schottky Diode | D4 | ZR1039 | ||
1 x 3mm Blue 6000mCd LED | LED1 | ZD0132 | ||
1 x 3mm Green 6500mCd LED | LED3 | ZD0124 | ||
1 x 3mm Red 2800mCd LED | LED2 | ZD0104 | ||
1 x BC557 Transistor | Q1 | ZT2164 | ||
1 x IRF3205/IRF1405 N-Channel MOSFET | Q2 | ZT2468 | ||
1 x 470kΩ Resistor* | R8 | RR0636 | ||
3 x 270Ω Resistors* | R4, R5, R6 | RR0558 | ||
1 x 220Ω Resistor* | R7 | RR0556 | ||
1 x 1kΩ Resistor* | R9 | RR0572 | ||
1 x 10kΩ Resistor* | R3 | RR0596 | ||
1 x 82kΩ Resistor* | R1 | RR0618 | ||
1 x 20kΩ Resistor* | R2 | RR0603 | ||
1 x ATtiny85 | U1 | ZZ8721 | ||
1 x TLP190B | U2 | Element 14: 1684602 | ||
1 x LP2950CZ-5.0 5V Regulator | U3 | ZV1645 | ||
1 x 8-pin IC Socket | - | PI6452 | ||
1 x TVS | D5 | ZR1177 | ||
1 x Battery Fuse | - | SZ2040 | ||
1 x Fuse 15A | - | SF5028 |
* Quantity shown, may be sold in packs. You’ll also need an enclosure, wiring and cable management parts, heatsink, and heat transfer paste.
Note: 1: Core Electronics provides some of the values we need in large multi-value resistor packs. 2: High brightness LEDs from Jaycar were used in the build. 3: The P30N06LE or STB36NF06L from Core should be suitable substitutes. IRLB8721PBF should also be suitable, but marginal for 24V systems. Altronics and Core parts specified may be lower brightness 4: The L4931-5.0 from Core suits a 12V system but at 20V max it doesn't suit a 24V system.
As the prototypes resembled a birds nest, a PCB was designed and manufactured through one of the online Chinese PCB manufacturers. This worked out better than expected, the built-up units perform well and I am yet to find any errors in the final PCB design.
The other consideration was how to enclose the unit.
I do not own a 3D printer so this is not an option for me. However, I would expect other readers with 3D printers will be inspired to manufacture their own custom enclosures. Originally, it was intended to mount the controller PCB in a small diecast box and drill and label holes for the LEDs. The diecast box would provide a rudimentary heatsink for the current carrying components.
I later reasoned that it would be better to waterproof the unit as it will primarily be used in outdoor applications.
A local supplier sells IP65 polycarbonate boxes with transparent lids, so I purchased several different sizes. The final choice is shown in the images. This has proved successful with the unit being weatherproof and the LEDs still clearly visible through the lid.
The final version depicted comfortably handles a 10A charge current with minimal heating of the small heatsink. Since the unit has been outside, the only problem encountered has been condensation on the interior surfaces of the enclosure on cold mornings.
Finally, I strongly recommend that you have an appropriately sized fuse or circuit breaker in the positive battery cable. Whilst there is no shock hazard with 12 or 24 volt systems, larger batteries are capable of producing currents in excess of 100A. These currents cause rapid heating of conductors and present a serious fire hazard. You also risk painful burns if you accidentally touch shorted current carrying conductors.
For small PV panels, a solar panel fuse is generally not necessary, and in my experience, causes more problems. However, for larger arrays over, say 10 amps output, a solar fuse is also a sensible precaution.
Where to from here?
As my eyesight is not that great, I decided through-hole components on the PCB made for easier construction, with the optocoupler being the only SMD device. Readers experienced with SMD construction would be in a position to produce a more elegant SMD design, particularly for applications with modest current requirements.
I recommend using an IC socket for the ATtiny85. This simplifies access to the processor should you wish to reprogram the device. It also allows access for fault finding of other components with the ATtiny removed. With wireless capable boards becoming available, the porting of this design onto a wireless board would allow the possibility of including remote monitoring, control, and data logging.
No attempt has been made to optimise the power consumption of the controller. As presented, the unit draws 7.8mA from the 12V supply (all LEDs off). Readers using the unit in power critical applications should check out Issue 15 of DIYODE for a discussion on ATtiny low power modes.
The final build shown in the accompanying images has a modest heatsink on the MOSFET, constructed from a 90mm length of 20mm x 1.5mm flat aluminum extrusion. With a constant 10A charge current, the heatsink was warm and still comfortable to touch. I am, therefore, confident that as presented the unit is capable of sustaining a 15A charge current. This equates to a maximum 250W 12V solar panel.
If charging a small "NBN" type battery, then a 10W panel would be plenty, however, with a bigger battery (I am using a 75Ah battery), at least 40W is desirable. A quick rule of thumb is that the solar charge current should not exceed 20% of the battery capacity. So, if you are charging a small 5Ah battery, then your maximum charge current should be 5 x 20% = 1 Amp. A second example is my setup. I am charging a 75Ah battery so my maximum charge current should not exceed 15A (20%).
An obvious upgrade would be to increase the current capacity of the controller. The author has plans to build a 40A version simply to find how much current a single MOSFET will support and also discover if it is feasible to parallel multiple MOSFETS.
For those intending to increase the controller’s current capacity, I suggest mounting the MOSFET on a large heatsink and rewiring the heavy current carrying conductors away from the PCB. The tracks on the PCB are not suitable for carrying more than 10-15 Amps.
For those wanting to include some form of automated battery protection, you can use the Red LED output to drive another MOSFET or relay driver to disconnect the loads when the battery is almost discharged. Alternatively, this output could be used to trigger an alarm when the battery is almost discharged, this is particularly useful for battery monitoring on remote sites where you have communications available.
Additional images
What about support for 24volt battery systems?
The LP2950 will tolerate supplies up to 30VDC, so no problem there. Should you wish to use the controller on a 24V battery all that you need to do is increase the value of the 82kΩ (R1) voltage divider resistor to 184kΩ (180kΩ + 3.9kΩ in series). The 20kΩ resistor should remain unchanged. Incidentally, these resistors should be 1% metal film to ensure accurate setpoint voltages.
Finally, the optocoupler provides excellent isolation between the ATtiny and the MOSFET. This affords the option to switch even higher DC voltages, providing possibilities for further projects.
How to Test Your TLP190B and Similar Photovoltaic Optocouplers
Connect your photovoltaic optocoupler to a DC supply the same way that you would connect an LED. The internal LED is connected to pins 1 and 3 on the TLP190B. I have used a 5V supply and a 270Ω resistor to limit the current to around 20mA. If all is OK when the internal LED is illuminated, you should see round 10V appear across pins 4 and 6.
Different Types of Solar Panels
There are two main categories of solar panels available today. The first type are panels intended for Grid connected solar systems. These are the ones that have become widespread on Australian roofs. They consist of 60 or 72 individual cells connected in series. They typically output from 30 to 40VDC at their maximum power point. They are designed to be connected in series to produce a total of 150 - 600VDC suitable for connection to a grid connected inverter. The higher output voltage means less panels are required and installation costs are minimised. For best efficiency, you should use an appropriately rated MPPT controller to charge batteries with these panels.
In contrast, the “12V” panels typically encompass 36 cells and, therefore, output around 17 - 18VDC, which is intended to directly charge a 12V battery.
This is the type of panel we recommended you use with this controller. At high temperatures, the panel voltage decreases and is typically only a few volts above the battery voltage. This allows the panel to operate near its maximum power point. Consequently, the battery charge current of this PWM controller will be similar to that of a MPPT unit. You will find these panels readily available in camping, 4WD and marine stores.
In recent months, very cheap second hand grid connect panels have become available as people upgrade their existing solar systems. These can often be purchased second hand for only $10- $25 each. At this price, it is worthwhile installing them with this controller. They will still work fine, however, keep in mind that at best you will only get 70 - 80% of their rated power output.
A word of caution, make sure you do not exceed the maximum MOSFET Vds rating and also the TVS clamp voltage. I managed to smoke a 30V TVS while playing with a grid connect panel on the prototype unit!
On 24V battery systems, you can use either a single grid connect panel or two 12V panels in series, both configurations offer good efficiency.
I have ignored the tiny 6V panels designed to power small electronics.
Demonstration of Gate Capacitance and MOSFET Input Impedance
Wire up the circuit shown in the attached diagram. To begin with, momentarily connect the gate to the source using a small jumper lead. This will bias it off. The LED should not be lit. Now, momentarily short the gate to the drain with a small screwdriver blade (ensure you only touch the plastic screwdriver handle and not the metal blade).
The positive voltage on the gate will switch the MOSFET on and the LED should light. When you withdraw the screwdriver blade what happens to the LED? You should find that it remains lit and will continue to be for several seconds.
What is going on?
In a nutshell, the internal gate capacitance is enough to store the original DC voltage and continues to bias the MOSFET on. The capacitance is only a few hundred pF but the gate resistance is so high it takes some time for the voltage to leak away. In fact, if you now touch the gate lead with your finger the charge will leak away and the LED will be extinguished.
This experiment also demonstrates that we have to drive the FET gate off, as well as on, when we are driving it. This can be simply implemented with a high value resistor between the gate and source to discharge this capacitance.