110V UNIVERSAL BATTERY CHARGING PANEL USING PIC MICROCONTROLLER A dissertation submitted to the Department of Electrical Engineering, University of Moratuwa in partial fulfillment of the requirements for the degree of Master of Science by SWARNA KUMARA VIJITHANANDA Supervised by: Dr. J.P Karunadasa Department of Electrical Engineering University of Moratuwa, Sri Lanka December 2006 DECLARATION The work submitted in this dissertation is the result of my own investigation, except where otherwise stated. It has not already been accepted for any degree, and is also not being concurrently submitted for any other degree. S.K Vijithananda Date: \ \ CM We/I endorse the declaration by the candidate. CONTENTS Declaration I Abstract IV Acknowledgement VI List of Figures VII List of Tables IX CHAPTER 1 1.00 Introduction 1 1.10 Requirement of the Project 1 1.20 Project Benefits 1 1.30 Technical Concept & Techniques 2 1.40 Project Tools & Materials 2 CHAPTER 2 2.00 Structure of the Project 12 2.10 Hardware Circuitry 13 2.11 Design of DC-DC Converter 15 2.12 Testing Circuit with 555 Timer 21 2.13 Converter Switching Amplifier Circuits 26 2.14 Overcurrent & Over/Under Voltage Circuits 30 2.20 Software Programming 34 2.21 Introduction to PIC (16F876A) Microcontroller 34 2.22 Analog to Digital Converter (A/D) Module 37 2.23 Operation in PWM Mode 45 2.24 Assembly Programs for A/D Conversion 49 & PWM operation 2.24 (i) A/D Conversion 49 2.24 (ii) PWM Operation 49 II CHAPTER 3 3.00 Results and Practical Observation 55 3.10 Waveforms of the DC-DC Converter 55 3.20 Voltage variation of the Panel Output 60 3.30 Project Photos 64 CHAPTER 4 4.00 Practical Limitations Challenges & Difficulties 69 4.10 Technical limitations & Challenges 69 4.20 Financial Difficulties 69 CHAPTER 5 5.00 Conclusion 71 5.10 Conclusion and Remarks 71 5.20 Recommendation for Future Developments 71 References 73 Appendix A Definitions of the terms 74 Appendix B Program Codes 77 III Abstract Conventional power electronics and electronic control circuits have been replacing by the intervention of the microprocessors/microcontrollers in modern industrial applications. This is mainly because with their applications the whole systems becomes more and more compact while enhancing the durability. On the other even with the more robust applications hand more accurate & fine operation could achieve by using such modern programming devices. This project was origin from based on an actual requirement of designing 1 lOv battery charging panel (to energize the batteries in spring charge type breakers)for electrical engineering division of Jaya Container Terminal(J.C.T) of Sri Lanka Ports Authority. But this technique would use to not only to charge batteries of spring charge breakers , but also batteries widely use in VHF communication hand held sets, explosive detectors, emergency lamps, etc... Rechargeable batteries are vital to portable electronic equipment such as laptop computers and cell phones. Fast charging circuits must be carefully designed and are highly dependent on the particular battery's chemistry. The most popular types of rechargeable batteries in use today are the Sealed-Lead-Acid (SLA), Nickel- Cadmium (NiCd), Nickel-Metal-Hydride (NiMH), and Lithium-Ion (Li-Ion). Li-Ion is fast becoming the chemistry of choice for many portable applications because it offers a high capacity-to-size (weight) ratio and a low self-discharge characteristic. Depending on the battery chemistry the charging characteristics of a battery differs to each other. In this project simply what I have done is allows the particular battery to follow its charging characteristic curve when they where you could not find in conventional charging techniques. The charging process is controlled by the software program microcontroller (PIC 16F876).Since the battery chemistries are different for different types of batteries, several sets of programs would have to written to the controller for each battery given by the manufacturer. IV There are some theoretical design calculations included for designing of power electronics modules. (DC-DC converter, square pulse generator, single rail power & dual rail power supplies,etc...) Calculations have been done based on highly theoretical facts. Therefore some practical observations are tends to differ from the theoretical approach. Most of the theories studied in the power electronic lessons of my M.Sc post graduate were widely used in doing above mentioned designs. At the beginning the actual target was to built a battery charging panel of 110V,but due to some limitations of purchasing of high capacity transformer which suit to this application, the project was limited to 40V panel only. But the concept, approach & the guide line would be more or less same for the more advanced systems also. V Acknowledgement Thanks are due first to my supervisor, Dr. J.P Karunadasa, for his great insight, perspectives, guidance and of humor. My sincere thanks go to the JCT Electrical engineering staff of J.C.T (Jaya Container Terminal) of Sri Lanka Ports Authority for helping in various ways to clarify things related to my academic works in time with excellent corporation and guidance. Sincere gratitude is also extended to the people who serve in the Department of Electrical Engineering office. I extend sincere gratitude to my superiors, Mr. A.D.T Gunasekara (Chief Electrical Engineer of Sri Lanka Ports Authority) who made me to be released from my duties to success this project & Mr.H.A.N.S Fernando (Deputy Chief Electrical Engineer) who suggested this project concept for this thesis. Lastly, I should thank many individuals, friends and colleagues who have not been mentioned here personally in making this educational process success. May be I could not have made it without your supports. VI List of Figures Figure Page Figure 1.3.1 Basic Functional Block 3 Figure 1.3.2 Typical Characteristics of Ni-Cd battery 4 Figure 1.3.3 Basic Software Algorithm 6 Figure 1.4.1 Pin Configuration of PIC 16F876A 8 Figure 1.4.2 Demonstration Circuit 10 Figure 1.4.3 PIC Programmer Circuit 10 Figure 2.1.14 Bridge Rectifier 13 Figure 2.1.2 DC-DC Converter Circuit 14 Figure 2.1.3 Single Rail Power Supplies 14 Figure 2.1.4 Dual Rail Power Supplies 14 Figure 2.11 (a) Dimensions of the Core 17 Figure 2.11 (b) Core Loss Curves 19 Figure 2.12 (a) Pin Configuration of 555 Timer 23 Figure 2.12 (b) Pin Data of 555 Timer 25 Figure 2.12 (c) Square Pulse Generator using 555 Timer 26 Figure 2.13 (a) Pin Configuration of TL082 family 27 Figure 2.13 (b) Internal View of TL082 28 Figure 2.13 (c) Frequency & Temperature Characteristics of TL082 28 Figure 2.13 (d) Load & Voltage Characteristics TL082 29 Figure 2.13 (e) Switching Amplifier Circuit 30 Figure 2.14 (a) Figure 2.14-(a) Pin Configuration of TL082 31 Figure 2.14 (b) Typical Characteristics of LM339 (Vcc=15v;Ta =25°) 33 Figure 2.14 (b) Comparator Circuit 33 Figure 2.21 (a) Pin Configuration of PIC16F876A 34 Figure 2.21 (b) Demonstration Circuit 37 Figure 2.22(a) ADCONO Register 38 VII Figure 2.22(b) ADC0N1 Register 40 Figure 11.2 Analog Input Model 42 Figure 11.3 A/D Conversion TAD Cycle 44 Figure 11.4 A/D Result Justification 45 Figure 2.23(a) CCP Module in PWM Mode 46 Figure 2.23(b) PWM Output 46 Figure 2.23(c) Data of the PIC16F876A 48 Figure 3.0 (a) Voltage across the Primary Winding (Theoretical) 55 Figure 3.0 (b) Voltage across the Primary Winding (Observed) 56 Figure 3.0 (c) Current of the Primary side of the Converter (Theoretical) 56 Figure 3.0 (d) Current of the Secondary side of the Converter (Observed) 57 Figure 3.0 (e) Current through the Secondary Diode 57 Figure 3.0 (f) Duty Cycle 50% 58 Figure 3.0(g) Duty Cycle 35% 58 Figure 3.0 (h) Duty Cycle 10% 59 Figure 3.21(a) Voltmeter reading & desired value vs. time (8 hrs.) 62 Figure 3.21(b) Voltage Error vs. Time (8 hrs.) 63 Figure 3.3 (a) Switching Amplifiers 64 Figure 3.3 (b) Controller Circuit Operate with the main Panel 64 Figure 3.3 (c) Fly-Back Transformer of the Converter 65 Figure 3.3 (d) Overvoltage Comparator Circuit 65 Figure 3.3 (e) Power Transformer Output to the Dual Supply 66 Figure 3.3 (f) Top view of the Panel ' 66 Figure 3.3 (g) 3 Push Buttons Assigned for 3 Battery Types 67 & the Reset Button (left corner) Figure 3.3 (h) 4 -Bridge Rectifier testing with a Variac 67 Figure 3.3 (i) 3 Sets of Batteries under Charging. 68 Figure Appendix A: (i) Comparator Symbol 75 VIII List of Tables Table Table 1: Operating characteristics of TL082 Table 2: Ratings of the LM339 comparator Table 3: Analog / Digital channel configuration Table 11.1: TAD vs. maximum device operating frequency Table 3.20 Voltmeter reading during eight hours