Sei sulla pagina 1di 38

A MODEL OF MINI 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

by
ANANDJEE SAH (B070470EE)
ARABINDA BHATTACHARJEE (B070338EE)
ARITRA KISHORE DEB ROY (B070610EE)

Under the guidance of


HEMA RANI P

Department of Electrical Engineering

NATIONAL INISTITUTE OF TECHNOLOGY CALICUT

NIT Campus P.O., Calicut - 673601, India


2010

1
CERTIFICATE

This is to certify that the thesis entitled “MINI UPS SYSTEM ” is a bona fide record of the
mini-project done by ANANDJEE SAH (Roll No.B070470EE), ARABINDA
BHATTACHERHEE (Roll No. B070338EE) and ARITRA KISHORE DEB ROY(Roll
No.B070610EE) 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.
If
the
re

HEMA RANI P
(Guide)
Lecturer
Dept. of Electrical Engineering

Dr. PAUL JOSEPH K


Professor & Head
Dept. of Electrical Engineering

Place: NIT CALICUT


Date: 18/05/09

ACKNOWLEDGEMENT

2
First of all we would like to thank our project guide Ms. HEMARANI P. ( Lecturer , Dept.
Of Electrical Engineering) under whose dexterous guidance we are able to do and finish our
project and could come to know more about how an “UPS SYSTEM WORKS” . I would
also like to thank Dr. ASHOK. S (Assistant Professor, Dept. Of Electrical Engineering) who
has handled this whole mini-project for the S6 electrical students. We would also like to
thank our Professor & Head Dr. PAUL JOSEPH K (Dept. Of Electrical Engineering) for his
helpful hands.

We would like to express our gratitude towards MR. FARHAD AHMAD. (B.TECH Dept. Of
Electronics Engineering) who helped us in understanding the function of microcontroller and
the electronics components.

We are also thankful to all our friends who has helped us in the completion of our project.
And last but not the least we would like to thank GOD to create his duplicates in the form of
our parents who have always helped us and without whom everything is worthless.

ANANDJEE SAH
ARITRA KISHORE DEB ROY
ARABINDA BHATTACHERJEE

3
ABSTRACT
The aim of our project is to make a system where the battery will be charged using a rectified
voltage from an AC source ; this battery will take the load instantaneously when the main line
power interruption will occur. Here two types of conversions is taking place AC-DC &DC-
AC. Using rectification circuit ac-dc conversion is taking place .Then we have prepared a
micro-controller controlled inverter circuit where we assembled a full bridge inverter using
four MOS-FET. At any instant only two of them are triggered .This type of system can be
installed in a non-conventional energy generation project too where main line is separated
from the load and from the battery after dc-ac conversion the power is supplied. We have
taken this project keeping in mind how much informative it will be to us as well as it will
give us an opportunity to explore various types of electronic components and how the outputs
can be controlled by transistor switching and what are the various types of probable problems
to be faced. We have tried to develop this project to get the basic knowledge and importance
of the microcontroller in ups system.

INTRODUCTION

4
WHAT IS AN UPS?

An uninterruptible power supply, also uninterruptible power source, UPS or battery backup is
an electrical apparatus that provides emergency power to a load when the input power source,
typically the utility mains, fails. A UPS differs from an auxiliary or emergency power system
or standby generator in that it will provide instantaneous or near-instantaneous protection
from input power interruptions by means of one or more attached batteries and associated
electronic circuitry. The on-battery runtime of most uninterruptible power sources is
relatively short—5–15 minutes being typical for smaller units—but sufficient to allow time to
bring an auxiliary power source on line, or to properly shut down the protected equipment.
While not limited to protecting 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 and/or data loss. UPS units range in size from units designed to protect a single
computer without a video monitor (around 200 VA rating) to large units powering entire data
centers, buildings, or even cities.

PRIMARY ROLE OF AN UPS:

1. Short time power: It provides short-term power when the input power source fails.
However, most UPS units are also capable in varying degrees of correcting common utility
power problems

2. Power failure: Defined as a total loss of input voltage and which can be taken over by the
ups

3.Power quality issues: Different power quality issues , which create problem in the power
supply can be optimized by ups . The names of such issues are given below-

a). Surge: Defined as momentary or sustained increase in the voltage.

b). Sag: defined as a momentary or sustained reduction in input voltage Spikes, defined as a
brief high voltage excursion.

c) Noise: Defined as a high frequency transient or a oscillation, usually injected into the line
by nearby equipment.

d) Frequency instability: Defined as temporary changes in the mains frequency.


e) Harmonic distortion: Defined as a departure from the ideal sinusoidal waveform expected
on the line.

4. Dc power source: Many systems used in telecommunications use 48 V DC power,


because it is not considered a high-voltage by most electrical codes and is exempt from many
safety regulations, such as being installed in conduit and junction boxes. DC has typically
been the dominant power source for telecommunications, and AC has typically been the
dominant source for computers and servers.

5
There has been much experimentation with 48 V DC power for computer servers, in the hope
of reducing the likelihood of failure and the cost of equipment. However, to supply the same
amount of power, the current must be greater than an equivalent 120 V or 240 V circuit, and
greater current requires larger conductors and/or more energy to be lost as heat.

High voltage DC (380 V) is finding use in some data center applications, and allows for small
power conductors, but is subject to the more complex electrical code rules for safe
containment of high voltages.

Most switched-mode power supply (SMPS) power supplies for PCs can handle 325 V DC
(mains voltage * sqrt(2)) directly. Because the first thing most SMPS supplies designed for
AC does is to convert it to DC by rectification. The only catch is that half of the rectifier
stage may be loaded with the full load.

General Idea of our project:


Our project is a small version of an ups system, where we tried to show how a basic ups
system works? What are required component? How the conversions are taking place .The
different steps are given using a flow chart given below.

6
s
q
T
m
0
3
2
A
n
d
fi
ti
R
lw
o
f
e
tt
a
b
t
u
ir
.vc
y
p
z
H
5
V
1
g
h
B
S
ff
D
1.Rectifier circuit
DETAILED DESCRIPTION OF CIRCUIT

The circuit has five parts which are playing the major role .This are very obvious
arrangement when an ups is to be made for a use in the industry, computer power supply,
server power supply, home electricity supply. We have tried to show a model of the basic ups
circuit . The large ups are some modified version of this. The different name of different
parts of the circuit are given below ,then described

2.Battery charging and protection circuit


3.Switching and regulator circuit
4.Inverter circuit
5.Micro-controller based triggering circuit

MAIN CIRCUIT

7
Fig-2.1

1.RECTIFIER CIRCUIT:
Major components:
a) Centre tap transformer (to step down the voltage).
b) Capacitor filter (for ripple free DC).
c) Diodes (for rectification) .
d) Resistors (for current control) .
The role of those components in the circuit are explained and justified in the following
extract.

CENTRE TAP TRANSFORMER


The centre tapped transformers is used here to step down the voltage supply of 230v AC into
a 12-0-12v DC voltage source to feed the circuit. A centre tapped rectifier is used for this
purpose.
In electronics, a center tap is a connection made to a point half way along a winding of a
transformer or inductor, or along the element of a resistor a potentiometer. This permit the
transformation of the amplitude of alternating current (AC) voltages for the purpose of power
conversion.
One of the major applications of the centre tap transformer is rectification using diodes
circuits .The working of the combined effect of the diodes and the transformer are explained
next .

8
RECTIFICATION
Simply defined, rectification is the conversion of alternating current (AC) to direct current
(DC). This involves a device that only allows one-way flow of electrons. The most popular
application of the diode is rectification. As we have seen, this is exactly what a
semiconductor diode does.
If we need to rectify AC power to obtain the full use of both half-cycles of the sine wave, a
different rectifier circuit configuration must be used. Such a circuit is called a full-wave
rectifier.
One kind of full-wave rectifier, called the center-tap design, uses a transformer with a center-
tapped secondary winding and two diodes as:

Fig-2.2

RECTIFIER CIRCUIT OPERATION

Consider the first half-cycle, when the source voltage polarity is positive (+) on top and
negative (-) on bottom. At this time, only the top diode is conducting; the bottom diode is
blocking current, and the load “sees” the first half of the sine wave, positive on top and
negative on bottom. Only the top half of the transformer's secondary winding carries current
during this half-cycle

Fig-2.2.1

9
During the next half-cycle, the AC polarity reverses. Now, the other diode and the other half
of the transformer's secondary winding carry current while the portions of the circuit formerly
carrying current during the last half-cycle sit idle. The load still “sees” half of a sine wave, of
the same polarity as before: positive on top and negative on bottom.

Thus we can see that due to the joint effect of the transformers and diodes the rectification is
successfully done. This rectifier circuit is going to give an input to charge the battery backup
up to a certain point

Fig-2.2.2

CAPACITOR FILTER

This is the most simple form of the filter circuit and in this arrangement a high value
capacitor C is placed directly across the output terminals in order to reduce the ripple
components in the DC output of the filter. During the conduction period it gets charged and
stores up energy to it during non-conduction period. But the discharging time is quite large
(roughly 100 times more than the charging time depending upon the value of R) because it
discharges through load resistance R.Large the value of capacitor C more it offers a low
impedance shunt path to the ac components or ripples but offers high impedance to the dc
component. Thus ripples get bypassed through capacitor C and only dc component flows
through the load resistance R..The working is explained using a series of diagrams:
Capacitor circuit in full wave cycle:

10
Fig-2.3- Rectified waveform without capacitor

Thus the ripple free DC obtained by the arrangement above is fed to the battery through a
resistor which plays an important role in current limiting as the current through the battery
should not exceed the specified limits .Now before connecting the circuit to the battery and
transformer connect it to a variable power supply. Provide 12V DC and adjust VR1 till LED1
glows. After setting the high voltage level, reduce the voltage to 10.5V and adjust VR2 till
the output trips off. After the settings are complete, remove the variable power supply and
connect a fully-charged battery to the terminals and see that LED1 is on. After making all the
adjustments connect the circuit to the battery and transformer. The battery used in the circuit
is a 12V, 4.5Ah UPS battery. Now at the time when the power goes off diodes D1, D3
becomes reverse biased and diode D4 comes into action as it is now forward biased due to the
fully charged battery connected to it

Fig-2.4 rectified out put with capacitor

11
THE BATTERY PROTECTION CIRCUIT

This newly improvised circuit has been introduced in the main circuit just next to the rectifier
circuit in order to create a diversion for the charging current , in case the battery voltage
crosses the maximum permissible limit for charging.
This has been observed that 70% of most of the lead acid cell batteries gets damaged because
of the overcharging of the battery. So in order to commercialize the product we have to resort
to the battery protection circuit.
The lead acid battery, used in the circuit has the following specifications:
Voltage = 12 volts
Ampere hour rating = 7.2 ampere hours
Minimum voltage obtained after full discharge of the battery = 10.5 volts
Maximum permissible voltage limit for charging = 13.5 volts
Total charging current of the battery required for full charging at 20 hours rate =360mA (at
room temperature).
Our main aim is directed towards charging the battery from an under voltage condition of
10.5 volts to the body rating voltage of 12volts (a maximum voltage of 13.5 volts can be
tolerated) and furthermore diverting the charging current of the battery as soon as the battery
voltage crosses the maximum permissible voltage limit of 13.5 volts by grounding away the
charging current through the emitter of the relevant transistor used.

THE MAIN COMPONENTS OF THE BATTERY PROTECTION CIRCUIT


1. TRANSISTOR
a) 2N 3055 (NPN)
b) SL 100 (NPN)

2. ZENER DIODE (with a break down voltage of 6 volts)


3. VARIABLE RESISTOR (10 K Ω)
4. TWO FIXED RESISTORS ( 10 k Ω each)
5. CURRENT LIMITING RESISTOR
R1 = 0.33 Ω, 5watts
R2 = 2 k Ω, 1/4 watts

WORKING OF THE CIRCUIT


The transistor 2N3055 used in the circuit is capable of carrying very high current value of
approximately 1 amperes from the starting. The arrangement is so adjusted that the emitter of
the transistor is directly connected to the positive end of the battery. So during the initial
periods of charging the NPN transistor 2N3055 conducts current to the positive side of the
battery. In the mean time during the initial period of charging the SL100 remains turned off
as its base voltage is so adjusted using the variable resistor. In this way the charging part of
the battery is controlled.
Now when the voltage across the battery crosses the maximum limit of 13.5 volts the
transistor SL100 gets turned on, as the variable resistor is so adjusted to give a voltage of
more than 6 volts across the zener diode. Thus the zener diode reaches its breakdown voltage
sufficient to turn the SL 100 ON after the SL100 gets turned ON the charging current no
more flows through the battery and is grounded through the emitter of the SL 100 circuit.
This can be evident from a LED connected to the ground through the emitter circuit.

12
DESIGN OF THE CIRCUIT
Voltage across the zener diode should be 6 volts ; when voltage across the battery is 13.5
volts

Fig- 2.5 Battery protection circuit

Rx+ R 3
Therefore ( ) ×13.5 V = 6 V
R 4+ R 3+VR 1
(Rx + R3) = {(6 /13.5)×30×103 }Ω
= 0.444KΩ
R1 is made to have a low enough value for allowing sufficient charging current through the
battery but also to provide a protection to the transistor. So a R1 is used of the value
0.33Ω,and of some higher wattage i.e. of 5 watts.
R2 must be a sufficiently high value so as to prevent current through the transistor SL 100
initially. Therefore a corresponding high value of 2 kΩ is sufficient

SWITCHING AND REGULATOR CIRCUIT

Switching is done by a Darlington pair transistor (PNP TIP-127) to prevent the battery from
deep discharging. When the battery voltage or input voltage falls below 10.5V, a cut-off
circuit is used to prevent deep discharging of the battery. Resistor R6, zener diode ZD2
(10.5V) and transistor T4 form the cut-off circuit. When the voltage level is above 10.5V,
transistorT4 conducts and its base becomes negative (as set by R6, VR3 and ZD2).But when
the voltage reduces below 10.5V, the zener diode stops conduction and the base voltage of
transistor T4becomes positive. It goes into the ‘cut-off’ mode and prevents the current in the
output stage. Preset VR3 (22k) adjusts the voltage below 0.6V to make T4 work if the voltage
is above 10.5V.

The Darlington Pair TIP 127

TIP 127 is a PNP Darlington Pair with specification

13
Collector Emitter voltage VCEO -100V

Collector Base voltage VCBO -100V

Base Emitter voltage VBEO -5V

Collector Current (DC) Ic -5A

Collector Dissipation Pc 60W

TIP 127 has two transistors connected together so that the current amplified by the first is
further amplified by the second transistor. It has three leads (B C E) which are equivalent to
the leads of a standard individual transistor. To turn on TIP127 there must be a voltage of
0.7V across both the base-emitter junctions which are connected in series inside the
Darlington pair, therefore it requires 1.4V to turn on. Overall current gain is equal to the two
individual gains multiplied together. When the voltage across the zener diode is 10.5V and
above the base of the T4 becomes negative and it start conducting. When the voltage across
the zener diode is less than 10.5 v the base of the T4 becomes positive and it is cut off . The
value of the variable resistor VR3 is so adjusted that a voltage of 5V appears across the Base
Emitter junction of T4. The transistor R6 is used as the voltage divider so that the Base
Emitter voltage is 5V.

Regulated output: Outputs at points B and C provide 9V and 5V, respectively, through
regulator ICs (IC1 and IC2), while output A provides 12V through the zener diode. The
emergency lamp uses two ultra-bright white LEDs (LED2 and LED3) with current limiting
resistors R5 and R6. The lamp can be manually switched ‘on’ and ‘off’ by S1. the circuit
is assembled on a breadboard. There is adequate space between the components to
avoid overlapping. heat sinks for transistor T4 and regulator ICs (7809 and 7805) to
dissipate heat are used. The positive and negative rails should be strong enough to
handle high current. Before connecting the circuit to the battery and transformer,
connect it to a variable power supply.

INVERTER CIRCUIT

Inverter is basically a DC to AC converter. The circuit we used here is a full bridge inverter
where four MOSFET s are used .Only 2 of them conduct at an instant where other 2 remain
off , the MOSFETs are triggered using micro controller. The waveform of the inverter are
given below

14
Fig-2.6 Inverter wave form

Inverter is a circuit which converts a DC power into AC power at desired output and
frequency. The ac voltage could be fixed at a fixed or variable frequency. Those DC to AC
power converters uses controlled turn ON and turn OFF devices (e.g. BJTs, MOSFETs,
IGBTs, and SCRs) or forced commutator thyristors for this conversions.

Introduction to the inverter circuit of the ups system

In the UPS main circuit the inverter has been acting as a load. Here the load output across the
REGULATOR IC 7809 (i.e. 9 volts) is given to the inverter terminal as its DC source. The
inverter used in the main circuit is a micro controller controlled full wave bridge rectifier.
According to the basis of working, the inverter circuit can be classified as:-
1. A force commutated inverter
This is a forced commutated inverter because input to the inverter is a DC voltage .So we
need external circuit for commutation purpose
2. A bridge inverter.
This is a full wave bridge inverter.
The controlled device which is used for the purpose of conversion here are four MOSFETS
the gating to which is controlled by micro controller programmed to generate a gate input
pulse for the inverter so as to gate two MOSFETS at a time . So conductively they will act as
a full wave bridge rectifier. Here for the purpose of gating we are using diodes which play an
important role in the feedback operation.

Effect of feedback diodes-


Those diodes are generally connected anti parallel to the MOSFETs (or in general to the
controlled devices) ; and they play an important role to feed the load reactive power back to
the DC supply.
When two MOSFET s are initially gated they tends to supply the load voltage; now as soon
as the gating voltage is removed from the two initially gated MOSFETs the feedback diode
comes into play and they causes a reverse bias across the two MOSFETs which were initially
conducting and as a result they cannot conduct any more making it way for the other two
MOSFETs to be gated. This is quite an efficient method to induce the turning OFF of the
MOSFETs. We also have to consider a fact that corresponding to each MOSFET connected

15
in the circuit, there is a feedback diode. So here there are four of them for each of the
MOSFETs.

CLASSIFICATION OF INVERTERS:

The inverters can be broadly classified into two types :

1. Current source inverters (CSI)

This type of inverters is supplied with a controlled current from a DC source of high
impedance. Typically a phase controlled thyristor feeds the inverter with a regulated current
through a large source inductor. Thus the load current instead of load voltage is controlled.

2. Voltage source inverters (VSI)


This type of inverters uses the DC source with negligible impedance. A voltage source
inverter has a stiff DC voltage source at its input terminals. Due to low internal impedance
the terminal voltage of the voltage source inverter always remain constant.
The thyristor inverters can be classified in the following categories :

According to the method of commutation:


a) Line commutated inverters
b) Forced commutated inverters

According to the connections:


a) Series inverters.
b) Parallel inverters.
c) Bridge inverters.

General application of inverter


a) Variable speed AC motor drives
b) Induction heating
c) Aircraft power supplies
d) UPS
e) HVDC lines etc

FULL BRIDGE INVERTER CIRCUIT

16
Fig2.7 Inverter circuit

This circuit represents the microcontroller controlled full wave inverter. As mentioned
previously the circuit is mainly a combination of four MOSFETs and four feedback diodes
and four transistors. Two LED bulbs are used as load to see the inverter output.
The four MOSFETs used in the circuit are :-
1. IRFZ40 N channel MOSFET( Q4 andQ8 )
2. IRF9Z30 P channel MOSFET (Q2 and Q6 )

Basic concept regarding the gating of the MOSFETs


The N channel MOSFETs are initially turned OFF by keeping their gates connected to the
ground and when a high value of positive voltage appears across the gate (i.e the gating
signal) the MOSFETs will be turned ON. Similarly the MOSFETs Q4 and Q8 are P channel
MOSFETs and to initially keep them in an OFF state we have to supply a high value of
voltage across the gate terminal ; as soon as the transistors across each of the MOSFETs are
turned ON by the signal from the port they exposes the GATE terminal to a ground and
owing to this low voltage across the gate the P channel MOSFET will be turned ON.

The microcontroller has been programmed so as to provide output signals at its two ports port
A and port B at regular intervals such that output frequency of the required AC signal is
obtained as 50 Hz. Now looking into the working we could see that the port A is directly
connected to the transistors Q1and point 3. From the point 3, the signal is directly going into

17
another transistorQ3 through a resistor of 33K and similarly port B is connected to the
transistors Q5 and Q7 .
Whenever a gating signal is applied across the transistors Q1through port A it gets turned
ON and the gate of MOSFET Q2 is immediately grounded to turn it ON. Simultaneously the
transistor Q3 which was initially OFF owing to the grounded gate condition, is now turned
ON as the positive voltage of +9 volts appears across it. Thus the mechanism is to gate two
diagonally opposite MOSFETs simultaneously so that the external supply of 9 volts that is
obtained from the output of REGULATOR IC 7809 is directly available to supply the load
voltage.
Similarly the MOSFETs connected to the port B are excited in the next cycle of events to get
the required load voltage across the load. In this phenomenon we will witness a continuously
alternating flickering of the LEDs. Whenever port A is signaled by the microcontroller device
current flows in the direction of A-R1-Q1-R3-Q2-R13-LED1-Q4-R5-Q3-R6 and the LED1
glows.
In the next moment the gating circuit is removed from the terminals across Q1 and Q3 and
then the diodes D1 and D2 comes into play by feed backing the loads reactive power back to
the DC supply and hence reverse biases the MOSFET in order to ensure the successful
turning OFF of the MOSFETs. Hence the next pair of MOSFETs are immediately turned ON
due to signals received on port B , simultaneously MOSFETs Q6 and Q8 are turned ON and
current flows in the direction B-R7-Q5-R9-Q6-LED2-R13-Q4-R12 to the ground. In this case
diodes D3 and D4 reverse biases the MOSFETs Q6 and Q8 and makes the circuit suitable for
next triggering.
The positive and the negative terminals of the input for the inverter operation are being
connected to a common terminal and its supply is taken from the outputs of the
REGULATOR IC ( i.e +9 volts) and the ground in order to witness the AC operation using
the LEDs.

PROGRAMME CODE OF MICRO-CONTROLLER-

The programming is done in C language . The microcontroller is an 8-bit processor .There


are 4 ports. A,B,C,D each of them are having 8 pins . Each port are having 3 register- DDR,
PORT, PIN.
DDR- This will define whether the pin is for input or for output. The programming language
is given below

/*----------------------------------------------------------------
-----------------HEADER FILES-------------------------------------
-----------------------------------------------------------------*/

#include<avr/io.h> //HEADER FILE FOR AVR INPUT OUTPUT


#include <stdlib.h>
#include <avr/pgmspace.h>
#include <compat/deprecated.h> //HEADER FILE FOR FUNCTIONS LIKE SBI AND
CBI
#include<util/delay.h> //HEADER FILE FOR DELAY
#include "lcd.c"
#include "lcd.h"

18
/*----------------------------------------------------------------
-----------------MAIN PROGRAM-------------------------------------
-----------------------------------------------------------------*/

int main(void)
{
lcd_init(LCD_DISP_ON);
DDRA=0xFF; //SET DATA DIRECTION REGISTER
DDRB=0XFB; //SET 1 for OUTPUT PORT
DDRD=0XF1; //SET 0 FOR INPUT PORT

sbi(PORTB,2); //ENABLE PULL UP FOR SWITCH INT2


sbi(PORTD,1); //ENABLE PULL UP FOR SW1
sbi(PORTD,2); //ENABLE PULL UP FOR SWITCH INT0
sbi(PORTD,3); //ENABLE PULL UP FOR SWITCH INT1

double TP,freq;
char arr1[5], arr2[5];

TP=200.00;
lcd_clrscr(); // clear display and home cursor
lcd_puts("TP Freq");
cbi(PORTA,0);
cbi(PORTA,1);

while(1) //START INFINITE LOOP TO SCAN INPUT FROM PORT


{
sbi(PORTA,0);
_delay_ms(T/2);
cbi(PORTA,0);
sbi(PORTA,1);
_delay_ms(T/2);
cbi(PORTA,1);

if (bit_is_clear(PINB,2)) //IF INT2 IS PRESSED


{
sbi(PORTA,4); //LED1 ON
if (TP<4000.00)
TP++;
}
else //ELSE
cbi(PORTA,4); //LED1 OFF

if (bit_is_clear(PIND,1)) //IF SW1 IS PRESSED


{
sbi(PORTA,5); //LED2 ON
if (TP>0.000)
TP--;

19
}
else //ELSE
cbi(PORTA,5); //LED2 OFF

freq=1/TP*1000;
itoa ((int)TP,arr1,10);
itoa ((int)freq,arr2,10);
lcd_gotoxy(0,1);
lcd_puts(arr1);
lcd_puts(" ");
lcd_puts(arr2);
}

return(0);
}

Explanation-
0X- is prefix for the c compiler to inform it that number is hexa-decimal number.
sbi- set bit of pin of different port.
cbi- clear the bit
TP- time period .Increasing with this the frequency will decrease.
arr x – command is used here for LCD display in the defined array
#include<util/delay.h>- it’s a predefined delay header file where delayed function is written
1- for setting pin high
0- for setting pin low

20
COMPONENTS USED:

1. Transformer: 230 volt ac to 12 ac step down transformer center tap with 1 amps current
rating.
2. Diodes: IN 4007 diodes are used for rectification , freewheeling action and in battery
charging circuit.
3. Zener Diodes: zener diode are used in battery charging circuit for switching the base of
the transistor besides this to control the voltage out put it is utilized.
Zd1- 6.2 volt ½ watt.
Zd2- 10 volt ½ watt.
Zd3- 12 volt 1 watt.
all the zener diodes were connected in reversed bias .The ratings mentioned above is
corresponding to the reversed break down voltage.
Figure of zener diode characteristics:

Fig3.1

4. Regulator IC:
The KA78XX/KA78XXA series of three-terminal positive Regulator are available in the TO-
220/D-PAK package and with several fixed output voltages, making them useful in a wide

21
range of applications. Each type employs internal current limiting, thermal shut down and
safe operating area protection, making it essentially indestructible. If adequate sinking is
provided, they can deliver over 1A output current. Although designed primarily as fixed
voltage regulators, these devices can be used with external components to obtain adjustable
voltages and currents.
IC used - 1.7809 for 9 volt.
2. 7805 for 5 volt.
5. Capacitor: 470 μF, 250 volt to obtain the ripple free dc voltage.
6. Variable resistance: Vr1-10k, Vr2- 10k, Vr3- 22k.
7. Resistance:
R1- 0.33 Ω 5 watt
R2- 2k Ω 0.5 watt
R3- 10kΩ 0.5 watt
R2- 9kΩ 0.5 watt
R4- 1kΩ 1 watt
R5- 9kΩ 1 watt
R6-1kΩ 1 watt
R7- 47Ω 1 watt
R8 & R9- 390Ω 1watt
8. Transistor:
T1- 2N 3055
T2- SL 100
T3- BC 548
T4-TIP 127 (it is a Darlington pair transistor which is working here as a switching regulator)
Q1>Q7>Q5>Q3- 2N 094
Q2>Q4>Q8>Q6- IRF 4230
9. Micro-controller –
Atmel 8-bit Microcontroller with 32K Bytes In-System Programmable Flash
FEATURES:
• High-performance, Low-power AVR® 8-bit Microcontroller
• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• High Endurance Non-volatile Memory segments
– 32K Bytes of In-System Self-programmable Flash program memory
– 1024 Bytes EEPROM
– 2K Byte Internal SRAM
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM

22
– Data retention: 20 years at 85°C/100 years at 25°C
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– Programming Lock for Software Security
• JTAG (IEEE std. 1149.1 Compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– One 16-bit Timer/Counter with Separate Rescale, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Four PWM Channels
– 8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels in TQFP Package Only
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby
• I/O and Packages
– 32 Programmable I/O Lines
– 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF
• Operating Voltages
– 2.7 - 5.5V for ATmega32L
– 4.5 - 5.5V for ATmega32
• Speed Grades
– 0 - 8 MHz for ATmega32L
– 0 - 16 MHz for ATmega32
• Power Consumption at 1 MHz, 3V, 25°C for ATmega32L
– Active: 1.1 mA
– Idle Mode: 0.35 mA
– Power-down Mode: < 1 μA

23
PIN DIAGRAM:

Fig. 3.2

Pin Descriptions
VCC: Digital supply voltage.
GND: Ground.
Port A (PA7-PA0): Port A serves as the analog inputs to the A/D Converter. Port A also
serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can
provide internal pull-up resistors (selected for each bit). The Port A output buffers have
symmetrical drive characteristics with both high sink and source capability. When pins PA0
to PA7 are used as inputs and are externally pulled low, they will source current if the
internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition
becomes active, even if the clock is not running.
Port B (PB7..PB0): Port B is an 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The Port B output buffers have symmetrical drive characteristics with
both high sink and source capability. As inputs, Port B pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset
condition becomes active, even if the clock is not running.Port B also serves the functions of
various special features of the ATmega32 as listed on .
Port C (PC7..PC0): Port C is an 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The Port C output buffers have symmetrical drive characteristics with
both high sink and source capability. As inputs, Port C pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset
condition becomes active, even if the clock is not running. If the JTAG interface is enabled,
the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a
reset occurs. The TD0 pin is tri-stated unless TAP states that shift out data are entered. Port C
also serves the functions of the JTAG interface and other special features of the ATmega32
as listed on
Port D (PD7..PD0): Port D is an 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The Port D output buffers have symmetrical drive characteristics with
both high sink and source capability. As inputs, Port D pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset
condition becomes active, even if the clock is not running. Port D also serves the functions of
various special features of the ATmega32 as listed on

24
RESET :Reset Input. A low level on this pin for longer than the minimum pulse length will
generate a reset, even if the clock is not running. The minimum pulse length is given in
Shorter pulses are not guaranteed to generate a reset.
XTAL1 :Input to the inverting Oscillator amplifier and input to the internal clock operating
circuit.
XTAL2 :Output from the inverting Oscillator amplifier.
AVCC :AVCC is the supply voltage pin for Port A and the A/D Converter. It should be
externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be
connected to VCC through a low-pass filter.
AREF :AREF is the analog reference pin for the A/D Converter.
About Code Examples:
This documentation contains simple code examples that briefly show how to use various
parts of the device. These code examples assume that the part specific header file is included
before compilation. Be aware that not all C Compiler vendors include bit definitions in the
header files and interrupt handling in C is compiler dependent. Please confirm with the C
Compiler documentation for more details.
External Reset: An External Reset is generated by a low level on the RESET pin. Reset
pulses longer than the minimum pulse width will generate a reset, even if the clock is not
running. Shorter pulses are not guaranteed to generate a reset. When the applied signal
reaches the Reset Threshold Voltage – VRST – on its positive edge, the delay counter starts
the MCU after the Time-out period TOUT has expired.
Status Register The Status Register contains information about the result of the most
recently executed arithmetic instruction. This information can be used for altering program
flow in order to perform conditional operations. Note that the Status Register is updated after
all ALU operations, as specified in the Instruction Set Reference. This will in many cases
remove the need for using the dedicated compare instructions, resulting in faster and more
compact code. The Status Register is not automatically stored when entering an interrupt
routine and restored when returning from an interrupt. This must be handled by software. The
AVR Status Register – SREG – is defined as

Fig 3.3

• Bit 7 – I: Global Interrupt Enable


The Global Interrupt Enable bit must be set for the interrupts to be enabled. The individual
interrupt enable control is then performed in separate control registers. If the Global Interrupt
Enable Register is cleared, none of the interrupts are enabled independent of the individual
interrupt enable settings. The I-bit is cleared by hardware after an interrupt has occurred, and
is set by the RETI instruction to enable subsequent interrupts. The I-bit can also be set and
cleared by the application with the SEI and CLI instructions, as described in the instruction
set reference.
• Bit 6 – T: Bit Copy Storage
The Bit Copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source or
destination for the operated bit. A bit from a register in the Register File can be copied into T
by the BST instruction, and a bit in T can be copied into a bit in a register in the Register File
by the BLD instruction.

25
• Bit 5 – H: Half Carry Flag
The Half Carry Flag H indicates a half carry in some arithmetic operations. Half Carry is
useful in BCD arithmetic. See the “Instruction Set Description” for detailed information.
• Bit 4 – S: Sign Bit, S = N ⊕ V
The S-bit is always an exclusive or between the Negative Flag N and the Two’s Complement
Overflow Flag V. See the “Instruction Set Description” for detailed information.
• Bit 3 – V: Two’s Complement Overflow Flag
The Two’s Complement Overflow Flag V supports two’s complement arithmetic’s. See the
“Instruction Set Description” for detailed information.
• Bit 2 – N: Negative Flag
The Negative Flag N indicates a negative result in an arithmetic or logic operation. See the
“Instruction Set Description” for detailed information.
• Bit 1 – Z: Zero Flag: The Zero Flag Z indicates a zero result in an arithmetic or logic
operation. See the “Instruction Set Description” for detailed information.
• Bit 0 – C: Carry Flag: The Carry Flag C indicates a carry in an arithmetic or logic
operation. See the “Instruction Set Description” for detailed information.
General Purpose Register File:The Register File is optimized for the AVR Enhanced RISC
instruction set. In order to achieve the required performance and flexibility, the following
input/output schemes are supported by the Register File:
• One 8-bit output operand and one 8-bit result input
• Two 8-bit output operands and one 8-bit result input
• Two 8-bit output operands and one 16-bit result input
• One 16-bit output operand and one 16-bit result input

Fig 3.4

Most of the instructions operating on the Register File have direct access to all registers, and
most of them are single cycle instructions. As shown in figure each register is also assigned a
data memory address, mapping them directly into the first 32 locations of the user Data
Space. Although not being physically implemented as SRAM locations, this memory
organization provides great flexibility in access of the registers, as the X-, Y-, and Z-pointer
Registers can be set to index any register in the file

26
The X-register, Y register and Z-register
The registers R26..R31 have some added functions to their general purpose usage. These
registers are 16-bit address pointers for indirect addressing of the Data Space. The three
indirect address registers X, Y, and Z are defined as described in Figure 5. The X-, Y-, and Z-
registers

Figure- 3.5

Stack Pointer The Stack is mainly used for storing temporary data, for storing local variables
and for storing return addresses after interrupts and subroutine calls. The Stack Pointer
Register always points to the top of the Stack. Note that the Stack is implemented as growing
from higher memory locations to lower memory locations. This implies that a Stack PUSH
command decreases the Stack Pointer. The Stack Pointer points to the data SRAM Stack area
where the Subroutine and Interrupt Stacks are located. This Stack space in the data SRAM
must be defined by the program before any subroutine calls are executed or interrupts are
enabled. The Stack Pointer must be set to point above $60. The Stack Pointer is decremented
by one when data is pushed onto the Stack with the PUSH instruction, and it is decremented
by two when the return address is pushed onto the Stack with subroutine call or interrupt. The
Stack Pointer is incremented by one when data is popped from the Stack with the POP
instruction, and it is incremented by two when data is popped from the Stack with return from
subroutine RET or return from interrupt RETI. The AVR Stack Pointer is implemented as
two 8-bit registers in the I/O space. The number of bits actually used is implementation
dependent. Note that the data space in some implementations of the AVR architecture is so
small that only SPL is needed. In this case, the SPH Register will not be present.

Fig-3.6

5.Mosfet- This voltage control switching are used in the inverter circuit to convert the
voltage from ac-dc P channel mosfet is connected in the circuit which turn on only when it’s
base voltage is made zero.

27
COMPLETE DIAGRAM OF THE CIRCUIT

Fig 4.1

28
OVERRALL WORKING OF THE CIRCUIT

A standard step-down transformer provides 12V of AC, which is rectified by diodes D1 and
D2. Capacitor C1 provides ripple-free DC to charge the battery and to the remaining circuit.
When the main power is on, diode D3 gets forward biased to charge the battery. Resistor R1
limits the charging current. Potentiometer VR2 (10k) with transistor T3 acts as the voltage
comparator to indicate the voltage level. VR2 is so adjusted that LED1 is in the ‘off’ mode.
When the battery is fully charged, LED1 glows indicating a full voltage level of 12V.
When the mains power fails, diode D3 gets reverse biased and D4 gets forward biased so that
the battery can automatically take up the load without any delay. When the battery voltage or
input voltage falls below 10.5V, a cut-off circuit is used to prevent deep discharging of the
battery. Resistor R5, zener diode ZD2 (10.5V) and transistor T4 form the cut-off circuit.
When the voltage level is above 10.5V, transistor T4 conducts and its base becomes negative
(as set by R6, VR3 and ZD2). But when the voltage reduces below 10.5V, the zener diode
stops conduction and the base voltage of transistor T4 becomes positive. It goes into the ‘cut-
off’ mode and prevents the current in the output stage. Preset VR3 (22k) adjusts the voltage
below 0.6V to make T4 work if the voltage is above 10.5V.
When power from the main is available, all output voltages—12V, 9V and 5V—are ready to
run the load. On the other hand, when the mains power is down, output voltages can run the
load only when the battery is fully charged (as indicated by LED1). For the partially charged
battery, only 9V and 5V are available. Also, no output is available when the voltage goes
below 10.5V. If battery voltage varies between 10.5V and 13V, output at terminal A may also
vary between 10.5V and 12V, when the UPS system is in battery mode.
Outputs at points B and C provide 9V and 5V, respectively, through regulator ICs (IC1 and
IC2), while output A provides 12V through the zener diode (12V, 1W). The emergency lamp
uses two ultra-bright white LEDs (LED2 and LED3) with current limiting resistors R5 and
R6. The lamp can be manually switched ‘on’ and ‘off’ by S1.
The circuit is assembled on a BREAD BOARD. There is adequate space between the
components to avoid overlapping. heat sinks for transistor T2 and regulator ICs (7809
and7805) to dissipate heat are used.

29
The positive and negative rails should be strong enough to handle high current. Before
connecting the circuit to the battery and transformer, we have connected it to a variable
power supply provided with 12V DC and VR2 is adjusted till LED1 glows. After setting the
high voltage level, the voltage is reduced to 10.5V and adjusts VR3 till the output trips off.
After the settings are complete, remove the variable power supply and connect a fully-
charged battery to the terminals and see that LED2 is on. After making all the adjustments
connect the circuit to the battery and transformer. The battery used in the circuit is a 12V,
7.2Ah UPS battery.
A circuit has been set so that when the battery has been charged to 13.V, the charging circuit
disconnects. The components (R2, R3, R4, T2, ZD1, and T2) form this cut off circuit. The
LED4 showing the voltage level of battery as 13.5V otherwise the LED4 remains off.
The inverter is connected as the load across the +9 v battery.

30
WAVEFORMS

Fig 4.1 -waveform of inverter output

Fig 4.2- waveform of rectifier output

31
CONCLUSION

The output at the loads point A, B, C is measured to be 11.988V, 8.98V, 4.98V respectively
which are near to the desired value i.e. 12V, 9V, 5V. The drop in the voltages is due to the
resistance of the circuit. The input to the circuit is a 230V, 50Hz AC supply.

This output was successfully implemented by connecting a load which is an inverter circuit in
our case. The inverter circuit was designed to take an input of 12V and convert it to a voltage
of 230V AC at 50Hz .the inverter circuit is a full bridge inverter.

Though care has been taken to minimize the spikes in the output by connecting a capacitor of
value (470u, 25V) in the circuit but there were spikes as it is not possible to get a spike less
output by an analog elements .the spike less output can be obtained by using digital device.
This was verified by using oscillograph.

The current in the circuit was maintained at value quiet lower than the maximum ratings
device so that each device works at their normal operating condition.
Heat sinks are used for the transistors (TIP 127, SL 100) and regulator IC (7809, 7805) so
that their thermal limit is not reached and they work under a value quiet lower than their
maximum thermal resistance value.
Power transistor 2N3055 is used to get better output and better current for charging the
battery.

The circuit was assembled on a bread board which can be easily assembled in the normal
PCB and can be used for domestic purposes.LEDs are used to indicate the load which can be
easily replaced by a normal load of relevant value.

The battery used is of rating 12V, 7.2Ah and it require about 320mA of current for normal
charging which was successfully supplied by the charging circuit. Measures have been taken
to minimize the overcharging of the battery by using current deviating circuit with elements
(2N3055, SL100, 10K pot). The data sheet of each components has been attached to get the
idea of their maximum tolerance.

32
BIBLIOGRAPHY

Electronic Devices and Circuit Theory by Robert L.Boylestad / Louis Nashelsky

The 8051 Microcontroller and Embedded Systems by Muhammed Ali Mazidi / Janice
Gillispie Mazidi / Rolin . McKinlay

Power Electronics by M D Singh and K B Khanchandani

http://www.electronicforu.com

http://www.datasheet4u .com/share-search.phpsword=SL100

http://www.datasheet4u .com/share-search.phpsword=TIP127

http://www.datasheet4u .com/share-search.phpsword=BC548

http://www.datasheet4u .com/share-search.phpsword=2N3055

http://kazus.info/datasheet/img/584841.gif

http://kazus.info/datasheet/img/584842.gif

33
DATA SHEET

34
35
36
37
38

Potrebbero piacerti anche