You are on page 1of 32

[1] INTRODUCTION

1.1 INTRODUCTION
Aim of this project is to control the unmanned rail gate automatically using embedded platform. Today often we see news papers very often about the railway accidents happening at un- attended railway gates. Present project is designed to avoid such accidents if implemented in spirit. 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. In this project AT89c51 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 as per the scheduled time. Stepper motors are used for the purpose of gate control interfaced with current drivers chip ULN2003 its a 16 pin IC.

1|Page

1.2 BLOCK DIAGRAM

89C51
REGULATED POWER SUPPLY

MICRO CONTROLLER

ULN 2003

STEPPER MOTOR

LM324

LIGHT DEPENDENT RESISTOR

Fig.1.1 Block diagram of AUTOMATIC RAILWAY GATE CONTROLLER

1.3 DESCRIPTION: Basically circuit consists of following blocks: i) Regulated power supply ii) Microcontroller AT89C51 iii) ULN 2003 iv) Stepper Motors v) LM 324 vi) Light dependent resistor

Let us take overview of basic blocks, which are as follow i) REGULATED POWER SUPPLY-:
2|Page

A regulated power supply is an embedded circuit, or stand alone unit, the function of which is to supply a stable voltage (or less often current), to a circuit or device that must be operated within certain power supply limits. The output from the regulated power supply may be alternating or unidirectional, but is nearly always DC. The type of stabilization used may be restricted to ensuring that the output remains within certain limits under various load conditions, or it may also include compensation for variations in its own supply source. The latter is much more common today. APPLICATIONS

D.C. variable bench supply (a bench power supply usually refers to a power supply capable of supplying a variety of output voltages useful for bench testing electronic circuits, possibly with continuous variation of the output voltage, or just some preset voltages; a laboratory (lab) power supply normally implies an accurate bench power supply, while a balanced or tracking power supply refers to twin supplies for use when a circuit requires both positive and negative supply rails). Mobile Phone power adaptors Regulated power supplies in appliances

ii.) MICROCONTROLLER AT89C51 -: This is the most important block of the system. Microcontroller is the decision making logical device which has its own memory, I/O ports, CPU and Clock circuit embedded on a single chip.

3|Page

Fig.1.2Microcontroller

iii) ULN 2003 -: The ULN2003 is a monolithic high voltage and high current Darlington transistor arrays. It consists of seven NPN Darlington pairs that features high-voltage outputs with common-cathode clamp diode for switching inductive loads. The collector-current rating of a single darlington pair is 500mA. The Darlington pairs may be paralleled for higher current capability. Applications include relay drivers, hammer drivers, lamp drivers, display drivers(LED gas discharge),line drivers, and logic buffers. The ULN2003 has a 2.7kW series base resistor for each darlington pair for operation directly with TTL or 5V CMOS devices. FEATURES * 500mA rated collector current (Single output) * High-voltage outputs: 50V * Inputs compatible with various types of logic. * Relay driver application. iv) STEPPER MOTOR -: A stepper motor (or step motor) is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor's position can then be commanded to move and hold at
4|Page

one of these steps without any feedback sensor (an open-loop controller), as long as the motor is carefully sized to the application. APPLICATION -: Computer-controlled stepper motors are a type of motion-control positioning system. They are typically digitally controlled as part of an open loop system for use in holding or positioning applications. In the field of lasers and optics they are frequently used in precision positioning equipment such as linear actuators, linear stages, rotation stages, goniometers, and mirror mounts. Other uses are in packaging machinery, and positioning of valve pilot stages for fluid control systems. Commercially, stepper motors are used in floppy disk drives, flatbed scanners, computer printers, plotters, slot machines, image scanners, compact disc drives, intelligent lighting and many more devices.

v) LM324 -: LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps) compensated in a single package. Op-amps are high gain electronic voltage amplifier with differential input and, usually, a single-ended output. The output voltage is many times higher than the voltage difference between input terminals of an op-amp. These op-amps are operated by a single power supply LM324 and need for a dual supply is eliminated. They can be used as amplifiers, comparators, oscillators, rectifiers etc. The conventional op-amp applications can be more easily implemented with LM324.

Fig.1.3 LM324 5|Page

vi) LIGHT DEPENDENT RESISTOR -: A photoresistor or light dependent resistor is a resistor whose resistance decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. It can also be referred to as a photoconductor or CdS device, from "cadmium sulfide," which is the material from which the device is made and that actually exhibits the variation in resistance with light level. Note that although CdS is a semiconductor, it is not doped silicon. A photoresistor is made of a high resistance semiconductor. If light falling on the device is of high enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electron (and its hole partner) conduct electricity, thereby lowering resistance.

Light dependent resistor


Fig.1.4 LIGHT DEPENDENT RESISTOR

Applications Photoresistors come in many different types. Inexpensive cadmium sulphide cells can be found in many consumer items such as camera light meters, street lights, clock radios, alarm devices, outdoor clocks,solar street lamps and solar road studs etc. They are also used in some dynamic compressors together with a small incandescent lamp or light emitting diode to control gain reduction and are also used in bed lamps etc. Lead sulphide (PbS) and indium antimonide (InSb) LDRs (light dependent resistor) are used for the mid infrared spectral region. Ge:Cu photoconductors are among the best farinfrared detectors available, and are used for infrared astronomy and infrared spectroscopy.

6|Page

[2] CIRCUIT DESCRIPTION

2.1 CIRCUIT DIAGRAM -:

Fig.2.1 Circuit Diagram of automatic gate railway controller

7|Page

2.2 COMPONENT LIST-:

S.NO. 1 2 3 4 5 6 7 8 9 10 11 12 13 14

COMPONENT MICRO CONTROLLER ATMEGA 8 OPERATIONAL AMPLIFIER LM324 VOLTAGE REGULATOR IC 7805 IR TRANSMITTER IR RECIEVER MOTOR DRIVER L 293D 7-SEGMENT DISPLAY STEPPER MOTOR VOLTAGE REGULATOR IC 7805 RESISTOR CAPACITOR DIODE BUZZER LED
Tab.1 component list

QUANTITY 1 2 1 1 1 1 1 2 1 7 2 6 1 4

2.3 COMPONENT DESCRIPTION:


2.3.1 PASSIVE ELEMENTS:

1.RESISTORS: Resistors (R) are the most commonly used of all electronic components, to the point where they are almost taken for granted. They are "Passive Devices", that is they contain no source of power or amplification but only attenuate or reduce the voltage signal passing through them. When used
8|Page

in DC circuits the voltage drop produced is measured across their terminals as the circuit current flows through them while in AC circuits the voltage and current are both In-phase Producing0 degree phase shift. In all Electrical and Electronic circuit diagrams and schematics, the most commonly used resistor symbol is that of a "zigzag" type line with the value of its resistance given in Ohms.

RESISTORSYMBOL: The symbol used in schematic and electrical drawings for a Resistor can either be a "zigzag" type line or a rectangular box.

RESISTORTYPES: All modern resistors can be classified into four broad groups Carbon Composition Resistor: Made of carbon dust or graphite paste, low wattage values. Film or Cermet Resistor: Made from conductive metal oxide paste, very low wattage values. Wire-Wound Resistors: Metallic bodies for heat sink mounting, very high wattage ratings. Semiconductor Resistors: High frequency/precision surface mount thin film technology.

RESISTOR COLOUR CODE: The resistance value, tolerance, and watt rating of the resistor are generally printed onto the body of the resistor as numbers or letters when the resistor is big enough to read the print, such as large power resistors. When resistors are small such as 1/4W Carbon and Film types, these specifications must be shown in some other manner as the print would be too small to read. So to overcome this, small resistors use coloured painted bands to indicate both their resistive value
9|Page

and their tolerance with the physical size of the resistor indicating its wattage rating. These coloured painted bands are generally known as a Resistors Colour Code.

To distinguish left from right there is a gap between the C and D bands. Band A is first significant figure of component value (left side) Band B is the second significant figure Band C is the decimal multiplier Band D if present, indicates tolerance of value in percent (no color means 20%)

Presets: These are miniature versions of the standard variable resistor. They are designed to be mounted directly onto the circuit board and adjusted only when the circuit is built. For example to set the

10 | P a g e

frequency of an alarm tone or the sensitivity of a light-sensitive circuit. A small screwdriver or similar tool is required to adjust presets.

Preset Symbol

Presets are much cheaper than standard variable resistors so they are sometimes used in projects where a standard variable resistor would normally be used.

2.

CAPACITORS:

Just like the Resistor, the Capacitor or sometimes referred to as a Condenser is a passive device, and one which stores energy in the form of an electrostatic field which produces a potential (Static Voltage) across its plates. When a voltage is applied to these plates, a current flows charging up the plates with electrons giving one plate a positive charge and the other plate an equal and opposite negative charge. This flow of electrons to the plates is known as the Charging Current and continues to flow until the voltage across the plates (and hence the capacitor) is equal to the applied voltage Vc. At this point the capacitor is said to be fully charged and this is illustrated below.

UNITS OF CAPACITANCE: Microfarad (F) 1F = 10-6 F Nano farad (nF) 1nF = 10-9F Pico farad (pF) 1pF = 10 -12F

11 | P a g e

TYPES OF CAPACITORS: There are a very large variety of different types of Capacitors available in the market place and each one has its own set of characteristics and applications from small delicate trimming capacitors up to large power metal can type capacitors used in high voltage power correction and smoothing circuits. Dielectric capacitors:

Dielectric capacitorsare usually of the variable type such as used for tuning transmitters, receivers and transistor radios. They have a set of fixed plates and a set of moving plates that mesh with the fixed plates and the position of the moving plates with respect to the fixed plates determines the overall capacitance. The capacitance is generally at maximum when the plates are fully meshed.

Variable Capacitor Symbols:

As well as the continuously variable types, preset types are also available called Trimmers .These are generally small devices that can be adjusted or "pre-set" to a particular capacitance with the aid of a screwdriver and are available in very small capacitances of 100pF or less and are non-polarized.

Film capacitors: Film Capacitors are the most commonly available of all types of capacitors, consisting of a relatively large family of capacitors with the difference being in their dielectric properties. These
12 | P a g e

include polyester (Mylar), polystyrene, polypropylene, polycarbonate, metallized paper, Teflon etc. Film type capacitors are available in capacitance ranges from 5pF to 100uF depending upon the actual type of capacitor and its voltage rating. Film capacitors also come in an assortment of shapes and case styles which include: Wrap & Fill (Oval & Round) Epoxy Case (Rectangular & Round) Metal Hermetically Sealed (Rectangular & Round)

Ceramic capacitors : Ceramic Capacitors or Disc Capacitors as they are generally called, are made by coating two sides of a small porcelain or ceramic disc with silver and are then stacked together to make a capacitor. For very low capacitance values a single ceramic disc of about 3-6mm issued. Ceramic capacitors have a high dielectric constant (High-K) and are available so that relatively high capacitances can be obtained in a small physical size. They exhibit large non-linear changes in capacitance against temperature and as a result are used as de-coupling or by-pass capacitors as they are also non-polarized devices. Ceramic capacitors have values ranging from a few Picofarads to one or two microfarads but their voltage ratings are generally quite low. Ceramic types of capacitors generally have a 3-digit code printed onto their body to identify their capacitance value. For example, 103 would indicate 10 x 103 PF.

Electrolytic capacitors : Electrolytic Capacitors are generally used when very large capacitance values are required. Here instead of using a very thin metallic film layer for one of the electrodes, a semi-liquid electrolyte solution in the form of a jelly or paste is used which serves as the second electrode (usually the cathode). The dielectric is a very thin layer of oxide which is grown electro- chemically in production with the thickness of the film being less than ten microns. This insulating layer is so thin that it is possible to make large value capacitors of a small size. The majority of electrolytic types of capacitors are polarized, that is the voltage applied to the capacitor terminals must be of the correct polarity as an incorrect polarization will break down the insulating oxide layer and permanent damage may result.
13 | P a g e

Electrolytic Capacitors are generally used in DC power supply circuits to help reduce the ripple voltage or for coupling and decoupling applications. Electrolytes generally come in two basic forms: Aluminum Electrolytic Tantalum Electrolytic capacitors

3) Light Emitting Diodes (LEDs): A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in many devices and are increasingly used for other 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. When a light-emitting diode is forward biased (switched on), electrons are able

to recombine with electron 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.

Advantages: Efficiency: LEDs emit more light per watt than incandescent light bulbs. Their efficiency is not affected by shape and size, unlike fluorescent light bulbs or tubes. Color: LEDs can emit light of an intended color without using any color filters as traditional lighting methods need. This is more efficient and can lower initial costs.
14 | P a g e

Size: LEDs can be very small (smaller than 2 mm2) and are easily populated onto printed circuit boards. On/Off time: LEDs light up very quickly. A typical red indicator LED will achieve full brightness in under a microsecond. LEDs used in communications devices can have even faster response times. Cycling: LEDs are ideal for uses subject to frequent on-off cycling, unlike fluorescent lamps that fail faster when cycled often, or HID lamps that require a long time before restarting. Dimming: LEDs can very easily be dimmed either by pulse-width modulation or lowering the forward current.

Disadvantages: High initial price: LEDs are currently more expensive, price per lumen, on an initial capital cost basis, than most conventional lighting technologies. The additional expense partially stems from the relatively low lumen output and the drive circuitry and power supplies needed. Temperature dependence: LED performance largely depends on the ambient temperature of the operating environment. Over-driving an LED in high ambient temperatures may result in overheating the LED package, eventually leading to device failure. Adequate heat sinking is needed to maintain long life. Voltage sensitivity: LEDs must be supplied with the voltage above the threshold and a current below the rating. This can involve series resistors or current-regulated power supplies. Light quality: Most cool-white LEDs have spectra that differ significantly from a black body radiator like the sun or an incandescent light. However, the color rendering properties of common fluorescent lamps are often inferior to what is now available in state-of-art white LEDs.

Application of LEDs falls into four 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.
15 | P a g e

Generate light for measuring and interacting with processes that do not involve the human visual system. Narrow band light sensors where the LED is operated in a reverse-bias mode and is responsive to incident light instead of emitting light.

2.3.2 IC PIN DESCRIPTION:

1) IC LM324: The Operational Amplifier is probably the most versatile Integrated Circuit available. It is very cheap especially keeping in mind the fact that it contains several hundred components. The most common Op-Amp is the 741 and it is used in many circuits. The OP AMP is a Linear Amplifier with an amazing variety of uses. Its main purpose is to amplify (increase) a weak signal - a little like a Darlington Pair. The OP-AMP has two inputs, INVERTING (-) and NON-INVERTING (+), and one output at pin 6.The 741 is used in two ways.

a) AN INVERTING AMPLIFIER Leg two is the input and the output is always reversed. In an inverting amplifier the voltage enters the 741 chip through leg two and comes out of the 741chip at leg six. If the polarity is positive going into the chip, it negative by the time it comes out through leg six. The polarity has been inverted.

b) A NON-INVERTING AMPLIFIER Leg three is the input and the output is not reversed. In a non-inverting amplifier the voltage enters the 741 chip through leg three and leaves the 741 chip through leg six. This time if it is positive going into the 741 then it is still positive coming out. Polarity remains the same.

16 | P a g e

PIN DIAGRAM:

Fig.2.2 Pin diagram of LM324 IC

CONNECTIONAL DIAGRAM:

Fig.2.3 Connectional diagram of LM324 IC

FEATURES Short Circuit Protection Excellent Temperature Stability Internal Frequency Compensation
17 | P a g e

High Input Voltage Range Null of Offset

APPLICATIONS Audio and Video frequency pre-amplifiers and buffers Differential amplifiers Differentiators and integrators Filters Precision rectifiers Precision peak detectors Voltage and Current regulators Analog calculators Analog-to-Digital converters Digital-to-Analog converters Voltage clamps Oscillators and Wave form generators

2) MICROCONTROLLER A micro-controller can be compared to a small stand-alone computer; it is a very powerful device, which is capable of executing a series of pre-programmed tasks and interacting with other hardware devices. Being packed in a tiny integrated circuit (IC) whose size and weight is usually negligible, it is becoming the perfect controller for robots or any machines requiring some kind of intelligent automation. A single microcontroller can be sufficient to control a small mobile robot, an automatic washer machine or a security system. Any microcontroller contains a memory to store the program to be executed, and a number of input/output lines that can be used to interact with other devices, like reading the state of a sensor or controlling a motor. Nowadays, microcontrollers are so cheap and easily available that it is common to use them instead of simple logic circuits like counters for the sole purpose of gaining some design flexibility and saving some space. Some machines and robots will even rely on a multitude of microcontrollers, each one dedicated to a certain task. Most recent microcontrollers are 'In System Programmable', meaning that you can modify the program being executed, without removing the microcontroller from its place.
18 | P a g e

Today, microcontrollers are an indispensable tool for the robotics hobbyist as well as for the engineer. Starting in this field can be a little difficult, because you usually can't understand how everything works inside that integrated circuit, so you have to study the system gradually, a small part at a time, until you can figure out the whole image and understand how the system works. Architecture of a Microcontroller:

Fig.2.4 Architecture of a Microcontroller

19 | P a g e

Pin diagram: The pin diagram of a general microcontroller can be given as:

Fig.2.5 pin diagram of microcontroller

Description This is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel's high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set.

20 | P a g e

By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, a precision analog comparator, on-chip oscillator and clock circuitry.

In addition, the AT89C2051 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 contents but freezes the oscillator disabling all other chip functions until the next hardware reset.

Pin description: VCC -: Digital supply voltage. GND -: Ground. Port B (PB7..PB0) XTAL1/XTAL2/TOSC1/TOSC2 Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Depending on the clock selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit. Depending on the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator amplifier. If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6 is used as TOSC2..1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set. The various special features of Port B are elaborated in Alternate Functions of Port B on page 58 and System Clock and Clock Options Port C (PC5..PC0) Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running.

21 | P a g e

PC6/RESET If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset, even if the clock is not running.

Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. RESET Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. AVCC AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. Note that Port C (5..4) use digital supply voltage, VCC. AREF AREF is the analog reference pin for the A/D Converter. ADC7.6 (TQFP and QFN/MLF Package Only) In the TQFP and QFN/MLF package, ADC7.6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels. 3) IC 7805: IC7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides
22 | P a g e

+5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels.

Pin diagram:

Fig.2.6.Pin diagram IC 7805

4) IC L293D: Introduction: L293D Dual H-Bridge Motor Driver so with one IC we can interface two DC motors which can be controlled in both clockwise and counter clockwise direction and if you have motor with fix direction of motion the you can make use of all the four I/Os to connect up to four DC motors. L293D has output current of 600mA and peak output current of 1.2A per channel. Moreover for protection of circuit from back EMF output 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.

23 | P a g e

Schematic Diagram: A simple schematic for interfacing a DC motor using L293D is shown.

Fig.2.7 Schematic Diagram of IC L293D

[3]

24 | P a g e

FINAL DESIGN 3.1 PCB LAYOUT-:

FIG 3.1 PCB LAYOUT

3.2 TESTING: A) HARDWARE B) SOFTWARE

3.2.1 HARDWARE TESTING: 1. Continuity test: First of all we checked the PCB that all the tracks are as per the design of PCB and showing continuity with the help of multimeter and PCB layout. 2. Short circuit test:

25 | P a g e

Then we checked the PCB for any unwanted short circuits with the help of multimeter and PCB layout. 3. Soldering: In the next step, we soldered the required components and then checked that there are no any unwanted shorts occurred due to soldering without putting IC's and keeping power supply off. 4. Power supply test: In the next step, we put power supply on and checked whether required voltage is appearing at the required voltage is appearing at the required points i.e. Vcc and GND at the respective points. We took care of not connecting IC's in the circuit while performing this test. 3.2.2 SOFTWARESTESTING: 1. Dip Trace: ROLE IN THE DESIGN: Dip Trace 1.50 proved to be a very handy & easy-to-use tool for the PCB layout process. Many of its features were utilized leading to an accurate & efficient design. It has Design Error Check & Electrical Rule Check tools which proved to be helpful in the design. It is loaded with a huge component list that is categorized in various libraries for giving simplicity. Placement of components is also very easy & they can be rotated in 360 to customize the design. 2. AVR STUDIO: ROLE IN THE DESIGN: avr studio provides IDE for 8051 programming & is very easy to use. When starting a new project, simply select the microcontroller you use from the Device Database and the avr IDE sets all Compiler, Assembler, Linker, and Memory options. Its device database is large which supports many ICs of the 8051 family. A HEX file can be created with the help of avr which is required for burning onto chip. It has a powerful debugging tool which detects most of the errors in the program.

26 | P a g e

[4] CODING
Program code-: #include<reg51.h> void MSDelay (unsigned int value); sbit sense1=P1^0; sbit sense2=P1^1; sbit buz1=P1^4; sbit buz2=P1^5; sbit led=P2^7; void main () { int i; P1=0xf0; buz1=0; buz2=0; led=0; while (1) { if (sense1==1 && sense2!=1) { buz1=1; led=1; for (i=0;i<=2;i++)
27 | P a g e

{ P2=0x66; MSDelay (10); P2=0xCC; MSDelay (10); P2=0x99; MSDelay (10); P2=0x33; MSDelay (10); } } sense1=0; if (sense2==1 && sense1!=1) { buz1=0; led=0; for (i=0; i<=2;i++) { P2=0x66; MSDelay (10); P2=0x33; MSDelay (10); P2=0x99; MSDelay (10); P2=0xCC;
28 | P a g e

MSDelay (10); }

for(i=0;i<=2;i++) { P0=0x66; MSDelay (10); P0=0xCC; MSDelay (10); P0=0x99; MSDelay (10); P0=0x33; MSDelay (10); } } sense2=0;

if (sense1==1 && sense2==1)

{ buz2=1; MSDelay (200); buz2=0; } sense1=0;


29 | P a g e

sense2=0; } } void MSDelay (unsigned int value) { unsigned int x,y; for(x=0; x<1275;x++) for(y=0;y<value;y++); )

30 | P a g e

[5] CONCLUSION Conclusion-:


From the above discussion and information of this system we, upto now surely comes to know that it is highly reliable effective and economical at dense traffic area, sub urban area and the route where frequency of trains is more. As it saves some auxiliary structure as well as the expenditure on attendant it is more economical at above mentioned places than traditional railway crossing gate system. We know that though it is very beneficial but it is also impossible to install such system at each and every places, but it gives certainly a considerable benefit to us, thereby to our nation.

31 | P a g e

[6] REFERENCE Reference-:


1. www.Wikipedia.com 2. www.scribd.com 3. www.alldatasheet.com 4. www.8051projects.info

32 | P a g e