Professional Documents
Culture Documents
Submitted by (Majid Ali 091320-079) (Hafiz Zahid Rasool 091320-007) (Majid Rehan Khan - 0913200043)
Department of Electrical Engineering School of Science and Technology University of Management and Technology
Project Report submitted to the Department of Electrical Engineering, University of Management and Technology in partial fulfillment of the requirements for the degree of Bachelor of Science in Electrical Engineering
(Majid Ali 091320-079) (Hafiz Zahid Rasool 091320-007) (Majid Rehan Khan 091320-043)
(Date)
Abstract
UPS stands for Uninterruptible Power Supply. It is an instrument connected between the electric grid and the consumer, comprising of electric hardware and rechargeable batteries. The aim of the instrument is to supply continuous undisturbed and conditioned power to the critical load. The energy for powering the load comes from the utility, or from the battery upon mains outage. Uninterruptible Power Supply (UPS) are widely used to provide emergency power to critical loads in case of utility mains failure, and as such constitutes an essential element in providing back-up power for computer networks, communication links, biomedical equipment, and industrial processes, among others. In market local ups designed for just power production using batteries or such types of power sources. They do work but not for all environment. We implement intelligent uninterrupted power supply (i-UPS) for multipurpose. It consists of microcontroller based circuit. Mainly four feature of our i-UPS. First, it is safe and Improves battery life by using temperature sensor. When battery is fully charged and comparator do not trip battery charging then microcontroller will come into work trip the battery charging by temperature sensing because heating hardens the battery and it loses its efficiency and life. Second, we provide two outputs from i-UPS, Load-1 and Load-2, Load-1 controls lights, chargers and low power electronics appliances. On the other hand, Load-2 controls the fans and inductor type loads. Third is Energy saving works in the form of battery status. When battery is at its critical situation it switches off Load-2 and lets the Load1 on. So we can get lights at low battery status. When main supply is on, automatically Load-1 and Load-2 are connected to main supply. Fourth, we have provided two main energy sources Line-1 and Line-2 from different feeders. Microcontroller automatically checks and selects the active Line. If both lines are active then microcontroller will select Line-1 by default setting. This Intelligent Uninterruptible Power Supply (i-UPS) will enable the users to monitor different status of i-UPS on LCD. One of the advantage applying microcontroller for the Intelligent Uninterruptible Power Supply (i-UPS) is that the system is more reliable and user friendly in functions as compare to the conventional Uninterruptible Power Supply available in the market. At the competition of our project we will be hopefully able to save energy and utilization of energy due to intelligent uninterruptible power supply because of our country facing a large amount of electricity crises so people wants such type of ups like i-UPS.
Acknowledgements
We would like to thank Allah, the Almighty at the first place for giving us much courage and strength during the completion of this project and thesis, without the help of whom all His creatures are worthless. Several people should also be mentioned for their contributions to accomplish our task. We are greatful to our project advisor Asst. Prof Mr. Farhan Iqbal and project co-advisor Lecturer Mr. JAWAD ULLAH for their kind supervision, help and support. We are also thankful to the lab staff in the Project Lab for their cooperation during this work.
ii
Table of Contents
Chapter 1. ......................................................................................................................................................................1 Introduction ...................................................................................................................................................................1 1. Introduction: ..............................................................................................................................................................1 1.1 Classification:...............................................................................................................................................3 1.2. Basic steps in simple UPS: .................................................................................................................................3 1.2.1. On-Line UPS: ..................................................................................................................................................4 1.3 1.4 Design Background: .....................................................................................................................................5 Application Markets for UPS Systems:........................................................................................................5
1.5. Components of UPS: ..........................................................................................................................................6 1.5.1. DC/DC Converters: .....................................................................................................................................6 1.5.2. Voltage Source Inverter (VSI): ...................................................................................................................6 1.5.3. Battery Charger: ..........................................................................................................................................7 1.6. Introduction of i-UPS: ........................................................................................................................................7 1.6.1. Objective or Features of our Project: ..........................................................................................................7 1.6.2. Project Applications: ...................................................................................................................................8 1.7. i-UPS Block Diagram: .......................................................................................................................................8 1.8. Methodology: .....................................................................................................................................................9 1.8.1. Project implementation Steps: ....................................................................................................................9 1.8.2. Implementation Tools: ................................................................................................................................9 2.1. Principles and configurations: .......................................................................................................................... 10 2.2. Dc-Ac Conversion: ........................................................................................................................................... 10 2.2.1. Inverter: ......................................................................................................................................................... 10 2.2.2. Problems in Typical Inverter: ........................................................................................................................ 11 2.2.3. Modified sine wave: ...................................................................................................................................... 12 2.2.4. Sinusoidal PWM Generation: ........................................................................................................................ 13 2.2.5. Inverter Module: ............................................................................................................................................ 15 2.2.6. Inverter Schematic: ....................................................................................................................................... 15 2.2.7. Sinusoidal PWM Generation: ........................................................................................................................ 15 2.2.8. Power Amplification: .................................................................................................................................... 16 2.2.8.1. Introduction: ........................................................................................................................................... 16 2.2.8.2. Components: .......................................................................................................................................... 16 2.2.8.3. Method:.................................................................................................................................................... 16 2.2.8.4. Working: ................................................................................................................................................ 18 2.2.8.5. Power Inverter Wattage Chart: ............................................................................................................... 18 2.2.8.5. i-UPS Power Amplification: .................................................................................................................. 19 2.2.8.6. i-UPS Power control Circuit: ................................................................................................................. 19 2.3. AC to DC Conversion: ..................................................................................................................................... 20 2.3.1. Centre-Tap Full-Wave Rectifier: .............................................................................................................. 20
iii
2.3.2. Basic Operation:........................................................................................................................................ 20 2.4. Microcontroller: ............................................................................................................................................... 21 2.4.1. PIC16F877A: ............................................................................................................................................ 22 2.4.2. Pin Configuration: ..................................................................................................................................... 23 2.4.3. I/O Ports of PIC16F877A: ........................................................................................................................ 24 2.4.4. PIC16F628: ................................................................................................................................................... 27 2.4.4.1. High-Performance RISC CPU: .............................................................................................................. 27 2.4.4.2. Special Microcontroller Features: .......................................................................................................... 27 2.4.4.4. Peripheral Features: ............................................................................................................................... 28 2.4.5. Pin Configuration: ......................................................................................................................................... 29 2.5. Microprocessor Oscillator: ............................................................................................................................... 29 2.6. Software: .......................................................................................................................................................... 30 2.6.1. Proton Basic: ............................................................................................................................................. 30 2.6.2. BASIC Language: ..................................................................................................................................... 30 2.6.3. Proteous: ................................................................................................................................................... 31 2.7. Transformer: ..................................................................................................................................................... 31 2.7.1. Basic Principle: ......................................................................................................................................... 32 2.8. i-UPS Transformer: .......................................................................................................................................... 33 2.9. Intelligent circuitry & LCD interfacing: ........................................................................................................... 34 2.9.1. First: .......................................................................................................................................................... 34 2.9.2. Second:...................................................................................................................................................... 34 2.9.3. Third: ........................................................................................................................................................ 34 2.9.4. Fourth: ....................................................................................................................................................... 34 2.9.5. Intelligent circuitry & LCD interfacing Schematic: .................................................................................. 35 2.9.6. Intelligent circuitry & LCD interfacing: ................................................................................................... 35 2.10. Final Hardware Implementation: .................................................................................................................... 36 Chapter 3. .................................................................................................................................................................... 37 Summary and conclusion ............................................................................................................................................. 37 3.1. Summary and Conclusion: ............................................................................................................................... 37 3.2. Comparison with simple UPS: ......................................................................................................................... 37 3.3. Conclusion with Future Work: ......................................................................................................................... 38 Chapter 4. .................................................................................................................................................................... 39 References ................................................................................................................................................................... 39 4.1. References: ....................................................................................................................................................... 39 4.1.1. Book: ......................................................................................................................................................... 39 4.1.2. Journal Articles: ........................................................................................................................................ 39 4.1.3. Web Pages: ............................................................................................................................................... 40
iv
List of Figures Sr. No 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Figure 1.1 1.2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 Page 04 08 12 14 14 15 17 18 19 19 20 23 29 29 30 32 33 35 35 36
Chapter 1. Introduction
1. Introduction:
UPS stands for Uninterruptible Power Supply. It is an instrument connected between the electric grid and the consumer, comprising of electric hardware and rechargeable batteries. The aim of the instrument is to supply continuous undisturbed and conditioned power to the critical load. The energy for powering the load comes from the utility, or from the battery upon mains outage. At times, power from a wall socket is neither clean nor uninterruptible. Many abnormalities such as blackouts, brownouts, spikes, surges, and noise can occur. Under the best conditions, power interruptions can be an inconvenience. At their worst, they can cause loss of data in computer systems or damage to electronic equipment. It is the function of an Uninterruptible Power Supply (UPS) to act as a buffer and provide clean, reliable power to vulnerable electronic equipment. The basic concept of a UPS is to store energy during normal operation (through battery charging) and release energy (through DC to AC conversion) during a power failure. UPS systems are traditionally designed using analog components. Today these systems can integrate a microcontroller with AC sine wave generation, offering the many benefits. As the general population continues to grow, there is an ever-increasing demand for electricity placed on the worlds power-generation and distribution facilities. Although significant measures are taken to ensure a reliable supply of electric power, the significant demand for power increases the likelihood that power outages and other electrical disruptions such as brownouts will occur. UPS that currently existed offer users extended periods of backup power during which they can continue to use electronic equipment such as a personal computer. However, this UPS only provide a minimal voltage regulation and filtering for disturbance occurred. Further, most UPS equipped with microcontroller for monitoring and display are much expensive than the standard available UPS in the market as the application of microcontroller will provide a wide range of application in term of programming and hardware controls. The purpose of this project is to design a UPS that manages to act as an emergency power supply to critical load and also equipped with microcontroller programming for UPS monitoring system. Mobility and versatility have become a must for the fast-paced society today. People can no longer afford to be tied down to a fixed power source location when using their equipments.
1
Overcoming the obstacle of fixed power has led to the invention of DC/AC power inverters. While the position of power inverter in the market is relatively well established, there are several features that can be improved upon. A comparison analysis of the different power inverter has been compiled. Aside from the differences in power wattage, cost per wattage, efficiency and harmonic contend, power inverters can be categorized into three groups: square wave, modified sine wave, and pure sine wave. A cost analysis of the different types of inverter shows that sine wave power inverter, though has the best power quality performance, and has a big spike in cost per unit power. Another feature which can be improved is the efficiency of the inverter. The standard sine wave in the market has an average efficiency of 85-90%. Power dissipated due to efficiency flaws will be dissipated as heat and the 10-15% power lost in the will shorten operational life span of inverters. The quality of the output power could also be improved. It is imperative that the output signal be as clean as possible. Distortion in the output signal leads to a less efficient output and in the case of a square wave, which has a lot of unwanted harmonics; it will damage some sensitive equipments. In designing any type of power supply, it is important to examine the intended market and place the product in a particular market. Our market will be to design a 300 watts power inverter that will provide optimum pure sine wave performance with minimal cost. In meeting the design requirements, there are several technical challenges that must be overcome. Our single, most difficult constraint will be to produce power at a lower power per unit cost than exists in the market. Our efficiency will be greater than 90 percent. This insures that, with a maximum load, less than 10% of power will be dissipated as heat. The total harmonic distortion will be less than 5 percent. Generally, an ideal UPS should be able to deliver uninterrupted power while simultaneously providing the necessary power conditioning for the particular power application. Therefore, an ideal UPS should have the following features: Regulated sinusoidal output voltage with low total harmonic distortion (THD) independent of the changes in the input voltage or in the load, linear or nonlinear, balanced or unbalanced. On-line operation, which means zero switching time from normal to backup mode and vice versa. Low THD sinusoidal input current and unity power factor. High reliability. Bypass as a redundant source of power in the case of internal failure. High efficiency. Low electromagnetic interference (EMI) and acoustic noise. Electric isolation of the battery, output, and input. Low maintenance. Low cost, weight, and size.
2
The advances in power electronics during the past three decades have resulted in a great variety of new topologies and control strategies for UPS systems. The research has been focused mainly on improving performance and expanding application areas of UPS systems. The issue of reducing the cost of converters has recently attracted the attention of researcher. Reducing the number of switches provides the most significant cost reduction. Another form of cost reduction is to replace active switches such as IGBTs, MOSFETs, and thyristors with diodes. Not only are diodes more reasonable than the controlled switches, but there is also a cost reduction from eliminating gate drivers for active switches and power supplies for gate drivers. Another way of reducing cost is to develop topologies that employ switches with lower reverse voltage stresses and lower current ratings, which means less silicon and smaller switching losses resulting in lower cost and higher efficiency.
1.1
Classification:
UPS systems are classified into three general types: static, rotary, and hybrid static/rotary. In this section, we explain these three categories of the UPS systems.
Fig # 1.1 The main important component is inverter, which converts the Dc stored in Battery back into Ac. So by improving the inverter we can improve the efficiency of UPS. There are few problems in inverters available in market, so we will try to overcome these problems, to increase the efficiency of ups.
1.3
Design Background:
When designing a UPS system, there are three items that must be considered: cost vs. performance, output waveform and topology.
Output Waveform:
Some UPS designs use a square wave output instead of a sine wave. This makes the system cheaper to produce. But is this type of waveform really acceptable? Electrical equipment uses power delivered in the form of a sine wave from local utility companies. When considering alternative waveforms, how differing loads rely on different parts of the standard power company waveform must be examined. Electrical equipment uses power delivered in the form of a sine wave from local utility companies. When considering alternative waveforms, how differing loads rely on different parts of the standard power company waveform must be examined. For instance, most appliances are always on, thus the power used by the appliance is the RMS value of the sine wave, which is approximately 120 volts. However, equipment such as computers use peak voltage values, which are approximately 170 volts. When a square wave output is used to supply power to computer equipment, the RMS and peak values are equivalent, thus stressing some loads and under-supplying others. So the best output to provide electrical equipment is the output that they are designed to operate with - a sine wave.
1.4
UPS systems provide for a large number of applications in a variety of industries. Their common applications range from small power rating for personal computer systems to medium power rating for medical facilities, life-support systems, data storage, and emergency equipment, and high power rating for telecommunications, industrial processing, and online management systems. Different considerations should be taken into account for these applications. As an example, a UPS for emergency systems and lighting may support the system for 90-120 minutes. For other applications like computer backup power, a UPS may typically support the system for 15-20 minutes. If power is not restored during that time, the system will be gracefully shut down.
5
If a longer backup period is considered, a larger battery is required. For process equipment and high power applications, some UPS systems are designed to provide enough time for the secondary power sources, such as diesel generators, to start up.
Energy saving in critical battery status. Multi input ports for different sources. Over Voltage Protection.
Fig # 1.2
8
2.2.1. Inverter:
The method, in which the low voltage DC power is inverted, is completed in two steps. The first being the conversion of the low voltage DC power to a high voltage DC source, and the second step being the conversion of the high DC source to an AC waveform using pulse width modulation. Another method to complete the desired outcome would be to first convert the low voltage DC power to AC, and then use a transformer to boost the voltage to 120 volts. This project focused on the first method described and specifically the transformation of a high voltage DC source into an AC output. Of the different DCAC inverters on the market today there are essentially two different forms of AC output generated: modified sine wave, and pure sine wave. Power inverters were first invented using a square wave as the output form. This led to many different problems involving the functionality of devices that were being powered because they were designed to work with a sine wave instead of a square wave. There were some changes made to the hardware to eliminate the harsh corners from the square wave to transform it to a modified sine wave. It was mainly marketers who coined the term modified sine wave which
10
in all reality is nothing more than a modified square wave. Power inverters that used a modified sine wave eliminate the problems associated with square wave inverters. Although most people without a background in electronics do not know the difference, a modified square wave can have detrimental effects on electrical loads. In square wave inverters abnormal heat will be produced, causing a reduction in product reliability, efficiency, and useful life. Another disadvantage of a square wave inverter is that its choppy waveform can confuse the operation of some digital timing devices. Undesirable or abnormal functions this can cause a device to perform. A modified sine wave can be seen as more of a square wave than a sine wave; it passes the high DC voltage for specified amounts of time so that the average power and RMS voltage are the same as if it were a sine wave. These types of inverters are much cheaper than pure sine wave inverters and therefore are attractive alternatives. Pure sine wave inverters, on the other hand, produce a sine wave output identical to the power coming out of an electrical outlet. These devices are able to run more sensitive devices that a modified sine wave may cause damage to such as: laser printers, laptop computers, power tools, digital clocks and medical equipment. This form of AC power also reduces audible noise in devices such as fluorescent lights and runs inductive loads, like motors, faster and quieter due to the low harmonic distortion.
In designing any type of power supply, it is important to examine the intended market and place the product in a particular market. Our market will be to design a power inverter that will provide optimum pure sine wave performance with minimal cost. In meeting the design requirements, there are several technical challenges that must be overcome. Our single, most difficult constraint will be to produce power at a lower power per unit cost than exists in the market. Our
11
efficiency will be greater than 90 percent. This insures that, with a maximum load, less than 10% of power will be dissipated as heat. The total harmonic distortion will be less than 5 percent. With a total harmonic distortion this low and a pure sine wave output, we will be able to power even the most sensitive loads. . The DC/AC inverter circuit will use a microprocessor to digitally pulse the transistors. This will allow us to produce a pure sine wave output. This feature will also allow us to enter other markets more easily. For instance, in Pakistan the fundamental frequency is 50 Hz. The feedback control system will be used to regulate the output voltage of the DC/DC converter. This is necessary since the current will vary will the load. The feedback control system will be accomplished using by sampling the output with an integrated circuit.
Fig # 2.1 A modified sine wave is similar to a square wave but instead has a stepping look to it that relates more in shape to a sine wave. This can be seen in Figure 2.1, which displays how a modified sine wave tries to emulate the sine wave itself. The waveform is easy to produce because it is just the product of switching between 3 values at set frequencies, thereby leaving out the more complicated circuitry needed for a pure sine wave. The modified sine wave inverter provides a cheap and easy solution to powering devices that need AC power. It does have some drawbacks as not all devices work properly on a modified sine wave, products such as computers and medical equipment are not resistant to the distortion of the signal and must be run off of a pure sine wave power source.
12
are not clear due to the high modulation ratio (requirement for pure sinusoidal output). For small filet at the output, modulation ratio should be greater than 200.
Fig # 2.2 In order to source an output with a PWM signal, transistor or other switching technologies are used to connect the source to the load when the signal is high or low. Full or half bridge configurations are common switching schemes used in power electronics. Full bridge configurations require the use of four switching devices and are often referred to as HBridges due to their orientation with respect to a load.
Fig # 2.3
14
Fig # 2.4
It is the most economical solution to get pure sinusoidal output up to tens of kilowatts power rating inverters.
2.2.8.2. Components:
Transformer 40 amps (500 W), 220 V, 12X12 V Transistor (10) 1047 Resistor (1) 500 ohms Battery 40 Ampere Capacitor 250 V, 0.5 uf
2.2.8.3. Method:
First of all you have to make some changes in transformer. If u are using 500 V transformer then take 18 to 22 gauge copper wire and on the one side of transformers core make five turn and put a point on it, and turn this point, and again turn the wire five times on the same direction. In this way u get three terminals. If u r connect the transformer to 220 V power supply then it gives 1.5 V on both terminals. Now put transformer D1047 on the palm of your hand and turn it such a way that number appears your way. Now you will see three points. The point on your left side is
16
known as (B) Base, middle one is collector(C) and the right one is (E) emitter . (These are the information only for D1047
Fig # 2.5
Now first of all tight the 5 transistor in heat sink in series with the help of nut bolt. Connect the base of all five transistors altogether and then join the points of collector together. In the same way arrange the other five transistors individually and connect the collector(C) of both sides of transistors with the outer terminal of secondary coil, after that connect the both outer terminals of the third coil with the base of the both heat sinks of transistor. then connect the (E) emitter of both side by wires n then connect the 500 ohm resistor on emitter and resistor on either side. Now connect the middle terminal of primary coil by one to two ft long wire and clip (crocodile) it and attach this terminal always by the positive terminal, and with the negative terminal of battery connect the both (E) emitter of transistor. After that the central point of the third coil and a wire attach it with emitter to connect using a heavy ampere switch between both terminals of the Inverter primary coil to apply a capacitor
17
which will prevent the current from the sparking. inverter will switch on as soon as starting to work.
2.2.8.4. Working:
With both the terminals of battery connect the positive and negative wires to its terminals positive to positive and negative to negative and then open the switch, slightly vibration starts in the inverter as switch is open. Now you can run it into 1 to 500 watt load.
inverters
50 watt inverter 100 watt inverter 300 watt inverter 500 watt inverter 1000 watt inverter 3000 watt inverter 5000 watt inverter
12 V
10 A
100 W
4 to 6
12 V
25 A
300 W
6 to 8
12 V
40 A
500 W
8 to 10
24 V
45 A
1000 W
20 to 26
24 V
125 A
3000 W
40 to 50
48 V
105 A
5000 W
60 to 70
Fig # 2.6
18
Fig # 2.7
Fig # 2.8
19
2.3. AC to DC Conversion:
A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), which flows in only one direction. The process is known as rectification. Physically, rectifiers take a number of forms, including vacuum tube diodes, mercury-arc valves, solid-state diodes, silicon-controlled rectifiers and other siliconbased semiconductor switches. Historically, even synchronous electromechanical switches and motors have been used. Early radio receivers, called crystal radios, used a "cat's whisker" of fine wire pressing on a crystal of galena (lead sulfide) to serve as a point-contact rectifier or "crystal detector". Rectifiers have many uses, but are often found serving as components of DC power supplies and high-voltage direct current power transmission systems. Rectification may serve in roles other than to generate direct current for use as a source of power. As noted, detectors of radio signals serve as rectifiers. In gas heating systems flame rectification is used to detect presence of flame. The simple process of rectification produces a type of DC characterized by pulsating voltages and currents (although still unidirectional). Depending upon the type of end-use, this type of DC current may then be further modified into the type of relatively constant voltage DC characteristically produced by such sources as batteries and solar cells.
Fig # 2.9
20
When the top of the transformer secondary winding is positive, say during the first half-cycle of the supply, the anode of diode D1 is positive w.r.t. cathode, and anode of diode D2 is negative w.r.t. cathode. Thus only diode D1 conducts, being forward biased and current flows from cathode to anode of diode D1 through load resistance RL and top half the transformer secondary making cathode end of load resistance RL positive. During the second half-cycle of the input voltage the polarity is reversed, making the bottom of the secondary winding positive w.r.t. centre tap and thus diode D2 is forward biased and diode D1 is reverse biased. Consequently during this half-cycle of the input only the diode D2 conducts and current flows through the load resistance RL and bottom of the transformer secondary make the cathode end of the load resistance RL positive. Thus the direction of flow of current through the load resistance RL remains the same during both halves of the input/supply voltage. Thus the circuit showed acts as a full-wave rectifier.
2.4. Microcontroller:
A microcontroller is a small computer on a single circuit containing a processor core, memory, and programmable input/output peripherals. Neither program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control nondigital electronic systems. Some microcontrollers may use four-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (mill watts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just nano watts, making many of them well suited for long lasting battery applications. Other microcontrollers may serve performance-critical roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption. Microcontrollers and microprocessors are integrated circuits, but they differ fundamentally from other ICs. They are a class in themselves, that the designers have not made them to do a particular job. As such when you buy them from the market, you can not specify what function it will do. In order to get some useful function, these ICs have to be configured. Thus a microprocessor or microcontroller can be configured to check the status of a button, and then turn a motor ON or OFF. While the same IC can be configured later, to read the status of an infra-red sensor, decode the signal and turn another device ON or OFF.
21
If these two types of circuitries were to be made using conventional digital ICs, it would have required a large number of components. Moreover any change in the specification, like change of Infra-Red codes would result in total change in design! Using a configurable IC is a great idea. Not only the same IC, can be configured to do different tasks, but a change in specifications can easily be implemented by just changing the device configuration.
2.4.1. PIC16F877A:
In our project we are using the PIC16F877A microcontroller for intelligent circuitry. We have chosen this controller due to its: Cost effectiveness. High-performance Built-in clock low-voltage Flexibility
Peripheral Features:
Timer0: 8-bit timer/counter Timer1: 16-bit timer/counter Timer2: 8-bit timer/counter Operating speed: DC 20 MHz clock input Up to 8K x 14 words of Flash Program Memory Up to 368 x 8 bytes of Data Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) Parallel Slave Port (PSP) 8 bits wide with external RD, WR and CS controls
Analog Features:
10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
Selectable oscillator options In-Circuit Debug (ICD) via two pins Enables you to view variable values, Special Function Register and EEPORM while the program is running.
Fig # 2.10
23
PORT A: 6-bit wide, bidirectional port. Data direction register is TRISA. If TRISA=1 then PORTA input port vice versa. Pin PA4 is multiplexed with Timer0 module clock input to become the PA4/TOCK1 pin. Other PORTA pins are multiplexed with Analog input. On power reset these pins are analog input.
PORTB: 8-bit wide, bidirectional port. Data direction register is TRISB. If TRISB=1, then PORTB is input else output. Three pins RB3/PGM, RB6/PGC and RB7/PGD are multiplexed with in circuit debugging and low voltage programming function. RB0/INT is an external interrupt pin and is configured using then INTEDG bit OPTION_REG<6>.
PORTC: PORTC is 8-bit wide, bidirectional port. Data direction register is TRISC. RC0/T1OSO/T1CKI Input/output port pin Timer1 oscillator output Timer1 clock input. RC1/T1OSI/CCP2 Input/output port pin Timer1 oscillator input PWM2 output. RC2/CCP1 Input/output port pin PWM1 output.
25
RC3/SCK/SCL RC3 can also be the synchronous serial clock for SPI mode. RC4/SDI RC4 can also be the SPI data in (SPI mode) RC5/SDO Input/output port pin Synchronous Serial Port data output. RC6/TX/CK Input/output port pin USART asynchronous transmit Synchronous clock. RC7/RX/DT Input/output port pin USART asynchronous receive Synchronous data.
PORTD: 8-bit wide port. This port can be I/O or Parallel Slave Port.
PORTE: Three pins port. The PORTE pins become the I/O control inputs for the microprocessor port when bit PSPMODE (TRISE<4>) is set. RE0/RD/AN5 I/O port pin read control input in Parallel Slave Port mode analog input
RE1/WR/AN6 I/O port pin write control input in Parallel Slave Port mode analog input
RE2/CS/AN7 I/O port pin chip select control input in Parallel Slave Port mode
26
analog input
27
28
Fig # 2.11
Fig # 2.12
29
Fig # 2.13
2.6. Software:
Proton Basic Proteous
Major advantages and why Basic is popular for hardware & Software designing 100 % High-level programming languages Easy for beginners to use Allow advanced features to be added for experts Provide clear and friendly error messages and correction
30
Todays market is demanding to solve their hardware & software problems, which is easil y done through Proton Basic Plus (PIC Microcontroller) Microsoft Visual Basic (PC to Hardware Communication, Database, etc ) Visual Basic .NET (.NET Framework) & many more
2.6.3. Proteous:
The Proteus Design Suite is wholly unique in offering the ability to co-simulate both high and low-level micro-controller code in the context of a mixed-mode SPICE circuit simulation. With this Virtual System Modeling facility, you can transform your product design cycle, reaping huge rewards in terms of reduced time to market and lower costs of development. If one person designs both the hardware and the software then that person benefits as the hardware design may be changed just as easily as the software design. In larger organizations where the two roles are separated, the software designers can begin work as soon as the schematic is completed; there is no need for them to wait until a physical prototype exists. In short, Proteus VSM improves efficiency, quality and flexibility throughout the design process.
2.7. Transformer:
A transformer is a power converter that transfers electrical energy from one circuit to another through inductively coupled conductorsthe transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF), or "voltage", in the secondary winding. This effect is calledinductive coupling. If a load is connected to the secondary winding, current will flow in this winding, and electrical energy will be transferred from the primary circuit through the transformer to the load. In an ideal transformer, the induced voltage in the secondary winding (Vs) is in proportion to the primary voltage (Vp) and is given by the ratio of the number of turns in the secondary (Ns) to the number of turns in the primary (Np) as follows:
31
Fig # 2.14 An ideal transformer is shown in the adjacent figure. Current passing through the primary coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very high magnetic permeability, such as iron, so that most of the magnetic flux passes through both the primary and secondary coils.
32
Fig # 2.15
33
2.9.1. First:
It is safe and Improves battery life by using temperature sensor. When battery is fully charged and comparator do not trip battery charging then microcontroller will come into work trip the battery charging by temperature sensing because heating hardens the battery and it loses its efficiency and life.
2.9.2. Second:
We provide two outputs from i-UPS, Load-1 and Load-2, Load-1 controls lights, chargers and low power electronics appliances. On the other hand, Load-2 controls the fans and inductor type loads.
2.9.3. Third:
Is Energy saving works in the form of battery status. When battery is at its critical situation it switches off Load-2 and lets the Load-1 on. So we can get lights at low battery status. When main supply is on, automatically Load-1 and Load-2 are connected to main supply.
2.9.4. Fourth:
We have provided two main energy sources Line-1 and Line-2 from different feeders. Microcontroller automatically checks and selects the active Line. If both lines are active then microcontroller will select Line-1 by default setting.
34
Fig # 2.16
Fig # 2.17
35
Fig # 2.18
36
38
Chapter 4. References
39
40
Appendices
Inverter:
Device 16F628 Config INTRC_OSC_NOCLKOUT , WDT_OFF ,MCLRE_OFF, PWRTE_ON , BODEN, CPD_OFF, CP_OFF XTAL 4 ANSEL=%00000000 OSCCAL=%11111111 ALL_DIGITAL=true Dim wave1 As PORTA.0 Dim wave2 As PORTA.1 Output wave1 Output wave2 High wave1 High wave2 inv: High wave2 DelayUS 1250 Low wave2 DelayUS 1250 High wave2 DelayMS 5 Low wave2 DelayUS 1250 High wave2 DelayUS 1250 Low wave2 High wave1 DelayUS 1250 Low wave1 DelayUS 1250 High wave1 DelayMS 5 Low wave1 DelayUS 1250 High wave1 DelayUS 1250 Low wave1 GoTo inv
41
' Lcd Reset Pin ' Lcd Enable Pin ' Lcd Data Pin '10-Bit Result Required 'RC OSC Chosen 'Allow 50us Sample Time
42
Print At 2,1," ID: " Print At 3,1,"091320-079" DelayMS 2000 Cls Print At 1,1,"MAJID REHAN" Print At 2,1," ID: " Print At 3,1,"091320-043" DelayMS 2000 Cls Print At 1,1,"** i-UPS_UMT 500W **" DelayMS 500 Main: TEMP = ADIn 0 BAT = ADIn 1 PHASE = ADIn 2 BATREF = ADIn 3 BATREF = BATREF *7.4969 *.0032 PHASE = PHASE * 6.51915 *.21425 BAT = BAT * (5/1023) BAT = BAT * 50 TEMP = TEMP * 200 * 0.0024351
If PHASE=0 Or PHASE>=250 Then GoTo ups_mood EndIf If PHASE=0 Or PHASE<=180 Then GoTo ups_mood EndIf If LINE_1=1 And LINE_2=0 Then High PORTD.6 High PORTD.7 Low PORTC.1 High PORTC.4 Low PORTC.6 Low PORTC.7 High PORTC.5 If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf If BAT<=100 Then Low PORTC.2 If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood
43
EndIf If TEMP<=100 Then If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf DelayMS 2000 High PORTC.3 Low PORTC.0 If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_1" Print At 3,1,"BAT-CHARGING ", DEC1 BAT,"" Print At 4,1,"TEMPERATURE ", Dec TEMP," " If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf Else High PORTC.0 Low PORTC.3 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_1" Print At 3,1,"BAT-CHARGING ", DEC1 BAT,"" Print At 4,1,"TEMPERATURE OVER" If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf EndIf Else Low PORTC.3 High PORTC.2 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_1" Print At 3,1,"BATTERY FULL" Print At 4,1,"TEMPERATURE ", Dec TEMP,"" If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf EndIf ElseIf LINE_1=0 And LINE_2=1 Then High PORTD.6 High PORTD.7 Low PORTC.1 High PORTC.4 Low PORTC.5 High PORTC.6 Low PORTC.7 If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf
44
If BAT<100 Then Low PORTC.2 If TEMP<=100 Then DelayMS 2000 If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf High PORTC.3 Low PORTC.0 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_2" Print At 3,1,"BAT-CHARGING ", DEC1 BAT,"" Print At 4,1,"TEMPERATURE ", Dec TEMP," " If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf Else High PORTC.0 Low PORTC.3 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_2" Print At 3,1,"BAT-STATUS % ", DEC1 BAT,"" Print At 4,1,"TEMPERATURE OVER" If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf EndIf Else Low PORTC.3 High PORTC.2 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_2" Print At 3,1,"BATTERY FULL" Print At 4,1,"TEMPERATURE ", DEC1 TEMP," " If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf EndIf Else If LINE_1=1 And LINE_2=1 Then High PORTD.6 High PORTD.7 Low PORTC.1 High PORTC.4 High PORTC.5 Low PORTC.6 Low PORTC.7 If BAT<=100 Then If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf
45
Low PORTC.2 If TEMP<=100 Then If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf DelayMS 2000 If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf High PORTC.3 Low PORTC.0 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_1" Print At 3,1,"BAT-CHARGING ", DEC1 BAT,"" Print At 4,1,"TEMPERATURE ", Dec TEMP," " If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf Else High PORTC.0 Low PORTC.3 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_1" Print At 3,1,"BAT-STATUS % ", DEC1 BAT,"" Print At 4,1,"TEMPERATURE OVER" If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf EndIf Else Low PORTC.3 High PORTC.2 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," LINE_1" Print At 3,1,"BATTERY FULL" Print At 4,1,"TEMPERATURE ", Dec TEMP," " If LINE_1=0 And LINE_2=0 Then Low PORTC GoTo ups_mood EndIf EndIf Else ups_mood: If UPS=1 And BAT>=10 Then If BAT>=30 Then Low PORTC Toggle PORTC.1 High PORTD.6 High PORTD.7 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," UPS" Print At 4,1,"TEMPERATURE ", Dec TEMP," " If BAT>=100 Then
46
Low PORTC High PORTC.1 High PORTD.6 Low PORTD.7 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1,"O/P ", Dec PHASE,""," V"," UPS" Print At 3,1,"BAT-STATUS % ", DEC1 BAT,"" Print At 4,1,"TEMPERATURE ", Dec TEMP," " EndIf Else Low PORTC Low PORTD.6 Low PORTD.7 Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" If BAT<=100 Then If BAT<=10 Then Print At 2,1," LIGHT OFF " Print At 3,1," PLZ RECHARGE " Print At 4,1," BATTERY EMPTY" Else Print At 2,1," LIGHT OFF " Print At 3,1," PUSH TO BACKUP " Print At 4,1," BAT-STATUS% ", DEC1 BAT,"" EndIf Else Print At 1,1,"i-UPS_UMT 500W ",DEC1 BATREF,"" Print At 2,1," LIGHT OFF " Print At 3,1," PUSH TO BACKUP " Print At 4,1," BATTERY FULL" EndIf EndIf EndIf End If DelayMS 1000 GoTo Main
47