Sie sind auf Seite 1von 52

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

CHAPTER 1
INTRODUCTION
1.1 Introduction
By the presently existing system once the train leaves the station, the
stationmaster informs the gatekeeper about the arrival of the train through the
telephone. Once the gatekeeper receives the information, he closes the gate
depending on the timing at which the train arrives. Hence, if the train is late due
to certain reasons, then gate remain closed for a long time causing traffic near
the gates.
By employing the automatic railway gate control at the level crossing the
arrival of the train is detected by the sensor placed near to the gate. Hence, the
time for which it is closed is less compared to the manually operated gates and
also reduces the human labour. This type of gates can be employed in an
unmanned level crossing where the chances of accidents are higher and reliable
operation is required. Since, the operation is automatic; error due to manual
operation is prevented.
Automatic railway gate control is highly economical microcontroller based
arrangement, designed for use in almost all the unmanned level crossings in the
country.
1.2 Aim of the project
The main aim of this project is to operate and control the unmanned
railway gate in the proper manner in order to avoid the accidents in the
unmanned railway crossing. In a country like ours where there are many
unmanned railway crossings, accidents are increasing day by day. These train
accidents are due to the absence of human power in the railway. In order to
Dept of EIE

Page 1

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


overcome the accidents due to the above problem we have planned to design the
project.
1.3 Scope of the project
This project is developed in order to help the INDIAN RAILWAYS in
making its present working system a better one, by eliminating some of the
loopholes existing in it. Based on the responses and reports obtained as a result
of the significant development in the working system of INDIAN RAILWAYS,
this project can be further extended to meet the demands according to situation.
This can be further implemented to have control room to regulate the working
of the system. Thus becomes the user friendliness. Additional modules can be
added without affecting the remaining modules. This allows the flexibility and
easy maintenance of the developed system.

Dept of EIE

Page 2

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

CHAPTER 2
BLOCKDIAGRAM AND DESCRIPTION
2.1 Block Diagram
In this chapter the block diagram of the project and design aspect of
independent modules are considered. Block diagram is shown in fig: 2.1

Fig 2.1: Block diagram of Microcontroller based automatic railway gate


control system
2.2 Description
The Block diagram consists of the power supply, which is of singlephase

230V ac. This should be given to step down transformer to reduce the

230V ac voltage to lower value. i.e., 9V to 12V ac this value depends on the
Dept of EIE

Page 3

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


transformer inner winding. The output of the transformer is given to the rectifier
circuit. This rectifier converts ac voltage to dc voltage. But the voltage may
consist of ripples or harmonics. To avoid these ripples, the output of the rectifier
is connected to capacitor. The capacitor thus removes the harmonics. This is the
exact dc voltage of the given specification. But the controller operates at 5V dc
and the relays and driver operates at 12V dc voltage. So the regulator is required
to reduce the voltage. Regulator 7805 produces 5V dc.
This project utilizes one pair of load cell sensors; one load cell is fixed at
upside (from where the train comes) beneath the tracks and similarly the other
load cell is fixed at down side of the train direction.
Sensors are fixed at (for practical implementation) on both sides of the
gate. We call the sensor along the train direction as foreside sensor and the
other as aft side sensor. When foreside sensor gets activated, the gate motor is
turned on in one direction and the gate is closed and stays closed until the train
crosses the gate and reaches aft side sensors.
When aft side sensor gets activated motor turns in opposite direction and
gate opens and motor stops. The position of gates is displayed on LCD screen
arranged at road side for road users..
In this project AT89S52 Micro controller Integrated Chip plays the main
role. The program for this project is embedded in this Micro controller
Integrated Chip and interfaced to all the peripherals. The timer program is
inside the Micro controller IC to maintain all the functions. Dc motor is used for
the purpose of gate control by using dc motor drive (L293).reset button is used
to start the operation from beginning.

Dept of EIE

Page 4

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

CHAPTER 3
COMPONENTS OF THE PROJECT
3.1 REGULATED POWER SUPPLY

3.1.1 Introduction
Power supply is a supply of electrical power. A device or system that
supplies electrical or other types of energy to an output load or group of loads is
called a power supply unit or PSU.
A power supply may include a power distribution system as well as
primary or secondary sources of energy such as

Conversion of one form of electrical power to another desired form and

voltage, typically involving converting AC line voltage to a well-regulated


lower-voltage DC for electronic devices. Low voltage, low power DC power
supply units are commonly integrated with the devices they supply, such
as computers and household electronics.
3.1.2 Block Diagram

Fig 3.1 Regulated Power Supply


The basic circuit diagram of a regulated power supply (DC O/P) with
led connected as load is shown in fig: 3.3.3.

Dept of EIE

Page 5

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

Fig 3.2 Circuit diagram of Regulated Power Supply with Led connection
The components used in regulated power supply are

230V AC MAINS

TRANSFORMER

BRIDGE RECTIFIER(DIODES)

CAPACITOR

VOLTAGE REGULATOR(IC 7805)

RESISTOR

LED(LIGHT EMITTING DIODE)


The detailed explanation of each and every component mentioned above is

as follows:
Transformation The process of transforming energy from one device to
another is called transformation. For transforming energy we use transformers.

Dept of EIE

Page 6

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


3.1.3 Transformers
A transformer is a device that transfers electrical energy from
one circuit to another through inductively coupled conductors without changing
its frequency. A varying current in the first or primary winding creates a
varying magnetic flux in the transformer's core, and thus a varying magnetic
field through the secondary winding. This varying magnetic field induces a
varying electromotive force (EMF) or "voltage" in the secondary winding. This
effect is called mutual induction.
If a load is connected to the secondary, an electric current will flow in
the secondary winding and electrical energy will be transferred from the
primary circuit through the transformer to the load. This field is made up from
lines of force and has the same shape as a bar magnet.
If the current is increased, the lines of force move outwards from the
coil. If the current is reduced, the lines of force move inwards.
If another coil is placed adjacent to the first coil then, as the field
moves out or in, the moving lines of force will "cut" the turns of the second coil.
As it does this, a voltage is induced in the second coil. With the 50 Hz AC
mains supply, this will happen 50 times a second. This is called mutual
induction and forms the basis of the transformer. The input coil is called the
primary winding; the output coil is the secondary winding. Fig: 3.1.4 shows
step-down transformer.

Fig 3.3 Step-Down Transformer


Dept of EIE

Page 7

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


The voltage induced in the secondary is determined by the turns ratio.

For example, if the secondary has half the primary turns; the
secondary will have half the primary voltage. Another example is if the primary
has 5000 turns and the secondary has 500 turns, then the turns ratio is 10:1.
There step up and step down transformers.
Step Up transformer
In case of step up transformer, primary windings are every less compared to
secondary winding. Because of having more turns secondary winding accepts
more energy, and it releases more voltage at the output side.
Step down transformer
Incase of step down transformer, Primary winding induces more flux than
the secondary winding, and secondary winding is having less number of turns
because of that it accepts less number of flux, and releases less amount of
voltage.
Regulation
The process of converting a varying voltage to a constant regulated
voltage is called as regulation. For the process of regulation we use voltage
regulators.
3.1.4 Voltage Regulator
A voltage regulator (also called a regulator) with only three
terminals appears to be a simple device, but it is in fact a very complex
integrated circuit. It converts a varying input voltage into a constant regulated
Dept of EIE

Page 8

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


output voltage. Voltage Regulators are available in a variety of outputs like 5V,
6V, 9V, 12V and 15V. The LM78XX series of voltage regulators are designed
for positive input. For applications requiring negative input, the LM79XX series
is used. Using a pair of voltage-divider resistors can increase the output
voltage of a regulator circuit.
It is not possible to obtain a voltage lower than the stated rating. You cannot
use a 12V regulator to make a 5V power supply. Voltage regulators are very
robust. These can withstand over-current draw due to short circuits and also
over-heating. In both cases, the regulator will cut off before any damage occurs.
The only way to destroy a regulator is to apply reverse voltage to its input.
Reverse polarity destroys the regulator almost instantly. Fig: 3.3.11 shows
voltage regulator.

Fig 3.4 Voltage Regulator


3.1.5 Resistors
A resistor is a two-terminal electronic component that produces a voltage across
its terminals that is proportional to the electric current passing through it in
accordance with Ohm's law.
V = IR

Dept of EIE

Page 9

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Resistors are 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 highresistivity alloy, such as nickel/chrome).
Resistors can be made to control the flow of current, to work as
Voltage dividers, to dissipate power and it can shape electrical waves when
used in combination of other components. Basic unit is ohms.
Power dissipation
The power dissipated by a resistor (or the equivalent resistance of a resistor
network) is calculated using the following:

Fig 3.5 Resistor

3.1.6 Capacitors
Capacitors are used as filter. The ripples from the DC voltage are
removed and pure DC voltage is obtained. And also these capacitors are used to
reduce the harmonics of the input voltage. The primary action performed by
capacitor is charging and discharging. It charges in positive half cycle of the AC
voltage and it will discharge in negative half cycle. So it allows only AC
Dept of EIE

Page 10

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


voltage and does not allow the DC voltage. This filter is fixed before the
regulator. Thus the output is free from ripples.
3.1.7. LED
A light-emitting diode (LED) is a semiconductor light source. LEDs
are used as indicator lamps in many devices, and are increasingly used for
lighting. Introduced as a practical electronic component in 1962, early LEDs
emitted low-intensity red light, but modern versions are available across the
visible, ultraviolet and infrared wavelengths, with very high brightness. The
internal structure and parts of a led are shown in figures 3.4.1 and 3.4.2
respectively.

Fig 3.6 Parts of a LED

Working
The structure of the LED light is completely different than that of the
light bulb. Amazingly, the LED has a simple and strong structure. The lightemitting semiconductor material is what determines the LED's color. The LED
is based on the semiconductor diode.

Dept of EIE

Page 11

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


When a diode is forward biased (switched on), electrons are able to
recombine with holes within the device, releasing energy in the form of
photons. This effect is called electroluminescence and the colour of the light
(corresponding to the energy of the photon) is determined by the energy gap of
the semiconductor. An LED is usually small in area (less than 1 mm2), and
integrated optical components are used to shape its radiation pattern and assist
in reflection. LEDs present many advantages over incandescent light sources
including lower energy consumption, longer lifetime, improved robustness,
smaller size, faster switching, and greater durability and reliability. However,
they are relatively expensive and require more precise current and heat
management than traditional light sources. Current LED products for general
lighting are more expensive to buy than fluorescent lamp sources of comparable
output. They also enjoy use in applications as diverse as replacements for
traditional light sources in automotive lighting (particularly indicators) and in
traffic signals. The compact size of LEDs has allowed new text and video
displays and sensors to be developed, while their high switching rates are useful
in advanced communications technology. The electrical symbol of led are
shown in fig: 3.7.

Fig 3.7 Electrical Symbol of led


LED lights have a variety of advantages over other light sources:

High-levels of brightness and intensity

Dept of EIE

Page 12

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

High-efficiency

Low-voltage and current requirements

Low radiated heat

High reliability (resistant to shock and vibration)

No UV Rays

Long source life

Can be easily controlled and programmed

Applications of LED fall into three major categories:

Visual signal application where the light goes more or less directly from the

LED to the human eye, to convey a message or meaning.

Illumination where LED light is reflected from object to give visual

response of these objects.

Generate light for measuring and interacting with processes that do not

involve the human visual system.


3.2 Microcontroller
3.2.1 Introduction
In our project we use at89s52 microcontroller for controlling the process of
operation of automatic

opening and

closing of railway gates.at89s52

microcontroller is similar to 8051 microcontroller with some additional features.


Pin diagram of at89s52 microcontroller is shown in below figure.

Dept of EIE

Page 13

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

Fig 3.8 pin diagram of AT89S52


The

AT89S52

is

low-power,

high-performance

CMOS

8-bit

microcontroller with 8K bytes of in-system programmable Flash memory. The


device is manufactured using Atmels high-density non-volatile memory
technology and is compatible with the Industry-standard 80C51 instruction set
and pin out. The on-chip Flash allows the program memory to be reprogrammed
in-system or by a conventional non-volatile memory pro-grammar. 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,
Dept of EIE

Page 14

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


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.
3.2.2 Pin description
VCC

Supply voltage

GND

Ground.

Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each
pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be
used as high-impedance inputs. Port 0 can also be configured to be the multiplexed
low-order address/data bus during accesses to external program and data memory.
In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during
Flash programming and outputs the code bytes during program verification.
External pull-ups are required during program verification.
Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1
output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins,
they are pulled high by the inter-nal pull-ups and can be used as inputs. As inputs,
Port 1 pins that are externally being pulled low will source current (IIL) because of
the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the
timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger
input (P1.1/T2EX), respectively, as shown in the follow-ing table. Port 1 also
receives the low-order address bytes during Flash programming and verification.
Dept of EIE

Page 15

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Table 3.1:Alternate Functions of Port 1

Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2
output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins,
they are pulled high by the internal pull-ups and can be used as inputs. As inputs,
Port 2 pins that are externally being pulled low will source current (IIL) because of
the internal pull-ups. Port 2 emits the high-order address byte during fetches from
external program memory and during accesses to external data memory that use
16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal
pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit
addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function
Register. Port 2 also receives the high-order address bits and some control signals
during Flash programming and verification.
Port 3: It is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3
pins that are externally being pulled low will source current (IIL) because of the
pull-ups. Port 3 receives some control signals for Flash programming and
verification. Port 3 also serves the functions of various special features of the
AT89S52, as shown in the following table.

Dept of EIE

Page 16

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Table 3.2:Additional functions of port 3

RST: Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device. This pin drives high for 98 oscillator periods after the
Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used
to disable this feature. In the default state of bit DISRTO, the RESET HIGH out
feature is enabled.
ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low
byte of the address during accesses to external memory. This pin is also the
program pulse input (PROG) during Flash programming. In normal operation,
ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used
for external timing or clocking purposes. Note, however, that one ALE pulse is
skipped during each access to external data memory. If desired, ALE operation
can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is
active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly
pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in
external execution mode.
PSEN: Program Store Enable (PSEN) is the read strobe to external program
memory. When the AT89S52 is executing code from external program memory,

Dept of EIE

Page 17

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


PSEN is activated twice each machine cycle, except that two PSEN activations are
skipped during each access to external data memory.
EA/VPP: External Access Enable. EA must be strapped to GND in order to
enable the device to fetch code from external program memory locations starting
at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will
be internally latched on reset. EA should be strapped to VCC for internal program
executions. This pin also receives the 12-volt programming enable voltage (VPP)
during Flash programming.
XTAL1: Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2: Output from the inverting oscillator amplifier.
3.2.3 Features of AT89S52
Compatible with MCS-51 Products
8K Bytes of In-System Programmable (ISP) Flash Memory Endurance:
10,000 Write/Erase Cycles
4.0V to 5.5V Operating Range
Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources

Dept of EIE

Page 18

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Full Duplex UART Serial Channel
Low-power Idle and Power-down Modes
Interrupt Recovery from Power-down Mode
Watchdog Timer Dual Data Pointer
Power-off Flag
Fast Programming Time
Flexible ISP Programming (Byte and Page Mode)
Green (Pb/Halide-free) Packaging Option

3.3 Load cell


3.3.1 Introduction
Load cell is a passive transducer or sensor which converts applied force
into electrical signals. They also referred to as load transducer.
A load cell is a transducer that is used to create an electrical signal whose
magnitude is directly proportional to the force being measured. The various types
of load cells include hydraulic load cells, pneumatic load cells and strain gauge
load cells. In most applications strainguage load cells are used. A load cell is made
by bonding strain gauges to a spring material. To efficiently detect the strain,
strain gauges are bonded to the position on the spring material where the strain
will be the largest. There is a linear relationship between the strain of the strain
gauge and the change in its resistance. The following formula is valid:

Dept of EIE

Page 19

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

R: Initial resistance of the strain gauge () R: Resistance change caused by


elongation or contraction () K: Proportional constant (called the gauge factor)
: Strain
The gauge factor K varies depending on the type of the metallic foil used. When a
copper-nickel alloy such as constantan is used (a common material used for strain
gauges) the value is approximately 2.
When the stress caused by external force to an object is below the proportional
limit, the strain varies linearly with the stress. In addition, when external force is
applied to a load cell and its spring material is deformed (strained), the resistance
value of the strain gauge varies linearly with the deformation. Load cells are
produced with a four- or six-wire cable. A four-wire cable is calibrated and
temperature compensated with a certain length of cable. The performance of the
load cell, in terms of temperature stability, will be compromised if the cable is cut;
never cut a four-wire load cell cable.

Fig:3.9 four wire connection of load cell

Dept of EIE

Page 20

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


In our present project we used single point load cell. These load cells are
applicable in various industries such as retail scales, dynamic weighing machinery,
industrial bench and floor scales and others.

Fig: 3.10 single point Load cell


3.3.2 Specifications of load cell
1. Rated Load 5-60 (Kg)
2. Rated Output 2.0mV/V5%
3. Zero Balance 1%F.S
4. Input Resistance 4056
5. Output Resistance 3503
6. Excitation Voltage 9-12VDC
7. Nonlinearity 0.017%F.S
8. Hysteresis 0.02%F.S
9. Repeatability 0.01%F.S

Dept of EIE

Page 21

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


10. Creep (30min) 0.015%F.S
11. Operating Temperature -20 To +65
12. Temperature Effect on Zero 0.017%F.S/10
13. Temperature Effect on Span 0.014%F.S/10
14. Insulation Resistance 5000M(50VDC)
15. Safe Overload 150%F.S
16. Ultimate Overload 200%FS
17. Cable 420mm (3mm 4-wire shielding cable)
The importance of load cell in this system is readily apparent. By transforming the
applied force into a voltage signal, it plays a crucial role in creating an easily
readable, digital display of the force can be measured. The applications of load
cells are ubiquitous, as they may be used whenever a force needs to be measured.
3.4 L293Driver

Fig3.11 pin diagram of L293


The L293 and L293D are quadruple high-current half-H drivers. The L293
is designed to provide bidirectional drive currents of up to 1 A at voltages from
Dept of EIE

Page 22

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


4.5 V to 36 V. The L293D is designed to provide bidirectional drive currents of
up to 600-mA at voltages from 4.5 V to 36 V. Both devices are designed to
drive inductive loads such as relays, solenoids, dc and bipolar stepping motors,
as well as other high-current/high-voltage loads in positive-supply applications.
All inputs are TTL compatible. Each output is a complete totem-pole drive
circuit, with a Darlington transistor sink and a pseudo- Darlington source.
3.4.1 Pin description
Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN
and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the
associated drivers are enabled, and their outputs are active and in phase with
their inputs. When the enable input is low, those drivers are disabled, and their
outputs are off and in the high-impedance state. With the proper data inputs,
each pair of drivers forms a full-H (or bridge) reversible drive suitable for
solenoid or motor applications.On the L293, external high-speed output clamp
diodes should be used for inductive transient suppression. A VCC1 terminal,
separate from VCC2, is provided for the logic inputs to minimize device power
dissipation. The L293and L293D are characterized for operation from 0C to
70C.
3.4.2 Features of l293 dc motor driver
Easily compatible with any of the system
Easy interfacing through FRC (Flat Ribbon Cable)
External Power supply pin for Motors supported
Onboard PWM (Pulse Width Modulation) selection switch
2pin Terminal Block (Phoenix Connectors) for easy Motors Connection

Dept of EIE

Page 23

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Onboard H-Bridge base Motor Driver IC
3.5 D.C. Motor
3.5.1 Introduction
A dc motor uses electrical energy to produce mechanical energy,
very typically through the interaction of magnetic fields and current-carrying
conductors. The reverse process, producing electrical energy from mechanical
energy, is accomplished by an alternator, generator or dynamo. Many types of
electric motors can be run as generators, and vice versa.The input of a DC
motor is current/voltage and its output is torque (speed).

Fig 3.12 DC Motor


The DC motor has two basic parts: the rotating part that is called
the armature and the stationary part that includes coils of wire called the field
coils. The stationary part is also called the stator. Figure shows a picture of a
typical DC motor. The armature is made of coils of wire wrapped around the
core, and the core has an extended shaft that rotates on bearings. The ends of
each coil of wire on the armature are terminated at one end of the armature. The
termination points are called the commutator, and this is where the brushes
make electrical contact to bring electrical current from the stationary part to the
rotating part of the machine.
Dept of EIE

Page 24

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


3.5.2.Operation
The DC motor in modern industrial applications operates very similarly to
the simple DC motor described earlier. Figure 12-9 shows an electrical diagram of
a simple DC motor. Notice that the DC voltage is applied directly to the field
winding and the brushes. The armature and the field are both shown as a coil of
wire. In later diagrams, a field resistor will be added in series with the field to
controlthemotorspeed.
When voltage is applied to the motor, current begins to flow through the
field coil from the negative terminal to the positive terminal. This sets up a strong
magnetic field in the field winding. Current also begins to flow through the
brushes into a commutator segment and then through an armature coil. The current
continues to flow through the coil back to the brush that is attached to other end of
the coil and returns to the DC power source. The current flowing in the armature
coil sets up a strong magnetic field in the armature.

Fig 3.13 Simple electrical diagram of DC motor

Dept of EIE

Page 25

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

Fig 3.14 Operation of a DC Motor


The magnetic field in the armature and field coil causes the armature
to begin to rotate. This occurs by the unlike magnetic poles attracting each other
and the like magnetic poles repelling each other. As the armature begins to
rotate, the commutator segments will also begin to move under the brushes. As
an individual commutator segment moves under the brush connected to positive
voltage, it will become positive, and when it moves under a brush connected to
negative voltage it will become negative. In this way, the commutator segments
continually change polarity from positive to negative. Since the commutator
segments are connected to the ends of the wires that make up the field winding
in the armature, it causes the magnetic field in the armature to change polarity
continually from North Pole to South Pole. The commutator segments and
brushes are aligned in such a way that the switch in polarity of the armature
coincides with the location of the armature's magnetic field and the field
winding's magnetic field. The switching action is timed so that the armature will
not lock up magnetically with the field. Instead the magnetic fields tend to build
on each other and provide additional torque to keep the motor shaft rotating.
When the voltage is de-energized to the motor, the magnetic fields in
the armature and the field winding will quickly diminish and the armature
shaft's speed will begin to drop to zero. If voltage is applied to the motor again,
the magnetic fields will strengthen and the armature will begin to rotate again.

Dept of EIE

Page 26

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


3.5.3 Types of DC motors
1. DC Shunt Motor,
2. DC Series Motor,
3. DC Long Shunt Motor (Compound)
4. DC Short Shunt Motor (Compound)
The rotational energy that you get from any motor is usually the battle between
two magnetic fields chasing each other. The DC motor has magnetic poles and
an armature, to which DC electricity is fed, The Magnetic Poles are
electromagnets, and when they are energized, they produce a strong magnetic
field around them, and the armature which is given power with a commutator,
constantly repels the poles, and therefore rotates.
3.5.4 Applications of DC Motors
1. Electric Train: A kind of DC motor called the DC Series Motor is used in
Electric Trains. The DC Series Motors have the property to deliver more power
when they are loaded more. So the more the people get on a train, the more
powerful the train becomes.
2. Elevators: The best bidirectional motors are DC motors. They are used in
elevators. Compound DC Motors are used for this application.
3. PC Fans, CD ROM Drives, and Hard Drives: All these things need motors,
very miniature motors, with great precision. AC motors can never imagine any
application in these places.
4. Starter Motors in Automobiles: An automobile battery supplies DC, so a DC
motor is best suited here. Also, you cannot start an engine with a small sized
AC motor.
Dept of EIE

Page 27

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


3.6 LCD DISPLAY
3.6.1 Block diagram

Fig:3.15 Block Diagram of LCD display


3.6.2 Pin description
Table 3.3:Pin description of LCD display

Dept of EIE

Page 28

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


3.7 ADC0808
3.7.1 Introduction
The ADC0808, ADC0809 data acquisition component is a monolithic
CMOS device with an 8-bit analog-to-digital converter, 8-channel multiplexer
and microprocessor compatible control logic. The 8-bit A/D converter uses
successive approximation as the conversion technique. The converter features
a high impedance chopper stabilized comparator, a 256R voltage divider with
analog switch tree and a successive approximation register. The 8-channel
multiplexer can directly access any of 8-single-ended analog signals.
The device eliminates the need for external zero and full-scale
adjustments. Easy interfacing to microprocessors is provided by the latched and
decoded multiplexer address inputs and latched TTL TRI-STATE outputs.
The design of the ADC0808, ADC0809 has been optimized by
incorporating the most desirable aspects of several A/D conversion techniques.
The ADC0808, ADC0809 offers high speed, high accuracy, minimal
temperature dependence, excellent long-term accuracy and repeatability, and
consumes Minimal power. These features make this device ideally suited to
applications from process and machine control to consumer and automotive
applications

Dept of EIE

Page 29

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


3.7.2 Pin diagram

Fig 3.16 Pin Diagram Of ADC0808


3.7.3 Multiplexer
The device contains an 8-channel single-ended analog signal multiplexer.
A particular input channel is selected by using the address decoder. Below
Table shows the input states for the address lines to select any channel. The
address is latched into the decoder on the low-to-high transition of the address
latch enable signal.
Table 3.4: Selection of Address lines in ADC

Dept of EIE

Page 30

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


3.7.4 Converter
The heart of this single chip data acquisition system is its 8-bit analog-todigital converter. The converter is designed to give fast, accurate, and repeatable
conversions over a wide range of temperatures. The converter is partitioned into
3 major sections: the 256R ladder network, the successive approximation
Register and the comparator. The converters digital outputs are positive
true. The 256R ladder network approach was chosen over the conventional
R/2R ladder because of its inherent monotonicity, which guarantees no missing
digital codes. Monotonicity is particularly important in closed loop feedback
Control systems. A non-monotonic relationship can cause oscillations that will
be catastrophic for the system. Additionally, the 256R network does not cause
load variations on the reference voltage. The difference in these resistors causes
the output characteristic to be symmetrical with the zero and full-scale points of
the transfer curve. The first output transition occurs when the analog signal has
reached +12 LSB.
And succeeding output transitions occur every 1 LSB later up to fullscale. The successive approximation register (SAR) performs 8 iterations to
approximate the input voltage. For any SAR type converter, n-iterations are
required for an n-bit converter. In the ADC0808, ADC0809, the approximation
technique is extended to 8 bits using the 256R network. The A/D converters
successive approximation register (SAR) is reset on the positive edge of the
start conversion (SC) pulse.
The conversion is begun on the falling edge of the start conversion pulse.
A conversion in process will be interrupted by receipt of a new start conversion
pulse. Continuous conversion may be accomplished by tying the end-ofconversion (EOC) output to the SC input. If used in this mode, an external start
conversion pulse should be applied after power up. End-of-conversion will go
low between 0 and 8 clock pulses after the rising edge of start conversion. The
Dept of EIE

Page 31

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


most important section of the A/D converter is the comparator. It is this section
which is responsible for the ultimate Accuracy of the entire converter. It is also
the comparator drift which has the greatest influence on the repeatability of the
device. A chopper-stabilized comparator provides the most effective method of
satisfying all the converter requirements. The chopper-stabilized comparator
converts the DC input Signal into an AC signal. This signal is then fed through
a high gain AC amplifier and has the DC level restored. This technique limits
the drift component of the amplifier since the drift is a DC component which is
not passed by the AC amplifier. This makes the entire A/D converter extremely
insensitive to temperature, long term drift and input offset errors.

Dept of EIE

Page 32

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

CHAPTER 4
SOFTWARE DESCRIPTION
This project is implemented using following softwares:

keil compiler - for compilation part

Proteus 7 (Embedded C) for simulation part

4.1 Keil u Vision4 software


The Vision IDE from Keil combines project management, make facilities,
source code editing, program debugging, and complete simulation in one
powerful environment. The Vision development platform is easy-to-use and
helping you quickly create embedded programs that work. The Vision editor
and debugger are integrated in a single application that provides a seamless
embedded project development environment.

4.1.1 Procedural steps for compilation, simulation and dumping


1. Open Keil from the Start menu
2. The Figure below shows the basic names of the windows referred in this
document

Dept of EIE

Page 33

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

4.1.3 Starting a new Assembler Project


1. Select New Project from the Project Menu.
2. Name the project Toggle.a51
3. Click on the Save Button.

Dept of EIE

Page 34

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


4. The device window will be displayed.
5. Select the part you will be using to test with. For now we will use the NXP
LPC1768.
6. Double Click on the NXP.

7. Scroll down and select the LPC 1768


8. Click OK

Dept of EIE

Page 35

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

4.1.4 Creating Source File


1. Click File Menu and select New.

2. A new window will open up in the Keil IDE.

3. Copy the example to the Right into the new window. This file will toggle
Ports 1 and 2 with a delay.
4. Click on File menu and select Save As
5. Name the file Toggle.a51
Dept of EIE

Page 36

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


6. Click the Save Button
4.1.5 Adding File to the Project
1. Expand Target 1 in the Tree Menu
2. Click on Project and select Targets, Groups, Files
3. Click on Groups/Add Files tab
4. Under Available Groups select Source Group 1
5. Click Add Files to Group button
6. Change file type to Asm Source file (*.a*; *.src)
7. Click on toggle.a51
8. Click Add button
9. Click Close Button
10. Click OK button when you return to Target, Groups and Files dialog box
11. Expand the Source Group 1 in the Tree menu to ensure that the file was
added to the project

Dept of EIE

Page 37

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

4.1.6 Creating HEX for the Part


1. Click on Target 1 in Tree menu
2. Click on Project Menu and select Options for Target 1
3. Select Target Tab
4. Change Xtal (Mhz) from 50.0 to 11.0592
5. Select Output Tab
6. Click on Create Hex File check box
7. Click OK Button
8. Click on Project Menu and select Rebuild all Target Files 9. In the Build
Window it should report 0 Errors (s), 0 Warnings
10. You are now ready to Program your Part

4.1.7 Testing Program in Debugger


1. Comment out line ACALL DELAY by placing a Semicolon at the beginning.
This will allow you to see the port change immediately.
2. Click on the File Menu and select Save
3. Click on Project Menu and select rebuild all Target Files
4. In the Build Window it should report 0 Errors (s), 0 Warnings
5. Click on Debug Menu and Select Start/Stop Debug Session

4.1.8 Running the Keil Debugger


1. The Keil Debugger should be now be Running.

Dept of EIE

Page 38

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


2. Click on Peripherals. Select I/O Ports, Select Port 1
3. A new window should port will pop up. This represent the Port and Pins
4. Step through the code by pressing F11 on the Keyboard. The Parallel Port 1
Box should change as you completely step through the code.
5. To exit out, Click on Debug Menu and Select Start/Stop Debug Session

4.2 How to Download Hex File into MCU of Board


The method to download Hex File into Flash Memory of MCU in Board is
to use Program Flash Magic that is connected with MCU through Serial Port of
computer PC. This program can be downloaded free without any charge from
websitehttp://www.flashmagictool.com/

4.2.1Proceeding to Download Hex File into MC

Interface RS232 Cable between RS232 Serial Port of

PC and Board

UART-0 (CN3).

Supply power into board; in this case, we can see red LED1 is in status ON.

Set jumper BR4 (INT1) in ON state.

Run Program Flash Magic, it will display result as shown in Figure 1.1

Start setting the initial values into program as desired, so we configure

values into program as follows;


Select COM port corresponding with (in this example, it is COM1)
Set the baud rate to 9600
Set Device to be LPC2148
Set Interface to be None ISP

Dept of EIE

Page 39

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

Set Crystal Oscillator with MHz corresponding

with the value

internal Board. In this case, it is 12.000MHz, so we must set to be 12.

Press ISP LOAD Switch (S1) and RESET Switch (S2) on Board ARM7
LPC2148 Development Board to reset MCU to run in Boot Loader
following the processes;

Press ISP LOAD Switch (S1) and hold

Press RESET Switch (S2) while ISP LOAD Switch (S1) is being held.

Remove RESET Switch (S2) but ISP LOAD Switch (S1) is being held.

Lastly, remove ISP LOAD Switch (S1).

Select format of erasing data to be Erase all Flash + Code Rd Prot.

13. Set Option to be Verify after programming.


14. Click Browse to select HEX File for downloading.
Dept of EIE

Page 40

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


15. Click Start, Program Flash Magic will start downloading data into MCU
instantly. In this case, we can see the status operation at Status Bar and we must
wait for the operation until it is completed.
16. When the operation of program is complete, press RESET Switch (S2) on
Board and MCU will start running follow the downloaded program instantly.

4.3 Flash Magic


Flash Magic is a tool which is used to program hex code in EEPROM of microcontroller. It is a freeware tool. It only supports the micro-controller of Philips
and NXP. It can burn a hex code into that controller which supports ISP (in
system programming) feature. Flash magic supports several chips like ARM
Cortex M0, M3, M4, ARM7 and 8051.
Flash Magic is an application developed by Embedded Systems Academy to
allow easily access the features of a microcontroller device. With this program
it can erase individual blocks or the entire Flash memory of the microcontroller.
The kit can be programmed through serial port using Flash Magic. Flash
Magic is a freeware windows utility used download the hex file format onto the
kit. The Flash Magic utility is provided in CD along with the KIT. If your PC
does not have a serial port; use a USB to serial converter to download the hex
file using the Flash Magic utility.

4.3.1 Proceeding to Download Hex File into MC


Here are the simple steps to follow to program the kit using Flash Magic utility
Interface RS232 Cable between RS232 Serial Port of

PC and Board

UART-0 (CN3).
Supply power into board; in this case, we can see red LED1 is in status ON.
Set jumper BR4 (INT1) in ON state.
Dept of EIE

Page 41

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Run Program Flash Magic, it will display result as shown in Figure 1.1

Start setting the initial values into program as desired, so we configure values
into program as follow sections.
Step-1 Communication

a) Select your target device.


b) Select your com port and if you are using USB to serial converter make sure
that you will select proper com port other wise you can not communicate.

Dept of EIE

Page 42

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


c) Now select baud rate ideally it should be 9600 (recommended). Avoid higher
than 9600 for proper communication.
d) Now select your interface if you are using DB-9 then it will be None (ISP).
e) Set Crystal Oscillator with MHz corresponding

with the value

internal

Board. In this case, it is 12.000MHz, so we must set to be 12.


Press ISP LOAD Switch (S1) and RESET Switch (S2) on Board ARM7
LPC2148 Development Board to reset MCU to run in Boot Loader following
the processes;
Press ISP LOAD Switch (S1) and hold
Press RESET Switch (S2) while ISP LOAD Switch (S1) is being held.
Remove RESET Switch (S2) but ISP LOAD Switch (S1) is being held.
Lastly, remove ISP LOAD Switch (S1).
Step-2 Erase
Select format of erasing data to be Erase all Flash + Code Rd Prot

Now here tick mark the Erase all Flash option. This is the most crucial thing
because wrong selection in this step can be resulting into lost of boot loader in
your chip. Nothing to worry if you lost your boot loader because you can again
load it but to load boot loader you must program you chip through universal
Dept of EIE

Page 43

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


programmer or any other programmer which is not depend upon boot loader for
loading hex code. After loading boot loader you can again able to program your
chip using flash magic.
Step-3 Hex file
Click Browse to select HEX File for downloading.

This is very simple and you need to set up a path of your Hex file which is to be
loaded on chip.
Step-4 Options
Set Option to be Verify after programming.

In this always keep Verify after programming option enable by tick mark. You
can use another features as well according to your need.
Step-5 Start
Click Start, Program Flash Magic will start downloading data into
MCU instantly. In this case, we can see the status operation at Status Bar and
we must wait for the operation until it is completed. When the operation of
program is complete, press RESET Switch (S2) on Board and MCU will start
running follow the downloaded program instantly.

Dept of EIE

Page 44

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

CHAPTER 5
5.1 Advantages
1. Automatic opening and closing of railway gate.
2. Automatic sensing of arrival and departure of train.
3. Efficient and low cost design.
4. Low power consumption.
5.2 Disadvantages
Improper installation of load cells leads to wrong operation of the gate.
5.3 Applications
This system can be used in real time to control any gate openings and
door opening systems.
5.4 Conclusion
Integrating features of all the hardware components used have been
developed in it. Presence of every module has been reasoned out and placed
carefully, thus contributing to the best working of the unit. Secondly, using
highly advanced ICs with the help of growing technology, the project has been
successfully implemented. Thus the project has been successfully designed and
tested.

Dept of EIE

Page 45

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


References
The sites which were used while doing this project:
1. www.wikipedia.com
2. www.allaboutcircuits.com
3. www.microchip.com
4. www.howstuffworks.com
5. www.atmel .com
Books referred
1. Raj kamal Microcontrollers Architecture, Programming, Interfacing and
System Design.
2. Mazidi and Mazidi Embedded Systems.
3. Embedded C Michael.J.Pont.

Dept of EIE

Page 46

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS

Appendix A
Program code for automatic railway gate control system using load cell
#include <reg51.h>
#include <stdlib.h>
#include <lcd.h>
#include <adc.h>
#define adc_databus P1
Sbit M1 = P2^2;
Sbit M2 = P2^3;
Void delay_ms (unsigned int dly);
Void write_cmd (char c);
Void write_string (char*s);
Void write data (char t);
Void Return Home (void);
Void init_lcd (void);
Void init_ports (void);
Void delay_ms (unsigned int dly);
Void delay_us (unsigned int us_count);
void ADC_Init();
Unsigned char ADC_StartConversion (char channel);
Dept of EIE

Page 47

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Void main ()
{
Unsigned char ch0=0, ch1=0, ch2=0;
init_ports ();
init_lcd ();
ADC_Init ();
write_cmd (0x01);
delay_ms (10);
write_string (" AUTOMATIC ");
delay_ms (1000);
write_cmd (0xc0);
delay_ms (10);
write_string (RAILWAY GATE ");
delay_ms (2000);
do {
delay_ms (200);
ch0 = ADC_StartConversion (0);
delay_ms (200);
ch1 = ADC_StartConversion (1);
delay_ms (200);
Dept of EIE

Page 48

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


write_cmd (0x01);
delay_ms (10);
write_string ("IN :");
write_num (ch0);
write_string (OUT :");
write_num (ch1);
delay_ms (1000);
If (ch0 > 30)
{
write_cmd (0x01);
delay_ms (10);
write_string (CLOSING GATE ");
write_cmd (0xC0);
delay_ms (10);
write_string ("~~PLEASE WAIT~~");
M1=1;
M2=0;
delay_ms (3000);
M1=0;
M2=0;
Dept of EIE

Page 49

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


}
else if(ch1 > 30 )
{
write_cmd (0x01);
delay_ms (10);
write_string (OPENING GATE ");
write_cmd (0xC0);
delay_ms (10);
write_string ("~PLEASE PROCEED~");
M1=0;
M2=1;
delay_ms (3000);
M1=0;
M2=0;
}
Return Home();
} while (1);
}
Void init_ports (void)
{
Dept of EIE

Page 50

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


P1 = 0xff;
P0 = 0x00;
P2 = 0x00;
P3 = 0x00;
}
Void delay_ms (unsigned int dly)
{
Unsigned int i;
for (; dly>0; dly--)
for (i=122;i>0; i--);
}

Dept of EIE

Page 51

AUTOMATIC RAILWAY GATE CONTROL USING LOAD CELLS


Appendix B

Circuit Diagram
In this chapter, schematic diagram and interfacing of 8051 microcontroller
with each module is considered.

Schematic diagram of Automatic railway gate control system

Dept of EIE

Page 52

Das könnte Ihnen auch gefallen