Documente Academic
Documente Profesional
Documente Cultură
DISTRIBUTION TRANSFORMER
MUDASSAR KHALID
YASIR ARAFAT
December 2014
Department of Electrical Engineering
PROJECT REPORT
PROJECT ID
TITLE
NUMBER OF
MEMBERS
40
SUPERVISOR NAME
TRN
MEMBER NAME
MUDASSAR KHALID
YASIR ARAFAT
Y
REG. NO.
EMAIL ADDRESS
BTE-SP11-039
mudassarkhalid266@gmail.com
b
BTE-SP11-087
yasiarafat1138@gmail.com
CHECKLIST:
Number of pages in this report
I/We have enclosed the soft-copy of this document along-with the
codes and scripts created by myself/ourselves
YES / NO
YES / NO
I/We confirm to state that this project is free from any type of
plagiarism and misuse of copyrighted material
YES / NO
MEMBERS SIGNATURES
Supervisors Signature
Date
External Examiner:
Head of Department:
Declaration
No portion of the work referred to in the dissertation has been submitted in support of an
application for another degree or qualification of this or any other university/institute or
other institution of learning.
MEMBERS SIGNATURES
ii
Acknowledgements
It is usual to thank those individuals who have provided particularly useful assistance, technical or otherwise, during your project.
Your supervisor will obviously be pleased to be acknowledged as he or she will have invested quite a lot of time overseeing your
progress.
iii
Abstract
Transformers have an important role in distribution system. Monitoring of transformer before any faults occur is very necessary
and this process prevent us from a big loss. Currently used systems are able to provide information about the state of transformer
but either they are offline or very expensive. Transformer is a very expensive device so we have to care about it. This project is
about the design and implementation of hardware to monitor the useful parameters like ambient temperature, load currents, over
voltage and oil level of distribution transformer. This project aim is to establish low cost solution for monitoring health condition of
remotely located distribution transformers using GSM technology. An Embedded module is design to get data from electrical
sensing system. The idea of on-line monitoring system is made up of a global service mobile (GSM) Modem, with a PIC
microcontroller and different sensors. All this hardware is installed at the distribution site. The above defined parameters are
recorded and processed if we find any abnormality then an emergency situation occur and an sms(short message service for mobile)
is sent to the mobile engineer to take the notice of this situation.
iv
Table of Contents
1
INTRODUCTION...............................................................................................................................1
1.1
OVERVIEW....................................................................................................................................1
1.2
PROJECT SCOPE............................................................................................................................1
1.3
MOTIVATION.................................................................................................................................1
1.4
PROBLEM STATEMENT...................................................................................................................2
LITERATURE REVIEW...................................................................................................................3
2.1
MICROCONTROLLER.....................................................................................................................3
2.1.1
Pin Description........................................................................................................................3
2.1.2
Crystal Oscillator....................................................................................................................6
2.1.3
Reset........................................................................................................................................7
2.2
2.3
GSM MODULE..............................................................................................................................8
2.3.1
SIM900D.................................................................................................................................8
2.3.2
2.3.3
Serial Communication...........................................................................................................10
2.4
TRANSFORMER............................................................................................................................10
2.4.1
Definition of Transformer......................................................................................................11
2.4.2
Working Principle..................................................................................................................11
2.4.3
Types of Transformer.............................................................................................................12
2.4.4
2.5
SENSORS.....................................................................................................................................14
2.5.1
2.5.2
2.5.3
2.5.3.1 Features.................................................................................................................................16
2.5.3.2 Application............................................................................................................................16
2.5.3.4 Importance of LM35..............................................................................................................16
2.6
3
HARDWARE DESCRIPTION........................................................................................................19
3.1
MICROCONTROLLER INTERFACING.............................................................................................19
3.2
TRANSFORMER............................................................................................................................20
3.3
PT SENSOR.................................................................................................................................21
3.4
CT SENSOR.................................................................................................................................21
3.5
TEMPERATURE SENSOR...............................................................................................................22
3.6
3.7
3.7.1
POWER SUPPLY...........................................................................................................................24
Voltage Regulator (7805)......................................................................................................25
3.8
MAX 232...................................................................................................................................25
3.9
RELAY.........................................................................................................................................27
FLOW CHART.................................................................................................................................28
REFERENCES..........................................................................................................................................29
APPENDIX A: HDL OR C SOURCE CODE.........................................................................................31
APPENDIX B: HARDWARE SCHEMATICS.......................................................................................32
APPENDIX C: LIST OF COMPONENTS.............................................................................................33
APPENDIX D: PROJECT TIMELINE...................................................................................................34
vi
Table of Figures
FIGURE 2-1 AN EXAMPLE OF INSERTING FIGURE INTO YOUR PROJECT ERROR! BOOKMARK NOT DEFINED.
FIGURE 3-1 FUNCTIONAL REQUIREMENTS NUMBERING.......................ERROR! BOOKMARK NOT DEFINED.
FIGURE 4-1 EXAMPLE FIGURE FOR PROTOTYPE APPLICATION.............ERROR! BOOKMARK NOT DEFINED.
FIGURE 4-2 ARCHITECTURE OVERVIEW DIAGRAM...............................ERROR! BOOKMARK NOT DEFINED.
FIGURE 5-1 EXAMPLE FIGURE FOR USER INTERFACE...........................ERROR! BOOKMARK NOT DEFINED.
vii
1 Introduction
In power systems, distribution transformer is an essential electrical equipment which distributes
power to the low-voltage users. Therefore, proper operation of distribution transformer is very
important for efficient power distribution. The life time of DT can be increased by operating it
under rated conditions. The performance of distribution transformer is severely affected if it is
subjected to any abnormalities such as over loading, reduced oil-level etc. The electric power
deficiency and various malpractices followed in Pakistan has lead to frequent power failures
among which distribution transformer over loading is main issue [10] . Although several
monitoring systems are used by electric utility companies, however, they are not efficient.
Therefore, real time monitoring of distribution transformer is a crucial task for reliable
operation of power system [1]. The status of distribution transformer is then transmitted to
control centre for necessary actions.
1.1 Overview
Distribution Transformer is the main equipment in the power system. The main purpose of this
project is real time monitoring of distribution Transformer. Real time monitoring of distribution
transformer is performed by deploying sensors which continuously examine the parameters such
as over voltage, oil-level etc. The monitored data from distribution transformer is processed by
microcontroller module which further transmits this data to the GSM module located at control
centre. On the basis of received of received data, the abnormalities in voltage, current and
temperature overcome by the central control system by performing necessary action against the
abnormality.
1.3 Motivation
The traditional electric power system has proved to be incompetent. Therefore, there is a strong
need to upgrade the out dated electric power system with an efficient power network. In this
prospective, sensors and communication infrastructure can enhance the efficiency of traditional
power systems, by deployment of sensors at various stage of power system [1]. Since
distribution transformer is an expensive part of the power system, effort is required to enhance
the reliability and long life operation of distribution transformer [2]. This project provides a
1
solution to over loading and over voltage issues frequently countered in distribution transformer
by utilizing temperature and voltage sensors. The acquired data from the sensors is forward to
the central system where decisions are made to overcome abnormality [3][4].
2 Literature Review
This chapter provides a literature review of different modules utilized in this project.
2.1 Microcontroller
A microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on a single
integrated circuit containing a processor core, memory, and programmable input and
output peripherals [5][6]. There are many families of the microcontroller such as PIC, AVR and
8051 each having different features and specifications. In this project PIC18f452 is used the
microcontroller key features of PIC18f452 are following:
5 I/O ports A,B,C,D and E in which A port has 6 pins, B, C and D have 8 pins and
E port has 3 pins.
40-pin DIP.
Pin-2: The name of this pin is RA0/AN0. Its basic functions are Input/output or
analog input 0.
Pin-3: This pin is called as RA1/AN1. Functionality of it is digital I/O, analog input
1
Pin-4: This pin is known as RA2/AN2, Vref-. Its basic functions are digital I/O,
analog input 2, A/D reference voltage (Low) input.
Pin-5: This pin known as RA3/AN3, Vref+. Functionality of this pin is digital I/O,
analog input 3 A/D reference voltage (high) input [14].
Pin-6: This pin is called as RA4/T0CKI. Basic function of this pin is as digital I/O,
open drain when configured as output and timer0 external clock input.
Pin-7: This pin is known as RA5/AN4/SS/LVDIN. Its functions are digital I/O,
analog input4 [15].
Port B:
It is 8-pin bidirectional port. PORTB can be software programmed for internal weak pull-ups on
all inputs. The resources of this port are Interrupts and Alt CCP2. The pin description of this
port is given below:
Pin-33: This pin is known as RB0/INT0. Functionality of this pin is digital I/O and external
interrupt 0.
Pin-34: It is called as RB1/INT1. Its basic function is external interrupt 1.
Pin-35: this pin is known as RB2/INT2. Its functionality is described as digital I/O, external
interrupt 2.
Pin-36: This pin is called as RB3/CCP2. Its functions are digital I/O, capture2 input, Compare2
output and PWM2 output.
Pin-37: This pin is denoted as RB4. Its basic functionality is Digital I/O, interrupt-on-change
pin.
Pin-38: This pin is known as RB5/PGM. Its functions are digital I/O, Interrupt-on-change pin.
Pin-39: This pin is called as RB6/PGC. Its functions are digital I/O, interrupt-on-change pin.
Pin-40: The name of this pin is RB7/PGD. Its functions are digital I/O, Interrupt-on-change pin,
in-circuit debugger and ICSP programming data pin.
Port C:
It is an 8 pin bidirectional port. Its resources are capture compares timers 1-3, SPI, I 2 C, and
UART, the pin description of this port is given below:
Pin-15: This pin is known as RC0/T1OSO/T1CKI. Its functions are digital I/O, timer1 oscillator
output and Timer1/Timer3 external clock input.
Pin-16: we can call this pin as RC1/T1OSI/CCP2. Its basic functionality is digital I/O, timer1
oscillator input, capture2 input, compare2 output, and PWM2 output.
Pin-17: This pin is called as RC2/CCP1. its functions are digital I/O, capture1 input/compare1
and output/PWM1 output.
Pin-18: This pin known as RC3/SCK/SCL. Its basic functions are digital I/O, synchronous
serial clock input/output for SPI mode and synchronous serial clock input/output for I 2 C mode.
Pin-23: This pin is called as RC4/SDI/SDA. Its functions are digital I/O, SPI Data In and I 2 C
Data I/O.
Pin-24: we can call this pin as RC5/SDO. Its basic functions are digital I/O and SPI Data Out.
Pin-25: This pin is denoted as RC6/TX/CK. Its functions are digital I/O, USART asynchronous
transmit and USART synchronous clock [16].
Pin-26: The name of this pin is RC7/RX/DT. Its functions are digital I/O, USART asynchronous
receive and USART synchronous data.
Port D:
It is 8 pin bi-directional I/O port, or a Parallel Slave Port (PSP) for interfacing to a
microprocessor port. These pins have TTL input buffers when PSP module is enabled, the pin
description of this port are given below:
Pin-19: This pin is called as RD0/PSP0.
Pin-20: This pin is known as RD1/PSP1.
Pin-21: This pin is denotes as RD2/PSP2.
Pin-22: This pin is called as RD3/PSP3.
Pin-27: This pin is known as RD4/PSP4.
Pin-28: This pin is denotes as RD5/PSP5.
Pin-29: This pin is called as RD6/PSP6.
5
Figure: 2.2
[5]
2.1.3 Reset
External power-on reset circuit is required only if the V DD power-up slope is too slow. The
circuitry for operation of reset is pin1 as shown in figure (2.1). The diode D helps to discharge
the capacitor quickly when VDD power is down, R < 40 k is recommended to make sure that
the voltage drop across R does not violate the devices electrical specification [6]. Moreover, R1
should be from 100 to 1 k will limit any current flowing into MCLR from external capacitor
6
C, in the event of MCLR/VPP pin breakdown due to electrostatic discharge (ESD) or electrical
overstress (EOS).
Figure: 2. 3 [5]
Minimum Interference.
Encryption procedures utilized gives high security as a part of the air Interface and also
use of SIM.
Emergency calls
These are different variants of GSM standards which are listed below [7]:
1. GSM 900:
Uplink is from 890 to 915 MHz [8]
Downlink is from 935 to 960 MHz
2. GSM 1800:
Uplink is from 1710 to 1785 MHz
Downlink is from 1805 to 1880 MHz
3. GSM 1900:
Uplink is from 1850 to 1909 MHz
Downlink is from 1930 to 1989 MHz
For GSM services this project utilized GSM module. The discussion of GSM module is given
below.
2.3.1 SIM900D
Simultaneous communication (SIMCom) provides an ultra-compact in addition to reliable
wireless module SIM900D [7]. This can be a complete Quad-band GSM/GPRS module in the
SMT variety and built with a really powerful single-chip processor chip integrating AMR926EJS key, allowing someone to benefit through small measurements and cost-effective solutions.
The SIM900D delivers GSM/GPRS 850/900/1800/1900MHz frequencies for voice.
Features of SIM900D are following:
managing wired dial-up modems [7]. AT commands are supported by GSM/GPRS modems and
mobile phones.
There are two types of AT commands [17]:
Basic commands: These commands are AT commands that do not start with "+". For
example, D (Dial), A (Answer), H (Hook control) and O (Return to online data state)
are basic commands.
Extended commands: These commands are AT commands that start with "+". All GSM
AT commands are extended commands. For example, +CMGS (Send SMS message),
+CMSS (Send SMS message from storage), +CMGL (List SMS messages) and
+CMGR (Read SMS messages) are extended commands.
2.4 Transformer
The history of transformer was commenced in early 1880's. First constant potential transformer
was invented in 1885, in the year 1950, 400KV electrical power transformer was introduced in
high voltage electrical power system [10]. In the early 1970s, unit rating as large as 1100MVA
was produced and 800KV and even higher KV class transformers were manufactured in year of
1980. Transformers have become essential for the AC transmission, distribution, and
utilization of electrical energy.
2.4.1 Definition
of Transformer
A transformer is an electrical
through electromagnetic
induction
which
Electrical power
transforms
electrical
the help of mutual induction between two windings. It transforms power from one circuit to
another without changing its frequency but may be in different voltage level [10].
10
Step-Up Transformer:
Step up transformer has greater number of turns in secondary winding [24].
Therefore, the output voltage is greater than input voltage.
(2.1)
Where:
NP = Number of turns on primary coil
NS = Number of turns on secondary coil
VP = Primary voltage
VS = Secondary voltage
By moving magnet
The magnitude of induced emf is equal to the rate of change of flux linkages with the coil. The
flux linkages is the product of number of turns and the flux associated with the coil.
Consider the conductor is moving in magnetic field. The flux at initial ( 1) and final (2)
position is given by following relation:
1 = N1
(2.2)
2 = N2
(2.3)
(2.4)
(2.5)
(volts)
(2.6)
Faraday's law tells us that a changing magnetic flux will induce an emf in a coil. The induced
emf for a coil with N loops is:
E = -N (d/dt) volts
12
(2.7)
Place two coils next to each other. If the first coil has a current going through it, a magnetic field
will be produced, and a magnetic flux will pass through the second coil [10]. Changing the
current in the first coil changes the flux through the second, inducing an emf in the second coil,
which is known as mutual inductance.
Figure: 2.8
2.5 Sensors
Sensors are installed on transformer site which reads and measures the physical quantity from
the distribution transformer and then it converts it into the analog signal. Sensor are used for
sensing load current, ambient temperature, winding temperature and oil level. A sensor is a
device which receives and responds to a signal when touched. A multitude of different
measurable variables can be collected for on-line monitoring. However, it is very rarely useful
to use the entire spectrum. Therefore, sensor technology must be adjusted to the specific
requirements of a particular transformer depending on their age and condition. Following
general set-up of sensors for example is proposed for the use at a Distribution transformer
an angle that is roughly zero. Voltage and potential transformers that are intended for checking
single-phase and three-phase line voltages in power metering applications are utilized primarily
as venture down gadgets. They are intended for interfacing line-to-line or line-to-neutral in the
same path as standard voltmeters [24]. The secondary voltage has an altered relationship to the
primary voltage with the goal that a change in potential inside the primary circuit is checked
precisely by meters associated over the secondary terminals [10].
Voltage and potential transformers can be utilized with voltmeters for voltage estimations, or
with current transformers for wattmeter or watt-hour meter estimations. Voltage transformers
and potential transformers are likewise used to work defensive transfers and gadgets, and in
numerous different applications. Since they are utilized basically as a part of an observing limit,
notwithstanding, voltage or potential transformers by and large oblige more prominent
precision. For illustrations, items utilized by open utilities for deciding power use must be exact
since these voltage or potential transformers are utilized for charging clients.
quantity of secondary windings, N2, the primary current can be made much littler than the
current in the primary circuit being measured. As it were, as N2 builds, I2 goes around a relative
sum.
Turns Ratio = n = Np /NS = Is/IP
(2.8)
(2.9)
2.5.5 Application
The LM35 can be connected effectively in the same route as other coordinated circuit
temperature sensors. It can be stuck or established to a surface and its temperature will be
around 0.01Cof the surface temperature
16
Name
Descriptions
VCC
Ground
VSS
VEE
LCD contrast
RS
Control pin
R/W
Control pin
Control pin
DB0
DB1
DB2
10
DB3
11
DB4
12
DB5
13
DB6
14
DB7
15
LED+
16
LED-
3 Hardware Description
This chapter provides detailed description of different modules of hardware user in in this
project. The hardware component consists of transformer, sensors, GSM module and
microcontroller etc.
18
Figure: 3.
3.2 Transformer
The transformer used in this project is an isolation transformer [24]. In this project we monitor
the parameters of this transformer because at that level we cant use 11 KVA transformers. With
this transformer we install some sensors which measure the parameters of this transformer. It is
a 200W or 0.25KVA transformer.
3.3 PT Sensor
In order to measure different parameters of the transformer sensors are deployed with
distribution transformer. PT sensor is installed at the transformer side to measure the voltage of
the transformer. This sensor comprises of a step-down transformer which take 220 AC voltage
and provides 12V AC which is further passed to bridge for rectification. The output of rectifier
which is 12V DC is then further minimized using variable resistance. Moreover, this final
output is provided to the microcontroller as shown in fig (3.3)
20
Figure: 3.3
hardware
design
of PT
sensor
3.4 CT
Sensor
CT sensor is also installed at the transformer side it is responsible to the measure of current of
the transformer and response when the current exceeds from its threshold value. This sensor
comprises of a step up transformer, diode (1N4007), variable resistance and a capacitor as
shown in fig (3.4). In CT sensor step-up transformer is connected parallel to the source and load
to measure current. Here is also a scaling factor used which take 1A current and gives 1V DC or
2A and give 2V DC then this output give to the Microcontroller.
Figure: 3.4
21
3.5
Temperature
Sensor
Temperature
sensor is used
to measure the
temperature of
the
[25].
transformer
sensor
wills
temperature
This
response when
of
the
transformer will go beyond the prescribed limit. LM35 sensor is used which has 3-pins and it
operate at +5V DC. It convert 10mV to 1 0C. In this project LM35 is used. The pin description
of LM35 is given as:
Pin 1: Input voltage unto 5.5v
Pin 2: Analog voltage out
Pin 3: Ground
Figure: 3.5
22
Figure: 3.6
The circuit configuration of oil level sensor depicted in figure (3.7) , F is the common pin, A is
the low pin, B is the medium pin and C is the high pin for detecting the oil level of the
transformer.
Figure:
3.7
3.7
Power
Supply
Power supply is the circuit from which we get our desired dc voltage to run other circuits. The
voltage we get from the principle line is 230V AC yet alternate parts of our circuit require 5V
DC. Consequently a step-down transformer is utilized to get 12V AC which is later changed
over to 12V DC utilizing a rectifier shown in fig (3.8). The yield of rectifier still contains a few
ripples despite the fact that it is a DC signal because of which it is called as Pulsating DC. To
remove the ripples and get smoothed DC power filter circuits are utilized. Here a capacitor is
utilized. The 12V DC is rated down to 5V utilizing a positive voltage controller chip 7805.
Therefore an altered DC voltage of 5V is acquired. Block diagram of power supply is given
below
23
Input
Output
230 AC
Transformer
Rectifier
Smoothing
main
Voltage
Regulated
Regulator
5V DC
Power
supply
Transformer: A transformer is an electrical device that exchanges energy between two or more
circuits through electromagnetic induction and it steps down high voltage AC to low voltage
AC.
Rectifier: Electrical device that changes AC to DC.
Smoothing: Smooths the DC to get rid of ripples.
Regulator: A voltage controller is intended to naturally keep up a consistent voltage level.
Figure:
3.8
3.7.1
Voltage
Regulator (7805)
Voltage regulator, any electrical device that keeps up the voltage of a power source inside
acceptable limits [12]. The voltage regulator is expected to keep voltages inside the
recommended range that can be endured by the electrical equipment utilizing that voltage. Such
a device is widely utilized as a part of motor vehicles of different sorts to match the yield
voltage of the generator to the electrical load and to the charging requirements of the battery.
Voltage controllers likewise are utilized as a part of electronic supplies in which excessive
variations in voltage would be detrimental.
24
e
Figure: 3.9
Figure: 3.10
In this figure (3.11) pin-12 is R x and pin-11 is Tx both are connected to the pin 26 and 25 of the
microcontroller.
25
Figure:
3.11
3.9
Relay
Relay is an electrical switch that uses an electromagnet to move the change from the OFF to ON
position rather than an individual moving the switch from OFF to ON. It takes a generally little
amount of power to turn on a relay yet the relay can control something that draws significantly
more power.
Figure: 3.12
3.10 Buzzer
A buzzer is an audio signalling device, it may be electromechanical or mechanical. Use
of buzzers include alarm devices and conformation of user input. These buzzers or beeper are
applicable to automobile equipments and its pin type terminal construction enables direct
mounting on to printed circuit boards. The circuit of buzzer is shown in the figure given below:
26
Figure: 3.13
Electronic symbol of buzzer is shown by figure given below:
Figure: 3.14
27
4 Flow Chart
c
Initialize
Read voltages
of transform
Yes
If
Relay 1 ON
Send SMS
(volts>26
0)
No
Read current
of transform
Yes
If
Dial number
(amps>6
0)
Buzzer ON
No
Read
temperature
Send message
Measure
Values
oil
level
Yes
If
Send to PC
(counter>6
0)
28
5 Methodology
The methodology for this project is briefly described in the fig (3.15)
Figure: 3.15
6 Results
The results of this project are given in following figures (3.16)
29
Figure: 3.16
Different readings of transformer and temperature are given in the following figure (3.17)
Figure: 3.17
30
Figure: 3.18
31
7 Conclusion
The GSM based monitoring of distribution transformer is useful as compared to manual
monitoring. It is also reliable as it is impossible to monitor the oil level and overloading etc.
After receiving message of any abnormality we can take action regarding any failure occurrence
in the transformers. In power distribution network there are several distribution transformer and
connecting each transformer with such system we can easily figure out that which transformer is
giving abnormal readings with the help of messaged received. So, there is no need for checking
all transformers. The time for getting messages may vary because of GSM network traffic but
still it is better than manual monitoring.
7.1
Future work
For receiving and storing transformer parameters information periodically about all the
distribution transformers of a particular utility in a database application a server module can be
included to this system. This database will be a useful source of information on the utility
transformers. Analysis of these stored data helps the utility in monitoring the behavior of their
distribution transformers and identify faults before any fatal failures. Thus, it will be cost saving
as well as improves system reliability.
32
References
[1]
[2]
Chan, W. L, So, A.T.P. and Lai, L., L.; Interment Based Transmission Substation
Monitoring, IEEE Transaction on Power Systems, Vol. 14, No. 1, February 1999,
pp. 293-298.
[3]
Akbari, A
[5]
http://www.microchip.com/wwwproducts/Devices.aspx?product=PIC18F452
[6]
http://www.warburtech.co.uk/products/pic/microcontrollers/40.pin.pic.microcontrol
lers/microchip.pic18f452.microcontroller/
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
33
[16]
PIC
18F452
Product
Features,
(Last
Accessed
on
June
2014),
https://www.microchip.com/wwwproducts/devices.aspx?dDocName=en010296
[17]
GSM
AT
Commands,
(Last
Accessed
on
July
2014),
http://m2msupport.net/m2msupport/sms-at-commands/
[18]
[19]
http://www.mikroe.com/products/view/11/book-pic-
microcontrollers/
[20]
Robert L. Boylestad, Louis Nashelsky, Electronic Devices and Circuit Theory, 9th
Edition, 2005 by Prentice Hall, ISBN: 0131189050
[21]
Bernard Grob, Grob Basic Electronics, 8th Edition, Jan 1997 by McGraw-Hill,
ISBN: 002802253X
[22]
[23]
LCD
20x4
datasheet,
(Last
Accessed
on
June
2014),
https://www.google.com.pk/#q=lcd+20x4+datasheet
[24]
[25]
Temperature
sensor
LM35
specification,
(Last
accessed
on
July),
http://www.facstaff.bucknell.edu/mastascu/elessonshtml/sensors/TempLM35.html
34
// ic number define
#device adc=10
//adc 10 bit
#use
delay (clock=20000000)
// 20mhz
#use rs232(baud=9600,STREAM=pc)
#use rs232(baud=9600,stream=gsm)
#include<lcd.c>
void process_volt_1_ac();
void process_amps_1_ac();
void process_temp_1();
void process_volt_2_ac();
void process_amps_2_ac();
void process_temp_2();
void process_send_pc();
void process_oil_level();
int32 adc_value;
int16 ac_volt_1,ac_volt_2;
int16 ac_amps_1,ac_amps_2;
int16 temp_1,temp_2;
int8 volt1_1,volt1_2,volt1_3;
int8 amps1_1,amps1_2,amps1_3;
int8 temp1_1,temp1_2,temp1_3;
int8 volt2_1,volt2_2,volt2_3;
int8 amps2_1,amps2_2,amps2_3;
int8 temp2_1,temp2_2,temp2_3;
int1 flag1,flag2,flag3,flag4;
35
int8 counter1;
#DEFINE buzzer
PIN_B0
#DEFINE relay1
PIN_B1
#DEFINE relay2
PIN_B2
#DEFINE led1
PIN_D1
// main loop
SETUP_ADC_PORTS(ALL_ANALOG);
// adc initialize
setup_adc(ADC_CLOCK_INTERNAL);
output_low(relay1);
output_low(relay2);
output_high(buzzer);
output_high(led1);
delay_ms(1000);
output_low(buzzer);
output_low(led1);
delay_ms(100);
flag1 = TRUE;
flag2 = TRUE;
flag3 = TRUE;
flag4 = TRUE;
counter1 = 0;
fprintf(pc,"TRANSFORMER PROJECT\n\r");
delay_ms(100);
36
while(true){
output_toggle(led1);
process_volt_1_ac();
process_amps_1_ac();
process_temp_1();
37
process_volt_2_ac();
process_amps_2_ac();
process_temp_2();
process_water_level();
process_send_pc();
counter1++;
if(counter1>60){
counter1 = 0;
fprintf(gsm,"AT+CMGF=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGD=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGS=\"03446656938\"\r");
delay_ms(500);
fputc('T',gsm);
fputc('1',gsm);
fputc('_',gsm);
fputc('V',gsm);
fputc('=',gsm);
fputc(volt1_3,gsm);
fputc(volt1_2,gsm);
fputc(volt1_1,gsm);
fputc('V',gsm);
fputc('T',gsm);
fputc('2',gsm);
fputc('_',gsm);
fputc('V',gsm);
fputc('=',gsm);
fputc(volt2_3,gsm);
38
fputc(volt2_2,gsm);
fputc(volt2_1,gsm);
fputc('V',gsm);
fputc('T',gsm);
fputc('1',gsm);
fputc('_',gsm);
fputc('A',gsm);
fputc('=',gsm);
fputc(amps1_3,gsm);
fputc('.',gsm);
fputc(amps1_2,gsm);
fputc(amps1_1,gsm);
fputc('A',gsm);
fputc('T',gsm);
fputc('2',gsm);
fputc('_',gsm);
fputc('A',gsm);
fputc('=',gsm);
fputc(amps2_3,gsm);
fputc('.',gsm);
fputc(amps2_2,gsm);
fputc(amps2_1,gsm);
fputc('A',gsm);
fputc('T',gsm);
fputc('E',gsm);
fputc('M',gsm);
fputc('P',gsm);
fputc('1',gsm);
fputc('=',gsm);
fputc(temp1_2,gsm);
fputc(temp1_1,gsm);
fputc('C',gsm);
fputc('T',gsm);
fputc('E',gsm);
fputc('M',gsm);
39
fputc('P',gsm);
fputc('2',gsm);
fputc('=',gsm);
fputc(temp2_2,gsm);
fputc(temp2_1,gsm);
fputc('C',gsm);
delay_ms(500);
}
}
void process_volt_1_ac()
{
set_adc_channel(0);
adc_value=read_adc();
ac_volt_1 = adc_value;
volt1_3 =0x30+ ac_volt_1/100;
//bcd
if(ac_volt_1>260){
output_high(relay1);
delay_ms(10);
if(flag3){
flag3 = false;
40
fprintf(gsm,"AT+CMGF=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGD=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGS=\"03446656938\"\r");
delay_ms(500);
fprintf(gsm,"Transformer1 Over Volts\r");
delay_ms(500);
}//end flag3
}
else{
flag3 = true;
output_low(relay1);
delay_ms(10);
}
}
void process_amps_1_ac()
{
set_adc_channel(1); // adc channel select
adc_value=read_adc();
ac_amps_1 = adc_value;
amps1_3 =0x30+ ac_amps_1/100;
amps1_2 =0x30+ (ac_amps_1/10) % 10;
amps1_1 =0x30+ (ac_amps_1/1) % 10;
lcd_line1(10);
printf(lcd_data,"T1_A=");
lcd_data(amps1_3);
41
lcd_data('.');
lcd_data(amps1_2);
lcd_data(amps1_1);
lcd_data('A');
if(ac_amps_1>60){
output_high(buzzer);
delay_ms(200);
output_low(buzzer);
printf("temp2 ");
delay_ms(200);
if(flag1){
flag1 = false;
fprintf(gsm,"AT+CMGF=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGD=1\r");
delay_ms(500);
fprintf(gsm,"ATD03446656938;\r");
delay_ms(500);
}//end flag1
}
else{
flag1 = true;
printf("temp3 ");
delay_ms(200);
}
42
}
void process_volt_2_ac()
{
set_adc_channel(2); // adc channel select
adc_value=read_adc();
ac_volt_2 = adc_value;
volt2_3 =0x30+ ac_volt_2/100;
volt2_2 =0x30+ (ac_volt_2/10) % 10;
volt2_1 =0x30+ (ac_volt_2/1) % 10;
lcd_line2(0);
printf(lcd_data,"T2_V=");
lcd_data(volt2_3);
lcd_data(volt2_2);
lcd_data(volt2_1);
lcd_data('V');
if(ac_volt_2>260){
output_high(relay2);
delay_ms(10);
if(flag4){
flag4 = false;
fprintf(gsm,"AT+CMGF=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGD=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGS=\"03446656938\"\r");
delay_ms(500);
fprintf(gsm,"Transformer2 Over Volts\r");
43
delay_ms(500);
}//end flag3
}
else{
flag4 = true;
output_low(relay2);
delay_ms(10);
}
}
void process_amps_2_ac()
{
set_adc_channel(3); // adc channel select
adc_value=read_adc();
ac_amps_2 = adc_value;
amps2_3 =0x30+ ac_amps_2/100;
amps2_2 =0x30+ (ac_amps_2/10) % 10;
amps2_1 =0x30+ (ac_amps_2/1) % 10;
lcd_line2(10);
printf(lcd_data,"T2_A=");
lcd_data(amps2_3);
lcd_data('.');
lcd_data(amps2_2);
lcd_data(amps2_1);
lcd_data('A');
if(ac_amps_2>60){
output_high(buzzer);
delay_ms(200);
44
output_low(buzzer);
printf("temp4 ");
putc('\0');
putc(13);
putc(10);
delay_ms(200);
if(flag2){
flag2 = false;
fprintf(gsm,"AT+CMGF=1\r");
delay_ms(500);
fprintf(gsm,"AT+CMGD=1\r");
delay_ms(500);
fprintf(gsm,"ATD03446656938;\r");
delay_ms(500);
}//end flag1
}
else{
flag2 = true;
printf("temp5 ");
delay_ms(200);
}
}
////////////////////////////////////////////////////////////
void process_temp_1()
45
{
set_adc_channel(4);
adc_value=read_adc();
temp_1 = adc_value;
temp1_3 =0x30+ temp_1/100;
temp1_2 =0x30+ (temp_1/10) % 10;
temp1_1 =0x30+ (temp_1/1) % 10;
lcd_line3(0);
printf(lcd_data,"TEMP1=");
lcd_data(temp1_2);
lcd_data(temp1_1);
lcd_data('C');
}
void process_temp_2()
{
set_adc_channel(5);
adc_value=read_adc();
temp_2 = adc_value;
temp2_3 =0x30+ temp_2/100;
temp2_2 =0x30+ (temp_2/10) % 10;
temp2_1 =0x30+ (temp_2/1) % 10;
lcd_line3(10);
printf(lcd_data,"TEMP2=");
lcd_data(temp2_2);
lcd_data(temp2_1);
lcd_data('C');
}
void process_send_pc(){
fputc('C',pc);
fputc('N',pc);
fputc('T',pc);
46
fputc('1',pc);
fputc(' ',pc);
fputc(volt1_3,pc);
fputc(volt1_2,pc);
fputc(volt1_1,pc);
fputc('V',pc);
fputc('C',pc);
fputc('N',pc);
fputc('T',pc);
fputc('2',pc);
fputc(' ',pc);
fputc(volt2_3,pc);
fputc(volt2_2,pc);
fputc(volt2_1,pc);
fputc('V',pc);
fputc('C',pc);
fputc('N',pc);
fputc('T',pc);
fputc('3',pc);
fputc(' ',pc);
fputc(amps1_3,pc);
fputc('.',pc);
fputc(amps1_2,pc);
fputc(amps1_1,pc);
fputc('A',pc);
fputc('C',pc);
fputc('N',pc);
fputc('T',pc);
fputc('4',pc);
fputc(' ',pc);
fputc(amps2_3,pc);
fputc('.',pc);
fputc(amps2_2,pc);
fputc(amps2_1,pc);
fputc('A',pc);
47
fputc('C',pc);
fputc('N',pc);
fputc('T',pc);
fputc('5',pc);
fputc(' ',pc);
fputc(temp1_2,pc);
fputc(temp1_1,pc);
fputc('C',pc);
fputc('C',pc);
fputc('N',pc);
fputc('T',pc);
fputc('6',pc);
fputc(' ',pc);
fputc(temp2_2,pc);
fputc(temp2_1,pc);
fputc('C',pc);
delay_ms(100);
}
void process_oil_level(){
if(!input(oil_l) && input(oil_m) && input(oil_h)){
lcd_line4(0);
printf(lcd_data,"OIL_LEVEL= LOW ");
delay_ms(10);
}
else if(!input(oil_l) && !input(oil_m) && input(oil_h)){
lcd_line4(0);
printf(lcd_data,"OIL_LEVEL= MEDIUM");
delay_ms(10);
}
else if(!input(oil_l) && !input(oil_m) && !input(oil_h)){
48
lcd_line4(0);
printf(lcd_data,"OIL_LEVEL= HIGH ");
delay_ms(10);
}
else{
lcd_line4(0);
printf(lcd_data,"OIL_LEVEL= EMPTY ");
delay_ms(10); } }
49
230VAC
Transformer
Voltage regulator
IC7805
LED
1.63V to 4.8V
Capacitor
Different types
Embedded system:
Microcontroller
PIC18F452
Crystal oscillator
20 MHz
LCD
20*4
GSM module:
GSM module
SIM900D
Sensors:
Sensors
MAX232
50
TITLE
TOTAL NUMBER
OF WEEKS IN
PLAN
40
PROJECT ID
36
No.
STARTING
WEEK
3 weeks
3 weeks
4 weeks
11
4 weeks
15
Project Design
4 weeks
19
Hardware Implementation
6 weeks
25
6 weeks
31
Documentation/Thesis Writing
6 weeks
DESCRIPTION OF MILESTONE
* You can provide Gantt chart instead of filling this form, if you like
51
DURATION