Mcu 0137-SLA-charge-controller

From wikipost
Jump to navigation Jump to search

For me this charge controller is part of a bigger project, but since it should work fine as a stand-alone solution I thought I'd put it here for the world to see and use.

I will be using the 8-pin 8-bit ATtiny84 for this design.


This charge controller aims to do the following:


  • use battery voltage sensing to detect whether the charging circuit should be activated or not.
  • use a fixed charge current in combination with an LM317 to regulate charge current
  • set final charge voltage using a trimpot (12V - 15V)
  • enter sleep mode on the microcontroller to save power when the battery is charged.
  • signal charge state with an LED
  • minimal current draw when not charging (a few uA's)
  • input voltage range (17V - 30V)


OPTIONALLY:

  • use a boost converter to allow charging from low input voltages (e.g. 5V from a USB port).


The first version of the charge controller schematic:

0137 schematic v1.0.png

NOTE: the value of the charge-current resistor (right next to the LM317) in the schematic applies to R3 (shown as 20R). The final PCB has this resistor listed as R7!


0137 prototype.jpg

After breadboarding, this was the first prototype on perfboard of the SLA battery charger circuit. It incorporates a tiny boost converter to allow charging a 12V battery from much smaller voltage sources.


0137 SLA-battery-charger pcb v1.0.jpg

First PCB (v1.0) with the IRF9540 for Q1. Working fine, but some improvements can still be made.



The next step will be to work out the following features:

  • choosing a more powerful FET to control higher charge currents




Sizing the Charge Controller FET Q1

N-channel FETs Q2 and Q4 are just for switching the P-channel FETs to ground, so they can be low-power 2N7000 or BS138. The FET Q3 is used to switch on the voltage-divider network to sample the battery voltage and with the two resistors in series we'll see only a few mA's running through Q3, so no worries there either. However, P-channel FET Q1 is the one that will be switching the charge current (as regulated by the LM317) to the battery.

For low-power charging we can suffice with a BS250 in a TO-92 package. Although the datasheet for the BS250 rates the FET for a maximum heat dissipation of 830mW (about 55mA @ 15V), in general, a TO-92 package is only capable of dissipating a maximum power of 644mW, so the power to the battery during charging should not exceed 42mA @ 15V (taken 15V as the maximum charge voltage)


(how to size the LM317 feedback resistor... link here?)


This means that if we want to use a higher charge current than 42mA we will need a different FET for Q1. Most importantly, we'll need a FET in a package that can dissipate the heat better. A good upgrade for Q1 will be the IRF9540. This FET is in a TO-220 package and it can handle up to 50W. Now, this 50W rating is only if you have a big heatsink on the metal body of the FET. Without a heatsink you should not go much higher than about 1.5 Watts. If we take 1.5 Watt as our example with a non-heatsinked IRF9540, we should be able to charge the battery at (1.5 Watts / 15V = ) 100mA.

A small heat sink will go a long way in keeping the FET cool(er) and allowing the circuit to charge the battery at higher rates.




Input voltage

The input voltage to properly charge the battery is around 17 Volts. This seems rather high for charging a 12V battery. Why is this so?

When charging a discharged 12V SLA battery the voltage applied to the battery will change over time. This graph shows what's going on:

SLA-charge-stages.jpg

On the (solid line) voltage curve you can see that the starting voltage of a cell is around 2.1V. There are 6 of those cells in a 12V SLA battery, so the voltage on the terminals is (6 x 2.1V = ) 12.6V. Initially the charger will output the maximum current to the battery, this is called the Bulk Charge state. When the charging has raised the terminal voltage to 13.8V (6 x 2.3V per cell) the battery voltage is kept at 13.8V by applying less and less current, this is called the Absorption Stage. Once the current reaches a certain minimum the charging is almost completely stopped and it will just keep the battery at a specific voltage that it can comfortably sit at for extended periods of time, this is the Float state. For most 12V SLA batteries this is around 13.5 V.

The little battery charger from our project isn't quite that clever. It will simply apply the maximum current to the battery until it reaches the voltage as set by the trimpot and then stop charging. It will begin charging again when the battery voltage has dropped about 1 Volt below the setpoint voltage.

The trimpot allows for setting the maximum voltage between 12V and 15V so we will need to cater for the maximum voltage when determining our input voltage.

At 100mA The LM317 needs at least 1.6V overhead, but this will be operating the device with no margin. A common 'headroom' figure for the LM317 is about 3V but this will be when running it at much higher current. In our design I have chosen a headroom of 2 Volts, but that means it shouldn't be used for charging with more than 250mA. So for low-power charging conditions and a headroom of 2V dropout voltage on top of 15V as a maximum charge voltage we need to provide at least a 17V input voltage.

LM317-dropout-voltage.png


The maximum input voltage should not exceed 30V, this being the maximum input voltage rating of the 78L05 voltage regulator to power the ATTiny85 microcontroller.