Sunteți pe pagina 1din 42

Project Report on

UNDERGROUND CABLE FAULT DETECTION


OVER Internet of Things(IOT)

Submitted to Government Polytechnic, Kothagudem towards the


partial fulfillment of the academic requirement for the Degree of
DIPLOMA
IN
ELECTRICAL AND ELECTRONICS ENGINEERING
By
Ch.Sanvitha K.Srinivas K.Harshitha M.Giridhar
(17046-EE-008) (17046-EE-020) (17046-EE-024) (17046-EE-029)

M.Moukthika P.Satya Aravind


(17046-EE-032) (17046-EE-040)

Under the guidance of


Mrs.P.Nagamani, Lecturer

Department of Electrical and Electronics Engineering

GOVERNMENT POLYTECHNIC COLLEGE


Rudrampur, Kothagudem,507 118
GOVERNMENT POLYTECHNIC COLLEGE
Rudrampur, Kothagudem
507 118

CERTIFICATE

This is to certify that the project entitled “UNDERGROUND CABLE


FAULT DETECTION OVER Internet of Things(IoT)” is a bonafide record
of the report of dissertation submitted by the students
Ch.Sanvitha(17046-EE-008),K.Srinivas(17046-EE-020),
K.Harshitha(17046-EE-024),M.Giridhar Reddy(17046-EE-029),
M.Moukthika(17046-EE-032) and P.Satya Aravind(17046-EE-040) to
the Government Polytechnic College Kothagudem.They have
completed the project under the guidance of specified guide teacher
and they found to be very regular and sincere to the work during the
project.

Project Guide Head of the Department


(Mrs.P.Nagamani) (Mr.A.K.Srikanth)

External Examiner Principal


(Mr.B.Nagamuni Naik)
ACKNOWLEDGMENT

First,we express our sincere gratitude to our project guide


Mrs.P.Nagamani,Lecturer for his distinct support band guidance
during each stage of the work that brought this project to a successful
completion.

It is a great privilege to record our deep sense of gratitude to Mr.


A.K.Srikanth,Head of Electrical Department for there technical support.

We thank Mr.B.Nagamuni Naik,Principal of Government Polytechnic College,


Kothagudem for permitting us to carry out this project.

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.

Basic construction of an underground cable


The underground cables have several advantages over the
overhead lines; they have smaller voltage drops, low chances
of developing faults and have low maintenance costs.
However, they are more expensive to manufacture, and their
cost may vary depending on the construction as well as the
voltage rating.
ARCHITECTURE OF UNDERGROUND CABLING
SYSTEM:

Types of underground cables


The underground cables are classified in two ways; by the
voltage capacity, or by the construction.

By Voltage
 LT cables: Low-tension cables with a maximum capacity of
1000 V
 HT Cables: High-tension cables with a maximum of 11KV

 ST cables: Super-tension cables with a rating of between 22

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

 Belted cables: Maximum voltage of 11KVA


 Screened cables: Maximum voltage of 66 KVA
 Pressure cables: Maximum voltage of more than 66KVA

Applications of Underground Power Cables


The applications of Underground Cables include:
 Electrical power is transmitted and distributed through these
cables.
 They are used in places where laying overhead cables becomes
impossible.

DISADVANTAGES OF OVERHEAD LINES:


 These lines are visually pollute the areas where they
are installed.
 These lines suffer from problems such as
terrorism,vandalism, and lighting etc
 Sometimes these lines come in the way of birds and
low flying aircrafts or drones which can be dangerous.

ADVANTAGES OF UNDERGROUND SYSTEM:

The advantages of Underground Cables are:


 More secured compared to overhead cables.
 Completely eliminates electrical and magnetic fields above the
ground level which otherwise would pose a threat to health
concerns.
 Less susceptible to damage caused by heavy rain, wind and
thunderstorms.
o Being exposed to atmosphere cables are free from the

interruptions of supply caused by lightning or thunderstorm or


birds or other severe weather conditions.
o It reduces accident due to breaking of conductors.

o Maintenance cost is low.

o It does not spoil the beauty of the cities.

o These are very much useful in densely populated areas.

Underground cables are suited for places where it is


difficult to use overhead lines due to obstructions and
dangers presented by the overhead lines. There are
different types of cables mostly constructed to handle a
certain range of voltages. Each of the cable type has its
advantages as well as disadvantages. However, the overall
advantages of underground cables outweigh the above
mentioned disadvantages of overhead lines.

 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:

The AT89S52 is a low-power, high-performance CMOS 8-


bit microcontroller with 8K bytes of in-system programmable
Flash memory. The device is manufactured using Atmel’s high-
density nonvolatile memory technology and is compatible with
the indus- try-standard 80C51 instruction set and pinout. The on-
chip Flash allows the program memory to be reprogrammed in-
system or by a conventional nonvolatile memory pro- grammer.
By combining a versatile 8-bit CPU with in-
system programmable Flash on a monolithic chip, the Atmel
AT89S52 is a powerful microcontroller which provides a highly-
flexible and cost-effective solution to many embedded control
applications.
The AT89S52 provides the following standard features: 8K bytes
of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two
data pointers, three 16-bit timer/counters, a six-vector two-
level interrupt architecture, a full duplex serial port, on-
chip oscillator, and clock circuitry. In addition, the AT89S52 is
designed with static logic for operation down to zero frequency
and supports two software selectable power saving modes. The
Idle Mode stops the CPU while allowing the RAM,
timer/counters, serial port, and interrupt system to continue
functioning. The Power-down mode saves the RAM con- tents
but freezes the oscillator, disabling all other chip functions until
the next interrupt or hardware reset.
PIN DIAGRAM OF AT89S52
BLOCK DIAGRAM of AT89S52
Pin Description of AT89S52
Port1 (Pin1 to Pin8): Port1 includes pin1.0 to pin1.7 and these pins can be
configured as input or output pins.
Pin 9 (RST): Reset pin is used to Reset 8051 Microcontroller by giving a
positive pulse to this Pin.
Port3 (Pin 10 to 17): The Port3 Pins are similar to port1 pins and can be
used as universal Input or output pins. These pins dual-function Pins and the
function of each Pin is given as:
Pin 10 (RXD): RXD pin is a Serial Asynchronous Communication Input
or Serial synchronous Communication Output.
Pin 11 (TXD): Serial Asynchronous Communication Output or Serial
Synchronous Communication clock Output.
Pin 12 (INT0): Input of Interrupt 0
Pin 13 (INT1): Input of Interrupt 1
Pin 14 (T0): Input of Counter 0 clock
Pin 15 (T1): Input of Counter 1 clock
Pin 16 (WR): Writing Signal to write content on external RAM.
Pin 17 (RD): Reading Signal to read contents of external RAM.
Pin 18 and 19 (XTAL2, XTAL1): X2 and X1 pins are input output pins for the
oscillator. These pins are used to connect an internal oscillator to the
microcontroller.
Pin 20 (GND): Pin 20 is a ground pin.
Port2 (Pin 21 to Pin28): Port2 includes pin21 to pin28 which can be
configured as Input Output Pins. But, this is only possible when we don’t
use any external memory. If we use external memory, then these pins will
work as high order address bus (A8 to A15).
Pin 29 (PSEN): This pin is used to enable external program memory. If we
use an external ROM for storing the program, then logic 0 appears on it,
which indicates Micro controller to read data from the memory.
Pin 30 (ALE): Address Latch Enable pin is an active high-output signal. If we
use multiple memory chips, then this pin is used to distinguish between
them. This Pin also gives program pulse input during programming of
EPROM.
Pin 31 (EA): If we have to use multiple memories then the application of
logic 1 to this pin instructs the Microcontroller to read data from both
memories: first internal and then external.
Port 0 (Pin 32 to 39): Similar to the port 2 and 3 pins, these pins can be
used as input output pins when we don’t use any external memory. When
ALE or Pin 30 is at 1, then this port is used as data bus: when the ALE pin is
at 0, then this port is used as a lower order address bus (A0 to A7)
Pin40 (VCC): This VCC pin is used for power supply.

16x2 LCD Module


16×2 LCD is named so because; it has 16 Columns and 2 Rows. There are a lot of
combinations available like, 8×1, 8×2, 10×2, 16×1, etc. But the most used one is the
16*2 LCD, hence we are using it here.
All the above mentioned LCD display will have 16 Pins and the programming approach
is also the same. Below is the Pinout and Pin Description of 16x2 LCD Module:
MAX 232
It is an Integrated Circuit (IC) embedded in a single chip and act as a voltage level
converter. MAX 232 is capable of converting 5V TTL Logic level to TIA/EIA-232-
F level and can take up to +-30V input. It is normally used for the communication
between microcontroller and Laptop/PC.

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.

• MAX232 is an integrated circuit (embedded in a single chip) designed by Maxim


Integrated Products and act as a Voltage Logic Converter i.e. it is used to convert
TTL Logic level (Microcontrollers’ COM Port) into TIA/EIA-232-F level (Laptop Serial
Port RS-232) and vice versa.
• It is used for the communication between Microcontroller and PC or laptop.
• 9 Pin Serial Port on our Laptop works on RS232 Voltage Logic while our
Microcontroller’s Serial Port i.e. Tx , RX pins work on TTL Logic.
• Suppose you are working on PIC16F877A Microcontroller and you want to connect to
Serial Pin of your Laptop, then you have to place MAX232 in between.
• In order to use MAX232, we have to design its small basic circuit in which we have to
use 4 capacitors of 1uF, as shown in below figure.
• It has several different applications e.g. computer, modem, battery powered systems
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

Pin # 2 Capacitor 3+ Pin # 10 T2 In

Pin # 3 Capacitor 1- Pin # 11 T1 In

Pin # 4 Capacitor 2+ Pin # 12 R1 Out

Pin # 5 Capacitor 2- Pin # 13 R1 In

Pin # 6 Capacitor 4- Pin # 14 T1 Out

Pin # 7 T2 Out Pin # 15 GND

Pin # 8 R2 In Pin # 16 Vcc

• 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,

logged in - slow blinking).

NOTICE: Be prepared to handle huge power consumption with peek up to 2A.


Maximum voltage on UART in this module is 2.8V. Higher voltage will kill the
module.
This module have two antennas included. First is made of wire (which solders
directly to NET pin on PCB) - very useful in narrow places. Second - PCB antenna
- with double sided tape and attached pigtail cable with IPX connector. This one
have better performance and allows to put your module inside a metal case - as long
the antenna is outside.

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

Pinout (bottom side - left):

 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”.

In this project we have used an AT89S52(8051)


Microcontroller 40 pin IC which has 32 input output
bidirectional pins.
We’ve used sim GSM 800L GPRS sim card
GPS module;GPY 6mV2 and a 16x2 LCD display and 3
relays i.e Red ,Green ,Yellow. Which determines at
ranges of 1 to 4 kilometres. Above mentioned components
belong to hardware kit .
The data is shown in the google maps in the given link

“http://rpihealth.com/iot_cable/”.
The latitude and longitude of the fault location will be
traced by the GPS.

Working Procedure

First the fault is created by using tactile switches t the distance


to be tested in the desired phase or line represented as R,G,Y
Let us assume that fault is created in yellow line at a distance
of 3 km line then the relay corresponding to it detects the fault
and inturn its led bulb glows representing the occurence of fault
in it.
It is also displayed in the 16X2 display GPS location of the
fault is traced and is updated in the server and the message is
sent to a predetermined mobile number.
Software Code
#include<reg52.h>
#include"lcddisplay.h"

#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==0) & (RL2==0) & (RL3==0) & (RL4==0) )


{RLD=0;}
if( (GL1==0) & (GL2==0) & (GL3==0) & (GL4==0) )
{GLD=0;}
if( (YL1==0) & (YL2==0) & (YL3==0) & (YL4==0) )
{YLD=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

The main disadvantage of under ground cables is fault


detection,this device can be used to overcome this problem.It
can be used in urban and metropolitan areas where fault
detection can become a havoc.This device reduces human effort
and also saves money.Reduces time for fault correction as it is a
combination of global local services and electronic components

CONCLUSION

The proposed system is suitable for all places where


Underground cables are laid .It efficiently controls the time of
Fault detection and correction.It also reduces blackouts .In
addition,it has sensors at predetermined distance and GPS which
shows precise location of fault occurence.

S-ar putea să vă placă și