Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

A PIC based NiMh Battery Charger

  • Author xaccto
  • Create date
  • Updated
  • Blog entry read time 3 min read
ok,i'm trying this blog thing to post about a battery charger using PIC12F683

My first goal for this charger is to charge either a single cell or 2 in series. I haven't seen any cheap
commercial single cell chargers, so that provided the motivation.

Many devices use 3xAA batteries, and this presents a problem using chargers that charge 2 in series, so
you keep swapping the 4th battery in your recharging regime.....but soon or later one battery is dead, and this has happened to me twice thus far.

So this charger is applied to AA cells, but you can use the design for other cells also.
It uses a PIC12F683 comparator mode to drive a PNP switch mode supply. It uses current feedback to supply
a constant current to the battery under charge.
I am using a 2SB772 PNP, this transistor is much superior to the venerable BD140 I have used in circuits in the past, and
is a big reason for the success and efficiency of this design.
I think using a BJT here is simpler than using say a PMOS FET, and this BJT is fairly cheap and small package (TO-126).

Schematic:

1BattCharger-mk4-v2-Sch.jpg



View attachment 1BattCharger-mk4-v2-Sch.pdf




To understand how this charger works you may want to review Microchip reference AN216 which explains
the use of the on chip comparator to control the DC/DC converter.

PCB:
1BattCharger-mk4-v2-pcb.jpg




View attachment 1BattCharger-mk4-v2-PCB.pdf

SOFTWARE:

I used the free Knudsen CC5X C compiler https://www.bknd.com/
which can conveniently be installed into MPLAB.
I am sure you would like to see some code, so I present my public version of it which is sufficient to show you
how to drive the circuit and chip. Its also a good demonstration of using finite state machine method of running
the code.
The parameters for NiMh charging are configurable in the EEPROM file batchgr_eedata.c. There are 2 blocks of parameters
which are used, depending on whether 1 or 2 cells in series are found.

To develop this code I used MPLAB ICD 2. It would have been quite difficult otherwise to develop for a 8pin chip directly.
Alternate method could be to prototype with a chip using more pins with a serial port to print out debugging results,
which I have done with other projects.
View attachment batchgr-1x.zip

IMPROVEMENTS:
1/
To get accurate and consistent results in charging batteries, the reference voltage needs to be considered.
Since the circuit uses the 5V regulator as voltage reference also, improvement can be obtained by replacing the cheap
78L05 with a LP2950-5.0.
If you look into the source code header and find
#define VREF (4.95)
this is the setting that you have measured the regulator to be doing in-circuit with your multimeter.


2/
Other improvement would be to now use PIC12F1822, this has a Fixed Voltage Reference peripheral on chip, which setting
to its lowest voltage value, 1.024V would allow a good range for f/b from the current sense resistors, which in the current scheme is 2R. Using 1R or less would improve efficiency here.

3/
The indicated pushbutton switch to GP3 could be replaced with a jumper to select either of 2 pre-configured values.

Well I hope you find this useful.


anyway, is a blog a superior way to post about a project than just posting in the usual forum ? we shall see.....
1BattCharger-mk4-v2-view.png


-----------
updated schematic pdf
  • Like
Reactions: abolayl

Comments

Part and Inventory Search

Blog entry information

Author
xaccto
Read time
3 min read
Views
2,322
Comments
2
Last update

Downloads

  • batchgr-1x.zip
    175 KB · Views: 911
  • 1BattCharger-mk4-v2-PCB.pdf
    43.3 KB · Views: 1,004
  • 1BattCharger-mk4-v2-Sch.pdf
    78 KB · Views: 1,589
  • 1BattCharger-mk4-v2-Sch.pdf
    77.7 KB · Views: 1,221

More entries in Projects with microcontrollers

Share this entry

Back
Top