Beruflich Dokumente
Kultur Dokumente
1.ABSTRACT
OBJECTIVE: The aim of this project is to Automate unmanned railway gate using
mechatronics.
PROJECT DEFINATION:
The objective of this project is to manage the control system of railway gate using
the microcontroller. When train arrives at the sensing point alarm is triggered at the
railway crossing point so that the people get intimation that gate is going to be closed.
Then the control system activates and closes the gate on either side of the track. once the
train crosses the other end control system automatically lifts the gate. For mechanical
operation of the gates DC geared motors are employed. Here we are using embedded
controller built around the 8051 family (AT89C52) for the control according to the data
pattern produced at the input port of the micro controller, the appropriate selected action
will be taken.. The logic is produced by the program written in Embedded C language.
The software program is written, by using the KEIL/SPJ micro vision environment. The
program written is then converted in HEX code after simulation and burned on to
microcontroller using FLASH micro vision.
Page 1
Intelligent Train Engine with Gate Control System
WORKING METHODOLOGY:
GATE CONTROL
Railways being the cheapest mode of transportation are preferred over all the other
means .When we go through the daily newspapers we come across many railway
accidents occurring at unmanned railway crossings. This is mainly due to the carelessness
in manual operations or lack of workers. We, in this project has come up with a solution
for the same. Using simple electronic components we have tried to automate the control
of railway gates. As a train approaches the railway crossing from either side, the sensors
placed at a certain distance from the gate detects the approaching train and accordingly
controls the operation of the gate. Also an indicator light has been provided to alert the
motorists about the approaching train.
Page 2
Intelligent Train Engine with Gate Control System
IR Out IR
put Engine
Sensor Sensor
IR Input IR
8051 Engine
Sensor
micro Sensor
controller
Geared Motor Geared Motor
-1 Engine -1 Railway
Gate
Railway
Signals
Red and green
Page 3
Intelligent Train Engine with Gate Control System
2.INTRODUCTION
Introduction:
The objective of this project is to manage the control system of railway gate using
the microcontroller. When train arrives at the sensing point alarm is triggered at the
railway crossing point so that the people get intimation that gate is going to be closed.
Then the control system activates and closes the gate on either side of the track. once the
train crosses the other end control system automatically lifts the gate. For mechanical
operation of the gates geared motors are employed. Here we are using embedded
controller built around the 8051 family (AT89C52) for the control according to the data
pattern produced at the input port of the micro controller, the appropriate selected action
will be taken.. The logic is produced by the program written in Embedded C language.
The software program is written, by using the KEIL micro vision environment. The
program written is then converted in HEX code after simulation and burned on to
microcontroller using FLASH micro vision.
AT89C51 Microcontroller
The Micro controller (AT89C51) is a low power; high performance CMOS 8-bit
micro controller with 4K bytes of Flash programmable and erasable read only memory
(PEROM). The on-chip Flash allows the program memory to be reprogrammed in-system
or by a conventional non-volatile memory programmer. By combining a versatile 8-bit
CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer,
which provides a highly flexible and cost-effective solution to many embedded control
applications. By using this controller the data inputs from the smart card is passed to the
parallel port of the pc and accordingly the software responds. The IDE for writing the
embedded program used is KEI L software.
Keil Software development tools for the 8051 micro controller family support
every level of developer from the professional applications engineer to the student just
learning about embedded software development.The industry-standard Keil C Compilers,
Macro Assemblers, Debuggers, Real-time Kernels, and Single-board Computers support
ALL 8051-compatible derivatives and help you get your projects completed on schedule.
The source code is written in assembly language .It is saved as ASM file with an
extension. A51.the ASM file is converted into hex file using keil software. Hex file is
dumped into micro controller using LABTOOL software. At once the file is dumped and
the ROM is burnt then it becomes an embedded one.
Page 4
Intelligent Train Engine with Gate Control System
3.CIRCUIT DIAGRAM
Page 5
Intelligent Train Engine with Gate Control System
Page 6
Intelligent Train Engine with Gate Control System
4.COMPONENTS
The project consists of three main parts:
8051 microcontroller
IR Transmitter
IR Receiver
DC motor Circuit
8051 CONTROLLER
The I/O ports of the 8051 are expanded by connecting it to an 8255 chip. The 8255 is
programmed as a simple I/O port for connection with devices such as LEDs, geared DC
motors and sensors.
The following block diagram shows the various devices connected to the different
ports of an 8255. The ports are each 8-bit and are named A, B and C. The individual ports
of the 8255 can be programmed to be input or output, and can be changed dynamically.
The control register is programmed in simple I/O mode with port A, port B and port C
(upper) as output ports and port C (lower) as an input port.
IR CIRCUITS
This circuit has two stages: a transmitter unit and a receiver unit. The transmitter
unit consists of an infrared LED and its associated circuitry.
IR TRANSMITTER
The IR LED emitting infrared light is put on in the transmitting unit. To generate
IR signal, 555 IC based astable multivibrator is used. Infrared LED is driven through
transistor BC 548. IC 555 is used to construct an astable multivibrator which has two
quasi-stable states. It generates a square wave of frequency 38kHz and amplitude 5Volts.
It is required to switch ON the IR LED.
IR RECEIVER:
The receiver unit consists of a sensor and its associated circuitry. In receiver
section, the first part is a sensor, which detects IR pulses transmitted by IR-LED.
Whenever a train crosses the sensor, the output of IR sensor momentarily transits through
a low state. As a result the monostable is triggered and a short pulse is applied to the port
pin of the 8051 microcontroller. On receiving a pulse from the sensor circuit, the
controller activates the circuitry required for closing and opening of the gates and for
track switching. The IR receiver circuit is shown in the figure below.
Page 7
Intelligent Train Engine with Gate Control System
Page 8
Intelligent Train Engine with Gate Control System
diodes are included within the IC. The output supply (VCC2) has a wide range from 4.5V
to 36V, which has made L293D a best choice for DC motor driver.
As you can see in the circuit, three pins are needed for interfacing a DC motor (A, B,
Enable). If you want the o/p to be enabled completely then you can connect Enable to
VCC and only 2 pins needed from controller to make the motor work.
As per the truth mentioned in the image above its fairly simple to program the
microcontroller. Its also clear from the truth table of BJT circuit and L293D the
programming will be same for both of them, just keeping in mind the allowed
combinations of A and B. We will discuss about programming in C as well as assembly
for running motor with the help of a microcontroller.
Page 9
Intelligent Train Engine with Gate Control System
5.EMBEDDED SYSTEMS
Introduction:
An Embedded system is a combination of computer hardware and software, and
perhaps additional mechanical or other parts, designed to perform a specific function.
Understand
Understanduser
user
requirements
requirements
Choose
Chooseoptimum
optimum
electronic
electronicchip
chip
S/W Side H/W Side
HLL/ALL
HLL/ALL
5.1 EMBEDDED PRODUCT DEVELOPMENT LIFE CYCLE
PCB
PCBLayout
Layoutdesign
design
Algorithm
Algorithm
Coding/Editing
Coding/Editing Assembling
Assembling
Compiling/Assembling
Compiling/Assembling components
components
Debugging
Debugging
Testing
Testing Testing
Testing
Simulator
Simulator
S/W
S/W H/W
H/W
DOWNLOAD
ICE
ICE(In
(InCircuit
Circuit
Emulator) Page 11
Emulator)
Embedded
EmbeddedProduct
Product
Intelligent Train Engine with Gate Control System
Introduction:
Page 12
Intelligent Train Engine with Gate Control System
and probes, communication signals, or control knobs and buttons. The outputs are
typically displays, communication signals, or changes to the physical world.
Memory
Memory
Inputs Processor
Processor Outputs
Inputs Outputs
Processing power
This is the amount of processing power necessary to get the hob done. A common
way to compare processing power is the MIPS (millions of instructions per second)
rating. Other important features of the processor need to be consider is register width,
typically ranges from 8 to 64 bits.
Page 13
Intelligent Train Engine with Gate Control System
Memory:
The amount of memory (ROM and RAM) required holding the executable
software and data it manipulates. The amount of memory required can also affect the
processor selection. In general, the register width off a processor establishes the upper
limit of the amount of memory it can access.
Development cost:
The development cost of the hardware and software design processes is a fixed,
one-time cost, so it might be that money is no object or that this is the only accurate
measure of system cost.
Number of units:
The tradeoff between production cost and development cost is affected most by
the number of units expected to be produced and sold.
Expected lifetime:
This indicates how long must the system continue to function? This affects all
sorts of design decisions from the selection of hardware components to how much the
system may cost to develop and produce.
Reliability:
How reliable must the final product be? If it is a childrens toy, it doesnt always
have to work right, but if it is part of a space shuttle or a car, it had sure better do what it
is supposed to each and every time.
The Basic Design REALTIME:
Designing Embedded systems is a challenging task. Most of the challenge comes
from the fact that Embedded systems have to interact with real world entities. These
interactions can get fairly complex. A typical Emebbed system might be interacting with
thousands of such entities at the same time. For example, a telephone switching system
Page 14
Intelligent Train Engine with Gate Control System
routinely handles calls from tens of thousands of subscriber. The system has to connect
each call differently. Also, the exact sequence of events in the call might vary a lot.
Embedded systems have to respond to external interactions in a predetermined
amount of time. Successful completion of an operation depends upon the correct and
timely operation of the system. Design the hardware and the software in the system to
meet the Realtime requirements. For example, a telephone switching system must feed
dial tone to thousands of subscribers within a recommended limit of one second. To meet
these requirements, the off hook detection mechanism and the software message
communication involved have to work within the limited time budget. The system has to
meet these requirements for all the calls being set up at any given time.
The designers have to focus very early on the Realtime response requirements.
During the architecture design phase, the hardware and software engineers work together
to select the right system architecture that will meet the requirements. This involves
deciding inter connectivity of the processors, link speeds, processor speeds, etc.
Are the processing components powerful enough? A CPU with really high
utilization will lead to unpredictable Realtime behavior. Also, it is possible that
the high priority tasks in the system will starve the low priority tasks of any CPU
time. This can cause the low priority tasks to misbehave.
Page 15
Intelligent Train Engine with Gate Control System
Is the Operating System suitable? Assign high priority to tasks that are involved
in processing Realtime critical events. Consider preemptive scheduling if
Realtime requirements are stringent. When choosing the operating system, the
interrupt latency and scheduling variance should be verified.
o Scheduling variance refers to the predictability in task scheduling times.
For example, a telephone switching system is expected to feed dialtone in
less than 500 ms. This would typically involve scheduling three to five
tasks within the stipulated time. Most operating systems would easily meet
these numbers as far as the mean dialtone delay is concerned. But general
purpose operating systems would have much higher standard deviation in
the dialtone numbers.
o Interrupt Latency refers to the delay with which the operating system can
handle interrupts and schedule tasks to respond to the interrupt. Again,
Embedded Systems based on real-time operating systems would have
much lower interrupt latency.
6.MICROCONTROLLER
Introduction:
Microcontrollers are "embedded" inside some other device (often a consumer
product) so that they can control the features or actions of the product. Another name for
a microcontroller, therefore, is "embedded controller."
Microcontrollers are dedicated to one task and run one specific program. The
program is stored in ROM (read-only memory) and generally does not change.
Microcontrollers are often low-power devices.
Page 16
Intelligent Train Engine with Gate Control System
A microcontroller has a dedicated input device and often (but not always) has a
small LED or LCD display for output. A microcontroller also takes input from the
device it is controlling and controls the device by sending signals to different
components in the device.
For example, the microcontroller inside a TV takes input from the remote control
and displays output on the TV screen. The controller controls the channel selector,
the speaker system and certain adjustments on the picture tube electronics such as
tint and brightness. The engine controller in a car takes input from sensors such as
the oxygen and knock sensors and controls things like fuel mix and spark plug
timing. A microwave oven controller takes input from a keypad, displays output on
an LCD display and controls a relay that turns the microwave generator on and off.
A microcontroller is often small and low cost. The components are chosen to
minimize size and to be as inexpensive as possible.
A microcontroller is often, but not always, ruggedized in some way.
On the other hand, a microcontroller embedded inside a VCR hasn't been
ruggedized at all.
The actual processor used to implement a microcontroller can vary widely.
Features
The AT89C51 provides the following standard features:
Compatible with MCS-51 Products
Endurance: 1,000 Write/Erase Cycles
4K Bytes of In-System Reprogrammable Flash Memory
128 bytes of Internal RAM (128 x 8-bit)
32 Programmable I/O Lines
Two 16-bit Timer/Counters
Five vector two-level interrupt architecture
A full duplex serial port
Three-level Program Memory Lock
Six Interrupt Sources
BLOCK DIAGRAM:
Page 18
Intelligent Train Engine with Gate Control System
PIN CONFIGURATIONS:
Page 19
Intelligent Train Engine with Gate Control System
PIN DESCRIPTION
Port 0:
Port 0 is an 8-bit open-drain bi-directional 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 may 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
Page 20
Intelligent Train Engine with Gate Control System
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 bi-directional 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 internal 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. Port 1 also receives the low-order address bytes during Flash
programming and verification.
Port 2
Port 2 is an 8-bit bi-directional 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 uses 16-bit addresses
(MOVX @ DPTR). In this application, it uses strong internal pull-ups when emitting 1s.
Port 3
Port 3 is an 8-bit bi-directional 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 also serves the functions of various special features of the AT89C51 as listed
below:
Page 21
Intelligent Train Engine with Gate Control System
Port 3 also receives some control signals for Flash programming and verification.
RST
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
ALE/PROG
Address Latch Enable 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
Page 22
Intelligent Train Engine with Gate Control System
Program Store Enable is the read strobe to external program memory. When the
AT89C51 is executing code from external program memory, 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 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, for parts that
require 12-volt VPP.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2
Output from the inverting oscillator amplifier
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1.
Either a quartz crystal or ceramic resonator may be used.
To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements on
the duty cycle of the external clock signal, since the input to the internal clocking
circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low time specifications must be observed.
Page 23
Intelligent Train Engine with Gate Control System
Page 24
Intelligent Train Engine with Gate Control System
f=12 ((1+C/CP)/(LC)))
Quartz crystal exhibits a property called the piezo-electric effect that is they
produce an electric voltage. When subjected to pressure along certain direction of the
crystal because of this property quartz crystal has important application in electronics
industry for controlling the frequency of radio waves.When piezo-electric crystal is used
in place of LC circuit for higher frequency stability, the oscillator is called as crystal
oscillator.
Page 25
Intelligent Train Engine with Gate Control System
Crystal oscillator is used for stability frequency for a long period of time. The
resolution of 0.01 nm/s can be obtained. Crystal operates between fp and fs frequency (a
very narrow bandwidth).
Program
Mode ALE PSEN Port 0 Port 1 Port 2 Port3
Memory
Idle Internal 1 1 Data Data Data Data
Idle External 1 1 Float Data Address Data
Power-
Internal 0 0 Data Data Data Data
down
Power-
External 0 0 Float Data Data Data
down
Program Memory Lock Bits
On the chip are three lock bits which can be left un-programmed (U) or can be
programmed (P) to obtain the additional features listed in the table below. When lock bit
1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the
device is powered up without a reset, the latch initializes to a random value, and holds
that value until reset is activated. It is necessary that the latched value of EA be in
agreement with the current logic level at that pin in order for the device to function
properly.
Page 26
Intelligent Train Engine with Gate Control System
Programming Interface
Every code byte in the Flash array can be written and the entire array can be
erased by using the appropriate combination of control signals. The write operation cycle
is self timed and once initiated, will automatically time itself to completion. All major
Page 27
Intelligent Train Engine with Gate Control System
programming vendors offer worldwide support for the Atmel microcontroller series.
Please contact your local programming vendor for the appropriate software revision.
Page 28
Intelligent Train Engine with Gate Control System
Page 29
Intelligent Train Engine with Gate Control System
7.HARDWARE DISCRIPTION
Introduction:
Geared motors convert electrical energy into precise mechanical motion. These
motors rotate a specific incremental distance per each step. The number of steps executed
controls the degree of rotation of the motors shaft. This characteristic makes step motors
excellent for positioning applications. For example, a 1.8 step motor executing 100 steps
will rotate exactly 180 with some small amount of non-cumulative error. The speed of
Page 30
Intelligent Train Engine with Gate Control System
step execution controls the rate of motor rotation. A 1.8 step motor executing steps at a
speed of 200 steps per second will rotate at exactly 1 revolution per second.
Geared motors can be very accurately controlled in terms of how far and how fast
they will rotate. The number of steps the motor executes is equal to the number of pulse
commands it is given. A step motor will rotate a distance and at a rate that is proportional
to the number and frequency of its pulse commands.
The diagram above shows a typical step motor based system. All of these parts
must be present in one form or another. Each components performance will have an
effect on the others. By altering the frequency of the pulse train, the pulse generator can
instruct the motor to accelerate, run at a speed, decelerate or stop. A pulse generator must
be present otherwise the motor will not move. Next is the motor driver.
The driver takes the pulses from the pulse generator and determines how and
when the windings should be energized. The windings must be energized in a specific
sequence to generate motion. Finally there is the step motor itself. A step motor has two
primary parts; the rotor, the moving piece, and the stator, the stationary piece. The stator
contains coils of wire called windings. The rotor spins on bearings or bushings inside the
stator. All step motors operate through the principle of the rotor following a rotating
magnetic field created by sequencing the flow of current through the stator windings.
Each NMB step motor has two phases, which are groups of electrically connected
windings. As current is passed through each phase, the motor takes steps or small
Page 31
Intelligent Train Engine with Gate Control System
movements to keep in synchronism with the magnetic field. The degree of rotation per
step depends on the style of driver used and the construction of the motor.
Positioning Stability Unlike other types of motors, step motors can be held
completely motionless in their stopped position.
Page 32
Intelligent Train Engine with Gate Control System
The windings at 12 and 6 would attract the teeth of the magnetically south end of
the rotor, and windings at 3 and 9 would attract the teeth of the magnetically north end of
the rotor.
.
7.2 CAPACITORS
Introduction:
Page 33
Intelligent Train Engine with Gate Control System
The electrolytic capacitor was invented in 1886 by Charles Pollack. It was largely
responsible for the development of mains-powered radio receivers, since it permitted the
filtering of the 50-60 hertz power supplied to residences, after it was rectified to power
the radio tubes. This was not practical without the small volume and low cost of
electrolytic capacitors.
Construction
Polarity
Modern capacitors have a safety valve, typically either a scored section of the can,
or a specially designed end seal to vent the hot gas/liquid, but ruptures can still be
dramatic. Electrolytic can withstand a reverse bias for a short period of time, but they will
conduct significant current and not act as a very good capacitor. Most will survive with
no reverse DC bias or with only AC voltage, but circuits should be designed so that there
is not a constant reverse bias for any significant amount of time. A constant forward bias
is preferable, and will increase the life of the capacitor.
Page 34
Intelligent Train Engine with Gate Control System
These are the different schematic symbols for electrolytic capacitors. The minus or N
marked side of the physical capacitor is equivalent to the node opposite to the plus sign
on its symbolic equivalent. Tip: Take notice of the shape of the symbols and the
placement of the positive and negative nodes, because most schematics do not print the
"+", but rely on the symbol itself instead.
note: caps in metal can have the color mark at the minus side !
axial: the minus wire is connected to the case, the plus wire is isolated.
radial = single ended: a vertical color stripe indicates the minus side.
Electrolyte
The electrolyte is usually boric acid or sodium borate in aqueous solution together
with various sugars or ethylene glycol which are added to retard evaporation. Care should
be taken to avoid ingestion of or eye contact with the electrolyte, and any areas of the
body where skin contact has occurred should be washed in good time. It is important to
follow safe working practice and to use appropriate protective equipment, notably gloves
and safety glasses, when working with the electrolyte. Some very old tantalum
electrolytic, often called "Wet-slug", contain the more hazardous sulfuric acid, however
most of these are no longer in service due to corrosion.
Page 35
Intelligent Train Engine with Gate Control System
Capacitance
A standardized set of capacitor base numbers was devised so that the value of any
modern electrolytic capacitor could be derived from multiplying one of the modern
conventional base numbers 1.0, 1.5, 2.2, 3.3, 4.7 or 6.8 by a power of ten. Therefore, it is
common to find capacitors with values of 10, 15, 22, 33, 47, 68, 100, 220, and so on.
Using this method, values ranging from 0.1 to 4700 are common in most applications.
Values are generally in microfarads (F).
Page 36
Intelligent Train Engine with Gate Control System
Super capacitor
MC and BC series super capacitors (up to 3000 farad capacitance) produced by Maxwell
Technologies
Page 37
Intelligent Train Engine with Gate Control System
Concept
In an electrical double layer, each layer by itself is quite conductive, but the
physics at the interface where the layers are effectively in contact means that no
significant current can flow between the layers. However, the double layer can withstand
only a low voltage, which means that super capacitors rated for higher voltages must be
made of matched series-connected individual super capacitors, much like series-
connected cells in higher-voltage batteries.
Page 38
Intelligent Train Engine with Gate Control System
History:
The super capacitor effect was first noticed in 1957 by General Electric engineers
experimenting with devices using porous carbon electrode. It was believed that the
energy was stored in the carbon pores and it exhibited "exceptionally high capacitance",
although the mechanism was unknown at that time.
General Electric did not immediately follow up on this work, and it was Standard
Oil of Ohio that eventually developed the modern version of the devices in 1966 after
accidentally re-discovering the effect while working on experimental fuel cell designs.
Their cell design used two layers of activated charcoal separated by a thin porous
insulator. Standard Oil also failed to commercialize their invention, licensing the
technology to NEC, who finally marketed the results as super capacitors in 1978, to
provide backup power for maintaining computer memory. In 2005, the ultra capacitor
market was between US $272 million and $400 million, depending on the source. It is
rapidly growing, especially in the automotive sector.
Technology advantages
Page 39
Intelligent Train Engine with Gate Control System
Transportation applications
China is experimenting with a new form of electric bus (casabas) that runs
without power lines using power stored in large onboard super capacitors, which are
quickly recharged whenever the electric bus stops at any bus stop (under so-called
electric umbrellas), and fully charged in the terminus. A few prototypes were being
tested in Shanghai in early 2005. In 2006, two commercial bus routes began to use super
capacitor buses; one of them is route 11 in Shanghai.
In 2001 and 2002, VAG, the public transport operator in Nuremberg, Germany
tested a bus which used a diesel-electric drive system with super capacitors.
Other companies from the public transport manufacturing sector are developing
super capacitor technology: The Transportation Systems division of Siemens AG is
developing a mobile energy storage based on double-layer capacitors called Subic Energy
Storage and also Sitars SES, a stationary version integrated into the trackside power
supply. The company Cudgeled is also developing a super capacitor-based energy storage
system.
For example, a resistor with bands of yellow, violet, red, and gold will have first
digit 4 (yellow in table below), second digit 7 (violet), followed by 2 (red) zeros:
4,700 ohms. Gold signifies that the tolerance is 5%, so the real resistance could lie
anywhere between 4,465 and 4,935 ohms.
Resistors manufactured for military use may also include a fifth band which
indicates component failure rate (reliability); refer to MIL-HDBK-199 for further details.
Page 40
Intelligent Train Engine with Gate Control System
Color 1st band 2nd band 3rd band (multiplier) 4th band (tolerance) Temp. Coefficient
Black 0 0 100
White 9 9 109
Note: red to violet are the colors of the rainbow where red is low energy and violet is
higher energy.
Page 41
Intelligent Train Engine with Gate Control System
CIRCUIT DIAGRAM:
7805
5
IN4007
1 2
2
230 V 0
6 1k 2 1000u
AC 1 100u 1 1f
SUPPL 8 f
4 LED
Y TRANSFORMER IN400
50 HZ 7
POWER SUPPLY:
To run the electronic gadget at home it is provided by some power supply. The
microcontroller used (at89c51) requires 12v D.C supply. The DTMF receiver used
(mt8870) requires 5v D.C. so design of these regulated power supply is also an important
part in hardware design. The A.C power supply from mains is taken and regulated using
the rectifiers.
For design of a regulated power supply components used are:
Transformer.
Diodes.
Rectifiers.
Regulated IC chips.
Capacitive filters.
Trans former:
A transformer is required to couple the mains to the actual power supply circuit.
This is required to isolate the mains from the actual regulated power supply circuit and
the other part of the kit. This isolation eliminates the dame of the kit to any power supply
variations or from a faulty shock.
Page 42
Intelligent Train Engine with Gate Control System
i1 i2
V1 V2
V1 = i2 = n1
V2 i1 n2
Diodes:
In bride rectifier four diodes are used. The specifications of diodes are chosen
as:
PIV > input voltage.
Si diode is better.
Power dissipation is kept fixed with respect to current through the diode.
Junction capacitance need not be considered for frequencies <1 kHz.
RECTIFIERS:
Rectification is a process of conversion of AC to DC. Here, the AC of transformer
output is given to the rectifier input, which converts it to DC output. Basically, bridge
rectifiers or diodes arranged in bridge called Diode arrangement are used for power
supply design.
A bridge rectifier makes use of four diodes in a bridge arrangement to achieve
full-wave rectification. This is a widely used configuration, both with individual diodes
wired as shown and with single component bridges where the diode bridge is wired
internally
Page 43
Intelligent Train Engine with Gate Control System
Page 44
Intelligent Train Engine with Gate Control System
The essential feature of this arrangement is that for both polarities of the voltage
at the bridge input, the polarity of the output is constant.
Capacitors:
Capacitive filters are used stabilized or perfect regulation of the voltage. The
capacitive filters are opted because, they are more efficient. But they are also more costly.
Different types of capacitors are:
1. Ceramic capacitors.
2. Electrolyte capacitors.
3. Paper/Mica capacitors.
4. Silver capacitors.
5. Tantalum capacitors.
Ceramic, Paper/Mica, Silver are nonpolarized capacitors. Electrolyte and Tantalum
are polarized capacitors. For high frequency, Ceramic capacitors are used. For low
frequencies, Electrolyte capacitors are used.
Linear regulated ICs:
Linear regulated ICs are used for best regulated output. The output from these
regulated ICs is given to microcontroller and DTMF receiver. These linear regulated ICs
are self protective (any accidental shot circuit in the IC is grounded automatically).
78xx series ICs are used for +ve supply.
79xx series ICs are used for -ve supply.
78xx and 79xx series ICs are fixed voltage regulators. LM 317 is a variable
voltage regulator.
Page 45
Intelligent Train Engine with Gate Control System
ULN2803buffer:
Features:
500-mA Rated Collector Current (Single
Output)
High-Voltage Outputs . . . 50 V
Output Clamp Diodes
Inputs Compatible With Various Types of
logic
Relay Driver Applications
Compatible with ULN2800A Series
description/ordering information:
The ULN2803A is a high-voltage, high-
current Darlington transistor array. The device
consists of eight nun Darlington pairs that feature high-voltage outputs with common-
cathode clamp diodes for switching inductive loads. The collector-current rating of each
Darlington pair is 500 mA. The Darlington pairs may be connected in parallel for higher
current capability.
Applications include relay drivers, hammer drivers, lamp drivers, display drivers
(LED and gas discharge), line drivers, and logic buffers. The ULN2803A has a 2.7-
kseries base resistor for each Darlington pair for operation directly with TTL or 5-V
CMOS devices.
Page 46
Intelligent Train Engine with Gate Control System
Logic diagram:
Page 47
Intelligent Train Engine with Gate Control System
M NEMONICS
A useful mnemonic for remembering the first ten color codes matches the first letter
of the color code, by order of increasing magnitude. There are many variations:
Bad Beer Rots Our Young Guts But Vodka Goes Well
Bright Boys Rave Over Young Girls But Veto Getting Wed
B. B. R O Y of Great Britain has a Very Good Wife
Big Boys Race Our Young Girls But Violet Generally Wins
Better Be Right Or Your Great Big Venture Goes West
Black Beauty Ran Over Yellow Grass By Violent Grey Waters
Bad Boys Race Over Yonder Green But Victory Goes Wanting
Black Birds Roam Over Your Garden But Vultures Go West
Bye Bye Rosie Off You Go Birmingham Via Great Weston
The word "Bad" in the first mnemonic and "Bright" in the second mnemonic are often
replaced with the word "Black" since black comes before brown in the color code. While
the second mnemonic is certainly the most offensive of these, all except the third lack a
sobriety that might be desirable, especially in a teaching context. A more staid memory
aide uses the fact that the central part of the code follows the color spectrum, without the
i for indigo. That is,
The most common variation of the mnemonic for the EIA color code generally
doesn't stay posted on this page for long due to its choice of words which is more
offensive to many today than when it was originated (mid 1920's). Refer to the discussion
for details.
Besides the ten colors of the main value code, the tolerance code is often
remembered as "for Gold or Silver" appended to the more offensive mnemonic, or "Get
Some Now" where Now refers to none for 20%.
If it is difficult to recall that black comes before brown in the color code, it may
be helpful to use the position of white at the end of the color code as a key to remember
that black (and not brown) is at the beginning.
Page 48
Intelligent Train Engine with Gate Control System
Other languages have other mnemonics for this color code. A rough translation of
the French is "Don't eat anything or I'll beat you violently, big animal."
Examples
Green-Blue-Black-Black-Brown
o 560 1%
Red-Red-Orange-Gold
o 22,000 5%
Yellow-Violet-Brown-Gold
o 470 5%
Blue-Gray-Black-Gold
o 68 5%
Note: The sizes of the resistors depend only on the power they can dissipate, and do not
affect their value.
Page 49
Intelligent Train Engine with Gate Control System
Enough current flows to make the LED light up, but not so much that the LED is
damaged. Later in this Chapter, you will find out how to calculate a suitable value for this
resistor. (LEDs are described in detail in Chapter 5.)
The 'box' symbol for a fixed resistor is popular in the UK and Europe. A 'zig-zag'
symbol is used in America and Japan:
Resistors are used with transducers to make sensor subsystems. Transducers are
electronic components which convert energy from one form into another, where one of
the forms of energy is electrical. A light dependent resistor, or LDR, is an example of
an input transducer. Changes in the brightness of the light shining onto the surface of
the LDR result in changes in its resistance. As will be explained later, an input transducer
is most often connected along with a resistor to to make a circuit called a potential
divider. In this case, the output of the potential divider will be a voltage signal which
reflects changes in illumination.
Page 50
Intelligent Train Engine with Gate Control System
How can the value of a resistor be worked out from the colours of the bands?
Each color represents a number according to the following scheme:
Number Color
0 black
1 brown
2 red
3 orange
4 yellow
5 green
6 blue
7 violet
8 grey
9 white
The first band on a resistor is interpreted as the FIRST DIGIT of the resistor
value. For the resistor shown below, the first band is yellow, so the first digit is 4:
Page 51
Intelligent Train Engine with Gate Control System
The second band gives the SECOND DIGIT. This is a violet band, making the
second digit 7. The third band is called the MULTIPLIER and is not interpreted in quite
the same way. The multiplier tells you how many nougats you should write after the
digits you already have. A red band tells you to add 2 nougats. The value of this resistor is
therefore 4 7 0 0 ohms, that is, 4 700 , or 4.7 . Work through this example again to
confirm that you understand how to apply the color code given by the first three bands.
The remaining band is called the TOLERANCE band. This indicates the
percentage accuracy of the resistor value. Most carbon film resistors have a gold-colored
tolerance band, indicating that the actual resistance value is with + or - 5% of the nominal
value. Other tolerance colours are:
Tolerance Color
1% brown
2% red
5% gold
10% silver
When you want to read off a resistor value, look for the tolerance band, usually
gold, and hold the resistor with the tolerance band at its right hand end. Reading resistor
values quickly and accurately isn't difficult, but it does take practice!
Page 52
Intelligent Train Engine with Gate Control System
8.SOFTWARE DISCRIPTION
8.1 KEIL MICROVISION
-An IDE for Microcontrollers
Introduction:
Keil development tools for the 8051 Microcontroller Architecture support every
level of software developer from the professional applications engineer to the student just
learning about embedded software development.
The Keil 8051 Development Tools are designed to solve the complex problems facing
embedded software developers.
When starting a new project, simply select the microcontroller you use from the
Device Database and the Vision IDE sets all compiler, assembler, linker, and
memory options for you.
Numerous example programs are included to help you get started with the most
popular embedded 8051 devices.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN,
UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM
Modules) of your 8051 device. Simulation helps you understand hardware
configurations and avoids time wasted on setup problems. Additionally, with
simulation, you can write and test applications before target hardware is available.
When you are ready to begin testing your software application with target
hardware, use the MON51, MON390, MONADI, or FlashMON51 Target
Monitors, the ISD51 In-System Debugger, or the ULINK USB-JTAG Adapter to
download and test program code on your target system.
Page 53
Intelligent Train Engine with Gate Control System
The Vision3 IDE offers numerous features and advantages that help you quickly and
successfully develop embedded applications. They are easy to use and are guaranteed to
help you achieve your design goals.
The Vision3 IDE and Debugger is the central part of the Keil development tool chain.
Vision3 offers a Build Mode and a Debug Mode.
In the Vision3 Build Mode you maintain the project files and generate the application.
In the Vision3 Debug Mode you verify your program either with a powerful CPU and
peripheral simulator or with the Keil ULINK USB-JTAG Adapter (or other AGDI
drivers) that connect the debugger to the target system. The ULINK allows you also to
download your application into Flash ROM of your target system.
Page 54
Intelligent Train Engine with Gate Control System
The Vision3 screen provides you with a menu bar for command entry, a tool bar
where you can rapidly select command buttons, and windows for source files, dialog
boxes, and information displays. Vision3 lets you simultaneously open and view
multiple source files.Vision3 has two operating modes:
Build Mode: Allows you to translate all the application files and to generate
executable programs. The features of the Build Mode are described under
Creating Applications.
Debug Mode: Provides you with a powerful debugger for testing your
application. The Debug Mode is described in Testing Programs.
In both operating modes you may use the source editor of Vision3 to modify your
source code. The Debug mode adds additional windows and stores an own screen layout.
The following picture shows a typical configuration of Vision3 in the Debug Mode.
The tabs of the Output Window provides: Build messages and fast error access;
Debug Command input/output console; Find in Files results with quick file
access.
The Memory Window gives access to the memory areas in display various
formats.
The Watch & Call Stack Window allows you to review and modify program
variables and displays the current function call tree.
The Workspace is used for the file editing, disassembly output, and other debug
information.
The Peripheral Dialogs help you to review the status of the on-chip peripherals
in the microcontroller.
Page 55
Intelligent Train Engine with Gate Control System
When you use the Keil Vision3, the project development cycle is roughly the same
as it is for any other software development project.
1. Create a project, select the target chip from the device database, and configure the
tool settings.
2. Create source files in C or assembly.
3. Build your application with the project manager.
4. Correct errors in source files.
5. Test the linked application.
The following block diagram illustrates the complete Vision3 software development
cycle. Each component is described below.
Vision3 IDE
Source files are created by the Vision3 IDE and are passed to the C or EC++
Compiler or Macro Assembler. The compiler and assembler process source files and
create reloadable object files.
Library Manager
The library manager allows you to create object library from the object files
created by the compiler and assembler. Libraries are specially formatted, ordered
program collections of object modules that may be used by the linker at a later time.
When the linker processes a library, only those object modules in the library that are
necessary to create the program are used.
Linker/Locator
The Linker/Locator creates an executable program file using the object modules
extracted from libraries and those created by the compiler and assembler. An executable
program file (also called absolute object module) contains no reloadable code or data. All
code and data reside at fixed memory locations.
Page 56
Intelligent Train Engine with Gate Control System
Vision3 Debugger
The Vision3 symbolic, source-level debugger is ideally suited for fast, reliable
program debugging. The debugger includes a high-speed simulator that let you simulate
an microcontroller system including on-chip peripherals and external hardware. The
Vision3 Debugger provides several ways for you to test your programs on real target
hardware.
Use the Keil ULINK USB-JTAG adapter for Flash downloading and software test
of your program via on-chip debugging system like the Embedded ICE macro cell
that is integrated in many ARM devices.
Use the AGDI interface to attach use the Vision3 Debugger front end with your
target system using other debuggers like Monitor, In-System Debugger, or
Emulator.
At Keil Software, we are dedicated to provide you with the best embedded
development tools and documentation available. If you have suggestions or comments
regarding any of the on-line manuals accompanying this product, please contact us. If
you think you have discovered a problem with the software, do the following before
calling technical support.
1. Read the sections in this manual that pertains to the job or task you are trying to
accomplish.
2. Make sure you are using the most current version of the software and utilities.
Check www.keil.com/update to make sure that you have the latest software
version.
3. Isolate the problem to determine if it is a problem with the assembler, compiler,
linker, debugger, or another development tool.
4. Further isolate software problems by reducing your code to a few lines.
If you are still experiencing problems after following these steps, report them to
our technical support group. Please include your product serial number and version
number. We prefer that you send the problem via email. If you contact us by fax, be sure
to include your name and telephone numbers (voice and fax) where we can reach you.
Try to be as detailed as possible when describing the problem you are having. The
more descriptive your example, the faster we can find a solution. If you have a single-
page code example demonstrating the problem, please email it to us. If possible, make
Page 57
Intelligent Train Engine with Gate Control System
sure that your problem can be duplicated with the Vision3 Simulator. Please try to avoid
sending complete applications or long listings as this slows down our response to you.
The Vision3 User Interface consists of menus, toolbar buttons, keyboard shortcuts,
dialog boxes, and windows that you use as you interact with and manage the various
aspects of your embedded project.
The menu bar provides menus for editor operations, project maintenance,
development tool option settings, program debugging, external tool control,
window selection and manipulation, and on-line help.
The toolbar buttons allow you to rapidly execute Vision3 commands. A Status
Bar provides editor and debugger information. The various toolbars and the status
bar can be enabled or disabled from the View Menu commands.
Keyboard shortcuts offer quick access to Vision3 commands and may be
configured via the menu command Edit Configuration - Shortcut Key.
The following sections list the Vision3 commands that can be reached by menu
commands, toolbar buttons, and keyboard shortcuts. The Vision3 commands are
grouped mainly based on the appearance in the menu bar:
CREATING APPLICATIONS
This chapter describes the Build Mode of Vision3 and is grouped into the
following sections:
Page 58
Intelligent Train Engine with Gate Control System
Project Target and File Groups: shows how to create application variants
and organized the files that belong to a project.
Tips and Tricks: provides information about the advanced features of the
Vision3 Project Manager.
CREATE PROJECT
The section provides a step-by-step tutorial that shows you how to create a
simple Vision3 project.
By using different Project Targets Vision3 lets you create several programs
from a single project. You may need one target for testing and another target for a
release version of your application. Each target allows individual tool settings within
the same project file.
Files Groups let you group associated files together in a project. We have
already used file groups in our example to separate the CPU related files from other
Page 59
Intelligent Train Engine with Gate Control System
source files. With these technique it is easily possible to maintain complex projects
with several 100 files in Vision3.
The Project Workspace shows all groups and the related files. Files are built
and linked in the same order as shown in this window. You can move file positions
with Drag & Drop. You may select a target or group name and Click to rename it.
The local menu opens with a right mouse Click and allows you for each item:
In the build toolbar you can quickly change the current project target to build.
PROJECT COMPONENTS
You may add, delete, or re-arrange the items with the list box buttons in
Project Targets, Groups, and Files.
Project Targets
Shows all Project Targets in your project. Project Targets let you create
several programs form a single project. You may need one target for testing
and another target for a release version of your application.
Groups
Page 60
Intelligent Train Engine with Gate Control System
Shows all File Groups in your current project. File Groups let you group
associated files together in a project. This is useful for grouping files into
functional blocks or for identifying engineers in your software team.
Files
Shows all files of the selected File Group.
Set as Current Target
Set the selected Project Target as the current target.
Add Files
Add files to the selected File Group.
FILE EXTENSIONS
Home Creating Applications Tips and Tricks File Extensions
Page 61
Intelligent Train Engine with Gate Control System
You may select one of these devices and then specify any necessary chip options in
the in the Options for Target Target dialog. For example on-chip memory may
be specified as External Memory.
You can import project files from Vision1 by using the menu item Project -
Import Vision1 Project. This starts the following procedure:
1. Create a new Vision project file. It is important that the new Vision2/3
project file is created in the existing Vision1 project folder.
2. Select a CPU from the device database.
3. Select the old Vision1 project file that exists in the project folder.
4. This import the old Vision1 linker settings into the L166 dialogs. However, we
recommend that you use the dialog Vision Options for Target Target to
define the memory structure of the target hardware. Once you have done
that, you should open the dialog Options for Target L166 / Lx51
Locate. Enable the option Use Memory Layout from Target and remove
the settings for User Classes, User Segments, or User Sections in this
dialog.
5. Check carefully if all settings are copied correctly to the new Vision project
file.
6. You may now create file groups in the new Vision project. Then you can Drag
& Drop files into the new file groups.
Debugging
Home Debugging
This chapter describes the Debug Mode of Vision3 and shows you how to use the
user interface to test a sample program. Also discussed are simulation mode and the
different options available for program debugging.
You can use Vision3 Debugger to test the applications you develop. The
Vision3 Debugger offers two operating modes that are selected in the Options for
Page 62
Intelligent Train Engine with Gate Control System
including the serial port, external I/O, and timers. The peripheral set is
selected when you select a CPU from the device database for your target.
Use Advanced GDI drivers, like the ULINK Debugger to interface to your
target hardware. For Vision3 various drivers are available that interface to:
o JTAG/OCDS Adapter: which connects to on-chip debugging systems
like the ARM Embedded ICE.
o Monitor: that may be integrated with user hardware or is available on
many evaluation boards.
o Emulator: which connects to the CPU pins of the target hardware.
o In-System Debugger: which is part of the user application program
and provides basic test functions.
o Test Hardware: such as the Infineon Smartcard ROM Monitor RM66P
or the Philips Smarm Box.
Flash Programming
Home Flash Programming
You may use external command-line driven utilities (usually provided by the chip
vendor) or the Keil ULINK USB-JTAG Adapter. The Flash Programming Utilities are
configured under Project - Options - Utilities.
Flash Programming may be started from the Flash Menu or before starting the
Vision3 Debugger when you enable Project - Options - Utilities - Update Target
before Debugging.
The project file for the MEASURE sample program is called Measure.UV2. To
load this project file, use Open Project from the Project menu and select
Measure.UV2 in the folder ...\ARM\...\Examples\Measure.
The Files page in the Project Workspace shows the source files that compose
the MEASURE project. The three application related source files that are located in
the Source Files group. The function of the source files is described below. To open
a source file, double-click on the filename.
Page 63
Intelligent Train Engine with Gate Control System
Measures: contains the main C function for the measurement system and
the interrupt routine for timer 0. The main function initializes all peripherals of
the ARM and performs command processing for the system. The timer
interrupt routine, timer0, manages the real-time clock and the measurement
sampling of the system.
MCommand.C: processes the display, time, and interval commands. These
functions are called from main. The display command lists the analog values
in floating-point format to give a voltage between 0.00V and 5.00V.
GetLine.C: contains the command-line editor for characters received from
the serial port.
IRQ.S: is an interface module for the interrupt service routine.
When you are ready to compile and link the MEASURE project, use the Build
Target command from the Project menu or the toolbar. Vision3 begins to compile
and link the source files in MEASURE and displays a message when the build is
finished.
Once the project is built, you are ready to browse the symbol information or
begin testing.
Testing Measure
Home Example Programs Measure: A Remote Measurement System Testing
Measure
Page 64
Intelligent Train Engine with Gate Control System
The MEASURE sample program is designed to accept commands from the on-
chip serial port. If you have actual target hardware, you can use a terminal
simulation to communicate with the ARM CPU. If you do not have target hardware,
you can use Vision3 to simulate the hardware. You can also use the serial window in
Vision3 to provide serial input.
Once the MEASURE program is build, you can test it. Use the Start/Stop Debug
Session command from the Debug menu to start the Vision3 debugger.
Vision3 lets you view the program code in the Disassembly Window that
opens with the View menu or the toolbar button. The Disassembly Window shows
intermixed source and assembly lines. You may change the view mode or use other
commands from the local menu that opens with the right mouse button.
Page 65
Intelligent Train Engine with Gate Control System
Vision3 displays memory in various formats. The Memory Window opens via
the View menu or the toolbar button. You can enter the address of four different
memory areas in the pages. The local menu allows you to modify the memory
contents or select different output formats.
Page 66
Intelligent Train Engine with Gate Control System
Program Execution
Home Example Programs Measure: A Remote Measurement System
Program Execution
Before you begin simulating MEASURE, open the Serial Window #1 that
displays the serial output with the View menu or the Debug toolbar. You may
disable other windows if your screen is not large enough.
You can use the Step toolbar buttons on assembler instructions or source
code lines. If the Disassembly Window is active, you single step at assembly
instruction basis. If an editor window with source code is active, you single step at
source code level.
Call Stack
Home Example Programs Measure: A Remote Measurement System Call
Stack
Vision3 internally tracks function nesting as the program executes. The Call
Stack page of the Watch Window shows the current function nesting. A double
click on a line displays the source code that called the selected function.
Breakpoints Dialog
Home Example Programs Measure: A Remote Measurement System
Breakpoints Dialog
Page 67
Intelligent Train Engine with Gate Control System
Open the Breakpoints dialog from the Debug menu. Enter as expression
current.time.sec==3. Select the Write check box (this option specifies that the
break condition is tested only when the expression is written to). Click on the Define
button to set the breakpoint.
Symbol Description
Reset CPU.
If program execution is halted begin executing the MEASURE program.
After a few seconds, Vision3 halts execution. The program counter line in the debug
window marks the line in which the breakpoint occurred.
Each of these dialogs lists the related SFR symbols and shows the current
status of the peripherals. To change the inputs, change the values of the Pins or
Analog Input Channels.
Page 68
Intelligent Train Engine with Gate Control System
9.CODING
Program written in C language
#include<stdio.h>
#include<reg51.h>
void delay(into);
void medley(void);
sit sen1=P1^0;
sit sen2=P1^1;
sit buzz=P1^3;
sit sig1=P1^4;
sit sig2=P1^5;
sit laser=P1 ^6;
void close();
void open();
void buzzer();
into m=10000;
void main()
{
P0=P2=P3=0x00;
P1=0xff;
buzzer();
sig1=0x00; //train stop/road go
sig2=0x01;
open();
for(;;)
{
if(sen1==0x00)
{
sig1=0x01; sig2=0x00; //train go/road stop
buzzer();
close();
medley();
while(sen2==0x01){}
while(sen2==0x00){}
sig1=0x00; sig2=0x01; //train stop/road go
buzzer();
open();
}
if(sen2==0x00)
{
sig1=0x01; sig2=0x00; //train go/road stop
buzzer();
close();
medley();
while(sen1==0x01){}
Page 69
Intelligent Train Engine with Gate Control System
while(sen1==0x00){}
sig1=0x00; sig2=0x01; //train stop/road go
buzzer();
open();
}
}
}
void medley(void)
{
into l=0;
for(l=0;l<=200;l++)
{
TMOD=0x10;
TL1=0xfe;
TH1=0xa5;
TR1=1;
while(TF1==0)
{
if(laser==0x00)
{
sig1=0x00; sig2=0x01; //train stop/road go
buzzer();
open();
while(laser==0x00){}
sig1=0x01; sig2=0x00; //train go/road stop
buzzer();
close();
}
}
TR1=0;
TF1=0;
}
}
void buzzer()
{
into y;
for(y=0;y<=8;y++)
{
buzz=0x01;deley(15000);
buzz=0x00;deley(15000);
}
}
void open()
{
P2=0x11;deley(m);
Page 70
Intelligent Train Engine with Gate Control System
P2=0x33;deley(m);
P2=0x22;deley(m);
P2=0x66;deley(m);
P2=0x44;deley(m);
P2=0xcc;deley(m);
P2=0x88;deley(m);
P2=0x99;deley(m);
P2=0x11;deley(m);
P2=0x33;deley(m);
P2=0x22;deley(m);
P2=0x66;deley(m);
P2=0x44;deley(m);
P2=0xcc;deley(m);
P2=0x88;deley(m);
P2=0x99;deley(m);
}
void close()
{
P2=0x99;deley(m);
P2=0x88;deley(m);
P2=0xcc;deley(m);
P2=0x44;deley(m);
P2=0x66;deley(m);
P2=0x22;deley(m);
P2=0x33;deley(m);
P2=0x11;deley(m);
P2=0x99;deley(m);
P2=0x88;deley(m);
P2=0xcc;deley(m);
P2=0x44;deley(m);
P2=0x66;deley(m);
P2=0x22;deley(m);
P2=0x33;deley(m);
P2=0x11;deley(m);
}
void delay(k)
{
into i=0;
for(i=0;i<=kid++){}
}
Page 71
Intelligent Train Engine with Gate Control System
Page 72
Intelligent Train Engine with Gate Control System
10. CONCLUSIONS :
Hence the Unmanned railway gates operate according to the data input from
sensors to microcontroller. First an alarm is triggered and then the gate is operated.
Specifications:
Mechanical gate arrangement
Atmel 89C51 an 8051 family microcontroller
SN7404 for microcontroller interfacing.
IR sensors for sensing train
Geared motor to operate gates
ULN 2803 for driving Geared motor
Page 73
Intelligent Train Engine with Gate Control System
11. BIBLIOGRAPHY
1. www.mitel.databook.com
2. www.atmel.databook.com
3. www.franklin.com
4. www.keil.com
References:
www.8052.com/tutorial.phtml
8051 microcontroller by Kenneth J. Ayala
www.electronicsforu.com/electronicsforu/articles/hits.asp?id=1431
Programming Embedded Systems: With C and GNU Development Tools
by Michael Barr
Basic electronics By: GROB
Practical transistor circuit design and analysis By: GERALD E. WILLIAMS
Sensor - Electronic circuit guide book Volume 1 By: JOSEPH J.CARR
Programming and Customizing the 8051 Micro-controller By: Mike Prado
The concepts and Features of Micro-controllers - By: Raj Kamala
The 8051 Micro-controller Architecture, programming & Applications
By: Kenneth J. Ayala
CMOS/TTL IC Data Manuals
Page 74