You are on page 1of 15

T.

C DOKUZ EYLUL UNIVERSITY FACULTY OF ENGINEERING ELECTRICAL & ELECTRONIC ENGINEERING DEPARTMENT

EE422 Embedded Systems


Pic Controlled Lead Acid Battery Charger FINAL REPORT

2005502020 ZGR MEHMET DUMAN

11.04.2011

1. ABSTRACT 2. INTRODUCTION 3. METHODOLOGY 3.1 LEAD ACID BATTERY & CHARACTERISTIC 3.2 STATE of CHARGE (SOC)

.2 .2 .3
.3 .4

3.3 TERMINAL ADJUSTABLE REGULATOR ( LM 317) 4 3.4 MICROCONTROLLER


.5

3.5 SHUNT RESISTANCE AND LM324 AMPLIFIER .......5


4. BLOCK DIAGRAM & SCHEMATIC 5. FLOW CHART 6. EXPERIMENTS & RESULTS .. 7. PHOTOS of PROJECT 8. CONCLUSION 9. REFERENCES 10. APPENDIX 10.1 CODES .6 .7 .8 ...10 ...11 ...11 ..12 ..12

1. ABSTRACT
In this project lead acid batteries are charged by pic controlled power electronic circuits. Ac power source is rectified to dc. Dc regulator IC circuits are used for supplying adjusted current and voltage on lead charging by pics pin outs which can create selection and adjustment signal.

2. INTRODUCTION
Lead acid batteries are used in Ups devices, cars electric system as starter or dc supply of electronic devices, etc. A lot of applications are able to meet in life. Their advantages are suitable to be charged any Dc source which supplies lower voltage than lead acids maximum charge voltage value and protecting against explosion and fire. In my final year project topic is lithium polymer battery charger circuit realization, but lipo batteries are so dangerous and risky wrong charging applications. Lead acid battery charging is a step of final year project before lipo charging. Thus power electronic information fundamentals are tried with charging experiments. Circuit elements behavior and effects on embedded systems are able to observe. In nowadays technology, too many type lead acid battery charger circuit designs are available. Their features are controlling battery type, lead acid, lithium polymer, nickel metal hybrids batteries then charge them suitable algorithms. They can count battery number and give error message about your batteries. Also their discharge and charge abilities provide to users, balancing to battery and creating characteristic curves of battery. In this project a current and voltage adjustable lead acid battery charger circuit is designed in addition state of charge (SoC) information due to time is represented with Hyperterminal until charging.

3. METHODOLOGY
3.1 LEAD ACID BATTERY & CHARACTERISTIC Battery is a complex electrochemical device which converts and stores chemical energy to electric energy. Battery term defines one unity. But the unity has one or more than one cell which fundamental element of battery.

Figure 1: Structure of Lead Acid Battery. [1]

In project battery packet has 3 cells and 4Ah capacity. Thats why nominal voltage of battery is 6Volt, Max. Charge Voltage 7.50V, Min. Discharge Voltage 5.25V .While charging operation current must be limited to protect the battery against oxidation. This current is 0.4 (0.1C) for 1C,4 Ah lead acid batteries .Battery characteristics give all information about battery performance, constant voltage charge is showed in figure 2.

Figure2: 6V 4Ah lead acid battery Characteristic.[2]

a. STATE of CHARGE (SOC) Deep discharge of the battery will reduce the life of the battery. Frequent overcharging also has a damaging effect on the battery. Accurate indication of the state of charge of battery is necessary to utilize the batteries to the maximum extent.State of charge data gives us charged capacity of battery due to time. Current integration and open circuit voltage measuring are used for implementation of reliable SOC in formula1.

Formula1
y y y y

Q(to) is initial capacity of battery charging is charging efficiency i is charge current[3] Rated Capacity is data of battery in nominal usage.

b. TERMINAL ADJUSTABLE REGULATOR ( LM 317)


Regulator IC is suitable for charging operation because of voltage adjustment pin to supply constant voltage in addition extreme current increasing is prevented by current limiting circuit of IC. Also different output resistors and extra IC combinations provide to create different capacity batteries chargers.

Figure3: Adjustable output voltage circuit with LM117 (or LM317).[4]

c. MICROCONTROLLER Another fundamental part is pic 16f877 microcontroller. In this project state of charge, charge current and voltage are critical values for charging process. 10 bit Analog to Digital converter pins of 16f877 Mcu are used for data transmission on battery. Timer0 block is adjusted for time counting. In addition, B port is connected start /stop and adjustment buttons.

Figure4 :16f877 pin configuration and timer0 interrupt calculation[5]

d. SHUNT RESISTANCE AND LM324 AMPLIFIER


Shunt resistor is used for charge current measuring, calibration value is 1A/1mV, analog input resolution of 16f877 is 4.8mV (10bit A/D 5Volt/210=4.8mV) so 4.8A changing effects least significant bit changing. Its not sensitive. But output value of shunt is amplified 101 times by lm324 amplifier.

Photo1: Shunt resistor.

4. BL

M&

EM TI

POWER

Current Limiter

Power Switch

Power Regulator

Power Switch Drivers DATA

microcontroller

Lcd Screen

Configuration Buttons

Fi

In t i bl di power source is regul ted to system supply. C rge current is limited by circuit and energy flowing t rough battery switched to suit algorithm steps. Charging data is showed in LDC and logged in laptop with rs232 connection.
 

Fi

I I

ti

it



#"   %   $$

   

l k i
 

! 

5. FLOW CHART

6. EXPERIMENTS & RESULTS


LM317 regulator applications are takes place in project literature search. This IC is called as current limiter, but this term doesnt mean adjustable current output, its only protection from extreme current flowing on IC, with extra transistor connection. Aim of the project was adjustable current and voltage supplying so Lm317 wasnt suitable the project. Therefore Vout is effected small input voltage changing. Only advantage is maximum flowing current higher than 78XX voltage regulator family.

Photo 2: Lm317 application circuit. The other feature of charger is distinguishing different capacity LA batteries. Firstly, battery choosing with switches was planned but project couldnt catch up time table. Thats why switches are used for current adjustment with changing rock resistances. Switches are run with transistors.

Photo 3:Battery distinguishing with switches

Reliable charging and SoC reading are able to realized only with characteristic curves of battery. I sent mail to firm of my battery but couldnt take answer so I consulted the tutors to create lookup table any same capacity battery characteristic from internet search. But my batteries were different and aging thats why I created own characteristic of battery. Thus I can determine SoC value on intersection with curve. Experience and curve were realized by Lipo balancer machine in photo 4 and figure7.

Photo4: Charging with 0.1A.

Figure7:Charge and Discharge curves of battery.

10

7. PHOTOS of PROJECT

11

8. CONCLUSION
In this project main purpose was controlling of all steps of lead acid battery charging. Lm 317 IC doesnt prove all steps of this project. Only constant voltage charging algorithm is suitable for lm317. Boost converter or buck converter type choppers have more features than lm317 so charging circuits are includes these power electronic circuit structures. Output Current and voltages are able to adjust with pwm changing on mosfet of chopper circuits. State of Charge couldnt measure, because of lm 317 couldnt constant current so constant current charge and discharge characteristic curves anytime intersect with charging curves by lm317.Only constant voltage curves give information about SoC of battery. The circuit abilities, which were realized, are changing of initial charge current. In addition button configurations provide rock resistance selection which is used for adjustment of the charge current. Problems of project obstructed to realize planned purposes. Firstly button connection didnt work so I couldnt close box of project. Box shape of project, which is my choice, limited me at location of circuit elements, cable connection of circuit between different pieces of circuits affected reliable working of circuit. Ventilator of circuit is connected to 7805 regulator as parallel to microcontroller it caused of wrong analog data transferring, quickly temperature increasing and suddenly shut off itself.

9. 1. 2. 3.

REFERENCES Haze Battery Company Ltd Lead Acid Catalogue BB Battery Free Rechargeable Sealed Lead Acid Battery BP4.5_6 D.Jaya Deepti and V. Ramanarayanan, State of Charge of Lead Acid Battery,Proceedings of India International Conference on Power Electronics 2006 4. National Semiconductor Lm117 Datasheet 5. Micro Chip 16f877 Datasheet

12

10. APPENDIX 10.1 CODES #include <16f877.h> #device ADC=10 #use delay(clock=4000000) #fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBU G,NOCPD #use fast_io(a) #use fast_io(b) #use fast_io(c) #use fast_io(d) #use fast_io(e) #include <lcd.c> #byte portb=6 //portb variable determined as portb connection #use rs232 (baud=2400, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1) //initialized fundamental software adjustments unsigned long int anadata; float voltage,current; int led=0,time=0,i=0,button,r1,r2,r3,r4,sum,as; // variables of analog measurements and buttons

// timer 0 INTERRUPT #int_timer0 void timer0_kesme() {output_high(pin_c0); if(input(pin_b0)==0) {button=0; output_b(0X00); disable_interrupts(INT_timer0); } portb=button; led++; if (led>40) {time=time+1; set_adc_channel(1); delay_us(50); current=read_adc(); delay_us(10); set_adc_channel(0);

13

delay_us(50); voltage=read_adc(); delay_us(10); //LCD Showing lcd_gotoxy( 1, 1 ); printf( lcd_putc, "Vol(V)Cur(A)Time(Sec)" ); delay_ms(100); lcd_gotoxy( 1, 2 ); printf( lcd_putc,"V=%.1gVI=%.1gAT=%dsc",voltage,current,time); //rs232 Data sending printf(" Voltage(V) Current(A) Time(Sec) \n\r"); printf("V=%.1gV I=%.1gA T=%dSec \n\r",voltage,current,time); //output_b(akim) set_timer0(255); led=0; } output_low(pin_c0); }

// External intterupt because of buttons #int_ext void ext_kesmesi () {for(as=0;as<50;as++) {output_high(pin_c0); delay_ms(100); output_low(pin_c0); delay_ms(100); } adjust: button=input_c(); printf("Push Any Charge Current Adjustment Button \n\r"); // delay_ms(1000); r1=bit_test(button,1); r2=bit_test(button,2); r3=bit_test(button,3); r4=bit_test(button,4); sum=r1+r2+r3+r4; if((sum>=2)|(sum==0)) { printf("Can't push more than ONE \n\r"); goto adjust; } else { set_timer0(255);

14

enable_interrupts(INT_timer0); } output_low(pin_c0); delay_ms(100); } void main() { setup_psp(PSP_DISABLED); // PSP unit close setup_spi(SPI_SS_DISABLED); // SPI unit close setup_timer_1(T1_DISABLED); // T1 timer close setup_timer_2(T2_DISABLED,0,1); // T2 timer close setup_CCP1(CCP_OFF); // CCP1 unit close setup_CCP2(CCP_OFF); // CCP2 unit close setup_timer_0(rtcc_div_256|rtcc_internal); setup_adc(adc_clock_div_8); setup_adc_ports(ALL_ANALOG); enable_interrupts(INT_EXT); // INT_EXT activation enable_interrupts(GLOBAL); set_tris_e(0X00); output_e(0x00); set_tris_b(0X01); output_b(0x00); set_tris_c(0X1E); output_c(0X00); set_tris_a(0X0F); output_a(0x00); printf(lcd_putc,"\f"); lcd_init(); lcd_gotoxy( 1, 1 ); printf( lcd_putc, "LA CHARGER " ); delay_ms(1000); lcd_gotoxy( 1, 2 ); printf( lcd_putc, "OzgurMehmetDuman " ); while(1) { } }

15

You might also like