|
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
VOLTAGE REFERENCE AND BATTERY TEMPERATURE
The voltage reference is supplied by
a TL431 CPK voltage reference. AREF is set by resistors
R34 and R10 and can be calculated by:
[1]
This value is a trade-off between a high-resolution
(low AREF value) and a high signal-to-noise ratio (high
AREF value). The voltage reference is common for both battery
charger designs.
Temperature is measured by a negative
temperature coefficient (NTC) resistor that has an approximate resistance
of 10 kilohms at 25ýC. The NTC is part of a voltage divider, which
is powered by the reference voltage.
The resolution, in respect to the voltage
measured across the NTC, is the same as for the voltage measurement
circuit:
[2]
The steps can be calculated by the following
equation:
[3]
The NTC resistance does not follow a
linear curve, which makes it difficult to calculate the temperature
from the ADC value. Using a table to look up the temperature solves
this (see Table 1).
|
ADC reading
|
Temperature (°C)
|
0.5°C Steps
|
NTC (ohm) resistance
|
|
675
|
8.6
|
5
|
19341
|
|
650
|
11
|
4
|
17380
|
|
625
|
14
|
6
|
15664
|
|
600
|
16
|
5
|
14151
|
|
575
|
18.8
|
5
|
12806
|
|
550
|
21.2
|
5
|
11603
|
|
525
|
23.6
|
5
|
10521
|
|
500
|
26.2
|
5
|
9542
|
|
475
|
28.8
|
4
|
8652
|
|
450
|
32
|
6
|
7840
|
|
425
|
34
|
4
|
7095
|
|
400
|
37
|
5
|
6410
|
|
375
|
39.4
|
5
|
5778
|
Table 1ýCheck out the NTC steps according
to temperature.
Table 1 indicates the steps equal 0.5°
C for ADC values 400 to 675. ADC value 400 is approximately 37ýC and
675 is 8.6ýC. Using this table and doing some minor changes in the
header file B_DEF.H will make it easy to implement any NTC
resistor.
The ATtiny15 battery charger design assumes
that the linearity of the thermistor is sufficient to detect a temperature
increase. Therefore, it uses a constant compare value to monitor the
temperature.
The values in the table are calculated
from the NTC voltage divider and datasheet.
PREVIOUS
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. |