Download: 8-bit Microcontroller Application Note AVR450: Battery Charger for SLA, NiCd, NiMH and Li-Ion Batteries Features

8-bit Microcontroller Application Note Rev. 1659B–AVR–11/02 AVR450: Battery Charger for SLA, NiCd, NiMH and Li-Ion Batteries Features • Complete Battery Charger Design • Modular “C” Source Code and Extremely Compact Assembly Code • Low Cost • Supports Most Common Battery Types • Fast Charging Algorithm • High Accuracy Measurement with 10-bit A/D Converter • Optional Serial Interface • Easy Change of Charge Parameters • EEPROM for Storage of Battery Characteristics Description The battery charger reference design is a battery charger that fully implements the lat- est technology in battery char...
Author: Zoble1980 Shared: 8/19/19
Downloads: 47 Views: 542

Content

8-bit

Microcontroller Application Note

Rev. 1659B–AVR–11/02

AVR450: Battery Charger for SLA, NiCd, NiMH and Li-Ion Batteries Features

• Complete Battery Charger Design • Modular “C” Source Code and Extremely Compact Assembly Code • Low Cost • Supports Most Common Battery Types • Fast Charging Algorithm • High Accuracy Measurement with 10-bit A/D Converter • Optional Serial Interface • Easy Change of Charge Parameters • EEPROM for Storage of Battery Characteristics

Description

The battery charger reference design is a battery charger that fully implements the lat- est technology in battery charger designs. The charger can fast-charge all popular battery types without any hardware modifications. It allows a full product range of chargers to be built around a single hardware design; a new charger model is designed simply by reprogramming the desired charge algorithm into the microcon- troller using In-System Programmable Flash memory. This allows minimum time to market for new products and eliminates the need to stock more than one version of the hardware. The charger design contains complete libraries for SLA, NiCd, NiMH, and Li-Ion batteries. Figure 1. Battery Charger Reference Design Board, The battery charger reference design includes two battery chargers built with the high- end AT90S4433 microcontroller and the highly integrated low-cost 8-pin ATtiny15 microcontroller. However, it can be implemented using any AVR microcontroller with A/D converter, PWM output and enough program memory to store the desired charging algorithm.

Introduction As more and more electronic equipment becomes portable, the rush for better batteries

with higher capacity, smaller size and lower weight will increase. The continuing improvements in battery technology calls for more sophisticated charging algorithms to ensure fast and secure charging. Higher accuracy monitoring of the charge process is required to minimize charge time and utilize maximum capacity of the battery while avoiding battery damage. The AVR microcontrollers are one step ahead of the competi- tion, proving perfect for the next generation of chargers. The Atmel AVR microcontroller is the most efficient 8-bit RISC microcontroller in the market today that offers Flash, EEPROM, and 10 bits A/D converter in one chip. Flash program memory eliminates the need to stock microcontrollers with multiple software versions. Flash can be efficiently programmed in production just before shipping the fin- ished product. Programming after mounting is made possible through fast In-System Programming (ISP), allowing up-to-date software and last minute modifications. The EEPROM data memory can be used for storing calibration data and battery charac- teristics, it also allows charging history to be permanently recorded, allowing the charger to optimize for improved battery capacity. The integrated 10-bit A/D converter gives superior resolution for the battery measurements compared to other microcontroller- based solutions. Improved resolution allows charging to continue closer to the maximum capacity of the battery. Improved resolution also eliminates the need for external op- amps to “window” the voltage. The result is reduced board space and lower system cost. AVR is the only 8-bit microcontroller designed for high-level languages like “C”. The ref- erence design for AT90S4433 is written entirely in “C”, demonstrating the superior simplicity of software design in high-level languages. C-code makes this reference design easy to adopt and modify for today’s and tomorrows batteries. The reference design for ATtiny15 is written in assembly to achieve maximum code density. 2 AVR450,

AVR450 Theory of Operation The charging of a battery is made possible by a reversible chemical reaction that

restores energy in a chemical system. Depending on the chemicals used, the battery will have certain characteristics. When designing a charger, a detailed knowledge of these characteristics is required to avoid damage inflicted by overcharging.

The AVR 8-bit RISC MCU The reference designs includes two separate battery chargers. One using AT90S4433

AVR microcontroller and one using the ATtiny15 AVR microcontroller. The AT90S4433 design demonstrates how efficient a battery charger can be implemented with C-code. The ATtiny15 design shows the highest integrated and lowest cost battery charger avail- able in today’s market. The AT90S4433 can be used for voltage and temperature monitoring with UART interface to PC for data logging. Table 1 shows the differences in the design. Table 1. Design Differences AT90S4433 Design ATtiny15 Design Programming Language C Assembly Code Size (approximately) 1.5K Bytes <350 Bytes Current Measurement External Op-Amp Gain Stage Built-in Differential Gain Stage PWM Frequency 14 kHz, 8-bit Resolution 100 kHz, 8-bit Resolution Clock Source External Crystal, 7.3 MHz Internal Calibrated RC Oscillator, 1.6 MHz Serial Comm. Interface Yes No In-System Programming Yes Yes

Battery Technologies Modern consumer electronics use mainly four different types of rechargeable batteries:

• Sealed Lead Acid (SLA) • Nickel Cadmium (NiCd) • Nickel Metal Hydride (NiMH) • Lithium-Ion (Li-Ion) It is important to have some background information on these batteries to be able to select the right battery and charging algorithm for the application. Sealed Lead Acid (SLA) Sealed Lead Acid batteries are used in many applications where cost is more important than space and weight, typically preferred as backup batteries for UPS and alarm-sys- tems. The SLA batteries are charged using constant voltage, with a current limiter to avoid overheating in the initial stage of the charging process. SLA batteries can be charged infinitely, as long at the cell voltage never exceeds the manufacturer specifica- tions (typically 2.2V). Nickel Cadmium (NiCd) Nickel Cadmium batteries are widely used today. They are relatively cheap and conve- nient to use. A typical NiCd cell can be fully charged up to 1,000 times. They have a high self-discharge rate. NiCd batteries are damaged from being reversed, and the first cell to discharge completely in a battery pack will be reversed. To avoid damaging discharge of a battery pack, the voltage should be constantly monitored and the application should be shutdown when the cell voltage drops below 1.0V. NiCd batteries are charged with constant current., Nickel Metal Hydride (NiMH) Nickel Metal Hydride batteries are the most widely used battery type in new lightweight portable applications (i.e., cell phones, camcorders, etc.). They have a higher energy density than NiCd. NiMH batteries are damaged from overcharging. It is therefore important to do accurate measurements to terminate the charging at exactly the right time (i.e., fully charge the battery without overcharging). Like NiCd, NiMH batteries are damaged from being reversed. NiMH has a self-discharge rate of approximately 20%/ month. Like NiCd batteries, NiMH batteries are charged with constant current. Lithium-Ion (Li-Ion) Lithium-Ion batteries have the highest energy/weight and energy/space ratio compared to the other batteries in this application note. Li-Ion batteries are charged using constant voltage, with current limiter to avoid overheating in the initial stage of the charging process. The charging is terminated when the charging current drops below the lower current limit set by the manufacturer. The battery takes damage from over- charging and may explode when overcharged.

Safe Charging of Modern fast chargers (i.e., battery fully charged in less than three hours, normally one Batteries hour) requires accurate measurements of the cell voltage, charging current and battery

temperature in order to fully charge the battery completely without overcharging or oth- erwise damage it. Charge Methods SLA and Li-Ion batteries are charged with constant voltage (current limited). NiCd and NiMH batteries are charged with constant current and have a set of different termination methods. Maximum Charge Current The maximum charge current is dependent on the battery capacity (C). The maximum charge current is normally given in amounts of the battery capacity. For example, a bat- tery with a cell capacity of 750 mAh charged with a charging current of 750 mA is referred to as being charged at 1C (1 times the battery capacity). If the charging current for trickle-charge is set to be C/40 the charging current is the cell capacity divided by 40. Overheating By transferring electric energy into a battery, the battery is charged. This energy is stored in a chemical process. But not all the electrical energy applied to the battery is transformed into the battery as chemical energy. Some of the electrical energy ends up as thermal energy, heating up the battery. When the battery is fully charged, all the elec- trical energy applied to the battery ends up as thermal energy. On a fast charger, this will rapidly heat up the battery, inflicting damage to the battery if the charging is not ter- minated. Monitoring the temperature to terminate the charging is an important factor in designing a good battery charger. 4 AVR450,

AVR450 Termination Methods The application and environment where the battery is used sets limitations on the choice

of termination method. Sometimes it might be impractical to measure the temperature of the battery and easier to measure the voltage, or the other way around. This reference design implements the use of voltage drop (-dV/dt) as primary termination method, with temperature and absolute voltage as backup. But the hardware supports all of the below mentioned methods. t – Time This is one of the simplest ways to measure when to terminate the charging. Normally used as backup termination when fast-charging. Also used as primary termination method in normal charging (14 - 16h). Applies to all batteries. V – Voltage Charging is terminated when the voltage rises above a preset upper limit. Used in com- bination with constant current charging. Maximum current is determined by the battery, usually 1C as described above. Current limiting is crucial to avoid thermal damage to the battery if charge current is too high. SLA batteries are normally charged infinitely by setting the maximum voltage above the actual charge voltage. Used for Li-Ion as pri- mary charging algorithm/termination method. Li-Ion chargers usually continue with a second phase after the maximum voltage has been reached to safely charge the battery to 100%. Also used on NiCd and NiMH as backup termination. -dV/dt – Voltage Drop This termination method utilizes the negative derivative of voltage over time, monitoring the voltage drop occurring in some battery types if charging is continued after the bat- tery is fully charged. Commonly used with constant current charging. Applies to fast- charging of NiCd and NiMH batteries. I – Current Charging is terminated when the charge current drops below a preset value. Commonly used with constant voltage charging. Applies to SLA and Li-Ion to terminate the top-off charge phase usually following the fast-charge phase. T – Temperature Absolute temperature can be used as termination (for NiCd and NiMH batteries), but is preferred as backup termination method only. Charging of all batteries should be termi- nated if the temperature rises above the operating temperature limit set by the manufacturer. Also used as a backup method to abort charging if voltage drops below a safe temperature – Applies to all batteries. dT/dt – Temperature Rise The derivative of temperature over time can be used as termination method when fast- charging. Refer to the manufacturer’s specifications on information on the exact termi- nation point (Typically 1C/min for NiCd batteries) – Applies to NiCd and NiMH. DT – Temperature over Terminates charging when the difference between ambient (room) temperature and bat- Ambient Temperature tery temperature rises over a preset threshold level. Applies to NiCd and SLA as primary or backup termination method. Preferred over absolute temperature to avoid battery damage when charged in a cold environment. As most systems have only one tempera- ture probe available, the ambient temperature is usually measured before charging is initiated. dV/dt = 0 – Zero Delta Voltage This termination method is very similar to the -dV/dt method, but pinpoints more accu- rately when the time voltage no longer rises. Applies to NiCd and NiMH batteries.,

Hardware The reference design includes two complete battery charger designs. The reference Implementation design is divided in 5 main blocks (see Figure 2).

Figure 2. The Main Blocks of the Battery Charger Reference Design LEDs and PC Interface Switches tiny15 Battery 2333 Charger Battery Charger Power Supply Power Supply Includes analog reference, push-button and LEDs. The input voltage is rectified through D9 - D12 and then filtered by C13. The rectified input voltage can be measured at the testpoint marked “VIN”. VIN is supplied to both the buck converter and to the LM7805 voltage regulator. The LM7805 delivers 5V for the microcontrollers. This voltage can be measured at the testpoint marked “VCC” The LED marked “5V OK” indicates power on. PC Interface Connected to the UART interface on the AT90S4433. Can be used to interface PC for logging battery data during charging. The data can be imported in a spreadsheet to dis- play the charging characteristic for a battery. The AT90S4433 can also be used as data logger when using the ATtiny15 battery charger. LEDs and Switches The board has several LEDs and switches for debug/monitoring purpose. Only few are used in the current applications, but the rest can be added easily when need. • LED0: Connected to Port B, pin 0 on AT90S4433. Used in the current application for visualizing the charge mode fast or trickle. • LED1: Connected to Port B, pin 2 on AT90S4433. • LED2: Connected to Port B, pin 3 on AT90S4433. • LED3: Connected to Port B, pin 0 on the AT90S4433. Used to display “Error” in the AT90S4433 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. 6 AVR450,

AVR450

• LED6: Connected to Port B, pin 1 on ATtiny15. Used In the current application for visualizing the PWM frequency. • VCCPower: Indicates power status. • SW0: Connected to Port D, pin 4 on AT90S4433. Used to start the charger in the current AT90S4433 application. • SW1: Connected to Port D, pin 5 on AT90S4433. • SW2: Connected to Port D, pin 6 on AT90S4433. • SW3: Connected to Port D, pin 7 on AT90S4433. • RESET: Restarts the program and is used to recover from charge errors. In-System Programming (ISP) Both designs have a 10-pin ISP header on the test board. The Flash program memory Interface and EEPROM data memory can be downloaded from AVRISP PC programming software. ATtiny15 with 100 kHz Buck ATtiny15 includes special features to make it specially suited for battery charger appli- Converter cations. The internal 100 kHz PWM is connected to a buck converter. The high switching frequency and high accuracy reduce the size of the external coil and capaci- tors. Testpoints are added to easily monitor the PWM output, voltage input, and current input. The ATtiny15 includes an internal gain stage that can amplify the differential volt- age between two A/D channels. This eliminates the need for external op-amps. The charge current is measured as the differential between two A/D channels over a 0.25 resistor. Power supply for the battery charger is shown in Appendix 2. AT90S4433 with 14 kHz Buck The 90S4433 battery charger design uses an external op-amps to amplify the voltage Converter for the current measurement. This ensures the highest accuracy for the battery mea- surement. The charger is capable of communicating with a PC, which can be used to monitor charging parameters and to debug the charging algorithm. The battery charger circuit was designed to charge any of the four battery types SLA, NiCd, NiMH and Li-Ion with the appropriate charge algorithm. These charge algorithms include fast-charge mode and a top-off trickle-charge to gain minimum charge time with maximum battery capacity. Power supply for the battery charger is shown in Appendix 2. Buck Converter The buck-converter is similar for both the AT90S4433 and the ATtiny15. They consist of one P-channel MOSFET switching transistor driven by the AVR via one bipolar NPN transistor. The switching transistor is connected to an inductor, a diode and a capacitor (see Figure 3). An additional diode prevents the battery from supplying voltage into the microcontroller when the power is disconnected. When the switching transistor is on (illustrated by a switch on the figures below) the current will flow like Figure 3A illus- trates. The capacitor is charged from the input via the inductor (the inductor is also charged up). When the switch is opened (Figure 3B), the inductor will try to maintain its current-flow by inducing a voltage. The current flows through the diode and the inductor will charge the capacitor. Then the cycle repeats itself. If the duty cycle is decreased, by shorter on time, longer off time, the voltage will decrease. If the duty cycle is increased (longer on timer, shorter off time), the voltage will increase. The buck-converter is most efficient running on a duty cycle of 50%., Figure 3. Buck Converter Switching Principle (A) (B) SWITCH ON INDUCTOR SWITCH OFF INDUCTOR VIN VOUT VIN VOUT SHOTTKY CAPACITOR SHOTTKY CAPACITOR DIODE DIODE GND GND GND GND Voltage Reference The voltage reference is supplied by a TL431 CPK voltage reference. AREF is set by the resistors R34 and R10 and can be calculated by: R 4K7 AREF VREF1 2.495 1 3.67V R10 10K 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 Battery Temperature Temperature is measured by a negative temperature coefficient (NTC) resistor. It has an approximate resistance of 10 k at 25C. 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. Resolution: 3.67V mV 3.58 1024steps step The steps can be calculated by the following equation:

R

N 1024 NTC RNTC 10k 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 2). The table indicates the steps equal to 0.5C for ADC values 400 to 675. ADC value 400 is approximately 37C and 675 is 8.6C. 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 ther- mistor 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 voltage divider at the NTC and datasheet for the NTC. 8 AVR450,

AVR450

Table 2. NTC Steps According to Temperature ADC Reading Tempereature (C) 0.5C Steps NTC () 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

AT90S4433 Battery This section describes theory specific for the battery charger design based on Charger AT90S4433.

Parameters for Layout Oscillator frequency: fOSC = 7.3728 MHz Saturation voltage: Vsat = 0.5V Input voltage: VI = 15V Output voltage: VO = 1.5V Maximum output current: IO,max = 1.5A 8-bit PWM: T 69.199s fOSC With duty cycle of 50%: 69.199s ton 34.60s2 Inductance: VVLIsat V0 ton 15V 0.5V 1.5V 34.60s 149.9H 2Io,max 2 1.5A, L 2 IOmax 150H 3Aton 33.83sVI Vsat VO 15V 0.2V 1.5V This gives a duty cycle of ton 33.83s 0.489 48.9 %

T 69.199s AT90S4433 Measurement Circuitry

Battery Voltage The charging voltage is monitored using an op-amp to measure the voltage difference between the positive and the negative pole of the battery. In order to select a suitable measurement range for the charger, decide how many battery cells and what type of batteries to charge, select a suitable input voltage (V1 - V2) and scale resistors for the voltage measurement. The op-amp circuit for measuring the battery voltage is an ordi- nary differential op-amp circuit. The equation for the output voltage from the op-amp circuit is shown below. The ADC is capable of measuring the voltage range from AGND to AREF (3.67V). The output voltage (VBAT2) from the op-amp has to be within this range:. Ra VBAT2 * V1V2Rb Where: • VBAT2 is the output voltage from the op-amp to the AVR A/D. • V1 is the positive pole of the battery. • V2 is the negative pole of the battery. • Ra and Rb are the resistors in the resistor network used to set the gain for the op- amp. • Ra is equal to R10 and R12. • Rb is equal to R6 and R7. The maximum charge voltage will be: Rb 33k (V1V 2) * A Ra REF * 3.67 12.1V 10k Gain in op-amp: G Ra 10 kU 1B 0.303Rb 33 k 10 AVR450,

AVR450

The resulting battery measurement resolution: ADCresolut ion 3.58mV mV 11.82 GU1B 0.303 step Charge Current The charge current is measured by sensing the voltage over a 0.033 shunt-resis- tor(R1). This voltage is amplified using an op-amp to improve the accuracy of the measurement before it is fed into the A/D converter. This voltage is amplified by the factor: R5 39k1 1 58.4 R2 680 The op-amp output voltage is therefore: R5 VIbat2 1 IShunt R6 R2 which is: VIbat2 1.926IShunt The maximum current that can be measured is: 3.58 IBATmax 2.0A1.926 This gives a resolution of: 2000mA mA 1.95 1024steps step The step number for a given current can now be calculated from: mA IShunt N 1.95step The current from a certain step number is:

I

N Shunt mA 1.95 step,

ATtiny15 Battery Charger This section describes theory specific for the battery charger design based on ATtiny15.

The 25.6 MHz oscillator frequency is generated with an on-chip PLL from an 1.6 MHz internal RC-oscillator. The reference design is shipped without resistors for dividing down the voltage of the battery. This limits the maximum voltage to 3.67V, making it suitable for 1-2 cells NiCd or NiMh batteries. To use higher voltages, simply add the required resistors to divide down the voltage into the 0-3.67V range. Calculation of the resistors are described at the end of this section. Parameters for Layout Oscillator frequency: fOSC = 25.6 MHz Saturation voltage: Vsat = 0.5V Input voltage: VI = 12V Output voltage: VO = 1.5V Maximum output current: IO,max = 1.5A 8-bit PWM: T 9.96S fOSC With duty cycle of 50%: 9.96s t on 4.43S2 Inductance: VI Vsat V0 ton 15V 0.5V 1.5V 4.43sL 21.1H 2Io,max 2 1.5AL2IOmax 22H 3Aton 4.88SVI Vsat VO 15V 0.5V 1.5V This gives a duty cycle of ton 4.88s 0.449 44.9 % T 9.96s 12 AVR450,

AVR450 ATtiny15 Measurement Circuitry

Battery Voltage The charge voltage is measured directly on the positive battery pole. When a voltage higher than the reference voltage (3.67V) is used to charge the battery, the charging voltage can be divided down with two resistors to fit into the 0-3.67V area. This input is also the negative input for the differential measurement of the battery charge current as shown in Figure 4. The current is measured as the difference between the negative and positive input to the internal 20x gain stage. This voltage is measured over a 0.25 shunt resistor. All measurements are done with 10-bit (1024 steps) resolution. Figure 4. Voltage and Current Measurement tiny15 I BAT 20x Gain Sense Stage Resistor ADC2 ADC3 VBAT The voltage resolution is decided by AREF. Resolution: 3.67V mV 3.58 1024steps step In order to select a suitable measurement range for the charger, decide how many bat- tery cells and what type of batteries to charge. The ADC is capable of measuring the voltage range from AGND to AREF (3.67V). The output voltage (VADC) from the voltage divider has to be within this range. Rb VADC * VbRa Rb Where: • VADC is the output voltage from the voltage divider to the AVR A/D. • Vb is the battery voltage. • Ra and Rb are the resistors used to scale down the battery voltage. • Ra is equal to R8 in the reference design. • Rb is equal to R16 in the reference design Note that the resistors R9 and R17 for scaling down the voltage of the shunt resistors must be equal to R8 and R16 for scaling down the voltage measurement. The reference design uses R8 = R9 = 3.7 k and R16 = R17 = 2.2 k., This gives maximum charge voltage:

R

V bat = 1 + - 8-V 3.7 R ADC = 1 + - 3.67 = 9.8V 2.216 Charge Current The charge current is measured by sensing the voltage over 0.025 shunt-resistor. This voltage is amplified 20 times using the internal gain stage to improve the accuracy of the measurement before it is fed into the A/D converter. The ADC input voltage output voltage is:

R V BIbat 20 IR R shunt R18 B A

where: • VIbat is the analog input voltage to the A/D converter. • Ishunt is the current through the 0.25 shunt resistor. • Ra and Rb are the resistors used to scale down the voltage on the shunt resistor with the same scale as the voltage measurement. • Ra is equal to R9. • Rb is equal to R17 VIbat 1.864 Ishunt The maximum current that can be measured is: 3.67 Ishuntmax 1.96A1.864 This gives a resolution of: 1968mA mA 1.92 1024steps step The step number for a given current can now be calculated from:

I

N BAT mA 1.92 step The current from a certain step number is: mA IBAT N 1.92step 14 AVR450,

AVR450 Software This section describes the software used in the battery charger reference design, it Implementation explains the C-code implementation for AT90S4433. The same principles also applies

for the assembly code for ATtiny15. For complete description of the ATtiny15 assembly code, see the comments in the source code. The battery type to be charged has to be set at program compile time. The software can be extended to support charging of more than one battery. The straightforward implementation is to charge batteries sequentially allowing each battery a timeslot during trickle-charge. SLA and Li-Ion batteries can be charged in parallel with constant voltage charging if the number of battery cells in each battery-pack is the same. The charging current for each battery is limited and the charging voltage is limited as for one cell. In the “Battery Characteristics” (b_car.h) all values are calculated with all their scaling factors. These values are defined in the include files, calculated at compile time and then handled as constants during program execution. All values taken from the A/D con- verter can directly be compared to these constants. This means that no time is used on recalculating values during program execution, saving time and memory space. The val- ues and fo rmu las used to ca lcu la te the va lues a re ex t rac ted f rom the “Measurement Circuitry” section. See “AT90S4433 Measurement Circuitry” on page 10 and See “ATtiny15 Measurement Circuitry” on page 13. For NiCd battery, charge is started if the battery temperature is within the temperature range. Charge is always terminated with an error message if the temperature is higher than the maximum temperature, if the voltage exceeds the maximum battery voltage or if the maximum fast-charge time expires. The normal ways to detect that the battery is fully charged, are the Temperature Rise (dT/dt) and the Voltage Drop (-dV/dt) methods. Therefore, a sample is taken every minute for the temperature and every second of the voltage. The values are compared to the sample taken one minute/second ago. In case the battery is fully charged, the charge status is automatically changed to trickle-charge, causing the program to jump into the trickle_charge() function. The trickle_charge() function executes in a loop checking for a change of the charge status, temperature and voltage measurement and adjusting the current. In case the temperature is outside the valid range or a voltage overflow is detected, the error flag is set and the function is terminated. If no error occurs and charge status is not changed by the user, the program loops forever, adjusting the charge current to the current defined at the top of this module.

User Settings The charger is built as a multipurpose charger that can charge four types of batteries

and a various number of cells by changing parameters before compiling the code. It is very important that this is done properly before compiling or it can damage the battery and the surroundings. Change Battery Type There is a C-file and an h-file for each battery type. Include the desired battery files in the compiler before compiling and “uncomment” the battery type under “Battery Type” in B_Def.h Change Number of Cells Change parameter “cells” in B_Def.h Change Cell Capacity Change parameter “capacity” in B_Def.h Change Li-Ion Cell Voltage Change parameter “cell_voltage” in B_Def.h, Change ADC Step Size After changing the resistor values as described in the Measurement section, the param- eters “voltage_step” and “current_step” must be changed in B_Def.h. This is very important and may damage the charger if not done properly.

Source Code Files The following files are included in the source code directory:

Table 3. C Source Code Files File Name Description Code Size(1) Io4333.h Header file with symbolic names for AT90S4333 cstartup.s90 Start-up files for the C-compiler Lnk0t.xcl Command file for the linker, optimized for AT90S4433 B_def.h Defines battery type, cell voltage, battery capacity and voltage steps Bc.h Header file for bc.h, constants and macro definitions Bc.c Main program, common for all battery types 474 bytes SLA.h Header file for Lead Acid battery, charger parameters and function declarations SLA.c Source code for Lead Acid battery 446 bytes NiCd.h Header file for Nickel Cadmium battery, charger parameters and function declarations NiCd.c Source code for Nickel Cadmium battery 548 bytes NiMh.h Header file for Nickel Metal Hydride battery, charger parameters and function declarations NiMh.c Source code for Nickel Metal Hydride battery 514 bytes Liion.h Header file for Lithium-Ion battery, charger parameters and function declarations Liion.c Source code for Lithium-Ion battery 690 bytes Note: 1. The Code Size applies for version 1.0 of the code. Compiled with IAR compiler ver- sion 1.41C, maximum size optimization. Table 4. Assembly Source Code Files File Name Description Code Size bc.inc Include file for register definitions, A/D channel definitions and general constants tn15def.inc Include file for ATtiny15 NiCd.inc Include file for Nickel Cadmium battery, charger parameters NiCd.asm Source code for Nickel Cadmium battery 324 bytes NiMh.inc Include file for Nickel Metal Hydride battery, charger parameters NiCd.asm Source code for Nickel Metal Hydride battery 328 bytes Liion.inc Include file for Lithium-Ion battery, charger parameters Liion.asm Source code for Lithium-Ion battery 340 bytes 16 AVR450,

AVR450 BC.C This module contains the main function, the setup and the UART functions, the real-time

clock and the interrupt handling routines. In the “setup” routine, all low-level initialization are done. The UART is initialized and the real-time clock set to zero. After the initialization the program loops in idle mode until the status is changed in the global status variable. The real-time clock is started when the PWM is started, and is also stopped when the PWM is stopped, i.e., when the battery voltage is measured. This ensures that only the time when the battery is charged is taken into account. On the other hand, this method has the disadvantage that measurements that rely on time (dV/dt or dT/dt) may be inaccurate. The user can cause an external interrupt by pressing a button to change the charge sta- tus. In the interrupt handling routine, the status is changed according to the button pressed, either to “fast-charge” or to “trickle-charge”. In the main function the program then calls a function depending on the value set in the “charge status” variable. BC.C also includes some common functions used by the different battery programs. The two most important are on the following,

Figure 5. The Main() Function

Main Setup Clear Termination Status

NO

Status = Fast ?

YES

YES Error Detected ?

NO

fast_charge NO Status = Trickle ?

YES

YES Error Detected ?

NO

trickle_charge

NO

Error Detected ?

YES

Red LED On

END

18 AVR450,

AVR450

int battery (Unsigned Char The function is called for each A/D conversion and controls the ADC registers and PWM

Value) according to the measurement requested. It reads eight measurements from the ADC

and calculates an average, which is returned to the calling function.

Figure 6. The Battery() Function

Battery Measurement Type? Current Charge Voltage Temperature Battery Voltage ADMUX = “Current” ADMUX = “Volt” stop_PWM() stop_PWM() ADMUX = ADMUX = “Volt” “Temperature” stable_ADC stable_ADC AV = 0 I = 0 I ≤ 7?

YES

Start ADC

YES NO

NO ADC Done? AV = AV +ADC AV = AV/8 PWM On? NO YES PWM On Return(AV), void stable_ADC (Void) The stable_ADC function is used when measuring battery voltage or temperature. It makes sure the ADC values are stable inside a defined area. This is important for an accurate measurement. The function loops until it gets three ADC values where the highest is no more than one step higher than the lowest. Figure 7. The stable_ADC() Function stable_ADC V[0] > V[1]+1

YES

V[5] = V[4] V[4] = V[3] V[3] = V[2] Start ADC

NO

ADC Done?

NO YES

V[2] = ADC V[1] = Highest Value of V[2] to V[5] V[0] = Lowest Value of V[2] to V[5] Return

BC.H In this module, the bit handling macros, the charge status and the termination bit mask

constants are defined. The “charge status” indicates the actual status of the battery charger; fast-charging, trickle charging or if an error has occurred. For Li-Ion and SLA battery types, an indica- tion on the charge mode, constant voltage or constant current is included as well as if Li- Ion is in the final stage of its fast-charge mode (called “delay”). The “termination” indi- cates the reason why fast-charge mode terminated or in case of a charge error where the error was detected and can be used for program debugging.

B_DEF.H This module defines the battery to be charged. When a customer designs a battery

charger using the given circuit and program code, this file has to be changed to meet the needs. The battery type defines the charging and termination algorithm. If more than one bat- tery type is chosen an error will occur during linking the program, as all functions with the same functions for different battery types have the same names battery(), fast_charge() and trickle_charge(). An error message will also occur if no battery type is chosen. The cell number determines the voltage of the battery pack and all related constants. It is assumed that all cells are in series. Zero cells are not very reasonable but will only result in zero charge current. The voltage range of the buck converter and the voltage measurement circuit sets the upper limit. 20 AVR450,

AVR450

The capacity (in mA) defines the charge current and all related constants. All battery types except SLA, are fast charged in a “conservative” way at 1C. SLA is charged with 2C. This sets the limit for the battery capacity. The buck converter is calcu- lated to supply a maximum current of 1.5 A. The maximum capacity for SLA is 750 mAh, for the other battery types 1500 mAh. If a higher charge current for NiCd or NiMH is required, the buck converter layout has to be changed. In case of a current higher than 2 A, the current measurement circuit also need some modifications. If batteries with a higher capacity than calculated above should be charged, it is possible to change the buck converter or to reduce charge current. For the Li-Ion battery type, two cell voltages exist, depending on the battery manufac- turer. This voltage, 4.1V or 4.2V, must be edited. It will be included automatically if the Li-Ion definition is chosen. Stating a wrong voltage in this place will not necessarily result in an error message, but will lead to incorrect charge methods, which can damage the battery and the battery charger. The ADC step parameters are to be edited according to the resistors used in the mea- surement circuitry. This is described under measurement circuits. The NTC table defines the ADC step value. A step value indicates 0.5C change in the temperature. This lookup table is used in NiCd charging. The table may be edited if the NTC is different from the used in this description.

SLA.C

Charge Method Fast-charge of Sealed Lead Acid batteries uses constant voltage. Before charging begins, a simple (but surprisingly effective) method is used to determine the charge volt- age. A constant current of 1C (10 mA) is applied and the corresponding battery voltage is measured. The battery is first charged with Constant voltage, fixing the voltage to that level and let the current float. When the current drops below 0.2C the charge cycle has finished. Fast-charge mode is then terminated and trickle-charge mode started. Trickle charge is a constant voltage charging at a level slightly below the fast-charge voltage. Trickle charge can be terminated after a set time. Charge Parameter Summary Fast-charge: Fixed fast-charge voltage = cells * 2450 mV Trickle charge: Fixed trickle-charge voltage = cells * 2250 mV General charge termination: Absolute minimum temperature T = 0C Absolute maximum temperature T = 45C Fast-charge termination: Minimum current threshold I = 0.2C Fast-charge error: Maximum fast-charge temperature T = 30C Maximum fast-charge time t = 60 min at 1C current Maximum fast-charge current I = 2C,

Trickle charge termination: None Figure 8. The Trickle_charge() Function for SLA

SLA_trickle Start PWM with Zero Output NO Status = Trickle and No Error ?

YES

NO T Within Limits ?

YES

Green LED Blinking Stop PWM and Flag Error Regulate Battery Voltage Green LED Off

END

22 AVR450,

AVR450 Figure 9. The Fast_charge() Function for SLA, Part 1(2)

SLA_fast_1 Start PWM with Zero Output set last_T set last_sec_V set last_min_V NO T Within Limits ?

YES

NO T < max_T_fast ?

YES

Calculate fast_finish_time Green LED On NO Status = Fast and No Error ?

YES

Regulate Battery Current Read Voltage NO Status = Fast and No Error ? Green LED Off

YES

Regulate Charge Voltage

END

NO Time Overflow ?

YES

Stop PWM and Flag Error A B, Figure 10. The Fast_charge() Function for SLA, Part 2(2) A SLA_fast_2 B NO Temperature Within Limits ? Stop PWM and Flag Error

YES

YES Current Too High ? Stop PWM and Flag Error

NO

60 Sec. Over NO ?

YES

Current NO Below Threshold ?

YES

Stop PWM Change Status to Trickle

NiCd.C

Charge Method NiCd battery types are charged with a constant current. In fast-charge mode this current is set to 1C. In trickle-charge mode, it is C/40. The charging is terminated by the Voltage Drop (-dV/dt) method. Maximum charge voltage, Temperature Rise (dT/dt), and maxi- mum charge time are used as backup terminations. In case the battery is fully charged, the charge status is automatically changed to trickle- charge, causing the program to jump into the trickle_charge() function. 24 AVR450,

AVR450

Charge Parameter Summary Charge conditions: Fast-charge: Fast-charge current = 1C Trickle charge: Trickle charge current = 0.025C General charge termination: Absolute minimum temperature T = 5C Absolute maximum temperature T = 40C Absolute maximum charge voltage V = cells * 1500 mV Fast-charge termination: Voltage drop threshold -dV/dt = 20 mV/min per cell Temperature rise threshold dT/dt = 1C per minute Fast-charge error: Minimum fast-charge temperature T= 15C Maximum fast-charge time t = 90 min at 1C current Figure 11. The Trickle_charge() Function for NiCd NiCd_trickle Start PWM with Zero Output NO Status = Trickle and No Error ?

YES

NO T Within Limits ?

YES

NO V < max_V ?

YES

Stop PWM Stop PWM Green LED Blinking and Flag Error Green LED Off Regulate Battery Current

END

,

Figure 12. The Fast_charge() Function for NiCd, Part 1(2)

NiCd_fast_1 NO T Within Limits ?

YES

NO V < max_V ?

YES

Flag Error NO T > min_T_fast ?

YES

Start PWM with Zero Output Set last_min_T Set last_min_V Calculate fast_finish_time Green LED On NO Status = Fast and No Error ?

YES

Green LED Off Regulate Battery Current NO Time END Overflow ?

YES

Stop PWM and Flag ErrorAB26 AVR450,

AVR450 Figure 13. The Fast_charge() Function for NiCd, Part 2(2)

A NiCd_fast_2 B NO Temperature Within Limits ? Stop PWM and Flag Error

YES

NO Voltage Overflow ? Stop PWM and Flag Error

YES

NO 60 Sec. Over ?

YES

YES dT/dt Overflow ? Stop PWM Change Status to Trickle

NO YES

-dV Overflow ? Stop PWM Change Status to Trickle

NO

Read last_min_T Read last_min_V,

NiMH.C

Charge Method NiMH battery types are charged with a constant current. In fast-charge mode, this cur- rent is set to 1C. In trickle-charge mode it is C/40. The charging is terminated by the Temperature Rise (dT/dt) and the Voltage Drop (- dV/dt) methods. Maximum charge voltage and maximum charge time are used as backup terminations. In case the battery is fully charged the charge status is automatically changed to trickle- charge, causing the program to jump into the trickle_charge() function. Charge Parameter Summary Charge conditions: Fast-charge: Fast-charge current: I = 1C Trickle charge: Trickle charge current: I = 0.025C Maximum trickle-charge time t = 90 min at 0.025C current General charge termination: Absolute minimum temperature = 5C Absolute maximum temperature = 40C Absolute maximum charge voltage = cells * 1500 mV Fast-charge termination: Temperature rise threshold dT/dt = 0.5C per minute Fast-charge error: Minimum fast-charge temperature T = 15C Maximum fast-charge time t = 90 min at 1C current 28 AVR450,

AVR450 Figure 14. The Trickle_charge() Function for NiMH

NiMH_trickle Start PWM with Zero Output NO Status = Trickle and No Error ?

YES

NO T Within Limits ?

YES

NO V < max_V ?

YES

Calculate finish_time Green LED Blinking Regulate Battery Current Time NO Overflow ?

YES

Stop PWM and Flag Error Green LED Off

END

,

Figure 15. The Fast_charge() Function for NiMH, Part 1(2)

NiMH_fast_1 Start PWM with Zero Output Set last_min_T Set last_min_V NO T Within Limits ?

YES

NO V < max_V ?

YES

NO T > min_T_fast ?

YES

Calculate fast_finish_time Green LED On NO Status = Fast and No Error ?

YES

Green LED Off Regulate Battery Current NO Time END Overflow ?

YES

Stop PWM and Flag ErrorAB30 AVR450,

AVR450 Figure 16. The Fast_charge() Function for NiMH, Part 2(2)

A NiMH_fast_2 B NO Temperature Within Limits ? Stop PWM and Flag Error

YES

YES Voltage Overflow ? Stop PWM and Flag Error

NO

NO 60 Sec. Over ?

YES

NO dV/dt Overflow ? Stop PWM Change Status to Trickle

YES

Read last_sec_V NO 60 Min. Over ?

YES YES

dT/dt Overflow ? Stop PWM Change Status to Trickle

NO

Read last_T,

LiIon.C

Charge Method Li-Ion batteries are the most advanced battery types to charge. Fast-charge starts at a constant current of 1C. This current is kept constant until a cell voltage level of 4.1 or 4.2V ± 50 mV is set. Then the battery is charged with constant voltage until the current drops below Imin. For an accurate measurement of the battery voltage (and not the charge voltage), the PWM is turned off during voltage measurements. If the charge method then changes from “constant current” to “constant voltage”, the charge voltage is the relevant parame- ter to be measured. This is the reason why there are two voltage measurement modes, one with “PWM turn off” and one without. Trickle charge of Li-Ion batteries is in principle the same as fast-charge. The current is much lower than in fast-charge mode and the constant voltage phase of the trickle- charge mode is simply terminated by a timer. Charge Parameter Summary Charge conditions: Fast-charge: Absolute maximum charge voltage = cells * cell voltage Voltage tolerance = cells * 50 mV Fast-charge current = 1C Minimum current threshold = 50 mA per cell Trickle charge: Trickle charge current = 0.025C Maximum trickle-charge time = 90 min at 0.025C current General charge termination: Absolute minimum temperature T = 5C Absolute maximum temperature T = 40C Fast-charge termination: See “charge conditions” Fast-charge error: Minimum fast-charge temperature 10C Maximum fast-charge time = 90 min at 1C current 32 AVR450,

AVR450 Figure 17. The Trickle_charge() Function for Li-Ion

LiIon_trickle Start PWM with Zero Output NO T Within Limits ?

YES

NO V < max_V ?

YES

Calculate fast_finish_time Green LED Blinking Status = Delay NO Status = Trickle and No Error ? Green LED Off

YES

Regulate Battery Current

END

Read Charge Voltage YES Charge Voltage Withinin Limits Change Status ? from const_C to const_V NO

NO

Status = const_V ?

YES

Regulate Voltage

YES

Trickle Finish Time Reached ? Stop PWM and Flag Termination

NO

YES Time Overflow ? Stop PWM and Flag Error

NO

YES Temperature Overflow ? Stop PWM and Flag Error

NO

,

Figure 18. The Fast_charge() Function for Li-Ion, Part 1(2)

LiIon_fast_1 Start PWM with Zero Output Status = const_C NO T Within Limits ?

YES

NO V < max_V ?

YES

NO T > min_T_fast ?

YES

Calculate fast_finish_time Green LED On NO Status = Fast and No Error ?

YES NO

Status = const_C ?

YES

Regulate Battery Current Read Charge Voltage YES Charge Voltage Withinin Limits ? Change Status from const_C NO to const_VBCAD34 AVR450,

AVR450 Figure 19. The Fast_charge() Function for Li-Ion, Part 2(2)

BCALiIon_fast_2 D

NO

Status = const_V ?

YES

Regulate Voltage YES Time Overflow ? Stop PWM and Flag Error

NO YES

Temperature Overflow ? Stop PWM and Flag Error

NO

NO 60 Sec. Over ?

YES

NO const_V, NOT Delay & Current Below Threshold ?

YES

Calculate fast_finish_time Status = Delay Delay Time NO Over ?

YES

Stop PWM Status = const_C Status = trickle Green LED Off

END

,

Suggested NiCd batteries suffer from “Memory Effect” – after charging the battery several times, it Improvements will not charge completely. To reset the “memory”, a shunt resistor can be added, allow-

ing the MCU to completely discharge the battery prior to charging. 36 AVR450,

AVR450 Appendix 1: Schematic Figure 20. Block Diagram of Main Blocks

Powersupply, Switches, LED and Analog referance AT90S4433 and 14 kHz Buck converter BC2_PSU.SCH BC2_14K.SCH VIN VIN VCC VCC AVCC AVCC AREF AREF LED0 LED0 LED1 LED1 LED2 LED2 LED3 LED3 SWITCH0 SWITCH0 SWITCH1 SWITCH1 SWITCH2 SWITCH2 SWITCH3 SWITCH3

AGND GND

ATtiny15 and 100 kHz buck converter BC2_100k.SCH

VIN VCC AREF

AGND AGND GND GND,

Figure 21. Power Supply and Reference Voltage Schematic

TP14 Powersupply VCC VIN Testpoint TP3, TP4, TP10, TP11, LEDs and switches

VIN I<=3A TP19 and TP20 have no marking

LED0 in the silkscreen. They are placed TP10 LED0 close to their respective resistors R25 U6 VCC LED0 making it easy to (if desired) cut 330R L78M05ABDT TP1 LED1 GREEN D9 D1013the track and patch the LED to an LSM345 LSM345 Vin +5V TP11 LED1 other function. J3 VCC R21LED1 1 330R 2 LED2 RED 3 TP19 LED2 C13 C5 LED7 100 uF/25V 100 nF R22 DC_JACK_2_1MM RED LED2 330R LED3 YELLOW Vin 9-15V DC TP20 LED3 9-12V AC D11 D12 R35 LSM345 LSM345 330R R23 TP2 LED3 330R LED4 GREEN TP3 LED4

GND LED4 R41

GND 330R LED5 GREEN TP4 LED5

LED5 R42

330R GREEN R26 SWITCH0 1k S1

GND

R27 SWITCH1 1k S2

Analog voltage reference GND

R28 SWITCH2 1k Vcc S3 R24 AREF 1k GND AREF R29SWITCH3 1k TP13 S4 Vcc R34 AREF 4k7 C11 R15 D13 2 U5 100 nF 10K BAS16

GND

TL431

RESET

C14 S5 R14 47nF RESET 10k TP15 AGND AGND GND

GND

312GND2323232323141414141438 AVR450,

AVR450 Figure 22. ATtiny15 and 100 kHz Buck Converter Schematic SDA

SMBus

SCL

Vcc

Buck-converter 100kHz

LED6 L222uH RED VIN CDRH127-220 D2 R32 R4 D4 LSM345 330R 680R LSM345 + C12 C3 TP6 Q3 100uF/25V 100nF PWM1 SI4425DY GND GND GND U3 ATTINY15 RESET12R19 Q1

RESET

AREF AREF 5 RESET/PB5 ADC3/PB4 3 IBAT1 PWM1 BC847CPB0/MOSI/AREF ADC2/PB3 VBAT1 1k VCC 7 R30 C4 PB2/ADC1/SCK TBAT18 10k R9 100 nF C6 VCC TP9 33k IBAT1 GND 100 nF 4 GND PB1/MISO/OCP 6 PWM1 R18GND GND 0R25 CC2520FC R36 IBAT1 0R Vcc AREF GND AGND Vcc JP1 R17 1 10kMOSI VCC25LED GND 4 R13 RESET GND 10K7 8 R37 R38 9 SCK GND 10 4k7 4k7MISO GND AGND R8 TBAT1TP12 ISP GND VBAT1 33k/0.1% SCL B1

BATTERY

VBAT1 SDA -T R16 10k/0.1%

NOTE: Use Either R37 and R38

or R8, R9, R16 and R17. (R37 and R38 for SMBus and R8, R9,

R16 and R17 for voltage and current

measurement using the ATtiny15.) AGND GND

Using both will not work in either case.

4321,

Figure 23. AT90S4433 and 14 kHz Buck Converter Schematic SDA

SMBus

SCL Buck-converter 14kHz

Vcc VIN L1 150uH D1 R39 R40 R3 D3 LSM345 4k7 4k7 680R LSM345 + C1 C2 U4 AT90S4433-PC TP16 TP17 TP18 TP5 1000 uF/25V 100 nF SDA 4 28 PC3 PC4 PC5 PWM2 Q4 5 PD2/INT0 ADC5/PC5 27 VBAT2SCL SI4425DYPD3/INT1 ADC4/PC4 IBAT2 GND GND GND SWITCH0 6 PD4/T0 ADC3/PC3 26 TBAT2 Q2R20 SWITCH1 11 25 BC847C AREF12 PD5/T1 ADC2/PC2 24 PWM2 U1B SWITCH2 13 PD6/AIN0 ADC1/PC1 1k R31 SWITCH3 PD7/AIN1 ADC0/PC0 23 5 R6 AREF 10k 7 33k LED0 TP7 6 R11 16 PB0/ICP 21 VBAT2 LED1 PB2/SS AREF 10 k LED2 17 PB3/MOSI AVCC L4 VCC C22 LM358 LED3 18 20 100nF GND GND R1019 PB4/MISO AVCC TBAT2 PB5/SCK BLM-21-xxx 10kC9 AGND VBAT2 TxD 3 PD1/TXD 100nF 2 22 R33RxD PD0/RXD AGND R12 10k AGND B2 0R -T RESET 1 15 AGND GND BATTERY RESET VCC RESET OC1/PB1 PWM2 AVCC 7 R7 C8 8 VCC XTAL1 10 TP8 GND XTAL2 33kX1 IBAT2 C24 100nF 100 nF U1A JP2 VCC 7.3728MHz 3 GND12X2 AGND13MOSI VCC 4 IBAT2 2 R1 5 LED GNDRESET GND 6 C15 7.3728MHz C16 R03378LM358 CC2520FC 9 SCK GND 10 22pF 22pF MISO GND ISP GND GND GND

AGND

R5 R2 39k 680R

GND

VCC Serial interface (RS-232) C20 C23 100 nF 100 nF U7 16 VCC C1+ 1 C18 TP21 J1 GND TXD12V+ C1- 3 100 nF6 RS232 TTL 2 14 T1 11 TxD 3 13 R1 12 8 RxD47T2 1058R2 9 TP22

RXD

DB9 GND 6 V- C2+ 4 C19 C17 15 5 100 nF GND C2- 100 nF MAX202CSE GND GND43482140 AVR450,

AVR450 Appendix 2: Power The schematic below shows a power supply that supplies both +15V for the battery Supply charger and +5V for the AVR microcontroller. The power supply unit for the battery charger is built around a TOP224 from Power Inte-

gration. The flyback design technique makes a compact and efficient power supply design. The input voltage may vary from 85 VAC to 265 VAC (50 - 60 Hz).

Figure 24. Power Supply Schematic

+15V 1,5A V15P D304 +C310 T301 PBYR1645 + C307 L302 100 uF/35V Phillips EFD20 ** 1000uF/35V 3,3 uH56GND

GND

D301 +5V 0.5A J1 C301 L301 C302 L 39 mH 1,2A/500V D302 100 nF/400V 100nF/400V VCC 1 BZW04-188 D305 2 PBYR1645 + + C308 L303 C311

N

Mains in D303 10 BYV26C GND U302 1000 uF/35V 3,3 uH R303 R304 R305 100 uF/35V 85-265V AC241D306 GND 100 22k 91k GND + 3 1 1N414832C303 100 uF/400V PC817 C305 R302 U301 100 1 100nF Control + C306 TOP224 R301 47 uF 6R2 C309100 nF U303 C304 1n0 TL431 R306 Y1* 10k

GND GND

* Two series connected, 2.2 nF, Y2-capacitors can replace C304 ** Pins 4, 8 and 9 on T1 are not connected14232331, Table 5. Power Supply Part List Part Part Type Description R301 6,2 Series resistor for C306 (U301 power supply) R302 100 Series Resistor for the Opto-coupler R303 100 Series resistor for the voltage reference R306 10 k Feedback circuitry R304 22 k Feedback circuitry (5V) R305 91 k Feedback circuitry (15V) C304 1n0/Y1 Y1 capacitor (Can be replaced by 2 * 2.2 nF Y2 capacitors) C305 100 nF C309 100 nF C301 100 nF/400V X Capacitor C302 100 nF/400V X Capacitor C310 100 µF/35V Post LC filter C311 100 µF/35V Post LC filter C303 100 µF/400V Primary capacitor C307 1000 µF/35V C308 1000 µF/35V L302 3.3 µH Post LC filter L303 3,3 µH Post LC filter L301 33 mH Input choke D301 1.2A/500V Rectifier Bridge D302 P6KE200 Clamping Zener diode D303 BYV26C Blocking diode for clamping diode. D304 PBYR1645 Rectifier diode for 15V supply D305 PBYR1645 Rectifier diode for 5V supply D306 1N4148 Rectifier diode for bias/U301 power supply U301 TOP224 Top switch regulator U302 TL431 Voltage reference U303 PC817 Opto-coupler T301 Phillips EFD20 Transformer, see text below for details The transformer T301 is built around an EFD20 transformer kernel from Philips. The pri- mary winding and the bias winding use AWG26 (0.40 mm) wire gauge. The secondary winding uses AWG20 (0.80 mm). The primary winding and the bias windings are sepa- rated from the two secondary windings with insulation tape. The 5V secondary winding is also a part of the 15V winding. It is very important to make the windings according to the directions shown in the schematic. 42 AVR450,

AVR450

Table 6. Power Supply Transformer Windings Winding Turns Wire Gauge Primary winding 86 AWG26 Bias winding 8 AWG26 Secondary winding (5V) 4 AWG20 Secondary winding (15V) 8 (+4) AWG20,

Atmel Headquarters Atmel Operations

Corporate Headquarters Memory RF/Automotive 2325 Orchard Parkway 2325 Orchard Parkway Theresienstrasse 2 San Jose, CA 95131 San Jose, CA 95131 Postfach 3535 TEL 1(408) 441-0311 TEL 1(408) 441-0311 74025 Heilbronn, Germany FAX 1(408) 487-2600 FAX 1(408) 436-4314 TEL (49) 71-31-67-0 FAX (49) 71-31-67-2340 Europe Microcontrollers Atmel Sarl 2325 Orchard Parkway 1150 East Cheyenne Mtn. Blvd. Route des Arsenaux 41 San Jose, CA 95131 Colorado Springs, CO 80906 Case Postale 80 TEL 1(408) 441-0311 TEL 1(719) 576-3300 CH-1705 Fribourg FAX 1(408) 436-4314 FAX 1(719) 540-1759 Switzerland TEL (41) 26-426-5555 La Chantrerie Biometrics/Imaging/Hi-Rel MPU/ FAX (41) 26-426-5500 BP 70602 High Speed Converters/RF Datacom 44306 Nantes Cedex 3, France Avenue de Rochepleine Asia TEL (33) 2-40-18-18-18 BP 123 Room 1219 FAX (33) 2-40-18-19-60 38521 Saint-Egreve Cedex, France Chinachem Golden Plaza TEL (33) 4-76-58-30-00 77 Mody Road Tsimhatsui ASIC/ASSP/Smart Cards FAX (33) 4-76-58-34-80 East Kowloon Zone Industrielle Hong Kong 13106 Rousset Cedex, France TEL (852) 2721-9778 TEL (33) 4-42-53-60-00 FAX (852) 2722-1369 FAX (33) 4-42-53-60-01 Japan 1150 East Cheyenne Mtn. Blvd. 9F, Tonetsu Shinkawa Bldg. Colorado Springs, CO 80906 1-24-8 Shinkawa TEL 1(719) 576-3300 Chuo-ku, Tokyo 104-0033 FAX 1(719) 540-1759 Japan TEL (81) 3-3523-3551 Scottish Enterprise Technology Park FAX (81) 3-3523-7581 Maxwell Building East Kilbride G75 0QR, Scotland TEL (44) 1355-803-000 FAX (44) 1355-242-743 e-mail email is hidden Web Site http://www.atmel.com © Atmel Corporation 2002. Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are not authorized for use as critical components in life support devices or systems. ATMEL® and AVR® are the registered trademarks of Atmel. Other terms and product names may be the trademarks of others. Printed on recycled paper. 1659B–AVR–11/02 0M]
15

Similar documents

Getting started with the AVR battery charger reference design.
Getting started with the AVR battery charger reference design. The AVR battery charger reference design is designed for use with several types of batteries and various number of battery cells. The AVR battery charger reference design is supplied with resistor values for scaling down the charge volta
8-bit Microcontroller Application Note
8-bit Microcontroller Application Note Rev. 2534A–AVR–05/03 AVR415: RC5 IR Remote Control Transmitter Features • Utilizes ATtiny28 Special HW Modulator and High Current Drive Pin • Size Efficient Code, Leaves Room for Large User Code • Low Power Consumption through Intensive Use of Sleep Modes • Cos
AVR336: ADPCM Decoder
AVR336: ADPCM Decoder Features • AVR Application Decodes ADPCM Signal in Real-Time • Supports Bit Rates of 16, 24, 32 and 40 kbit/s • More Than One Minute Playback Time on ATmega128 (at 16 kbit/s) • Decoded Signal Played Using Timer/Counter in PWM Mode 1 Introduction Adaptive Differential Pulse Code
8-bit Microcontroller Application Note
8-bit Microcontroller Application Note Rev. 1181B–AVR–04/03 AVR360: Step Motor Controller Features • High-speed Step Motor Controller • Interrupt Driven • Compact Code (Only 10 Bytes Interrupt Routine) • Very High Speed • Low Computing Requirement • Supports all AVR Devices Introduction This applica
8-bit RISC Microcontroller Application Note AVR335: Digital Sound Recorder with AVR and Serial DataFlash Features
8-bit RISC Microcontroller Application Note Rev. 1456B–01/04 AVR335: Digital Sound Recorder with AVR and Serial DataFlash Features • Digital Voice Recorder • 8-bit Sound Recording • 8 KHz Sampling Rate • Sound Frequency up to 4000 Hz • Maximum Recording Time 2 1/4 Minutes • Very Small Board Size • O
USB in a Nutshell. Making Sense of the USB Standard.
USB in a Nutshell. Making Sense of the USB Standard. Starting out new with USB can be quite daunting. With the USB 2.0 specification at 650 pages one could easily be put off just by the sheer size of the standard. This is only the beginning of a long list of associated standards for USB. There are U
What is USB Enumeration? What does enumeration look like?
What is USB Enumeration? Enumeration is the process by which a USB device is attached to a system and is assigned a specific numerical address that will be used to access that particular device. It is also the time at which the USB host controller queries the device in order to decide what type of d
Draft
CYCLIC REDUNDANCY CHECKS IN USB Introduction The USB specification calls for the use of Cyclic Redundancy Checksums (CRC) to protect all non-PID fields in token and data packets from errors during transmission. This paper describes the mathematical basis behind CRC in an intuitive fashion and then e
File: X:\USERS\IGOR\DOC\WORD\Atmel\USB to RS232 Application Note\Firmware\USBtoRS232_ATmega8\AVR Studio 4 project\USBtoRS232.asm 1.2.2004
1 ;*************************************************************************** 2 ;* USBSTACKFORTHEAVRFAMILY3;* 4 ;* File Name :"USBtoRS232.asm" 5 ;* Title :AVR309:USB to UART protocol converter 6 ;* Date :01.02.2004 7 ;* Version :2.8 8 ;* Target MCU :ATmega8 9 ;* AUTHOR :Ing. Igor Cesko 10 ;* Slovak
File: X:\USERS\IGOR\DOC\WORD\Atmel\USB to RS232 Application Note\Firmware\USBtoRS232_AT90S2313\AVR Studio 4 project\USB90S2313.asm 26.1.2004
1 ;*************************************************************************** 2 ;* USBSTACKFORTHEAVRFAMILY3;* 4 ;* File Name :"USB90S2313.asm" 5 ;* Title :AVR309:USB to UART protocol converter (simple - small FIFO) 6 ;* Date :26.01.2004 7 ;* Version :2.2 8 ;* Target MCU :AT90S2313-10 9 ;* AUTHOR :I
AVR309: Software Universal Serial Bus (USB)
AVR309: Software Universal Serial Bus (USB) Features • USB (Universal Serial Bus) protocol implemented in firmware • Supports Low Speed USB (1.5Mbit/s) in accordance with USB2.0 • Implementation runs on very small AVR devices, from 2kBytes and up • Few external components required - One resistor for
Application Note
8-bit Microcontrollers Application Note AVR270: USB Mouse Demonstration Features • Runs with AT90USB Microcontrollers at 8MHz • USB Low Power Bus Powered Device (less then 100mA) • Supported by any PC running Windows® (98SE or later), Linux® or Mac OS®. • 3Kbytes of Code Required • X, Y Movement, Le
8-bit Microcontroller Application Note
8-bit Microcontroller Application Note Rev. 2547A–AVR–11/03 AVR244: AVR UART as ANSI Terminal Interface Features • Make use of standard terminal software as user interface to your application. • Enables use of a PC keyboard as input and ascii graphic to display status and control information. • Driv
MPASM USER'S GUIDE with MPLINK and MPLIB MPASM USER'S GUIDE with MPLINK and MPLIB
Adjust Spine to fit MPASM USER'S GUIDE with MPLINK and MPLIB Microchip Technology Inc. 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 602.786.7200 Fax: 602.899.9210 © 1999 Microchip Technology Inc., Printed in the U.S.A. 3/99 DS33014 MPASM USER'S GUIDE with MPLINK and MPLIB Information only.
Microcontroller Core Features: RA5/SS/AN4 7 34 RB1RE0/RD/AN5 8 33 RB0/INT
Device Pins A/D PSP Pin Diagram PIC16C63A 28 NO NO PDIP, Windowed CERDIP PIC16C73B 28 YES NO MCLR/VPP 1 40 RB7 PIC16C65B 40 NO YES RA0/AN0 2 39 RB6 RA1/AN1 3 38 RB5 PIC16C74B 40 YES YES RA2/AN2 4 37 RB4 RA3/AN3/VREF 5 36 RB3 RA4/T0CKI 6 35 RB2 Microcontroller Core Features: RA5/SS/AN4 7 34 RB1RE0/RD
PACKAGE OPTION ADDENDUM
PCM2704 and PCM2705 Not Recommended For New Designs PCM2704, PCM2705 PCM2706, PCM2707 Burr-Brown Audio www.ti.com... SLES081F–JUNE 2003–REVISED JANUARY 2009 STEREO AUDIO DAC WITH USB INTERFACE, SINGLE-ENDED HEADPHONE OUTPUT AND S/PDIF OUTPUT 1FEATURES – External ROM Interface (PCM2704/6) 2345• On-Ch
14 + 14W STEREO AMPLIFIER WITH MUTE & ST-BY
TDA7269A 14 + 14W STEREO AMPLIFIER WITH MUTE & ST-BY WIDE SUPPLY VOLTAGE RANGE UP TO ±20V SPLIT SUPPLY HIGH OUTPUT POWER 14 + 14W @ THD =10%, RL = 8Ω, VS = +16V NO POP AT TURN-ON/OFF MUTE (POP FREE) STAND-BY FEATURE (LOW Iq) SHORT CIRCUIT PROTECTION TO GND THERMAL OVERLOAD PROTECTION Multiwatt11 OR
FOREWORD This repair manual has been prepared to provide essential in-
FOREWORD This repair manual has been prepared to provide essential in- formation on body panel repair methods (including cutting and welding operations, but excluding painting) for the TOYOTA YARIS. Applicable models: KSP90 series Applicable models: NCP90, 91 series This manual consists of body repa
MPASM and MPLINK PICmicro® QUICK REFERENCE GUIDE
MPASM and MPLINK PICmicro® QUICK REFERENCE GUIDE The Embedded Control Solutions Company® MPASM Quick Reference Guide This Quick Reference Guide gives all the instructions, directives, and command line options for the Microchip MPASM Assembler. MPASM Directive Language Summary Directive Description S
M INTRODUCTION
M Author: Mark Palmer Microchip Technology Inc. INTRODUCTION The PICmicro™ families of RISC microcontrollers are designed to provide advanced performance and a cost-effective solution for a variety of applications. To address these applications, there is the PIC16CXXX microcontroller family of produ
M ENGINE ON-VEHICLE INSPECTION ASSEMBLY
1NZ-FE ENGINE MECHANICAL – ENGINE EM–1 M ENGINE ON-VEHICLE INSPECTION 1. INSPECT ENGINE COOLANT (See page CO-1) 2. INSPECT ENGINE OIL (See page LU-1) 3. INSPECT BATTERY (See page CH-4) 4. INSPECT AIR CLEANER FILTER ELEMENT SUB- ASSEMBLY (a) Remove the air cleaner filter element sub-assembly. (b) Vis
FOREWORD This wiring diagram manual has been prepared to provide information on the electrical system of the 2007 YARIS. Applicable models: NCP91, 93 Series
FOREWORD This wiring diagram manual has been prepared to provide information on the electrical system of the 2007 YARIS. Applicable models: NCP91, 93 Series Refer to the following manuals for additional service specifications and repair procedures for these models: Manual Name Pub. No. 2007 YARIS Re
X AUTOMATIC TRANSAXLE SYSTEM PRECAUTION
U340E AUTOMATIC TRANSAXLE – AUTOMATIC TRANSAXLE SYSTEM AX–1 X AUTOMATIC TRANSAXLE SYSTEM PRECAUTION NOTICE: • Perform the RESET MEMORY (AT initialization) when replacing the automatic transaxle assembly, engine assembly or ECM (See page AX-14). • Perform the REGISTRATION (VIN registration) when repl
ON Semiconductor 2N5550 Amplifier Transistors NPN Silicon 2N5551*
ON Semiconductor 2N5550 Amplifier Transistors NPN Silicon 2N5551* *ON Semiconductor Preferred Device MAXIMUM RATINGS Rating Symbol 2N5550 2N5551 Unit Collector–Emitter Voltage VCEO 140 160 Vdc Collector–Base Voltage VCBO 160 180 Vdc Emitter–Base Voltage VEBO 6.0 Vdc Collector Current — Continuous IC
GENERAL DESCRIPTION QUICK REFERENCE DATA PINNING - TO92 variant PIN CONFIGURATION SYMBOL
GENERAL DESCRIPTION QUICK REFERENCE DATA Glass passivated sensitive gate SYMBOL PARAMETER MAX. UNIT thyristor in a plastic envelope, intended for use in general purpose VDRM, Repetitive peak off-state voltages 200 V switching and phase control VRRM applications. This device is intended IT(AV) Averag
N-Channel JFETs
N-Channel JFETs 2N4117A PN4117A SST4117 2N4118A PN4118A SST4118 2N4119A PN4119A SST4119 Part Number VGS(off) (V) V(BR)GSS Min (V) gfs Min (S) IDSS Min (A) 4117 –0.6 to –1.8 –40 70 30 4118 –1 to –3 –40 80 80 4119 –2 to –6 –40 100 200 Ultra-Low Leakage: 0.2 pA Insignificant Signal Loss/Error Voltage
Order this document SEMICONDUCTOR TECHNICAL DATA by 2N3903/D NPN Silicon
Order this document SEMICONDUCTOR TECHNICAL DATA by 2N3903/D NPN Silicon *Motorola Preferred Device COLLECTOR BASE EMITTER 1 MAXIMUM RATINGS Rating Symbol Value Unit CASE 29–04, STYLE 1 TO–92 (TO–226AA) Collector–Emitter Voltage VCEO 40 Vdc Collector–Base Voltage VCBO 60 Vdc Emitter–Base Voltage VEB
DISCRETE SEMICONDUCTORS DATA SHEET 2N2222; 2N2222A NPN switching transistors Product specification 1997 May 29 Supersedes data of September 1994 File under Discrete Semiconductors, SC04
DISCRETE SEMICONDUCTORS DATA SHEET M3D125 2N2222; 2N2222A NPN switching transistors Product specification 1997 May 29 Supersedes data of September 1994 File under Discrete Semiconductors, SC04 FEATURES PINNING • High current (max. 800 mA) PIN DESCRIPTION • Low voltage (max. 40 V). 1 emitter 2 base A
Small-signal Transistors Selection guide
Philips Semiconductors Small-signal Transistors Selection guide V TYPE CEO IC Ptot fhhTPNP PACKAGE max. max. max. FE FE min. PAGE NUMBER min. max. COMPL. (V) (mA) (mW) (MHz) BC846 SOT23 65 100 250 110 450 100 BC856 305 BC846A SOT23 65 100 250 110 220 100 BC856A 305 BC846AT SC-75 65 100 150 110 220 1
Small-signal Transistors Selection guide
Philips Semiconductors Small-signal Transistors Selection guide SURFACE-MOUNT DEVICES NPN GENERAL PURPOSE LOW-POWER TRANSISTORSVIPfTYPE CEO C tothhTPNP PACKAGE max. max. max. FE FE min. PAGE NUMBER min. max. COMPL. (V) (mA) (mW) (MHz) 2PC4081 SC-70 40 100 200 120 560 100 2PA1576 210 2PC4081Q SC-70 4