Final Report
-
Upload
tushar-menon -
Category
Documents
-
view
39 -
download
0
Transcript of Final Report
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 1/40
1
INTELLIGENT MONITORING OF UPS
SYSTEM
B Tech Mini-Project Report
Submitted in partial fulfillment for the award of the Degree of
Bachelor of Technology in Electrical and Electronics Engineering
A V VINAY B080166EE
GOVIND G B080091EEJITHIN RAJEEV B080100EE
TUSHAR MENON B080358EE
Under the guidance of
Dr. T.L JOSE
Department of Electrical Engineering
NATIONAL INSTITUTE OF TECHNOLOGY CALICUT
NIT Campus P.O., Calicut - 673601, India
2011
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 2/40
2
CERTIFICATE
This is to certify that the thesis entitled “INTELLIGENT MONITORING OF UPS SYSTEM ” is a bona fide record of the mini-project done by A.V Vinay ( Roll No. B080166EE), Govind
G (Roll No. B080091EE) , Jithin Rajeev (Roll No. B080100EE) and Tushar Menon ( Roll No.
B080358EE) under my supervision and guidance, in partial fulfillment of the requirements for
the award of Degree of Bachelor of Technology in Electrical & Electronic Engineering from
National Institute of Technology Calicut for the year 2009.
Dr. T.L Jose Dr. Sreeramkumar
(Guide) Professor & Head
Professor Dept. of Electrical Engineering
Dept. of Electrical Engineering
Place:
Date:
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 3/40
3
ACKNOWLEDGEMENT
It is with deep sense of gratitude that we thank our Project Guide Dr. T.L Jose and
Project Coordinator Dr. Ananthakrishnan whose valuable advice and suggestions
helped us a lot for the completion of the Project Work.
We also thank the Head of Electrical Department, Dr.Sreeramkumar for giving us
permission to work in labs and also to the Lab assistants who helped us a lot in getting
the required components and assembling the circuit.
Last but not the least we thank our friends who were with us at all times and also
Almighty God who showered his blessings upon us.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 4/40
4
CONTENTS
1. ABSTRACT 5
2. PROBLEM STATEMENT 6
3.
LITERATURE 73.1 UPS SYSTEM 7
3.2 BATTERY AN OVER VIEW 10
3.3 PIC 18F452 13
4. THEORETICAL BACKGROUND 1
4.1 ADC PROGRAMMING IN PIC 14
4.2 PROBLEM DEFINITION AND FUNCTIONAL REQUIREMENTS 20
5. SALIENT FEATURES OF THE PROJECT 22
5.1 INTRODUCTION- HOW WE PROCEEDED 22
5.2 COMPONENTS USED 23
5.3 INTERFACING THE MOSFET SWITCHES TO MICRO CONTROLLER 26
5.4 CONSTANT CURRENT BATTERY CHARGING 285.5 VOLTAGE ANALYZER CIRCUIT 30
5.6 VOLTAGE RECTIFICATION 31
5.7 PROGRAMMING 32
5.8 PROGRAM 33
6. CONCLUSION 39
7. REFERENCES 40
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 5/40
5
CHAPTER-1
ABSTRACT
Uninterrupted Power Supplies (UPS) are widely used to provide emergency power to criticalloads in case of utility mains failure in areas like computer networks, communication links,
biomedical instrumentation etc. The rampant popularity of digital control and automation has
not eluded this area too. Here we intend to propose the design of an off line UPS incorporating
an intelligent switching of power from the supply side to the battery and back. The
microcontroller forms the brain of the circuit and constantly monitors the battery as well as the
supply side. At the same time the battery is constantly charged using the constant current
charging scheme while the battery is feeding the load. This microcontroller based design
incorporates several features like overvoltage protection of the battery, supply side under-
voltage switching. Such a design can be used as part of the initial stage of the UPS. It alsoinvolves a voltage analyzing circuit which provides effective user interface by indicating the
current voltage level of the battery. The use of microcontroller thus greatly increases the
flexibility of the whole design as any change in the logic warrants a change in just the software
structure while essentially keeping the rest of the associated circuitry to remain unchanged.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 6/40
6
CHAPTER-2
PROBLEM STATEMENT
Provide a backup power to critical load in the event of a power outage and also to limit
the duration of backup power needed to a suitable length to permit a user to save
unsaved data and properly shut down.
One of the project main goals is to provide information for user about the backup
battery and status of the UPS during power outage. A voltage level analyzer circuit has
to be there in order to indicate the state of charge.
A charging circuit also needs to be built for this project which is to charge a12V DC for
the backup battery. The charging, discharging and switching processes are to be
controlled by microcontroller.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 7/40
7
CHAPTER-3
LITERATURE
3.1 UPS SYSTEMS
An Uninterruptible power supply (UPS), also known as a battery back-up, provides emergency
power and, depending on the topology, line regulation as well to connected equipment by
supplying power from a separate source when utility power is not available. It differs from an
auxiliary or emergency power system or standby generator, which does not provide instant
protection from a momentary power interrupts. While not limited to safeguarding any
particular type of equipment, a UPS is typically used to protect computers, data centers ,
telecommunication equipment or other electrical equipment where an unexpected power
disruption could cause injuries, fatalities, serious business disruption or data loss. UPS units
come in sizes ranging from units which will back up a single computer without monitor (around
200 VA) to units which will power entire data centers, buildings, or even an entire city. (Several
megawatts).
An UPS contains an internal rechargeable battery that gets charged from the power line thengets used to generate line power to the load when the power line fails. To accomplish that they
also contain an inverter, an electronic device capable of generating 110/220v AC from battery-
level DC voltage.
The general categories of modern UPS systems are on-line, line-interactive, and standby. An on-
line UPS uses a "double conversion" method of accepting AC input, rectifying to DC for passing
through the battery (or battery strings), then inverting back to 120v AC for powering the
protected equipment. A line-interactive UPS maintains the inverter in line and redirects the
battery's DC current path from the normal charging mode to supplying current when power is
lost. In a standby ("off-line") system the load is powered directly by the input power and the
backup power circuitry is only invoked when the utility power fails. Most UPS below 1 kVA
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 8/40
8
3.1.1 OFFLINE UPS
The Offline / Standby UPS (SPS) offers only the most basic features, providing surge protection
and battery backup. Usually the Standby UPS offers no battery capacity monitoring or self-testcapability, making it the least reliable type of UPS since it could fail at any moment without
warning. These are also the least expensive. The SPS may be worse than using nothing at all,
because it gives the user a false sense of security of being assured protection that may not work
when needed the most.
With this type of UPS, a user's equipment is normally connected directly to incoming utility
power with the same voltage transient clamping devices used in a common surge protected
plug strip connected across the power line. When the incoming utility voltage falls below a
predetermined level the SPS turns on its internal DC-AC inverter circuitry, which is powered
from an internal storage battery. The SPS then mechanically switches the connected equipment
on to its DC-AC inverter output. The switchover time Is usually less than 4 milliseconds, but
typically can be as long as 25 milliseconds depending on the amount of time it takes the
Standby UPS to detect the lost utility voltage
3.1.2 LINE INTERACTIVE UPS
The Line-Interactive UPS is similar in operation to a Standby UPS, but with the addition of a
multi-tap variable-voltage autotransformer. This is a special type of electrical transformer that
can add or subtract powered coils of wire, thereby increasing or decreasing the magnetic field
and the output voltage of the transformer. This type of UPS is able to tolerate continuous
under-voltage brownouts and over- voltage surges without consuming the limited reserve
battery power. It instead compensates by auto-selecting different power taps on the
autotransformer.
3.1.3 COMMON POWER PROBLEMS
There are various common power problems that UPS units are used to correct:
1. Power failure
2.Voltage spike
3.Over-voltage
4.Line noise
5.Harmonic distortion
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 9/40
9
3.1.4 POWER FAILURE:
A power outage (also known as a power cut, power failure ,power loss, or blackout) refers to
the short- or long-term loss of the electric power to an area.
Power outages are categorized into three different phenomena, relating to the duration and
effect of the outage:
• A dropout is a momentary (milliseconds to seconds) loss of power typically caused by a
temporary fault on a power line. Power is quickly (and sometimes automatically) restored once
the fault is cleared.
• A brownout is a drop in voltage in an electrical power supply, so named because it typically
causes lights to dim. Systems supplied with three-phase electric power also suffer brownouts if
one or more phases are absent, at reduced voltage, or incorrectly phased. Such malfunctions
are particularly damaging to electric motors.
• A blackout refers to the total loss of power to an area and is the most severe form of power
outage that can occur. Blackouts which result from or result in power.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 10/40
10
3.2 BATTERY-AN OVERVIEW
3.2.1 Introduction
A battery converts chemical energy into electric energy through an electro-chemical process.
The basic unit is called a "cell" and can be manufactured in a wide variety of shapes and sizes.
Batteries are made up of one or more cells in series or parallel combinations to create the
desired voltage and output capacity.
The electro-chemical cells consist of two terminals suspended in an electrolyte. The terminals
are called the anode (-) and the cathode (+). An electrical current is essentially a flow of
electrons, and the battery can be regarded as an electron pump. The chemical reaction
between the anode and the electrolyte forces electrons out of the electrolyte and into the
anode metal, through the circuit, then back to the cathode. From the cathode metal, the
electrons re-enter the electrolyte. This direction may seems strange, from negative to positive.
We regard ‘current’ as flowing from positive down to negative, but in fact, this current is a flow
of electrons in the opposite direction! The anode and cathode both get converted during thisreaction, one is ‘eaten away’, and the other has a build-up of material on it. When a
rechargeable battery is recharged, this chemical reaction is reversed, and the terminals are
restored.
3.2.2 Primary and Secondary cells
Batteries can be divided into two classes: primary, and secondary. Primary batteries are
designed for a single discharge cycle only, i.e. they’re non-rechargeable. Secondary cells are
designed to be recharged, typically, from 200 to 1000 times. For use in robot wars, primary cells
would be far too expensive. Among secondary cells, the options open to us include NiCd, NiMH,
rechargeable Lithium, or lead-acid.
3.2.3 Ampere hour ratings.
The energy stored in a battery is measured in the units Ampere-hours (Ah). The units of energy
are actually Volts × Amps × Seconds, but since the voltage of the cell is constant, it is only the
product of current and time which determines the amount of energy in the battery.
Rechargeable cells generally have a lower energy density (that is the total amount of energy
they can hold, Volts × current × time, divided by the physical size of the cell) than primary cells.
A Ni-Cd cell provides 5Ah at 1.2V, a lead acid D cell provides 2.5Ah at 2V, and the comparablealkaline cell provides 10Ah at 1.5V.
3.2.4 Lead acid batteries
In lead-acid batteries, the positive electrode is lead dioxide, while the negative electrode is
metallic lead. The electrolyte is sulphuric acid. As the cell discharges, the acid electrolyte is
consumed producing water and both electrodes change into lead sulphate. When the cell is
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 11/40
11
recharged, the chemical reaction reverses. As in most battery types, it is good to store them at
cool temperatures and operate them at warm temperatures. Most lead-acid batteries have the
highest energy density at about 30-40ºC. If the cell undergoes overcharging, hydrogen and
oxygen gassing will occur with the loss of water.
The sealed type of lead- acid battery
(SLA battery) is similar to the non-
sealed type except a few changes in
the electrolyte. This commonly
takes the form of a gel or is absorbed
by the separator. Methods to
recombine oxygen formed at
overcharging are employed.
Although specifically designedfor the reduction of excess gassing,
pressure valves usually are installed to
vent excess pressures to the
atmosphere. The sealed
construction allows a
maintenance-free life which is not
restricted to a horizontal orientation. Fig. 3.1. Lead Acid Battery
3.2.5 BATTERY CHARGING
Charging Schemes
The charger has three key functions
Getting the charge into the battery (Charging)
Optimizing the charging rate (Stabilizing)
Knowing when to stop (Terminating)
The charging scheme is a combination of the charging and termination methods.
Charge Termination
Once a battery is fully charged, the charging current has to be dissipated somehow. The result is
the generation of heat and gasses both of which are bad for batteries. The essence of good
charging is to be able to detect when the reconstitution of the active chemicals is complete and
to stop the charging process before any damage is done while at all times maintaining the cell
temperature within its safe limits. Detecting this cut off point and terminating the charge is
critical in preserving battery life. In the simplest of chargers this is when a predetermined upper
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 12/40
12
voltage limit, often called the termination voltage has been reached. This is particularly
important with fast chargers where the danger of overcharging is greater.
Safe Charging
If for any reason there is a risk of overcharging the battery, either from errors in determining
the cutoff point or from abuse this will normally be accompanied by a rise in temperature.
Internal fault conditions within the battery or high ambient temperatures can also take a
battery beyond its safe operating temperature limits. Elevated temperatures hasten the death
of batteries and monitoring the cell temperature is a good way of detecting signs of trouble
from a variety of causes. The temperature signal, or a resettable fuse, can be used to turn off or
disconnect the charger when danger signs appear to avoid damaging the battery. This simple
additional safety precaution is particularly important for high power batteries where the
consequences of failure can be both serious and expensive.
Charging Scheme
There are different charging schemes like constant current, constant voltage charging etc.We use constant current charging for this project.
,
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 13/40
13
3.3 PIC18F452
PIC18F452 has a RISC architecture that comes with some standard features such as on-chip
program (code) ROM, data RAM, data EEPROM, timers, ADC, USART,and input /output ports.
The 40 pin PIC18F452 has five ports. They are PORTA ,PORTB ,PORTC ,PORTD ,PORTE. Port A
has 7 pins; Ports B,C and D each have 8 pins; and port E has only 3 pins. In addition to being
used for simple input/output ports, each port has some other functions such as ADC, timers,
interrupts and serial communication pins. Each port has three SFRs associated with it. They are
designated as PORTx, TRISx, and LATx.
Fig. 3.2 Pin Diagram of PIC18F452
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 14/40
14
CHAPTER-4
THEORETICAL BACKGROUND
4.1 ADC PROGRAMMING IN PIC
The signals in nature are usually analog in nature (here it is voltage ).But most of our computer
(or Microcontrollers) are digital in nature. They can only differentiate between HIGH or LOW
level on input pins. For example if input is more than 2.5v it will be read as 1 and if it is below
2.5 then it will be read as 0 (in case of 5v systems). So we cannot measure voltage directly from
microcontrollers. To solve this problem most modern MCUs have an ADC unit. ADC stands for
analog to digital converter. It will convert a voltage to a number so that it can be processed by a
digital systems .
Most important specification of ADCs is the resolution. This specifies how accurately the ADC
measures the analog input signals. Common ADCs are 8 bit, 10 bit and 12 bit. For example if the
reference voltage(explained latter) of ADC is 0 to 5v then a 8 bit ADC will break it in 256
divisions so it can measure it accurately up to 5/256 v= 19mV approx. While the 10 bit ADC will
break the range in 5/1024 = 4.8mV approx. So you can see that the 8 bit ADC can't tell the
difference between 1mV and 18mV. The ADC in PIC18 are 10 bit. So we have 10 bit ADC.
Other specification include (but not limited to) the sampling rate, that means how fast the ADC
can take readings. Microchip claims that pic18f4520's ADC can go as high as 100K samples per
second.
ADC Terminology
Reference Voltage: The reference voltage specifies the minimum and maximum voltage range
of analog input. In PIC 18 there are two reference voltage, one is the Vref- and one is Vref+. The
Vref- specifies the minimum input voltage of analog input while the Vref+ specifies the
maximum. For example if the input signal Vref- is applied to analog input channel then the
result of conversion will be 0 and if voltage equal to Vref+ is applied to the input channel the
result will be 1023 (max value for 10bit ADC).
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 15/40
15
Fig.4.1 ADC Reference Voltage.
The Vref+ and Vref- pins are available in PIN5 and PIN4 of the PIC18F4520 chip. So you can
connect the reference voltage here. For a simple design the Vref- is GND and Vref+ is Vcc. Asthis is such a common configuration that the ADC can be set up to use these reference
internally. Therefore you do not need to connect these on the external Vref pins, so you can
use them for other purpose.
ADC Channels: The ADC module is connected to several channels via a multiplexer. The
multiplexer can connect the input of the ADC to any of the available channels. This allows you
to connect many analog signals to the microcontroller. In PIC18F452 there are 15 analog input
channels, they are named AN0, AN1 etc.
Acquisition Time: When an specific channel is selected the voltage from that input channel isstored in an internal holding capacitor. It takes some time for the capacitor to get fully charged
and become equal to the applied voltage. This time is called acquisition time. The PIC18F452's
ADC provides a programmable acquisition time, so you can setup the acquisition time. Once
acquisition time is over the input channel is disconnected from the source and the conversion
begin. The acquisition times depends on several factor like the source impedance, Vdd of the
system and temperature. A safe value is 2.45uS, so acquisition time must be set to any value
more than this.
ADC Clock: ADC Requires a clock source to do its conversion, this is called ADC Clock. The time
period of the ADC Clock is called TAD. It is also the time required to generate 1 bit of
conversion. The ADC requires 11 TAD to do a 10 bit conversion. It can be derived from the CPU
clock (called TOSC) by dividing it by a suitable division factor. There are Seven possible option.
* 2 x TOSC
* 4 x TOSC
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 16/40
16
* 8 x TOSC
* 16 x TOSC
* 32 x TOSC
* 64 x TOSC
* Internal RC
For Correct A/D Conversion, the A/D conversion clock (TAD) must be as short as possible but
greater than the minimum TAD. It is 0.7uS for PIC18FXXXX device.
We are running at 20MHz in our PIC Development board so we set prescaler of 32 TOSC.
Our FOSC = 20MHz
Therefore our FOSC = 1/20MHz
= 50nS
32 TOSC = 32 x 50 nS
= 1600nS
= 1.6uS
1.6 uS is more than the minimum requirement.
You can calculate the value for division factor using the above example in case you are using
crystal of other frequency. Also now we have the TAD we can calculate the division factor for
acquisition time. Acquisition time can be specified in terms of TAD. It can be set to one of the
following values.
* 20 x TAD
* 16 x TAD
* 12 x TAD
* 8 x TAD
* 6 x TAD
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 17/40
17
* 4 x TAD
* 2 x TAD
* 0 x TAD
As we saw in above paragraph that the safe acquisition time is 2.45uS, so we select 2 x TAD as
acquisition time.
TACQ=2 x TAD
=2 x 1.6uS (Replacing TAD= 1.6uS)
=3.2uS
3.2uS is more than required 2.45uS so its ok.]
The converted binary output data is held by two special function registers called ADRESL(A/D
result low
) and ADRESH(A/D result high).
There are two ADCON registers available in PIC18F242, they are ADCON0 AND ADCON1 . The
ADCON0 is used to set the conversion time and analog input channel. ADCON1 is used to set
the vrefvoltage . The detailed description of both the registers are given below.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 18/40
18
Fig. 4.2. ADCON0 REGISTER
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 19/40
19
Fig 4.3. ADCON1 Register
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 20/40
20
4.2. PROBLEM DEFENITION AND FUNCTIONAL REQUIREMENTS
Figure illustrates the functional requirements in the development of the UPS system. The
designer is confronted with two fundamental problems, namely providing continuous power to
a critical load, such as a PC, and suppressing the effects of disturbances on the power lines
between the supplies and the load.Continuous power flow implies the need for a secondary energy storage device to replace the
utility mains in case the latter fails. Energy taken from the secondary source is replenished from
the mains when the latter is restored. The UPS continues to operate on battery power for the
duration of the backup time or, as the case may be, until the AC-input supply voltage returns to
within the specified tolerances, at which point the UPS returns to its normal mode. Hence, a
power interface is necessary between the AC supply and the back-up source.
These elements have to take into account the types of disturbances that need to be overcome
in the present system from the given specifications. Hence, one fundamental requirement for
this function is the continuous monitoring of current and voltage on the power lines at points
where protection is to be offered by microcontroller.The AC input line is continuously monitored for detecting blackout condition for the facility. The
load is transferred to the battery bank via transfer switch TI as in when the input from AC
source is no longer available. When that happens,the transfer switch must operate to switch
the load over to the battery
backup power source . In case the battery is not sufficiently charged to supply the load during a
mains failure, uncontrolled shutdown will occur to UPS.
Fig 4.4. Monitoring System block diagram
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 21/40
21
Fig. 4.5. Flow Chart of Operations
When an outage had occurs, the select switch within the UPS will isolate the load from the
utility power and switches it to UPS battery as a backup power sources.
As the load been switched to UPS, LM324 indicating circuit will be needed in order to monitor
the power of the UPS battery and also to display the status of the UPS during the operation
.The backup power will provide a sufficient time for user to continue their work before safely
power down the load. When UPS battery had reached the critical value, uncontrolled shutdown
will occur to the load as the battery weakened.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 22/40
22
CHAPTER-5
SALIENT FEATURES OF THE PROJECT
5.1 Introduction- How we proceeded
A 230V ac main supply is the input to the total setup. The 230V ac main supply is given to a 12-
0-12 transformer. The output voltage of the transformer is 24V ac .This 24V is rectified using a
bridge rectifier . The bridge rectifier was made by four P600 diodes . The output of this rectifier
is filtered using 4700pf .The output at this stage is 24V dc . We have two connections from this
point. One connection is o the load and the other is to the battery .
The connection to the load is given through an ic LM7812 and a MOSFET IRF640 switch. The
input to the LM7812 can be from 14V to 35V , but the output will be a constant 12V . We use
this IC to get this constant 12V output . This 12V output is given to the load through the IRF640.
The switch is triggered from the microcontroller . It is triggered on when the input supply
voltage is greater than 16V . So it will switch off when the supply is off .
The connection from the supply to the battery is given through an LM317 . It maintains a 1.25
volt potential difference between the OUT pin and the ADJ pin . This 1.25 is made use of using a
1ohm 5 watt resistor which causes a constant charging current of 1.25 A . When we have to
stop charging the switch is turned on which causes the ADJ pin to be shorted to the ground .
This in turn reverse biases the diode thereby stops charging current . The logic to the switch is
given from the microcontroller . When the battery voltage is more than 12.5V the battery is
overcharged and it should stop charging and so we switch on that particular switch .
There is a connection from the battery to the load which is done through a mosfet IRF640
switch . this switch is also controlled by the microcontroller. This switch is turned on when the
suppy is off and the battery is not in the deep discharge stage . the deep discharge stage is
when the battery goes below 9.8 voltage .
The battery voltage and the supply voltage is constantly monitored by the microcontroller and
the output logic is given to the switches . The microcontroller is powered up from the battery
through LM7805. LM7805 gives a 5V output when the input is between 7V to 35V .
A battery level indicating circuit is connected from the battery . This indicates the battery
charge level . the level is indicated with the help of four LEDS . LM324 is the ic used in this
circuits . the resistors connected to it are such that they show the correct battery stage (among
the four stages).
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 23/40
23
5.2 COMPONENTS USED
5.2.1 LM7805
It is part of the LM78XX series of positive voltage regulators. LM7805 is used to regulate
the input voltage to 5V which is used as the Vcc for the PIC. The typical circuit employedfor this positive regulation is as shown.
5.2.2 LM7812
It serves the same purpose as LM7805 except that the voltage is now regulated to 12V
instead of 5V. The associated circuitry is as shown. One of the prime requirements of all
positive regulators of this series is that the input voltage must be at least 2 -3 V more
than the expected output voltage
Fig.5.1 Internal structure diagram of LM 78XX
5.2.3 IR 2110
IR2110 is a high voltage high speed MOS gated power device driver with independent
high side and low side referenced out channels. The floating channel can be used to
drive a N-channel power MOSFET that operates between high voltage rails.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 24/40
24
Fig 5.2 Internal structure of IR2110
5.2.4 CD4049
CD4049 is an inverting type hex buffers and feature logic level conversion using only one
supply voltage. The input-signal high level can exceed the Vcc supply when used as logic
levels.
Fig. 5.3 Internal structure of CD 4049
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 25/40
25
5.2.5 LM317/117
LM317 is part of the series of 3 terminal adjustable positive voltage regulators. Here it is
used to provide a constant charging current to the battery. This is achieved by utilizing
the constant 1.25V potential difference between the ADJ pin and OUT to cause aconstant 1.25 A charging current
Fig 5.4. Typical connection diagram for LM317/117
5.2.6 LM324
LM324 is a JFET based differential input quad opamp consisting of 4 opamps. The
opamps here are used as comparators
Fig 5.5. Typical connection diagram for LM324
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 26/40
26
5.3 INTERFACING THE MOSFET SWITCHES TO THE MICROCONTROLLERS
5.3.1 POWER MOSFET (IRF640)
The power mosfet in use is the IRF640. It is highly conducive for high current
applications and is used primarily in UPS applications. As a result we decided to stickwith this MOSFET even though our load requirement is pretty small. Another plausible
reason for including this power mosfet is that it showed pretty satisfactory results
during simulation. Upon comparing it with the mosfet 2SJ48, it was observed that the
latter although it can be gated ON using a very low gate voltage, its behavior remains
unchanged when the mosfet is desired to be in OFF state. In any switching circuit clearly
defining the switching levels is of utmost importance. As a result the IRF640 was found
to be more suitable in our experimentation.
5.3.2 NEED FOR A BUFFER AMPLIFIERThe control outputs of the PIC are normally no followed by a buffering stage. This serves
the dual purpose of isolating the output stage of the PIC from the switches and also
safeguards the PIC from surge voltages that are bound to occur across the switches in
lieu of the charging and discharging of the gate source and gate drain capacitances.
Here we use a CD4049 which is a inverting stage hex buffer. It effectively functions in
the circuit as two cascaded NOT gates.
An obvious downside of using such an intermediate stage would be introduction of an
additional delay. However we have compensated for that delay in the control algorithm.
5.3.3 THE MOSFET DRIVER( IR2110)
The introduction of a power MOSFET in our circuit obviously brings in the additional
headache of designing an appropriate driver circuit. This is because the output logic
levels of the PIC are 0-5V which are not enough to cause the MOSFET to switch from the
cut-off to saturation region. Therefore we bring in a high speed high frequency MOS-
gated power device driver IR2110. High speed is desired since intermediate buffer stage
is already accounting for a propagation delay and we don’t want any further increase in
it.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 27/40
27
Fig 5.6 Typical connection diagram of IR2110
Here we need use the high side outputs of the IR2110. A typical connection is shown
above where the high side is that between 7 and 5. The application note was referred
for the capacitor and diode values. The supply for the IC was obtained from the supply
side.
Fig 5.7 High side connection of MOSFET to IR2110
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 28/40
28
5.4 CONSTANT CURRENT BATTERY CHARGING
A constant current supply is switched on and off as required by a micro-controller. The micro-
controller senses the battery voltage and internally uses an analog to digital converter to read
the battery voltage. The micro-controller requires its own 5V regulated supply.
Fig 5.8 Block diagram of constant charging of battery
The microcontroller used here is the PIC18F452. The constant current supply to the battery
while charging is realized using the LM317. This will maintain 1.25V between the OUT pin and
the ADJ pin. We used a large 1ohm, 5W resistor here to ensure a constant 1.25A supplied. You
can select this value as suits your application. The IN5404 diode ensures that the circuit charges
the battery, and prevents the battery running the circuit, should the input power be turned off.
If this does occur with a fully charged pack, the diode isolates the circuit and upon turn on the
charger will find the battery peak again and return to a trickle charge after just a few minutes.
The MOSFET switch is biased on by default, to ensure that the unit is "fail-safe". The PIC can
turn the transistor off by shorting the base to ground, and this allows the LM317 to provide a
regulated, constant current output. The drive current for the PIC is in the order of 1mA which is
within the rated range of the PIC and MOSFET.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 29/40
29
Fig. 5.9 Complete Block diagram
The full circuit is illustrated above. When the charging of the battery is to be stopped the
MOSFET switch is turned ON. This shorts the ADJ to the ground which in turn reverse biases the
diode cutting off the charging current.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 30/40
30
5.5 VOLTAGE ANALYSER CIRCUIT
The battery voltage analyzer circuit is built around the popular quad op-amp LM324 that has
four separate op-amps (A through D) with differential inputs.
Op-amps have been used here as comparators. Switch is a push switch, which is pressedmomentarily to check the battery voltage level before charging the battery.
The non-inverting terminals of op-amps A through D are connected to the positive supply rail
via a potential divider chain comprising resistors R1 through R5. Thus the voltage applied to any
non-inverting input is the ratio of the resistance between that non-inverting terminal and
ground to the total resistance (R1+R2+R3+R4+R5). The resistor chain provides a positive voltage
of above 5V to the non-inverting inputs of all op-amps when battery voltage is 12.5V or more. A
reference voltage of 5V is applied to the inverting inputs of op-amps via 5V zener diode. When
the circuit is connected to the battery and push switch S2 is pressed, the battery voltage is
sampled by the analyzer circuit. If the supply voltage sample applied to the non-inverting input
of an op-amp exceeds the reference voltage applied to the inverting inputs, the output of the
op- amp goes high and the led lights up.
Battery Voltage Status Indication
Battery
Voltage
Red Green Yellow Orange Comments
<9.8v Off Off Off Off Deepdischarge
>9.8v On Off Off Off Danger level
11.5v On On Off Off Low level
12v On On On Off Normal level
12.5v On On On On High level
Table 5.1 Battery status indication
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 31/40
31
Fig 5.10 Connection diagram for voltage analyzing circuit
5.6 VOLTAGE RECTIFICATION
The input voltage which we receive is from the supply mains and it is an ac supply . so we have
to make it dc so that it can be used to charge the the battery . in the first stage we have to
convert the 230V ac to 24V ac . for this we use a 12-0-12 transformer . the current rating of the
transformer is 4A . the output of the transformer is still ac. So we use a rectifier circuit to
convert this ac to dc. We use four P600 diodes and connect it in the bridge rectifier manner in
order to give a rectified output. The output will now have all positive cycles but not a dc . so we
keep a capacitor of suitable value to filter out the ripples and give a dc output. We use a 4700pf
to smooth out the ripple.
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 32/40
32
Fig. 5.11 Rectifying circuit
5.7 PROGRAMMING
In our project the microcontroller controls all the three switches. One switch is from the supply
to load , another from the supply to battery for the purpose of battery charging and the lastone from battery to load to supply the load when the supply is off. we have kept three mosfet
switches. So to drive them or switch it on we have to make that particular bit connected to the
mosfet high or low .so we accept input (analog input from the battery and the supply ) in A0
and A1 pins. this analog signal is converted top digital and the values will be available in ADRESL
and ADRESH.According to the values availablein ADRESL and ADRESH we control the three
switches.
The input to the microcontroller has to be below 5 volt .so we divide the input voltage from the
supply (24V) in 5V range by dividing it by 8 using resistors .This value is given to the A0 pin and
it goes to the ADRESH and ADRESL as digital value . For this action to take place we give the
ADCON0 value to be 10000001 and ADCON1 value to be 11000100 . This means we have
selected A0 pin , conversion clock source as FOSC/64 and right justified.
The voltage from the battery comes in A1. For the conversion of this value we give 10001000 in
ADCON0 and 11000100 for ADCON1 . This means that the input pin is A1 ,conversion clock
source as FOSC/64 and right justified .
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 33/40
33
The switch from supply to load is set such that it opens when the supply voltage goes below a
particular value (16V) .So it works according to the input in PORTA0. PORTB0 is made an output
port and a logic 1 is given if it has to be on and logic 0 if it has to be off.
The switch from supply to battery is set such that it opens when the battery is overcharged ie
its voltage goes beyond 12.5 V .So it works according to the input in PORTA0. PORTD0 is made
as a output port and a logic 1 is given for the switch to be on and logic 0 for the switch to be off.
The switch from the battery to load is switched on or off according to the input from both the
battery and the supply.So it works according to the input in PORTA0 and PORTA1. PORTC0 is
made as an output port and a logic 0 is given for the switch to be off and logic 1 for it to be on .
The program is written in both assembly and c language and are written below .
5.8 PROGRAM
#include<P18F452.h>
#pragma config OSC=HS, OSCS=OFF
#pragma config WDT=OFF
#pragma config DEBUG=OFF, LVP=OFF, STVR=OFF
unsigned char mainline1,mainline2,battery1,battery2;
int open1,i;
void mainline();
void battery();
void DELAY()
{
for(i=0;i<5000;i++)
{;}
}
void main()
{
TRISAbits.TRISA0=1;
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 34/40
34
TRISAbits.TRISA1=1;
TRISB=0;
TRISC=0;
TRISD=0;
PORTB=1;
PORTC=0;
PORTD=1;
while(1)
{
void mainline();
switch(mainline1)
{
case 0x3:
PORTB=1;
open1=1;
break;
case 0x2:
PORTB=1;
open1=1;
break;
case 0x1:
if(mainline2>0x9A)
{
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 35/40
35
PORTB=1;
open1=1;
}
else
{
PORTB=0;
open1=0;
}
break;
default:
PORTB=0;
open1=0;
break;
}
if(open1==0)
{
switch(battery1)
{
case 0x3:
PORTC=1;
break;
case 0x2:
PORTC=1;
break;
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 36/40
36
case 0x1:
if(battery2>0xF6)
{
PORTC=1;
}
else
{
PORTC=0;
}
break;
default:
PORTC=0;
break;
}
}
if(open1==1)
{
switch(battery1)
{
case 0x3:
PORTD=0;
break;
case 0x2:
if(battery2>=0x80)
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 37/40
37
PORTD=0;
else
PORTD=1;
break;
default:
PORTD=1;
break;
}
}
void mainline()
{
int j=0,k=0;
ADCON0=0x81;
ADCON1=0xC4;
DELAY();
ADCON0bits.GO=1;
while(ADCON0bits.DONE==1);
for(i=0;i<200;i++)
for(j=0;j<10;j++);
mainline1=ADRESH;
mainline2=ADRESL;
battery();
}
void battery()
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 38/40
38
{
int j=0,k=0;
ADCON0=0x89;
ADCON1=0xC4;
DELAY();
ADCON0bits.GO=1;
for(i=0;i<200;i++)
for(j=0;j<10;j++);
battery1=ADRESH;
battery2=ADRESL;
mainline();
}
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 39/40
39
CHAPTER-6
CONCLUSIONS
We initially thought working with an NiCd but switched over to lead acid battery as
they are cheaper and methods of charging are better developed in case of lead acid.
Our initial design had a DC-DC converter. This however was not available in the market
forcing us to use the LM7812 instead. Since our load requirements are low this did not
cause much of a problem.
We initially used transistors as switching devices. Even the simulation was completed
using them. However acting on some expert advice which said that BJTs do attract a lot
of problems, we replaced them by MOSFETs.
In the simulation stage itself the MOSFETs refused to turn ON using the 5V output from
the PIC. We then tried to use the ULN2803 IC which is normally used to drive relays.
Using this meant that we could do away with these MOSFET switches as a whole. This
was not to be as the load cannot be isolated and we dropped that idea. Next we tried
the IR2110 MOSFET driver. We used two of them to drive two of our MOSFETs. In both
cases the high side output was used.
The part by part analysis of the circuit was conducted in simulation as well as on a PCB.
The simulation platform used is Proteus 7.7 .The results obtained were satisfactory and
commensurate with the desired results. The code was burned into the microcontroller
and its working tested. The whole circuit was divided into three parts and assembled on
different boards. The charging of the battery and the working of the switches was
observed to be satisfactory. The voltage analyzing circuit ant rectifying circuit worked
perfectly fine.
FUTURE SCOPE:
Our proposed design can be used as the initial stages of a microcontroller based
UPS system. Adding an inverter circuit and conditioning elements would
complete the fabrication of the UPS systems
The visual interfacing can be improved by adding an LCD module to the
proposed circuitry
Other charging schemes can be implemented for charging the battery
Buzzer can be integrated which gives an indication about the over or under
voltage
5/14/2018 Final Report - slidepdf.com
http://slidepdf.com/reader/full/final-report-55a757b896c0c 40/40
40
CHAPTER-7
REFERENCES
1. Nik Mohamad Anis Bin Nik Haron, university Malaysia Pahang ‘Design of a
Micro controller based passive stand by uninterrupted power supply’
2. ‘Power Electronics Converters applications and design’ by Ned Mohan.
Second edition 1989, John wiley and sons.
3. ‘Uninterrupted power supply common topologies’ technical article by K.S
Suresh Kumar, NITC.
4. www.batteryuniversity.com
5. Application note-AN-936 “ the Dos and Don’ts of using HEXFETIII”
6. Application note – AN-967 ”a new gate charge factor “ 7. PIC microcontroller and embedded systems by M.A Mazidi, Pearson
Publications, 2008.
8. www.nationalsemiconductors.org