Documente Academic
Documente Profesional
Documente Cultură
CERTIFICATE
Finally,we wish to express our sincere thanks to our parents for their
moral support and constant encouragement without whom it would not
have been possible to complete the project successfully
CONTENTS
Abstract
Project Description
Images of project
Block diagram
AT89S52 micro controller
LCD module
MAX232
GPS or GPRS Modem
SIM 800 L
Circuit diagram
Circuit explanation
Software Code
Working procedure
Applications
Conclusion
ABSTRACT:
The objective of this project is to determine the distance of underground
cable fault from the base station in kilometers and displayed over the internet.
Underground cable system is a common practice followed in major urban areas.
While a fault occurs for some reason, at that time the repairing process related to
that particular cable is difficult due to exact unknown location of the fault in the
cable.
Proposed system is used to find out the exact location of the fault and to send
data in graphical format to a dedicated website together with on board LCD display
using a GSM module.
The project uses the standard theory of Ohms law, i.e., when a low DC
voltage is applied at the feeder end through a series resistor (Cable lines), then the
current would vary depending upon the location of the fault in the cable as the
resistance is proportional to the distance. In case there is a short circuit (Line to
Ground), the voltage across series resistors changes according to the resistance that
changes with distance .This is then fed to an ADC to develop precise digital data
which the programmed microcontroller of the 8051 family displays in kilometers.
The project is assembled with a set of resistors representing the cable length
in km and the fault creation is made by a set of switches at every known km to
cross check the accuracy of the same. The fault occurring at a particular distance,
the respective phase along with the distance is displayed on the LCD. The same
information is also sent to a dedicated website over internet activated SIM with
GSM, interfaced to the microcontroller. Furthermore, this project can be enhanced
by using capacitor in an AC circuit to measure the impedance which can even
locate the open circuited cable, unlike the short circuited fault that uses only
resistors in DC circuit as followed in the above proposed project. GPS module will
provide exact location. That gps data we are sending through gprs internet sim card
which is insert on GSM Modem. We can continuously monitor on laptop.
The AT89S52 are based on a 8 bit AT M E L CPU with real-time emulation and
embedded trace support, together with 128/512 kilobytes of embedded high speed
flash memory.This project uses regulated 5V, 750mA power supply. 7805 three
terminal voltage regulator is used for voltage regulation. Bridge type full wave
rectifier is used to rectify the ac output of secondary of 230/18V step down
transformer.
Project Description
INTRODUCTION OF UNDERGROUND
SYSTEM:
UNDERGROUND CABLE:-
Underground cables are used for power applications where it is
impractical, difficult, or dangerous to use the overhead lines. They are
widely used in densely populated urban areas, in factories, and even to
supply power from the overhead posts to the consumer premises.
By Voltage
LT cables: Low-tension cables with a maximum capacity of
1000 V
HT Cables: High-tension cables with a maximum of 11KV
KV and 33 KV
EHT cables: Extra high-tension cables with a rating of
between 33 KV and 66 KV
Extra super voltage cables: with maximum voltage ratings
beyond 132 KV
By Construction
Images of project
Hardware Requirements of the project
8051 series Micro controller
LCD
Crystal
ADC
Relays
Relay Driver IC
Transformer
Diodes
Voltage Regulator
Resistors
Capacitors
LEDs
slide switches
max232
and GSM module.
Gps modem
Software Requirements
Keil compiler
Language: Embedded C or Assembly
.
BLOCK DIAGRAM:
AT89S52 Micro Controller:
We can use MAX-232 to convert Transistor Transistor Logic (TTL) voltage level to
RS232 and vice versa. RS232 is the method of transferring data using serial
communication. MAX 232 is a dual receiver or driver having capacitive voltage
generator in order to supply RS232 voltage levels from a single supple of 5V. Each
receiver converts RS232 inputs to 5V either Transistor Transistor Logic (TTL) or
Complementary Metal Oxide Semiconductor (CMOS) levels. Whereas each of the
driver coverts TTL or CMOS levels to RS232 levels. RS232 receiver receives the
input from the serial pins of the microcontroller. The receiver also receives the
input from RS232’s serial port and provides the output to the microcontroller’s
receiver pin. Four external capacitors are needed for MAX-232 and their values are
ranging from 1uF to 22uF. MAX 232 has a lot of applications including battery
powered systems, terminals, modem, computer etc.
Pin out
• MAX232 Pinout consists of 16 pins in total, the first 6 Pins are used to connect
capacitors while the next 8 Pins are for serial port connections and the last two Pins
are Power Pins.
• All of the pins are given in chronological order in the table shown below.
Pin # 1 Capacitor 1+ Pin # 9 R2 Out
• A complete pin diagram and the real image of MAX 232 is shown in figure below:
Pin Functions
• MAX 232 has 16 pins in total as I have told earlier, some of the pins have common
features and some have different.
• The functions associated with all of the pins are provided in the table shown below.
Schematic
• The schematic diagram of a device provides help in understanding its internal
functionality.
• I have provided the labelled schematic diagram of MAX 232 as shown in the figure
below.
Max 232 Ratings
• The voltage, current and power ratings of any device displays its power requirement
i.e. how much voltage and current is required for its operation.
• MAX 232’s current, voltage, power ratings are in the table shown below.
GPS/GPRS Modem
Analogic GSM/GPRS Smart Modem is a multi-functional, ready to
use, rugged unit that can be embedded or plugged into any
application. The Smart Modem can be controlled and customized to
various levels by using the standard AT commands. The modem is
fully type-approved, it can speed up the operational time with full
range of Voice, Data, Fax and Short Messages (Point to Point and Cell
Broadcast), the modem also supports GPRS (Class 2*) for
spontaneous data transfer.
Functions of GSM modes
Interface
Serial interface RS232 V. 24/V.28 Autobauding function
AT command set based on V.25ter and GSN 07.05 &
07.07
SMS
Mobile Originated (MO) and Mobile Terminated
(MT), Mode Text & PDU point to point. Cell
broadcase. In accordance with GSM 07.05.
Data
Asynchronous 2400, 4800, 9600 and 14400 bits/s
Transparent and Non Transparent mode
In Non Transparent Mode only: 300, 1200, 1200/75 bauds
Mode 3.1 KHz ( PSTN) and V110(ISDN)
FAX
2400/4800/7200/9600 bit/s
GSM teleservice 62 in Transparent Mode
Class 2. Group 3 compatible
Audio
Half Rate/Full Rate/ Enhanced Full Rate. Accessories ( options):
Handset & car kit
LED Status Indicator
The LED will indicate different status of the modem:
OFF-Modem Switched off
ON -Modem is connecting to the network
Flashing Slowly -Modem is in idle mode
Flashing rapidly-Modem is in transmission or in communication
(GSM only)
SIM800L
SIM800L is a miniature cellular module which allows for GPRS transmission,
sending and receiving SMS and making and receiving voice calls. Low cost and
small footprint and quad band frequency support make this module perfect
solution for any project that require long range connectivity. After connecting
power module boots up, searches for cellular network and login automatically.
On board LED displays connection state (no network coverage - fast blinking,
Specification
Supply voltage: 3.8V - 4.2V
Recommended supply voltage: 4V
Power consumption:
o sleep mode < 2.0mA
o idle mode < 7.0mA
o GSM transmission (avg): 350 mA
o GSM transmission (peek): 2000mA
Module size: 25 x 23 mm
Interface: UART (max. 2.8V) and AT commands
SIM card socket: microSIM (bottom side)
Supported frequencies: Quad Band (850 / 950 / 1800 /1900 MHz)
Antenna connector: IPX
Status signaling: LED
Working temperature range: -40 do + 85 ° C
Set includes:
SIM800L module
goldpin headers
wire antenna
PCB antenna with pigtail and IPX connector
Module pinout
RING (not marked on PBC, first from top, square) - LOW state while
receiving call
DTR - sleep mode. Default in HIGH state (module in sleep mode, serial
communication disabled). After setting it in LOW the module will wake up.
MICP, MICN - microphone (P + / N -)
SPKP, SPKN - speaker (P + / N -)
Pinout (bottom side - right):
NET - antenna
VCC - supply voltage
RESET - reset
RXD - serial communication
TXD - serial communication
GND - ground
CIRCUIT DIAGRAM:
10K PULLUP
cc
1
2
3
4
5
6
7
8
R
R
R
R
R
R
R
R
V
VC C VC C
1
2
3
4
5
6
7
8
9
1 0 u f/6 3 v
VC C
M AX232
16
1 4 0
R ED L IN E SW 1 P 1 .0 (T 2 ) VC C 2 14
2 3 9 V+ T1O U T
VC C
G R EEN L IN E SW 1 P 1 .1 (T 2 E X ) P 0 .0 (A D 0 ) 1 13
3 3 8 C 1+ R 1 IN
Y ELLO W L IN E SW 1 P 1 .2 P 0 .1 (A D 1 ) R S
1 0 u f/6 3 v
4 3 7
R ED L IN E SW 2 P 1 .3 P 0 .2 (A D 2 ) 12
5 3 6 R 1O U T
G R EEN L IN E SW 2 P 1 .4 P 0 .3 (A D 3 ) E N 11
6 3 5 T 1 IN
Y ELLO W L IN E SW 2 P 1 .5 P 0 .4 (A D 4 ) D 4 3
7 3 4 C 1-
P 1 .6 P 0 .5 (A D 5 ) D 5 4 10
8 3 3 C 2+ T 2 IN P 3 .0
R ST P 1 .7 P O .6 (A D 6 ) D 6 9
9 3 2 R 2O U T P 3 .1
R ST P 0 .7 (A D 7 ) D 7
1 0 u f/6 3 v
1 0 3 1
T 2 IN P 3 .0 (R X D ) E E /V D D 8 1
1 1 3 0 VC C R 2 IN
R 2 O U T P 3 .1 (T X D ) A L E /P R O G 5 7 2
1 2 2 9 C 2- T2O U T
G N D
P 3 .2 (IN T 0 ) PSEN 6 3
1 3 2 8 V-
P 3 .3 (IN T 1 ) P 2 .7 (A 1 5 ) P 2 .7 R E L A Y 1
1 4 2 7
R E D L IN E S W 3 P 3 .4 (T 0 ) P 2 .6 (A 1 4 ) P 2 ^6 R E L A Y 2
1 0 u f/6 3 v
1 5 2 6
G R E E N L IN E S W 3 P 3 .5 (T 1 ) P 2 .5 (A 1 3 ) P 2 ^5 R E L A Y 3 G PR S MO D EM
15
1 6 2 5
Y E L L O W L IN E S W 3 1 7 P 3 .6 (W R ) P 2 .4 (A 1 2 ) 2 4
1 8 P 3 .7 (R D ) P 2 .3 (A 1 1 ) 2 3 gnd
XTA L2 P 2 .2 (A 1 0 ) Y E L L O W L IN E S W 4 gnd
33pf 1 1 .0 5 9 2 M H z 1 9 2 2
XTA L1 P 2 .1 (A 9 ) G R E E N L IN E S W 4 gnd
2 0 2 1
C R Y S TAL G N D P 2 .0 (A 8 7 ) R E D L IN E S W 4
LS1 VC C
GND
VC C 5
33pf GND AT89S52 J1 3
LS1 VC C
1 4
GND 2 1
VC C 5
VC C J1 2
1N 4007
GND 3
1 4
G R E E N L IN E
2 1
R ELAY
2
1N 4007
SW 1
10uf
1K
R E D L IN E
R ELAY P 2 ^6 R E L A Y 2
BC 547
R ST
1K
8 .2 K P 2 .7 R E L A Y 1 BC 547
GND
LS1 VC C
GND GND
VC C 5
J1
1
3
B R ID G E R E C T IF IE R
1 4
VC C 2 1
J2 7805R EG U LATO R 2
1N 4007
2 2 - + 4 1 3
V IN VO U T
G N D
1 Y E L L O W L IN E
R ELAY
220 ohm s
to tra n s f o rm e r
1000uf
1K
2
104pf 33pf P 2 ^5 R E L A Y 3
BC 547
3
LED
GND
GND
BASIC CIRCUIT EXPLANATION :
The Title of the project is “Web Based Underground
Cable Fault Detection over google maps”.
“http://rpihealth.com/iot_cable/”.
The latitude and longitude of the fault location will be
traced by the GPS.
Working Procedure
#define BUFF_LEN 50
void RECEIVE_GPS(void);
void RECEIVE_GPGLL(unsigned long);
unsigned char RECEIVE_CHR(unsigned long);
unsigned int k=0,j=0;
unsigned char REC_BUFF[BUFF_LEN];
sbit RL1=P1^0;
sbit RL2=P1^3;
sbit RL3=P2^2;
sbit RL4=P1^6;
sbit GL1=P1^1;
sbit GL2=P1^4;
sbit GL3=P2^3;
sbit GL4=P2^1;
sbit YL1=P1^2;
sbit YL2=P1^5;
sbit YL3=P2^4;
sbit YL4=P2^0;
sbit RLD=P2^7;
sbit GLD=P2^6;
sbit YLD=P2^5;
int ii=0;
int jj=0;
int kk=0;
int ll=0;
int iii=0;
int jjj=0;
int kkk=0;
int lll=0;
int iiii=0;
int jjjj=0;
int kkkk=0;
int llll=0;
void delay(unsigned int v)
{unsigned int ii,j;for(ii=0;ii<=v;ii++)for(j=0;j<=1275;j++);}
void tx(unsigned char *tx)
{for(;*tx != '\0';tx++){SBUF=*tx;while(TI == 0);TI=0;}}
void ch_send_to_modem (unsigned char single_char)
{SBUF=single_char;while(TI==0);TI=0;delay(10);}
void GPRS_SENT()
{
///////////////////////////////////////
delay(100); RECEIVE_GPGLL(1000);
lcdcmd(0x01);RECEIVE_GPS();
delay(50);delay(50);
lcdcmd(0x01);msgdisplay ("HTTP START...");
///////////////////////////////////////////////////////////////////////////
tx("AT+HTTPPARA=\"URL\",\"http://rpihealth.com/iot_cable/put_data.php");delay(100);
RECEIVE_GPGLL(1000);RECEIVE_GPS();
k=0,j=0;delay(100); k=1;
while((REC_BUFF[k++]!=',')||(j++<1));
j=0;tx("?lat=");
while((REC_BUFF[k]!=',')||(j++<1))
ch_send_to_modem(REC_BUFF[k++]);
tx("&lon=");k++;j=0;
while((REC_BUFF[k]!=',')||(j++<1))
ch_send_to_modem(REC_BUFF[k++]);tx("\"");tx("\r\n");
////////////////////////////////////////////////////////
tx("AT+HTTPACTION=0\r\n");delay(5000);
lcdcmd(0x01);msgdisplay("GPRS SENT....");delay(1000);
}
void SMS_SENT()
{
tx(" http://rpihealth.com/iot_cable/");tx("\r\n");delay(100);
tx(" Location at ");tx("\r\n");delay(100);
RECEIVE_GPGLL(1000);RECEIVE_GPS();
k=0,j=0;delay(100); k=1;
while((REC_BUFF[k++]!=',')||(j++<1));
j=0;tx(" LAT=");
while((REC_BUFF[k]!=',')||(j++<1))
ch_send_to_modem(REC_BUFF[k++]);
tx(" LONG=");k++;j=0;
while((REC_BUFF[k]!=',')||(j++<1))
ch_send_to_modem(REC_BUFF[k++]);tx("\r\n");
ch_send_to_modem(0x1a);delay(200); lcdcmd(0x01);
lcdcmd(0x01);msgdisplay("SMS SENT....");delay(1000);
}
void main(void)
{
char RESULT=0;
RLD=GLD=YLD=0;
TMOD=0x20;TH1=0xfd;SCON=0x50;TR1=1;EA=1;IT0=1;EX0=1;
lcd_init();lcd_init();lcd_init();lcdcmd(0x01);
//web based underground cable fault detection over google maps
lcdcmd(0x80);msgdisplay("Web Based " );
lcdcmd(0xc0);msgdisplay("Underground ");
delay(1000);lcdcmd(0x01);
lcdcmd(0x80);msgdisplay("Cable Fault" );
lcdcmd(0xc0);msgdisplay("detection over");
delay(1000);lcdcmd(0x01);
lcdcmd(0x80);msgdisplay("google maps" );
lcdcmd(0xc0);msgdisplay("Internet - IOT ");
tx("AT\r\n");delay(50);
tx("AT\r\n");delay(50);
tx("AT+CMGF=1\r\n");delay(50);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("wait 2 sec " );
tx("AT\r\n");delay(50);
tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CGATT=1\r\n");delay(100);
lcdcmd(0x01);lcdcmd(0x80);
msgdisplay ("GPRS START...");
tx("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\r\n");delay(300);
tx("AT+SAPBR=3,1,\"APN\",\"internet\"\r\n");delay(300);
tx("AT+SAPBR=1,1\r\n");delay(1000);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("wait 1 sec " );
lcdcmd(0x01);msgdisplay ("HTTP START...");
tx("AT+HTTPINIT\r\n");delay(1000);
tx("AT+HTTPPARA=\"CID\",1\r\n");delay(1000);
tx("AT\r\n");delay(50);
tx("AT+CMGF=1\r\n");delay(50);
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GPRS IS READY" );
delay(500); lcdcmd(0x01);
while(1)
{
if(RL1==0){lcdcmd(0x80);msgdisplay("RL1 OK ");ii=0;}
if(RL2==0){lcdcmd(0x80);msgdisplay("RL2 OK ");jj=0;}
if(RL3==0){lcdcmd(0x80);msgdisplay("RL3 OK ");kk=0;}
if(RL4==0){lcdcmd(0x80);msgdisplay("RL4 OK ");ll=0;}
if(GL1==0){lcdcmd(0x80);msgdisplay("GL1 OK ");iii=0;}
if(GL2==0){lcdcmd(0x80);msgdisplay("GL2 OK ");jjj=0;}
if(GL3==0){lcdcmd(0x80);msgdisplay("GL3 OK ");kkk=0;}
if(GL4==0){lcdcmd(0x80);msgdisplay("GL4 OK ");lll=0;}
if(YL1==0){lcdcmd(0x80);msgdisplay("YL1 OK ");iiii=0;}
if(YL2==0){lcdcmd(0x80);msgdisplay("YL2 OK ");jjjj=0;}
if(YL3==0){lcdcmd(0x80);msgdisplay("YL3 OK ");kkkk=0;}
if(YL4==0){lcdcmd(0x80);msgdisplay("YL4 OK ");llll=0;}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(RL1==1)
{RLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("RL1 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 1 KM");delay(100);lcdcmd(0x01);
ii=ii+1;
if(ii==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" RED CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 1 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(RL2==1)
{RLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("RL2 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 2 KM");delay(100);lcdcmd(0x01);
jj=jj+1;
if(jj==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" RED CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 2 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(RL3==1)
{RLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("RL3 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 3 KM");delay(100);lcdcmd(0x01);
kk=kk+1;
if(kk==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" RED CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 3 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(RL4==1)
{RLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("RL4 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 4 KM");delay(100);lcdcmd(0x01);
ll=ll+1;
if(ll==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" RED CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 4 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////green cable line
if(GL1==1)
{GLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GL1 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 1 KM");delay(100);lcdcmd(0x01);
iii=iii+1;
if(iii==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" GREEN CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 1 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(GL2==1)
{GLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GL2 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 2 KM");delay(100);lcdcmd(0x01);
jjj=jjj+1;
if(jjj==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" GREEN CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 2 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(GL3==1)
{GLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GL3 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 3 KM");delay(100);lcdcmd(0x01);
kkk=kkk+1;
if(kkk==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" GREEN CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 3 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(GL4==1)
{GLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("GL4 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 4 KM");delay(100);lcdcmd(0x01);
lll=lll+1;
if(lll==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" GREEN CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 4 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////YELLOW cable line
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(YL1==1)
{YLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("YL1 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 1 KM");delay(100);lcdcmd(0x01);
iiii=iiii+1;
if(iiii==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" YELLOW CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 1 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(YL2==1)
{YLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("YL2 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 2 KM");delay(100);lcdcmd(0x01);
jjjj=jjjj+1;
if(jjjj==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" YELLOW CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 2 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(YL3==1)
{YLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("YL3 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 3 KM");delay(100);lcdcmd(0x01);
kkkk=kkkk+1;
if(kkkk==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" YELLOW CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 3 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(YL4==1)
{YLD=1;
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("YL4 Fault ");lcdcmd(0xc0);msgdisplay("Distance
IS 4 KM");delay(100);lcdcmd(0x01);
llll=llll+1;
if(llll==1)
{
EA=0;
GPRS_SENT();
lcdcmd(0x01);lcdcmd(0x80);msgdisplay("Sending SMS1 ");
tx("AT\r\n");delay(50);tx("AT+CMGF=1\r\n");delay(50);
tx("AT+CMGS=\"8639259265\"\r\n");delay(100);
tx(" YELLOW CABLE Line Fault ");tx("\r\n");delay(100);
tx(" Distance IS 4 KM ");tx("\r\n");delay(100);
SMS_SENT();
//////////////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
void RECEIVE_GPS(void)
{
unsigned int k=0,j=0;
k=1;
while((REC_BUFF[k++]!=',')||(j++<1));
j=0;
lcdcmd(0X80);
msgdisplay("LT:");
while((REC_BUFF[k]!=',')||(j++<1))
lcddata(REC_BUFF[k++]);
lcdcmd(0XC0);
msgdisplay("LN:");
k++;j=0;
while((REC_BUFF[k]!=',')||(j++<1))
lcddata(REC_BUFF[k++]);
}
void RECEIVE_GPGLL(unsigned long timeout)
{
unsigned int m=0;
char loop = 1;
while(loop)
{
while(RECEIVE_CHR(timeout) != '$');
if(RECEIVE_CHR(timeout) == 'G')
{
if(RECEIVE_CHR(timeout) == 'P')
{
if(RECEIVE_CHR(timeout) == 'R')
{
if(RECEIVE_CHR(timeout) == 'M')
{
if(RECEIVE_CHR(timeout) == 'C')
{
m = 0;
do{
REC_BUFF[m] =RECEIVE_CHR(timeout);
if(m > BUFF_LEN-1) break;
}while((REC_BUFF[m++]!=0x0D)&&(m < (BUFF_LEN-2)));
REC_BUFF[m-1] = 0x00; loop = 0;
}else loop =
1;
}
else loop = 1;
}
else loop = 1;
}
else loop = 1;
}
else loop = 1;
}
}
unsigned char RECEIVE_CHR(unsigned long timeout)
{
unsigned char temp=0x00;
while((!RI)&&(--timeout > 0));
if(timeout)
temp = SBUF;
RI = 0;
return temp;
}
Applications
CONCLUSION