|
Part 2: Hardware and Software Implementation
by Thomas Richter
Start ý The
Buck Converter ý Voltage Reference and
Battery Temperature ý AT90S2333 Battery
Charger ý ATtiny15 Battery Charger
ý Charge Current ý Software
Implementation ý User Settings ý Source
Code ý INT Battery Function ý The
Stable_ADC Function ý BC.H ý B_DEF.H
ý Charge MethodýSLA.C ý Charge
MethodýNiCd.C and NiMH.C ý Charge MethodýLilon.C
ý Suggested Improvement ý Sources
and PDF
Last month, I introduced you to the AVR
Battery Charger Reference Design and went through the basics of battery
technologies, safe charging methods, and termination methods. This
month, Iýd like to get down deep into the design by discussing the
hardware and software.
The reference design includes two complete
battery charger designs and is divided into five main blocks (see
Photo 1). The power supply includes analog reference, pushbutton,
and LEDs (for
power supply and reference voltage schematics).
The input voltage is rectified through D9ýD12 and then filtered by
C13. The rectified input voltage can be measured at the test point
marked VIN. VIN is supplied to both the buck
converter and LM7805 voltage regulator. The LM7805 delivers 5 V for
the microcontrollers. This voltage can be measured at the test point
marked VCC. When the power is on, the LED marked "5V
OK" is lit.
The PC interface is connected to the
UART interface on the 2333 and can be used to log battery data while
charging. The data can be imported in a spreadsheet to display the
charging characteristic for a certain battery. For more information
about logging data, see application note "AVR451: Data Logger
for Battery Charger Reference Design." In the app note, youýll
also find source code examples and Microsoft Excel spreadsheets for
importing data. The 2333 can also be used as a data logger when using
the ATtiny15 battery charger.
The board has several LEDs and switches
for debug/monitoring purposes. Only a few are used in the current
applications, but the rest can be added easily when needed. The table
below shows a quick rundown of the connections and functions for the
LEDs and switches.
|
Label
|
Description
|
|
LED0
|
Connected to Port B, pin 0 on
the 2333. Used in the current application for visualizing
the charge mode fast or trickle.
|
|
LED1
|
Connected to Port B, pin 2 on
the 2333.
|
|
LED2
|
Connected to Port B, pin 3 on
the 2333.
|
|
LED3
|
Connected to Port B, pin 4 on
the 2333. Used to display "Error" in the 2333 application.
|
|
LED4
|
Not connected, can be connected
to test points on the board for extended debug/monitoring.
|
|
LED5
|
Not connected, can be connected
to test points on the board for extended debug/monitoring.
|
|
LED6
|
Connected to Port B, pin 1 on
the ATtiny15. Used in the current application for visualizing
the PWM frequency.
|
|
LED7
|
Indicates power status.
|
|
S1
|
Connected to Port D, pin 4 on
the 2333. Used to start the charger in the current 2333 application.
|
|
S2
|
Connected to Port D, pin 5 on
the 2333.
|
|
S3
|
Connected to Port D, pin 6 on
the 2333.
|
|
S4
|
Connected to Port D, pin 7 on
the 2333.
|
|
S5
|
Restarts the prog Restarts the
program and is used to recover from charge errors.
|
Both designs have a 10-pin ISP header
on the test board. The flash program memory and EEPROM data memory
can be downloaded from AVRISP PC programming software.
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |