Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
126 views69 pages

Arduino Cable Fault Detection Guide

This project detects faults in underground cables using an Arduino. It applies a low DC voltage to the cable through a series resistor and measures the current. A drop in current could indicate a fault in the cable. The Arduino displays any faults on a liquid crystal display. It was developed by students to fulfill requirements for their Bachelor's degree in electrical engineering. The project aims to provide a low-cost solution to detect cable faults.

Uploaded by

Naziya Begum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views69 pages

Arduino Cable Fault Detection Guide

This project detects faults in underground cables using an Arduino. It applies a low DC voltage to the cable through a series resistor and measures the current. A drop in current could indicate a fault in the cable. The Arduino displays any faults on a liquid crystal display. It was developed by students to fulfill requirements for their Bachelor's degree in electrical engineering. The project aims to provide a low-cost solution to detect cable faults.

Uploaded by

Naziya Begum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

JAYAPRAKASH NARAYAN COLLEGE OF ENGINEERING

Dharmapur, Mahabubnagar – 509 001

AFFILIATED TO JAWAHARLAL Nehru TECHNOLOGICAL UNIVERSITY,

KUKAT PALLY, HYDERABAD – 500082, Telangana, India.

A Dissertation submitted to the Jawaharlal Nehru Technological


University, Hyderabad in partial fulfillment of the requirement for the award of degree of

Bachelor of Technology

in

Electrical & Electronics Engineering

Submitted by

K.JAGAN - 14361A0201

R.PAVAN - 14361A0208

G.PRANAY - 14361A0211

Y.SHEKAR - 14361A0215

G.C.ARUN - 15365A0205

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Under the Guidance of

Mr.Mahesh

(Asst.prof.)

June 2018

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

JAYAPRAKASH NARAYAN COLLEGE OF ENGINEERING


DHARMAPUR,MAHABUBNAGAR

Phones: 08542-275313,275587

AFFILIATED TO JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY,

kukatpally, HYDERABAD – 509001, Telengana, India.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

A Dissertation submitted to the Jawaharlal Nehru Technological University, Hyderabad in


partial fulfillment of the requirement for the award of degree of

Bachelor of Technology

in

Electronics & Electrical Engineering

Submitted by

K.JAGAN - 14361A0201

R.PAVAN - 14361A0208

G.PRANAY - 14361A0211

Y.SHEKAR - 14361A0215

G.C.ARUN - 15365A0205

Under the Guidance of

Mr.Mahesh

(Asst.prof.)

June 2018

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

Jayaprakash Narayan College Of Engineering


Dharmapur,Mahabubnagar.

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Phones: 08542-275313,275587

Web: jpnce.ac.in, Email: [email protected]

JAYAPRAKASH NARAYAN COLLEGE OF ENGINEERING


DHARMAPUR,MAHABUBNAGAR

Phones: 08542-275313,275587

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

CERTIFICATE

Certified that the work entitled ‘ARDUINO BASED UNDERGROUND CABLE


FAULT DETECTION” is a bonafied work carried out by

K.JAGAN(14361A0201),R.PAVAN(14361A0208),G.PRANAY(14361A211),
Y.SHEKAR(14361A0215),G.C.ARUN(15365A0205)Bachelor of Engineering in Electronics &
Communication Engineering of the Jawaharlal Nehru Technological University, Hyderabad
during the year 2017-18. It is certified that all corrections / suggestions indicated for Internal
assessment have been incorporated in the Report deposited in the department library. The
project report has been approved as it satisfies the academic requirements in respect of
Project work prescribed for the said Degree.

Dr.Susant Kumar Panigrahi Dr.Susant Kumar Panigrahi Dr. LinganGouda Kulkarni

Guide Head of the Department Principal


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

External Viva

Name of the examiners: Signature with date

1.

2.

ACKNOWLEDGEMENT
There are many people instrumental for the successful completion of this dissertation work.
First, I owe my parents my deepest gratitude, as nothing would have been really possible
without their constant support and encouragement.

The heights reached by the great men did not come in a single fight, but they, on their way
stepped on successes crossing all the stones of failures. Accordingly I now take up this
privilege of remembering with gratitude those people behind the success of my project,
which really pushed me across the stones of failure.

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

As Noble Laureate Sir Rabindranath Tagore said, “A good teacher explains, a better teacher
demonstrates but the best teacher inspires”, this is how my guide Dr.Susant Kumar Panigrahi
guided me through my project work. I would like to thank him for permitting me to
undertake the dissertation work under his able guidance, and Prof. for his / her very useful
suggestions, support and guidance. They have been pillars of strength, and their presence
has inspired me to do all the better and there aren’t enough words to describe it.

I would be failing in my duty if I don’t thank our beloved H.O.D Dr.Susant Kumar Panigrahi and
our Principal, Dr. LinganGouda Kulakarni for their constant encouragement and resolve.

I also take this opportunity in expressing my gratitude and respect to all those who have
directly and indirectly helped and encouraged me during the course of this project.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

CONTENTS PAGE NO.

1. ABSTRACT 10

2. INTRODUCTION TO EMBEDDED SYSTEMS 13

3. BLOCK DIAGRAM OF PROJECT

4. HARDWARE REQUIREMENTS

4.1 TRANSFORMERS 17

4.2 VOLTAGE REGULATOR (LM7805) 19

4.3 RECTIFIER

4.4 FILTER

22

4..6 LIQUID CRYSTAL DISPLAY 32

4.8 ULN2003

4.9 RELAYS

4.10 1N4007

4.11 RESISTORS

4.12 CAPACITORS

5. SOFTWARE REQUIREMENTS 56

6. SCHEMATIC DIAGRAM 66

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

6.1 DESCRIPTION 67

7. LAYOUT DIAGRAM 71

8. BILL OF MATERIALS 72

10. HARDWARE TESTING 88

10.1 CONTINUITY TEST 88

10.2 POWER ON TEST 89

11. RESULTS 69

12. CONCLUSION 93

13. BIBLIOGRAPHY 94
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

LIST OF FIGURES PAGE NO.

2(a) EMBEDDED DESIGN CALLS 19

2(b) EMBEDDED DESIGN CYCLE 19

3. BLOCK DIAGRAM OF THE PROJECT

4.1 A TYPICAL TRANSFORMER 19

4.2(a) BLOCK DIAGRAM OF VOLTAGE REGULATOR 21

4.2(b) RATING OF VOLTAGE REGULATOR 22

4.2(c) PERFORMANCE CHARACTERISTICS

OF VOLTAGE REGULATOR 22

4.5(a) BLOCK DIAGRAM OF AT89S52 27

4.5(b) PIN DIAGRAM OF AT89S52 28

4.5(c) OSCILLATOR CONNECTIONS 3

4.2(d) EXTERNAL CLOCK DRIVE CONFIG. 3

4.6 LIQUID CRYSTAL DISPLAY

6. SCHEMATIC

7. LAYOUT

1. ABSTRACT
The project uses the standard concept of Ohms law i.e., when a low DC voltage is applied at the

feeder end through a series resistor (Cable lines), then current would vary depending upon the

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

location of fault in the cable. In case there is a short circuit (Line to Ground), the voltage across

series resistors changes accordingly, which is then fed to inbuilt ADC of Arduino board to

develop precise digital data for display in kilometers.

The project is assembled with a set of resistors representing cable length in KM’s and 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 and the respective phase is displayed on a LCD

interfaced to the Arduino board.

2. INTRODUCTION TO EMBEDDED SYSTEMS


What is embedded system?
An Embedded System is a combination of computer hardware and software, and perhaps
additional mechanical or other parts, designed to perform a specific function. An embedded
system is a microcontroller-based, software driven, reliable, real-time control system,
autonomous, or human or network interactive, operating on diverse physical variables and in
diverse environments and sold into a competitive and cost conscious market.
An embedded system is not a computer system that is used primarily for processing, not a
software system on PC or UNIX, not a traditional business or scientific application. High-end
embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit
Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc .Lower
end embedded systems - Generally 8,16 Bit Controllers used with an minimal operating systems
and hardware layout designed for the specific purpose.

EMBEDDED SYSTEM DESIGN CYCLE


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Figure 3(b) “V Diagram”

Characteristics of Embedded System


​ An embedded system is any computer system hidden inside a product other than a
computer
​ Embedded systems have a microprocessor/ microcontroller and a memory. Some have a
serial port or a network connection. They usually do not have keyboards, screen drives.
APPLICATIONS
1) Military and aerospace embedded software applications
2) Communication Applications
3) Industrial automation and process control software
4) Mastering the complexity of applications.
5) Reduction of product design time.
6) Real time processing of ever increasing amounts of data.
7) Intelligent, autonomous sensors.

CLASSIFICATION
​ Real Time Systems.
​ A right answer after the dead line is a wrong answer.
11

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

​HARD REAL TIME SYSTEM


​ "Hard" real-time systems have very narrow response time.
​ Example: Nuclear power system, Cardiac pacemaker.

​SOFT REAL TIME SYSTEM


​ "Soft" real-time systems have reduced constrains on "lateness" but still must operate very
quickly and repeatable.
​ Example: Railway reservation system – takes a few extra seconds the data remains valid.

3.PROJECT BLOCK DIAGRAM

4. HARDWARE REQUIREMENTS
1. TRANSFORMER (230 – 12 V AC)

2. VOLTAGE REGULATOR (LM 7805)

3. RECTIFIER

4. FILTER
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

5. MICROCONTROLLER (AT89S52/AT89C51)

6. LIQUID CRYSTAL DISPLAY

7. ADC0804

8. ULN2003

9. RELAYS

10. IN4007

11. RESISTORS

12. CAPACITORS

4.1 TRANSFORMER
Transformers convert AC electricity from one voltage to another with a little loss of power.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most power
supplies use a step-down transformer to reduce the dangerously high voltage to a safer low
voltage.

FIG 4.1: A TYPICAL TRANSFORMER

The input coil is called the primary and the output coil is called the secondary. There is no
electrical connection between the two coils; instead they are linked by an alternating magnetic
field created in the soft-iron core of the transformer. The two lines in the middle of the circuit
symbol represent the core. Transformers waste very little power so the power out is (almost)
equal to the power in. Note that as voltage is stepped down and current is stepped up.
13

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

TURNS RATIO = (Vp / Vs) = ( Np / Ns )

Where,
Vp = primary (input) voltage.
Vs = secondary (output) voltage
Np = number of turns on primary coil
Ns = number of turns on secondary coil
Ip = primary (input) current
Is = secondary (output) current.

Ideal power equation

The ideal transformer as a circuit element

If the secondary coil is attached to a load that allows current to flow, electrical power is
transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly
efficient; all the incoming energy is transformed from the primary circuit to the magnetic field
and into the secondary circuit. If this condition is met, the incoming electric power must equal
the outgoing power:
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Giving the ideal transformer equation

Transformers normally have high efficiency, so this formula is a reasonable approximation.

If the voltage is increased, then the current is decreased by the same factor. The impedance in
one circuit is transformed by the square of the turns ratio. For example, if an impedance Zs is
attached across the terminals of the secondary coil, it appears to the primary circuit to have an
impedance of (Np/Ns)2Zs. This relationship is reciprocal, so that the impedance Zp of the primary
circuit appears to the secondary to be (Ns/Np)2Zp.

4.2 VOLTAGE REGULATOR 7805


Features
• Output Current up to 1A.
• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V.
• Thermal Overload Protection.
• Short Circuit Protection.
• Output Transistor Safe Operating Area Protection.

15

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Description
The LM78XX/LM78XXA series of three-terminal positive regulators are available in the
TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide
range of applications. Each type employs internal current limiting, thermal shutdown and safe
operating area protection, making it essentially indestructible. If adequate heat sinking is
provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage
regulators, these devices can be used with external components to obtain adjustable voltages and
currents.

Internal Block Diagram


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

FIG 4.2(a): BLOCK DIAGRAM OF VOLTAGE REGULATOR

Absolute Maximum Ratings

TABLE 4.2(b): RATINGS OF THE VOLTAGE REGULATOR

4.3 RECTIFIER
A rectifier is an electrical device that converts alternating current (AC), which periodically
reverses direction, to direct current (DC), current that flows in only one direction, a process
known as rectification. Rectifiers have many uses including as components of power supplies
and as detectors of radio signals. Rectifiers may be made of solid state diodes, vacuum tube
diodes, mercury arc valves, and other components. The output from the transformer is fed to the
rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave
rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full

17

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

wave rectification. In positive half cycle only two diodes( 1 set of parallel diodes) will conduct,
in negative half cycle remaining two diodes will conduct and they will conduct only in forward
bias only.

4.4 FILTER
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and
smoothens the D.C. Output received from this filter is constant until the mains voltage and load
is maintained constant. However, if either of the two is varied, D.C. voltage received at this point
changes. Therefore a regulator is applied at the output stage.
The simple capacitor filter is the most basic type of power supply filter. The use of this filter is
very limited. It is sometimes used on extremely high-voltage, low-current power supplies for
cathode-ray and similar electron tubes that require very little load current from the supply. This
filter is also used in circuits where the power-supply ripple frequency is not critical and can be
relatively high. Below figure can show how the capacitor changes and discharges.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

4.5 LCD
Description:
This is the example for the Parallel Port. This example doesn't use the Bi-directional feature
found on newer ports, thus it should work with most, if not all Parallel Ports. It however doesn't
show the use of the Status Port as an input for a 16 Character x 2 Line LCD Module to the
Parallel Port. These LCD Modules are very common these days, and are quite simple to work
with, as all the logic required running them is on board.

Pros:

​ Very compact and light


​ Low power consumption

​ No geometric distortion

​ Little or no flicker depending on backlight technology

19

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

​ Not affected by screen burn-in

​ No high voltage or other hazards present during repair/service

​ Can be made in almost any size or shape

LCD Background:
Frequently, an 8051 program must interact with the outside world using input and output devices
that communicate directly with a human being. One of the most common devices attached to an
8051 is an LCD display. Some of the most common LCDs connected to the 8051 are 16x2 and
20x2 displays. This means 16 characters per line by 2 lines and 20 characters per line by 2 lines,
respectively.

FIG 4.10: LCD

44780 LCD BACKGROUND

The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The
user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit
data bus is used the LCD will require a total of 7 data lines (3 control lines plus the 4 lines for
the data bus). If an 8-bit data bus is used the LCD will require a total of 11 data lines (3 control
lines plus the 8 lines for the data bus).
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

4.8 ULN2003
RELAY DRIVER:
ULN2003 is a high voltage and high current Darlington transistor array.

DESCRIPTION:
The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays. It
consists of seven NPN Darlington pairs that feature high-voltage outputs with common-cathode
Clamp diode for switching inductive loads. The collector-current rating of a single Darlington
pair is 500mA. The Darlington pairs may be paralleled for higher current capability.
Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED gas
discharge), line drivers, and logic buffers.
The ULN2003 has a 2.7kW series base resistor for each Darlington pair for operation directly
with TTL or 5V CMOS devices.

21

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Fig: ULN 2003


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

FEATURES:

​ Pin no.:16

​ Temperature, Operating Range:-20°C to +85°C

​ Transistor Polarity: NPN

​ Transistors, No. of:7

​ Case Style:DIP-16

​ Temp, Op. Min:-20°C

​ Temp, Op. Max:85°C

​ Base Number:2003

​ Channels, No. of:7

​ Current, Output Max:500mA

​ Device Marking:ULN2003A

​ IC Generic Number:2003

​ Input Type: TTL, CMOS 5V

​ Logic Function Number:2003

​ Output Type: Open Collector 

​ Transistor Type: Power Darlington

​ Voltage, Input Max:5V

​ Voltage, Output Max:50V

23

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

PIN Diagram:

Fig: Schematics of Darlington’s pair


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Fig: Darlington pair

 
Darlington pairs are back to back connection of two transistors with some source resistors and
when they are arranged as shown in the circuit they are used to amplify weak signals. The
amount by which the weak signal is amplified is called the ‘GAIN’. .

FEATURES OF DRIVER:
​ Seven Darlington’s per package

​ Output currents500mA per driver(600mA peak)

​ Integrated suppression diodes for inductive loads

​ Outputs can be paralleled for high currents

​ TTL/CMOS/PMOS/DTL compatible inputs.

​ Inputs pinned opposite to outputs

​ Simplified layout

25

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Figure shows the Darlington pair connection of transistor. The circuit above is a ‘Darlington
Pair’ driver. The first transistor’s emitter feeds into the second transistor’s base and as a result
the input signal is amplified by the time it reaches the output. The important point to remember
is that the Darlington Pair is made up of two transistors

FEATURES
* 500mA rated collector current (Single output).
* High-voltage outputs: 50V.
* Inputs compatible with various types of logic.
* Relay driver application.

4.9 RELAY
A relay is an electrically operated switch. Many relays use an electromagnet to operate a
switching mechanism mechanically, but other operating principles are also used. Relays are used
where it is necessary to control a circuit by a low-power signal (with complete electrical
isolation between control and controlled circuits), or where several circuits must be controlled by
one signal.

A relay is an electrically operated switch. Current flowing through the coil of the relay creates a
magnetic field which attracts a lever and changes the switch contacts.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Fig 4.8 Relay showing coil and switch contacts

Relays allow one circuit to switch a second circuit which can be completely separate from the
first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains
circuit. There is no electrical connection inside the relay between the two circuits; the link is
magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be
as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot
provide this current and a transistor is usually used to amplify the small IC current to the larger
value required for the relay coil. The maximum output current for the popular 555 timer IC is
200mA so these devices can supply relay coils directly without amplification.
Relays are usually SPDT or DPDT but they can have many more sets of switch contacts, for
example relays with 4 sets of changeover contacts are readily available. For further information
about switch contacts and the terms used to describe them please see the page on switches.

Applications of relays
Relays are used to and for:

​ Control a high-voltage circuit with a low-voltage signal, as in some types of modems or


audio amplifiers.

27

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

​ Control a high-current circuit with a low-current signal, as in the starter solenoid of an


automobile.
​ Detect and isolate faults on transmission and distribution lines by opening and closing
circuit breakers.

4.10 IN4007
Diodes are used to convert AC into DC these are used as half wave rectifier or full
wave rectifier. Three points must he kept in mind while using any type of diode
1.Maximum forward current capacity
2.Maximum reverse voltage capacity
3.Maximum forward voltage capacity

Fig: 1N4007 diodes


The number and voltage capacity of some of the important diodes available in the market are as
follows:
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Fig:PN Junction diode

PN JUNCTION OPERATION

Now that you are familiar with P- and N-type materials, how these materials are joined together
to form a diode, and the function of the diode, let us continue our discussion with the operation
of the PN junction. But before we can understand how the PN junction works, we must first
consider current flow in the materials that make up the junction and what happens initially
within the junction when these two materials are joined together.

Current Flow in the N-Type Material

Conduction in the N-type semiconductor, or crystal, is similar to conduction in a copper wire.


That is, with voltage applied across the material, electrons will move through the crystal just as
current would flow in a copper wire. This is shown in figure 1-15. The positive potential of the
battery will attract the free electrons in the crystal. These electrons will leave the crystal and
flow into the positive terminal of the battery. As an electron leaves the crystal, an electron from
the negative terminal of the battery will enter the crystal, thus completing the current path. Therefore,

29

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

the majority current carriers in the N-type material (electrons) are repelled by the negative side of
the battery and move through the crystal toward the positive side of the battery.

Current Flow in the P-Type Material

Current flow through the P-type material is illustrated. Conduction in the P material is by
positive holes, instead of negative electrons. A hole moves from the positive terminal of the P
material to the negative terminal. Electrons from the external circuit enter the negative terminal
of the material and fill holes in the vicinity of this terminal. At the positive terminal, electrons
are removed from the covalent bonds, thus creating new holes. This process continues as the
steady stream of holes (hole current) moves toward the negative terminal

4.11 RESISTORS
A resistor is a two-terminal electronic component designed to oppose an electric current by
producing a voltage drop between its terminals in proportion to the current, that is, in accordance
with Ohm's law:
V = IR
Resistors are used as part of electrical networks and electronic circuits. They are extremely
commonplace in most electronic equipment. Practical resistors can be made of various
compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as
nickel/chrome).
The primary characteristics of resistors are their resistance and the power they can dissipate.
Other characteristics include temperature coefficient, noise, and inductance. Less well-known is
critical resistance, the value below which power dissipation limits the maximum permitted
current flow, and above which the limit is applied voltage. Critical resistance depends upon the
materials constituting the resistor as well as its physical dimensions; it's determined by design.
Resistors can be integrated into hybrid and printed circuits, as well as integrated circuits. Size,
and position of leads (or terminals) are relevant to equipment designers; resistors must be
physically large enough not to overheat when dissipating their power.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

A resistor is a two-terminal passive electronic component which implements electrical resistance


as a circuit element. When a voltage V is applied across the terminals of a resistor, a current I
will flow through the resistor in direct proportion to that voltage. The reciprocal of the constant
of proportionality is known as the resistance R, since, with a given voltage V, a larger value of R
further "resists" the flow of current I as given by Ohm's law:

Resistors are common elements of electrical networks and electronic circuits and are ubiquitous
in most electronic equipment. Practical resistors can be made of various compounds and films,
as well as resistance wire (wire made of a high-resistivity alloy, such as nickel-chrome).
Resistors are also implemented within integrated circuits, particularly analog devices, and can
also be integrated into hybrid and printed circuits.
The electrical functionality of a resistor is specified by its resistance: common commercial
resistors are manufactured over a range of more than 9 orders of magnitude. When specifying
that resistance in an electronic design, the required precision of the resistance may require
attention to the manufacturing tolerance of the chosen resistor, according to its specific
application. The temperature coefficient of the resistance may also be of concern in some
precision applications. Practical resistors are also specified as having a maximum power rating

31

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is
mainly of concern in power electronics applications. Resistors with higher power ratings are
physically larger and may require heat sinking. In a high voltage circuit, attention must
sometimes be paid to the rated maximum working voltage of the resistor.

​Units
The ohm (symbol: Ω) is the SI unit of electrical resistance, named after Georg Simon Ohm. An
ohm is equivalent to a volt per ampere. Since resistors are specified and manufactured over a
very large range of values, the derived units of milliohm (1 mΩ = 10−3 Ω), kilohm (1 kΩ = 103
Ω), and megohm (1 MΩ = 106 Ω) are also in common usage.
The reciprocal of resistance R is called conductance G = 1/R and is measured in Siemens (SI
−1
unit), sometimes referred to as a mho. Thus a Siemens is the reciprocal of an ohm: S = Ω .
Although the concept of conductance is often used in circuit analysis, practical resistors are
always specified in terms of their resistance (ohms) rather than conductance.

4.12 CAPACITORS

A capacitor or condenser is a passive electronic component consisting of a pair of conductors


separated by a dielectric. When a voltage potential difference exists between the conductors, an
electric field is present in the dielectric. This field stores energy and produces a mechanical force
between the plates. The effect is greatest between wide, flat, parallel, narrowly separated
conductors.
An ideal capacitor is characterized by a single constant value, capacitance, which is measured in
farads. This is the ratio of the electric charge on each conductor to the potential difference
between them. In practice, the dielectric between the plates passes a small amount of leakage
current. The conductors and leads introduce an equivalent series resistance and the dielectric has
an electric field strength limit resulting in a breakdown voltage.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

The properties of capacitors in a circuit may determine the resonant frequency and quality factor
of a resonant circuit, power dissipation and operating frequency in a digital logic circuit, energy
capacity in a high-power system, and many other important aspects.

A capacitor (formerly known as condenser) is a device for storing electric charge. The forms of
practical capacitors vary widely, but all contain at least two conductors separated by a
non-conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils
separated by a layer of insulating film.
Capacitors are widely used in electronic circuits for blocking direct current while allowing
alternating current to pass, in filter networks, for smoothing the output of power supplies, in the
resonant circuits that tune radios to particular frequencies and for many other purposes.
A capacitor is a passive electronic component consisting of a pair of conductors separated by a
dielectric (insulator). When there is a potential difference (voltage) across the conductors, a
static electric field develops in the dielectric that stores energy and produces a mechanical force

33

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

between the conductors. An ideal capacitor is characterized by a single constant value,


capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the
potential difference between them.
The capacitance is greatest when there is a narrow separation between large areas of conductor,
hence capacitor conductors are often called "plates", referring to an early means of construction.
In practice the dielectric between the plates passes a small amount of leakage current and also
has an electric field strength limit, resulting in a breakdown voltage, while the conductors and
leads introduce an undesired inductance and resistance.

​Theory of operation
Capacitance

Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric


(orange) reduces the field and increases the capacitance.

A capacitor consists of two conductors separated by a non-conductive region. The


non-conductive region is called the dielectric or sometimes the dielectric medium. In simpler
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

terms, the dielectric is just an electrical insulator. Examples of dielectric mediums are glass, air,
paper, vacuum, and even a semiconductor depletion region chemically identical to the
conductors. A capacitor is assumed to be self-contained and isolated, with no net electric charge
and no influence from any external electric field. The conductors thus hold equal and opposite
charges on their facing surfaces, and the dielectric develops an electric field. In SI units, a
capacitance of one farad means that one coulomb of charge on each conductor causes a voltage
of one volt across the device.
The capacitor is a reasonably general model for electric fields within electric circuits. An ideal
capacitor is wholly characterized by a constant capacitance C, defined as the ratio of charge ±Q
on each conductor to the voltage V between them:

Sometimes charge build-up affects the capacitor mechanically, causing its capacitance to vary. In
this case, capacitance is defined in terms of incremental changes:

​Energy storage
Work must be done by an external influence to "move" charge between the conductors in a
capacitor. When the external influence is removed the charge separation persists in the electric
field and energy is stored to be released when the charge is allowed to return to its equilibrium
position. The work done in establishing the electric field, and hence the amount of energy stored,
is given by:

​Current-voltage relation
The current i(t) through any component in an electric circuit is defined as the rate of flow of a
charge q(t) passing through it, but actual charges, electrons, cannot pass through the dielectric
layer of a capacitor, rather an electron accumulates on the negative plate for each one that leaves

35

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

the positive plate, resulting in an electron depletion and consequent positive charge on one
electrode that is equal and opposite to the accumulated negative charge on the other. Thus the
charge on the electrodes is equal to the integral of the current as well as proportional to the
voltage as discussed above. As with any antiderivative, a constant of integration is added to
represent the initial voltage v (t0). This is the integral form of the capacitor equation,

.
Taking the derivative of this, and multiplying by C, yields the derivative form,

.
The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than
the electric field. Its current-voltage relation is obtained by exchanging current and voltage in the
capacitor equations and replacing C with the inductance L.

5. SOFTWARE REQUIREMENTS
5.1 ARDUINO PROGRAMMING LANGUAGE

The Arduino microcontroller is an easy to use yet powerful single board computer that has
gained considerable traction in the hobby and professional market . The Arduino is
open-source, which means hardware is reasonably priced and development software .

This is what the Arduino board looks like.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

The Arduino programming language is a simplified version of C/C++. If you know C,


programming the Arduino will be familiar. If you do not know C, no need to worry as only a few
commands are needed to perform useful functions.

An important feature of the Arduino is that you can create a control program on the host PC,
download it to the Arduino and it will run automatically. Remove the USB cable connection to
the PC, and the program will still run from the top each time you push the reset button. Remove
the battery and put the Arduino board in a closet for six months. When you reconnect the battery,
the last program you stored will run. This means that you connect the board to the host PC to
develop and debug your program, but once that is done, you no longer need the PC to run the
program.

1.2 What You Need for a Working System


1. Arduino Duemilanove board
2. USB programming cable (A to B)
3. 9V battery or external power supply (for stand-alone operation)
4. Solder less breadboard for external circuits, and 22 g solid wire for connections
5. Host PC running the Arduino development environment. Versions exist for Windows, Mac
and Linux

1.3 Installing the Software


Follow the instructions on the Getting Started section of the Arduino web site,

37

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

http://arduino.cc/en/Guide/HomePage. Go all the way through the steps to where you see the
pin 13 LED blinking. This is the indication that you have all software and drivers successfully
installed and can start exploring with your own programs.

1.4 Connecting a Battery


For stand-alone operation, the board is powered by a battery rather than through the USB
connection to the computer. While the external power can be anywhere in the range of 6 to 24 V
(for example, you could use a car battery), a standard 9 V battery is convenient. While you
could jam the leads of a battery snap into the Vin and Gnd connections on the board, it is better
to solder the battery snap leads to a DC power plug and connect to the power jack on the board.
Disconnect your Arduino from the computer. Connect a 9 V battery to the Arduino power jack
using the battery snap adapter. Confirm that the blinking program runs. This shows that you can
power the Arduino from a battery and that the program you download runs without needing a
connection to the host PC

Congratulations; you have created and run your first Arduino program.Push the Arduino reset
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

button a few times and see what happens.

1.6 Troubleshooting

If there is a syntax error in the program caused by a mistake in typing, an error message will
appear in the bottom of the program window. Generally, staring at the error will reveal the
problem. If you continue to have problems, try these ideas
​ Run the Arduino program again
​ Check that the USB cable is secure at both ends.
​ Reboot your PC because sometimes the serial port can lock up
​ If a “Serial port…already in use” error appears when uploading
​ Ask a friend for help

1.7 Solderless Breadboards


A solderless breadboard is an essential tool for rapidly prototyping electronic circuits.
Components and wire push into breadboard holes. Rows and columns of holes are internally
connected to make connections easy. Wires run from the breadboard to the I/O pins on the
Arduino board. Make connections using short lengths of 22 g solid wire stripped of insulation
about 0.25” at each end. Here is a photo of a breadboard showing which runs are connected
internally. The pairs of horizontal runs at the top and bottom are useful for running power and
ground. Convention is to make the red colored run +5 V and the blue colored run Gnd. The
power runs are sometimes called “power busses”.

2 Flashing an LED

Light emitting diodes (LED's) are handy for checking out what the Arduino can do.. For this
task, you need an LED, a 330 ohm resistor, and some short .
Connect the notched or flat side of the LED (the notch or flat is on the rim that surrounds the
LED base; look carefully because it can be hard to find) to the Gnd bus and the other side to a

39

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

free hole in main area of the breadboard Place the resistor so that one end is in the same column
as the LED and the other end is in a free column. From that column, connect a wire to digital pin
2 on the Arduino board. Your setup will look something like this

PIN 2 330

Gnd

Did the LED light up for one second? Push the Arduino reset button to run the program again.
The pinMode command sets the LED pin to be an output. The first digitalWrite command says
to set pin 2 of the Arduino to HIGH, or +5 volts. This sends current from the pin, through the
resistor, through the LED (which lights it) and to ground. The delay(500) command waits for
500 msec. The second digitalWrite command sets pin 2 to LOW or 0 V stopping the current
thereby turning the LED off. Code within the brackets defining the loop() function is repeated
forever, which is why the LED blinks.

This exercise shows how the Arduino can control the outside world. With proper interface
circuitry the same code can turn on and off motors, relays, solenoids, electromagnets,
pneumatic valves or any other on-off type device.

3.Reading switch
Open the Serial Monitor window. When the switch is open, you should see a train of 1's on the
screen. When closed, the 1's change to 0's. On the hardware side, when the switch is open, no
current flows through the resistor. When no current flows through a resistor, there is no voltage
drop across the resistor, which means the voltage on each side is the same. In your circuit, when
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

the switch is open, pin 3 is at 5 volts which the computer reads as a 1 state. When the switch is
closed, pin 3 is directly connected to ground, which is at 0 volts. The computer reads this as a 0
state.

Now try this program which is an example of how you can have the computer sit and wait for a
sensor to change state.
4.Controlling a Small DC Motor

The Arduino can control a small DC motor through a transistor switch. You will need a TIP120
transistor, a 1K resistor a 9V battery with battery snap and a motor.

pin 2 can be any digital I/O pin on your Arduino. Connect the minus of the battery to the emitter
of the transistor (E pin) and also connect the emitter of the transistor to Gnd on the Arduino
board.
To check if things are working, take a jumper wire and short the collector to the emitter pins of
the transistor. The motor should turn on. Next, disconnect the 1K resistor from pin 2 and jumper
it to +5V. The motor should turn on. Put the resistor back into pin 2 and run the following test
program:

5. Arduino Hardware
41

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

The power of the Arduino is not its ability to crunch code, but rather its ability to interact with the
outside world through its input-output (I/O) pins. The Arduino has 14 digital I/O pins labeled 0 to 13
that can be used to turn motors and lights on and off and read the state of switches.
Each digital pin can sink or source about 40 mA of current. This is more than adequate for
interfacing to most devices, but does mean that interface circuits are needed to control devices
other than simple LED's. In other words, you cannot run a motor directly using the current
available from an Arduino pin, but rather must have the pin drive an interface circuit that in turn
drives the motor. A later section of this document shows how to interface to a small motor.
To interact with the outside world, the program sets digital pins to a high or low value using C
code instructions, which corresponds to +5 V or 0 V at the pin. The pin is connected to external
interface electronics and then to the device being switched on and off. The sequence of events is
shown in this figure.

Program sets pin digitalWrite(4,HIGH);


high/low (1/0) digitalWrite(4,LOW);

+5V
0V
Board pin
set to +5V/0V

+12 V

Interface
electronics use
signal voltages and
1K
PIN 4
power supply to TIP120

switch motor
on/off
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

To determine the state of switches and other sensors, the Arduino is able to read the voltage
value applied to its pins as a binary number. The interface circuitry translates the sensor signal
into a 0 or +5 V signal applied to the digital I/O pin. Through a program command, the Ardiomp
interrogates the state of the pin. If the pin is at 0 V, the program will read it as a 0 or LOW. If it
is at +5 V, the program will read it as a 1 or HIGH. If more than +5 V is applied, you may blow
out your board, so be careful. The sequence of events to read a pin is shown in this figure.

Program reads digitalRead(4);


value of pins (1/0)
+5V
0V
Board pins
set to +5V/0V

The set of valid instructions comes from the particular programming language used. There are
many languages, including C, C++, Java, Ada, Lisp, Fortran, Basic, Pascal, Perl, and a thousand
others. The Arduino uses a simplified variation of the C programming language.
For any programming language, the instructions must be entered in a specific syntax in order for
the computer to interpret them properly. Typically, the interpretation is a two step process. A
compiler takes the language specific text you enter for the program and converts it into a
machine readable form that is downloaded into the processor. When the program executes, the
processor executes the machine code line by line.

6.1 Basics of Programming Languages

All sequential programming languages have four categories of instructions. First are operation

43

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

commands that evaluate an expression, perform arithmetic, toggle states of I/O lines, and many
other operations. Second are jump commands that cause the program to jump immediately to
another part of the program that is tagged with a label. Jumps are one way to break out of the
normal line-by-line processing mode. For example, if you want a program to repeat over and
over without stopping, have the last line of the program be a jump command that takes the
program back to its first line. Third are branch commands that evaluate a condition and jump if
the condition is true. For example, you might want to jump only if a number is greater than zero.
Or, you might want to jump only if the state of an i/o line is low. Fourth are loop commands that
repeat a section of code a specified number of times. For example, with a loop you can have a
light flash on and off exactly six times.
Most programming languages contain a relatively small number of commands. The complexity
of computers comes from combining and repeating the instructions several million times a
second.

Here's a generic program.

The computer will execute this line by line. The art of programming is simply a matter of
translating your intent into a sequence of instructions that match.

Here is an example of a for loop command followed by a branch command that uses an IF
statement

The commands inside the loop will be repeated six times. Following this, if the value of
the variable j is greater than 4, the program will skip to the instruction tagged with the
specified label, and if not, the line following the if statement will be executed.

In addition to the basic commands, languages have the ability to call functions which are
independent sections of code that perform a specific task. Functions are a way of calling a
section of code from a number of different places in the program and then returning from that
section to the line that follows the calling line. Here's an example
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

The function apples is everything between the set of braces that follows “apples()”. When
the function completes, the program jumps back to the line following the line that called the
function.

6.2 Digital Numbers


When working with a microcontroller that interacts with the real world, you have to dig a little
below the surface to understand numbering systems and data sizes.
A binary (base 2) variable has two states, off and on, or 0 and 1, or low and high. At their core,
all computers work in binary since their internal transistors can only be off or on and nothing
between. Numbers are built up from many digits of binary numbers, in much the same way that
in the base 10 system we create numbers greater than 9 by using multiple digits.
A bit is one binary digit that can take on values of either 0 or 1. A byte is a number comprised of
8 bits, or 8 binary digits. By convention, the bits that make up a byte are labeled right to left with
bit 0 being the rightmost or least significant bit as shown below

b7 b6 b5 b4 b3 b2 b1 b0

Thus, in the binary number 011, bits 0 and 1 are 1 while bit 2 is 0. In the binary number
1000001, bits 0 and 7 are 1 and the rest are zero.
Here are a few binary to decimal conversions for byte size numbers.

Binary Decimal
00000011 3

00000111 7

11111111 255

In a computer, variables are used to store numbers. A bit variable can take on two values, 0 and
1, and is typically used as a true/false flag in a program. A byte variable can take on integer
45

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

values 0-255 decimal while a 16-bit word variable can take on integer values 0-65,535. Variables
can be either signed (positive and negative values) or unsigned (positive only).

7. Arduino Programming Language


The Arduino runs a simplified version of the C programming language, with some extensions for
accessing the hardware. In this guide, we will cover the subset of the programming language that
is most useful to the novice Arduino designer.
All Arduino instructions are one line. The board can hold a program hundreds of lines long and
has space for about 1,000 two-byte variables. The Arduino executes programs at about 300,000
source code lines per sec.
7.1 Creating a Program
Programs are created in the Arduino development environment and then downloaded to the
Arduino board. Code must be entered in the proper syntax which means using valid
command names and a valid grammar for each code line. The compiler will catch and flag
syntax errors before download. Sometimes the error message can be cryptic and you have to
do a bit of hunting because the actual error occurred before what was flagged.
Although your program may pass cleanly through the syntax checker, it still might not do what
you wanted it to. Here is where you have to hone your skills at code debugging. The Arduino did
what you told it to do rather than what you wanted it to do. The best way to catch these errors is
to read the code line by line and be the computer. Having another person go through your code
also helps. Skilled debugging takes practice.

7.2 Program Formatting and Syntax


Programs are entered line by line. Code is case sensitive which means "myvariable" is different
than "MyVariable".
Statements are any command. Statements are terminated with a semi-colon. A classic mistake is
to forget the semi-colon so if your program does not compile, examine the error text and see if
you forgot to enter a colon.
Comments are any text that follows “//” on a line. For multi-line block comments, begin with
“/*” and end with “*/”
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Constants are fixed numbers and can be entered as ordinary decimal numbers (integer only) or
in hexadecimal (base 16) or in binary (base 2) as shown in the table below
Labels are used to reference locations in your program. They can be any combination of letters,
numbers and underscore (_), but the first character must be a letter. When used to mark a
location, follow the label with a colon. When referring to an address label in an instruction line,
don't use the colon. Here's an example
Use labels sparingly as they can actually make a program difficult to follow and
Here is the same using a symbol to define "LED"

#define LED 2 // define the LED pin

void setup()

{
pinMode(LED,OUTPUT);

void loop()

digitalWrite(LED,HIGH);

delay(500);
digitalWrite(LED,LOW);
delay(500);

Note how the use of symbols reduces the need for comments. Symbols are extremely useful to
define for devices connected to pins because if you have to change the pin that the device
connects to, you only have to change the single symbol definition rather than going through the
whole program looking for references to that pin.

7.3 Program Structure


All Arduino programs have two functions, setup() and loop(). The instructions you place in the

47

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

startup() function are executed once when the program begins and are used to initialize. Use it to
set directions of pins or to initialize variables. The instructions placed in loop are executed
repeatedly and form the main tasks of the program. Therefore every program has this structure
The program performs no function, but is useful for clearing out any old program. Note that the
compiler does not care about line returns, which is why this program works if typed all on one
line.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

7.4 Math
The Arduino can do standard mathematical operations. While floating point (e.g. 23.2) numbers
are allowed if declared as floats, operations on floats are very slow so integer variables and
integer math is recommended. If you have byte variables, no number, nor the result of any math
operation can fall outside the range of 0 to 255. You can divide numbers, but the result will be
truncated (not rounded) to the nearest integer. Thus in integer arithmetic, 17/3 = 5, and not 5.666
and not 6. Math operations are performed strictly in a left-to-right order. You can add parenthesis
to group operations.
The table below shows some of the valid math operators. Full details of their use can be found
in the Arduino Language Reference.

Symbol Description
+ addition
- subtraction
* multiplication
/ division
% modulus (division remainder)
<< left bit shift
>> right bit shift
& bitwise AND
| bitwise OR

8 The Simple Commands

This section covers the small set of commands you need to make the Arduino do something
useful. These commands appear in order of priority. You can make a great machine using only
digital read, digital write and delay commands. Learning all the commands here will take you
to the next level.
PIN MODE
This command, which goes in the setup() function, is used to set the direction of a digital I/O
pin. Set the pin to OUTPUT if the pin is driving and LED, motor or other device. Set the pin to
INPUT if the pin is reading a switch or other sensor. On power up or reset, all pins default to
inputs. This example sets pin 2 to an output and pin 3 to an input.

49

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Serial.print
The Serial.print command lets you see what's going on inside te Arduino from your computer.
For example, you can see the result of a math operation to determine if you are getting the right
number. Or, you can see the state of a digital input pin to see if the Arduino is a sensor or switch
properly. When your interface circuits or program does not seem to be working, use the
Serial.print command to shed a little light on the situation. For this command to show anything,
you need to have the Arduino connected to the host computer with the USB cable.
You may have noticed when trying this out that if you leave one of the pins disconnected, its
state follows the other. This is because a pin left floating has an undefined value and will wander
from high to low. So, use two jumper wires when trying out this example.
Here's one that checks the value of a variable after an addition. Because the calculation is done
just once, all the code is in the setup() function. The Serial.flush()

int i,j,k;
void setup()

{
Serial.begin(9600);
i=21;

j=20;
k=i+j;

Serial.flush();
Serial.print(k);
}

void loop() {}

DIGITAL WRITE

This command sets an I/O pin high (+5V) or low (0V) and is the workhorse for commanding the
outside world of lights, motors, and anything else interfaced to your board. Use the pinMode()
command in the setup() function to set the pin to an output.

digitalWrite(2,HIGH); // sets pin 2 to +5 volts


digitalWrite(2,LOW); // sets pin 2 to zero volts
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

DELAY
Delay pauses the program for a specified number of milliseconds. Since most interactions with
the world involve timing, this is an essential instruction. The delay can be for 0 to 4,294,967,295
m sec. This code snippet turn on pin 2 for 1 second.

digitalWrite(2,HIGH); // pin 2 high (LED on)


delay(1000); // wait 500 ms
digitalWrite(2,LOW); // pin 2 low (LED off)
IF
This is the basic conditional branch instruction that allows your program to do two different
things depending on whether a specified condition is true or false.
Here is one way to have your program wait in place until a switch is closed. Connect a switch to
pin 3 as shown in Section 3. Upload this program then try closing the switch

void setup()

{
Serial.begin(9600);

void loop()
{

if (digitalRead(3) == LOW) {
Serial.println("Somebody closed the switch!");
}

}
The if line reads the state of pin 3. If it is high, which it will be for this circuit when the switch is
open, the code jumps over the Serial.println command and will repeat the loop. When you close

51

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

the switch, 0V is applied to pin 3 and its state is now LOW. This means the if condition is true so
this time around the code between the braces is executed and the message is printed

The syntax for the if statement is

if (condition) {
//commands

If the condition is true, the program will execute the commands between the braces. If the
condition is not true, the program will skip to the statement following the braces.
The condition compares one thing to another. In the example above, the state of pin 1 was compared
to LOW with ==, the equality condition. Other conditional operators are != (not equal to), > (greater
than), < (less than), >= (greater than or equal to), and <= (less than or equal to).
You can have the program branch depending on the value of a variable. For example, this
program will print the value of i only when it is less than 30.

int i;

void setup()
{

Serial.begin(9600);
i=0;
}

void loop()

{
i=i+1;

if (i<30) {
Serial.println(i);
}

}
The for statement is used to create program loops. Loops are useful when you want a chunk of
code to be repeated a specified number of times. A variable is used to count the number of times
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

the code is repeated. Here is an example that flashes an LED attached to pin 2 five times

int i;

void setup()
{

pinMode(2,OUTPUT);
for (i=0;i<5;i++) {

digitalWrite(2,HIGH);

delay(250);
digitalWrite(2,LOW);

delay(250);
}

void loop() {}
The variable i is the loop counter. The for() statement has three parts: the initialization, the check
and the increment. Variable i is initialized to zero. The check is to see if i is less then 5. If so, the
commands between the braces are executed. If not, those commands are skipped. After the
check, i is incremented by 1 (the i++ command). While the for statement could read for
(i=1;i==5;i++), it is convention to start the counter variable at zero and use less than for the
condition check.
You can have the loop counter increment by two or by three or by any increment you want. For
example, try this code fragment.

int i;
void setup()

53

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Serial.begin(9600);
for (i=0;i<15;i=i+3) {
Serial.println(i);
}

}
void loop() {}

Loops can be nested within loops. This example will flash the LED 10 times because for each of
the five outer loops counted by i, the program goes twice through the inner loop counted by j.

int i,j;
void setup()

pinMode(2,OUTPUT);
for (i=0;i<5;i++) {

for(j=0;j<2;j++) {
digitalWrite(2,HIGH);
delay(250);
digitalWrite(2,LOW);
delay(250);

}
}

WHILE
The while statement is another branch command that does continuous looping. If the condition
following the while is true, the commands within the braces are executed continuously. Here is
an example that continuously reads a switch on pin 3, and then when the switch is pressed, the
condition is no longer true so the code escapes the while command and prints.

void setup()

Serial.begin(9600);
while(digitalRead(3) == HIGH) {
}
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

Serial.println("Switch was pressed");

}
void loop() {}

GOTO

The goto statement commands the computer to jump immediately to another part of the program
marked by an address label. The goto should be used sparingly because it makes the program
hard to follow, but is handy for breaking out of nested loops or other complex control structures.
Here is an example

void setup()
{

Serial.begin(9600);
while(true) {

if (digitalRead(3) == LOW) {
goto wrapup;
}

}
wrapup:

Serial.println("Switch was pressed");


}
void loop() {}

The while(true) statement runs continuously, checking the state of pin 3 each time. When pin 3 is
low (pressed), the if condition is true and the goto statement executed, breaking out of the while
loop.

55

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

functions

Functions are a powerful programming feature that are used when you want to set up an action
that can be called from several places in the program. For example, let's say you wanted an LED
connected to pin 2 to flash 3 times as an alert, but that you needed to execute the alert at three
different places in the program. One solution would be to type in the flashing code at the three
separate program locations. This uses up precious code space and also means that if you change
the flash function, for example changing from 3 flashes to 4, you have to change the code in
three places. A better solution is to write the flash function as a subroutine and to call it from the
main body of the code.
int i;
void setup()

{
pinMode(2,OUTPUT);

Serial.begin(9600);

Serial.println("Welcome to my program");
delay(1000);

flasher(); // call flasher function


Serial.println("I hope you like flashing");
delay(1000);

flasher(); // call flasher again


Serial.println("Here it is one more time");
delay(1000);

flasher();
}

void loop() {}
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

void flasher()

for(i=0;i<3;i++) {
digitalWrite(2,HIGH);
delay(250);
digitalWrite(2,LOW);
delay(250);

}
}

Several things should be noted here. The function flasher() is defined outside the setup() and
loop() functions. When the main program encounters a flasher(); command, the program
immediately jumps to the function and starts executing the code there. When it reaches the end
of the function, the program returns to execute the command that immediately follows the
flasher(); command. It is this feature that allows you to call the subroutine from several different
places in the code. Parameters can be passed to and returned from functions, but that feature is
for the advanced programmer.

This concludes the section on basic program commands. You can write some awesome programs
using just what was described here. There is much more that the Arduino can do and you are
urged to read through the complete Arduino Language Reference page on-line

9 Coding Style
Style refers to your own particular style for creating code and includes layout, conventions for
using case, headers, and use of comments. All code must follow correct syntax, but there are

57

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

many different styles you can use. Here are some suggestions:
​ Start every program with a comment header that has the program name and perhaps a brief
description of what the program does.
​ Use indentation to line things up. Function name and braces are in column one, then use
indents in multiples of 2 or 4 to mark code chunks, things inside loops and so on. Mark
major sections or functions with a comment header line or two
​ Have just the right number of comments, not too few and not too many. Assume the reader
knows the programming language so have the comment be instructive. Here is an example of
an instructive comment
digitalWrite(4,HIGH) // turn on motor

and here is a useless comment


digitalWrite(4,HIGH) // set pin 4 HIGH

You need not comment every line. In fact, commenting every line is generally bad practice.

​ Add the comments when you create the code. If you tell yourself, "Oh, I'll add the comments
when the code is finished", you will never do it.
*//

10 Common Coding Errors


​ Forgetting the semi-colon at the end of a statement
​ Misspelling a command
​ Omitting opening or closing braces
11 Appendix

On the following page is a summary of basic Arduino commands, with examples.

Arduino Programming Basic


Command Description
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

pinMode(n,INPUT) Set pin n to act as an input. One-time command at top of program.


pinMode(n,OUTPUT) Set pin n to act as an output
digitalWrite(n,HIGH) Set pin n to 5V
digitalWrite(n,LOW) Set pin n to 0V
delay(x) Pause program for x millisec, x = 0 to 65,535
tone(n,f,d) Play tone of frequency f Hz for d millisec on speaker attached to pin n
for() Loop. Example: for (i=0;i<3;i++){} Do the instructions enclosed by {} three times
if (expr) {} Conditional branch. If expr true, do instructions enclosed by {}
while (expr) {} While expr is true, repeat instructions in {} indefinitely

For more commands see the ME2011 “Arduino Microcontroller Guide” and the Language
Reference section of the arduino web site.
Instructions in the setup() function are executed once. Those in the loop() function are
executed indefinitely.

Examples {}

1. Turn on LED connected to Pin 2 for 1 s. 2. Flash LED connected to Pin 2 at 1 Hz forever.

void setup() { void setup() {

pinMode(2,OUTPUT); pinMode(2,OUTPUT);

digitalWrite(2,HIGH);
delay(1000); }
digitalWrite(2,LOW);

void loop()

6.SCHEMATIC DIAGRAM

( FOR SCHEMATIC REFER CD)

59

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

6.1 OPERATION
POWER SUPPLY
The circuit uses standard power supply comprising of a step-down transformer from 230Vto
12V and 4 diodes forming a bridge rectifier that delivers pulsating dc which is then filtered by
an electrolytic capacitor of about 470µF to 1000µF. The filtered dc being unregulated, IC
LM7805 is used to get 5V DC constant at its pin no 3 irrespective of input DC varying from 7V
to 15V. The input dc shall be varying in the event of input ac at 230volts section varies from
160V to 270V in the ratio of the transformer primary voltage V1 to secondary voltage V2
governed by the formula V1/V2=N1/N2. As N1/N2 i.e. no. of turns in the primary to the no. of
turns in the secondary remains unchanged V2 is directly proportional to V1.Thus if the
transformer delivers 12V at 220V input it will give 8.72V at 160V.Similarly at 270V it will give
14.72V.Thus the dc voltage at the input of the regulator changes from about 8V to 15V because
of A.C voltage variation from 160V to 270V the regulator output will remain constant at 5V.
The regulated 5V DC is further filtered by a small electrolytic capacitor of 10µF for any noise so
generated by the circuit. One LED is connected of this 5V point in series with a current limiting
resistor of 330Ω to the ground i.e., negative voltage to indicate 5V power supply availability.
The unregulated 12V point is used for other applications as and when required.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

All standard items like power supply, accessories to the Arduino board like LCD, the relay driver
IC –U2 ,ULN 2003 the blue square bordered on the diagram as seen, a set of resistors
representing the underground cable are used as per the circuit .

WORKING OF ULN 2003 RELAY DRIVER IC


ULN2003 is an IC which is used to interface relay with the Arduino board since the output of the
Arduino is maximum 5V with too little current delivery and is not practicable to operate a relay
with that voltage. ULN2003 is a relay driver IC consisting of a set of Darlington transistors. If
logic high is given to the IC as input then its output will be logic low but not the vice versa. Here
in ULN2003 pin 1 to 7 are IC inputs and 10 to 16 are IC outputs. If logic 1 is given to its pin no 1
the corresponding pin 16 goes low. If a relay coil is connected from +ve to the output pin of the
uln2003,(the relay driver) then the relay contacts change their position from normally open to
close the circuit as shown below.

61

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

OPERATION EXPLANATION
CONNECTIONS
The output of the power supply which is 5v is given to the respective pin of Arduino board and
GND is connected accordingly. Relay’s 1, 2, &3 are given to pins 1B, 2B&3B of ULN2003A
and Arduino board.

WORKING
The project uses four sets of resistances in series representing cables i.e. R4 to7; 8 to 11; 12 to 15
and 16 to 19 as shown in the circuit diagram, one set for each phase and one for ground. Each
series resistors represents the resistance of the underground cable for a specific distance thus 4
such resistances in series represent 1-4kms. 3 relays are used to common point of their contacts
are grounded while the NO points are connected to the input of the R11, R15,R19 being the 3
phase cable input. R4 is fed with a series resistor R20 to 5v supply. The common point of which
is given to input pin of inbuilt ADC of Arduino board duly wired as explained above.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

While any of the 12switches (representing as fault switches) are operated they impose conditions
like LG, LL, 3L fault as per the switch operation. The program while executed continuously
scans by operating the 3relays in sequence of 1sec interval. Thus any NO point while driven to
GND through the common contact point of the relay develops a current flow through R20 & any
of the cable by the fault switch and all the resistors in that branch ,depending on the created
fault. Thus the voltage drop at the ADC pin varies depending on the current flow which is
inversely proportional to the resistance value representing the length of cable in kilometres. This
varying voltage is fed to the inbuilt ADC of the Arduino board and program while executed

63

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

displays an output in the LCD display upon the distance of the fault occurring in kms. In a fault
situation it display’s R=3km if the 3km’s switch is made ON. Accordingly all other faults are
indicated.

OPERATING PROCEDURE
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

7. LAYOUT DIAGRAM

8. BILL OF MATERIALS

{PLEASE REFER CD}

65

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

9.CODING
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

10. HARDWARE TESTING


10.1 CONTINUITY TEST:
In electronics, a continuity test is the checking of an electric circuit to see if current flows (that it
is in fact a complete circuit). A continuity test is performed by placing a small voltage (wired in
series with an LED or noise-producing component such as a piezoelectric speaker) across the
chosen path. If electron flow is inhibited by broken conductors, damaged components, or
excessive resistance, the circuit is "open".
Devices that can be used to perform continuity tests include multi meters which measure current
and specialized continuity testers which are cheaper, more basic devices, generally with a simple
light bulb that lights up when current flows.
An important application is the continuity test of a bundle of wires so as to find the two ends
belonging to a particular one of these wires; there will be a negligible resistance between the
"right" ends, and only between the "right" ends.
This test is the performed just after the hardware soldering and configuration has been
completed. This test aims at finding any electrical open paths in the circuit after the soldering.
Many a times, the electrical continuity in the circuit is lost due to improper soldering, wrong and
rough handling of the PCB, improper usage of the soldering iron, component failures and
presence of bugs in the circuit diagram. We use a multi meter to perform this test. We keep the
multi meter in buzzer mode and connect the ground terminal of the multi meter to the ground.
We connect both the terminals across the path that needs to be checked. If there is continuation
then you will hear the beep sound.

10.2 POWER ON TEST:

67

Dept of EEE, JPNCE, Mahabubnagar.


ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

This test is performed to check whether the voltage at different terminals is according to the
requirement or not. We take a multi meter and put it in voltage mode. Remember that this test is
performed without microcontroller. Firstly, we check the output of the transformer, whether we
get the required 12 v AC voltage.
Then we apply this voltage to the power supply circuit. Note that we do this test without
microcontroller because if there is any excessive voltage, this may lead to damaging the
controller. We check for the input to the voltage regulator i.e., are we getting an input of 12v and
an output of 5v. This 5v output is given to the microcontrollers’ 40th pin. Hence we check for the
voltage level at 40th pin. Similarly, we check for the other terminals for the required voltage. In
this way we can assure that the voltage at all the terminals is as per the requirement.

11. RESULTS

12. CONCLUSION
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION

13. BIBLIOGRAPHY

TEXT BOOKS REFERED

1. “The 8051 Microcontroller and Embedded systems” by Muhammad Ali Mazidi and Janice

Gillispie Mazidi , Pearson Education.

2. ATMEL 89S52 Data Sheets.

WEBSITES

​ www.atmel.com
​ www.arduino forum.com
​ www.beyondlogic.org
​ www.wikipedia.org
​ www.howstuffworks.com
​ www.alldatasheets.com

69

Dept of EEE, JPNCE, Mahabubnagar.

You might also like