Sei sulla pagina 1di 51

EAUTOMATION FOR TRAINS

E-AUTOMATION FOR TRAINS


INTRODUCTION
There are many railway crossings which are unmanned due to lack of man power needed to fulfill the demands. Hence many accidents occur at such crossings since there is no one to take care of the functioning of the railway gate when a train approaches the crossing. This project is a step towards improving the status of such unmanned railway crossings. Here, the railway gate is closed automatically as train approaches the crossing and automatically the gate is opened after the train has crossed. Here the magnetic switches have been utilized to sense the train approach and departure. This project is designed using Microcontroller IC 8051,the program is written and stored in the ROM of the 8051.when the Microcontroller is powered up, the controller starts working as per the program stored in the IC. To sense the train and to control the gates, the ports of Microcontroller are utilized. The main advantage of using Microcontroller, the size of the circuit is minimized to greater extent, consumes less power, reliable and has high accuracy in its operation. The two magnetic sensors are placed 1/4th KM away from the railway gate crossing on either side of the gate .When the train approaches and passes on the magnetic sensor the gate buzzer produces sound for few seconds , which indicates to the motor vehicles that gate is about to close and no one should cross the gate. Similarly once the Train passes on the other sensor kept at other side of the gates will be opened. The distance of placing sensors can be adjusted. This project is facilitated with multi options such as anti collision system for trains and it sends indication to the driver in the train as soon as the track is cut or removed.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

2.1 BLOCK DIAGRAM OF UNMANNED RAILWAY GATE CONTROL:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

2.2

BLOCK DIAGRAM OF TRACK CUT :

TRACK CUT SENSING CIRCUIT

FM Tx ULN 2803 IC

FM Rx

8051

16X2 LCD

2.3 BLOCK DIAGRAM OF ANTI COLLISION :


DRIVE R CKT

BUZZER

IR TxBLOCK IR 2.4 DIAGRAM Rx EXPLANATION OF MICROCONTROLLER BASED UNMANNED RAILWAY GATE CONTROL:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

MAGNETIC SENSORS:
When the magnet is passed on the magnetic switch, it makes the magnetic switch gets shorted. Using this principle, we can detect the train. The magnetic sensors are used at either side of the Railway gate in order to detect the arrival and departure of train at the Railway gate. The sensors has to be 1/4 KM away from the Railway gate on either side, the above distance is not mandatory, this can be adjusted as per the requirement. The two magnetic switches are connected to the Microcontroller in order to provide triggering to the ports of Microcontroller.

PROGRAM:
A Microcontroller program is written and stored in chip, whose function of the program is to open and close the Railway gate on the arrival and departure of the Train. The program is written such a way that ,before closing the gate the Microcontroller provides the beeping sound for predetermined time indicating to the vehicle passers that gate is going to be closed.

MICRO CONTROLLER:
The program is stored in the flash ROM of Microcontroller, once the power is made ON, the Microcontroller checks the signals from it ports to detect the train coming. microcontroller, the microcontroller enables the port to activate to produce sound for seconds, then the gate will be closed. Once the train leaves the gate the gate will beautomatically closed.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

PORTS:
The ports can be programmed as an input port or output port .In this project the input port is used to sense the arrival and departure of train, the output ports are used to bias the driver circuit to produce sound from the Buzzer. Similarly another port is also connected to driver IC in order to drive the Stepper motor.

DRIVER CIRCUIT FOR STEPPER MOTOR:


The stepper motor works for 12V DC, where as the o/P of microcontroller is 5V DC which can not drive the motor. A driver IC inputs is connected to the outputs of Microcontroller and outputs of IC whose output voltage is 12V DC is connected to the stepper motor.

DRIVER CIRCUIT:
A driver circuit comprises of Darlington amplifier or signal transistor, which increases the DC level to a required value say (12V). This 12V is much more enough to operate the Buzzer.

STEPPER MOTORS:
A stepper motor is a widely used device that translates electrical pulses into mechanical movement. In applications such as disk drives, dot matrix printers, and robotics,

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

the stepper motor is used for position control. Every stepper motor has a permanent magnet rotor (also called the shaft) surrounded by a stator.

2.5

BLOCK DIAGRAM EXPLANATION OF TRACK CUT:

TRACK CUT SENSING:


To sense the track metal conductors are connected to the tack, when ever the track is cut the output or track cut sensing circuit becomes high and provides base bias to the transistor, the output of transistor is connected to the relay to make the FM Tx ON.

FM TRANSMITTER:
When track is cut FM Tx transmits the signal to the space.The freqncy of FM Tx is 27MHz.

FM RECEIVER:
The FM receiver is tuned to the frequency of 49MHz, the FM Rx receives the signal from the FM transmitter demodulates it and fed to the input port of 8051.

INPUT PORT:
The signal is received from the FM Rx and fed to the input port of 8051microcontroller, the function of input port is to receive the signal and feds to the

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

microcontroller. As we know by default or by reset , the Microcontroller ports acts as a out put port ,if it is to be used as input port, it must be programmed .

MICROCONTROLLER:
The 8051 microcontroller is employed and the program is down loaded in the ROM, the 8051 receives the signal from the input port and executes the instructions stored in the ROM and sends the signal through the output port to make the buzzer On and to display the track cut on the LCD screen.

2.6

BLOCK DIAGRAM EXPLANATION OF ANTICOLLISION:

POWER SUPPLY:
A centre tapped fullwave regulated power supply of 9V is constructed in for the operation of IR Tx and IR Rx circuits. In order to get 9V a regulated IC 7809 is employed.

IR GENERATOR AND MODULATOR CIRCUIT:


The IR Tx and receiver are placed to detect the any train coming in opposite direction or any obstacle and the driver gets the beeping sound and the collision can be avoided.
www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

IR LED:
It converts the oscillations in to IR rays, these IR rays can not seen by the eyes and does not affect by sun light and atmosphere.

IR RECIVER :
IR receiver is one which senses the IR Rays and converts into electrical signals.

IR SENSING CIRCUIT:
This section provides the biasing to the signal booster circuit section to smaller value, just like preamplifier in amplifiers.

IR SIGNAL BOOSTER: IR signal booster is one which increases the signal strength and fed to the driver circuit. DRIVER CIRCUIT: A driver circuit comprises of Darlington amplifier or signal transistor, which increases the DC level to a required value say (9V). This 9V is much more enough to operate Buzzer.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

3.1 SCHEMATIC DIAGRAM OF INTERFACING 8051 WITH STEPPER MOTOR AND BUZZER:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

SCH EMATI C DIAG RA M OF INTE RF ACING 8 05 1 WITH STEPPE R MOTO R AND BUZZ ER

3.2
VCC:

EXPLANATION OF SCHEMATIC DIAGRAM


Pin 40 provides supply voltage to the chip. The voltage source is +5V.

GND:
Pin 20 is the ground.

XTAL1 and XTAL2:


The 8051 has an on-chip oscillator but requires an external clock to run it.Most often
www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

quartz crystal oscillator connected to inputs XTAL1(pin 19) and XTAL2 (pin 18).The quartz crystal oscillator connected to XTAL1 and XTAL2 also needs two capacitors of 30 pF value. One side of each capacitor is connected to the ground as shown in Circuit diagram.

RST:
Pin 9 is the RESET pin. It is an input and is active high (normally low).Upon apply a high pulse to this pin, the microcontroller will reset and terminate all activities. This is often referred to as a power-on reset. Activating a power-on reset will cause all values in the registers to be lost. When the Microcontroller is powered up ,the Program stored in the ROM of Microcontroller starts executing and microcontroller functions as per the Program. In this project the Microcontroller keeps on checking the signals arriving at the input port, if there is no signal from it no function is taken Place. If the train is arriving near to Railway gate say at 1/4 KM the sensor senses that the Train is arriving and gives Sound for 10sec indicating that Train is arriving and all the Vehicles should stop passing across the Railway gate ,then the gates are closed automatically, similarly once the Train leaves the gate the gates are opened automatically. The

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

same process is repeated for all the Trains.

3.3 SCHEMATIC DIAGRAM OF FM TRANSMITTER:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

3.4 EXPLANATION OF TRACKCUT SENSING CIRCUIT& FM TRANSMITTER:

When the two tracks are connected to tracks, the inputs of U1A become LOW and the o/p of NAND gate1 becomes high. The o/p of NAND gate1 is connected to the to the i/p of the

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

NAND gate of U1B, Now the i/p of NAND gates U1B becomes High and the o/p of NAND gate U1B becomes LOW, the transistor Q1 does not conduct and the buzzer is OFF. Similarly, when the track is cut the inputs of UA1 becomes HIGH and the o/p of NAND gate becomes LOW. The o/p of NAND gate is connected to the to the i/p of the NAND gate U1B, Now the i/p of NAND gates U1B becomes LOW and the o/p of NAND gate U1B becomes HIGH, the transistor Q1 conducts and the buzzer is off. The IC Tx-2 ,is an low frequency generator, when the switch s1 is connected to the relay of metal sensor of track cut the FM Tx becomes automatically ON AND transmits the signal. In FM Tx IC in built oscillator in IC generates frequency at pin no.9, the pin no.9 is fed to the base of the transistor Q1,the Q1 starts conducting as per the input signal coming from the pin no9.due to conduction of transistor, the capacitor starts charging and discharging through the inductor, so the oscillations are generated at collector of Q1 ,the o/p of Q1 is fed to the is fed to the base of Q2,now the transistor Q2 starts conducting as per the oscillations, due to change in base current, the collector current varies and therefore the crystal generates high frequency, the high frequency is fed the antenna, the antenna converts electrical signal into electromagnetic signals and transmits into space.

3.5 SCHEMATIC DIAGRAM OF FM RECEIVER:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

3.6 EXPLANATION OF FM RECEIVER:

The FM receiver is tuned to receive the frequency of about 49 MHz with the help of the capacitor C2 and the inductance L1 shown in the circuit diagram. The signal from the antenna is
www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

fed to the base of the Transistor which conducts as per the input signal, simultaneously the charging and discharging of the capacitor takes place and this signal frequency is demodulated with the of receiver IC i.e. low frequency signal is passed to the transistor T2 which amplifies the signal, the function of T3 is also same as T2, this transistor increases the signal ,the amplified signal operates the relay. The output of FM Rx is connected to the 8051in order to display the opposite information.

3.7 SCHEMATIC DIAGRAM OF ANTI COLLISION:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

3.8 EXPLANATION OF ANTI COLLISION:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

The advantages of using IR circuits is, these circuits are unaffected by sunlight and other artificial lights, range of the this circuit is about 5 meters with out any lenses. Range can be extended further by using lenses or reflectors with sensors.

WORKING OF IR-TRANSMITTER CIRCUIT:


Transmitter module is based on timer IC.555. given by the formula f = 1.44/(R1+2R2)C The frequency of astable multivibrator is nearly 1kHz. The output of astable multivibrator is a square wave which is fed to the base of the PNP transistor, to increase the signal strength in order to drive the IR LEDs. It is wired as astable

multivibrator. As we the output of astable multivibrator is an square wave, whose frequency is

WORKING OF IR-RECEIVER CIRCUIT:


When I.R. Photo diode receives I.R. signals from transmitter, tone signal amplifier amplifies 1KHz signals. The amplified signals are given to the base of transistor T4. During negative half cycles of tone signals, T4 conducts. Then transistor T5 gets base bias. Then it also conducts and the voltage at collector terminal of T5 becomes 0V. So the transistor T6 will not have base bias, therefore transistor T6 does not conduct. So the output across diode D5 will be 0V, and buzzer does not produce any sound. But when the I.R. beam between transmitter and receiver is interrupted , transistors T4 and T5 stop conduction. The voltage at collector terminal of T5 will be high, therefore the transistor T6 gets base bias and conducts (goes to saturation region).

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

The voltage across diode D5 will be 9V and the buzzer produces audio tone.

4.1

CIRCUIT DIAGRAM OF DUAL POWER SUPPLY:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

T1 = Step down Transformer 12-0-12, i=750mA D1=D2= IN4007 C1= 25V, 1000F C2=C3=C4= 104 ICs = 7809, 7806, 7805

Fig 4.1: Power supply section. 4.2 WORKING OF DUAL POWER SUPPLY:

In every project we need different voltages for different circuits. Some need to construct different power supply of different voltages employing different voltage transformers, rectifier circuits, filter circuits and regulator circuits. This type of construction requires many components (transformers, capacitors regulators.......etc).So the size of the power supply becomes bulky and costly. To overcome above disadvantages by using regulator ICS the different voltages (12V, 9V, 5V.....etc) can be obtained with only one transformer.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

The circuit diagram of Dual power supply is shown in the figure.The function of each component of the circuit is explained below. The circuit consists of following stages. 1. 2. 3. 4. TRANSFORMER: It is an electrical device which transfers the power from one winding to the other winding with isolation. All the electronic gadgets works for less voltage (normally 3V to 12V).So an step down transformer is used, whose function is to step down the AC voltage from 230V to required voltage depending on the need. In this project 12V-0-12V is used. The output of transformer is 12V AC which is connected to the diodes for rectification. Transformer Rectifier Filter and Regulator

RECTIFIER CIRCUIT: It employs diodes, which converts AC voltage into DC voltage. The output of rectifier circuit is not a pure DC. It also consists of some AC

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

components, which is called ripples. In order to remove these AC components, filter circuits are employed. So the output of rectifier circuit is fed to the filter circuit (capacitor).

FILTER CIRCUIT: Filter circuit employees electrolytic capacitors in-order to remove the AC components. As we know the capacitor does not allow DC components to pass through it because it offers high reactance to the DC component .And offers less reactance to the AC component so all AC components will be bypasses through the capacitors to ground.

REGULATOR: Regulator is an electronic circuit whose function is to keep output always constant though the input is varied. In this project the three terminal IC regulators of 7809 & 7805 is used for providing output DC voltages. Eg 7809, the number 78 represents the positive regulator IC and 09 represents the output voltage i.e output is 9V.

5.1

PIN DIAGRAM OF 89S51

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

Although 8051 family members (e.g., 8751, DS5000) come in different packages, such as DIP (dual in-line package), QFP (quad flat package), and LLC (leadless chip carrier), they all have 40 pins that are dedicated for various functions such as I/O, RD, WR, address, data, and interrupts. It must be noted that some

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

companies provide a 20-pin version of the 8051 with a reduced number of I/O ports for less demanding applications. However, since the vast majority of developers use the 40-pin DIP package chip, we will concentrate on that.

Examining Figure 5-1, note that of the 40 pins, a total of 32 pins are set aside for the four ports P0, P1, P2, and P3, where each port takes 8 pins. The rest of the pins are designated as V CC , GND, XTAL1, XTAL2, ALE/PROG, RST, EA, PSEN. Of these 8 pins, six of them (V CC , GND, XTAL1, XTAL2, RST, and EA) are used by all members of the 8051 and 8031 families.

In other words, they must be connected in order for the system to work, regardless of whether the microcontroller is of the 8051 family. The other two pins, PSEN and ALE, are used mainly in 8031-based systems. function of each pin. Ports are discussed separately. We first describe the

5.2

PIN DESCRIPTION OF 89S51:

V CC:
www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

Pin 40 provides supply voltage to the chip. The voltage source is +5V. GND: Pin 20 is the ground. XTAL1 and XTAL2: The 8051 has an on-chip oscillator but requires an external clock to run it. Most often a quartz crystal oscillator connected to XTAL2 (pin 18). inputs XTAL1(pin 19) and The quartz crystal oscillator connected to XTAL1 and XTAL2

also needs two capacitors of 30 pF value. One side of each capacitor is connected to the ground as shown in Figure 4-2 (a).

It must be noted that there are various speeds of the 8051 family. Speeds refer to the maximum oscillator frequency connected to XTAL. For example, a 12-MHz chip must be connected to a crystal with 12 MHz frequency or less. Likewise, a 20MHz microcontroller requires a crystal frequency of no more than 20 MHz. When the 8051 is connected to a crystal oscillator and is powered up, we can observe the frequency on the XTAL2 pin using the oscilloscope.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

If you decide to use a frequency source other than a crystal oscillator, such as a TTL oscillator, it will be connected to XTAL1; XTAL2 is left unconnected, as shown in Figure 4-2 (b). RST: Pin 9 is the RESET pin. It is an input and is active high (normally low).

Upon applying a high pulse to this pin, the microcontroller will reset and terminate all activities. This is often referred to as a power-on reset. Activating a power-on reset will cause all values in the registers to be lost.

RESET Value of Some 8051 Register:

REGISTER PC ACC

RESET VALUE 0000 0000

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

B PSW SP DPTR

0000 0000 0007 0000

TAB 5-1: RESET Value of Some 8051 Registers

Table 5-1 provides a partial list of 8051 registers and their values after power-on reset. Notice that the value of the PC (program counter) is 0 upon reset, forcing the CPU to fetch the first opcode from ROM memory locationThis means that we must place the first line of source code in ROM location 0 because that is where the CPU wakes up and expects to find the first instruction. Figure 5-3 shows two ways of connecting the RST pin to the power-on reset circuitry.

In order for the RESET input to be effective, it must have a minimum duration of 2 machine cycles. In other words, the high pulse must be high for a minimum of 2 machine cycles before it is allowed to go low.

EA:
The 8051 family members, such as the 8751, 89C51, or DS5000, all come with on-chip ROM to store programs. In such cases, the EA pin connected to V CC . For family members such as the 8031 and 8032 in which there is no on-chip ROM, code is stored on an external ROM and is fetchedby the 8031/32. Therefore, for the

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

8031 the EA pin must be connected to GND to indicate that the code is stored externally. EA, which stands for external access, is pin number 31 in the DIP packages. It is an input pin and must be connected to either V CC or GND. In other words, it cannot be left unconnected.

PSEN:
This is an output pin. PSEN stands for program store enable. In an8031based system in which an external ROM holds the program code,this pin is connected to the OE pin of the ROM.

ALE:
ALE (address latch enable) is an output pin and is active high. When

connecting an 8031 to external memory, port 0 provides both address and data. In other words, the 8031 multiplexes address and data through port 0 to save pins. The ALE pin is used for de multiplexing the address and data by connecting to the \G pin of the 74LS373 chip.

I/O port pins and their functions:


The four ports P0, P1, P2, and P3 each use 8 pins, making them 8-bit ports. All the ports upon RESET are configured as output, ready to be used as output ports. To use any of these ports as an input port, it must be programmed, as we will

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

explain throughout this section. First, we describe each port.

Port 0:
Port 0 occupies a total of 8 pins (pins 32-39). It can be used for input or output. To use the pins of port 0 as both input and output ports,each pin must be connected externally to a 10K ohm pull-up resistor.This is due to the fact that P0 is an open drain, unlike P1, P2, and P3, as we will soon see. Open drain is a term used for MOS chips in the same way that open collector used for TTL chips. For example, the following code will continuously send out to port 0 the alternating values 55H and AAH. MOV A, # 55H BACK: MOV P0, A ACALL CPL SJMP DELAY A BACK is

Port 0 as input :

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

With resistors connected to port 0, in order to make it an input, the port must be programmed by writing 1 to all the bits. MOV MOV BACK : MOV MOV SJMP A, # OFFH ; A = FF hex P0, A ; make P0 an input port ; by writing all 1s to it A, P0 ; get data from P0 P1, A ; send it to port 1 BACK ; keep doing it

Dual role of port 0:


As shown in Figure 4-1, port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. When connecting an 8051/31 to an external

memory, port 0 provides both address and data. The 8051 multiplexes addresand data through port 0 to save pins. ALE indicates if P0 has address or data. When ALE = 0, it provides data D0-D7, but when ALE = 1 it has address A0A7. Therefore, ALE is used for demuliplexing address and data with the help of a 74LS373 latch.

Port 1:
Port 1 occupies a total of 8 pins (pins 1 through 8). It can be used as input oroutput. In contrast to port 0, this port does not need any pullup resistors since italready has pull-up resistors internally. Upon reset, port 1 is configured as anoutput port. For example, the following code will continuously send out to port 1

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

the alternating values 55H and AAH. MOV A, # 55H MOV P1, A ACALL DELAY CPL A SJMP BACK

BACK :

Port 1 as input:
To make port 1 an input port, it must programmed as such by writing 1 to all its bits. In the following code, port 1 is configured first as an input port by writing 1s to it, then data is received from that port and saved in R7, R6, and R5. MOV MOV MOV MOV ACALL MOV MOV ACALL MOV MOV A, # 0FFH P1, A A, P1 R7, A DEALY A, P1 R6, A DELAY A, P1 R5, A ; ; ; ; ; ; ; ; ; ; ; A=FF hex make P1 an input port by writing all 1s to it get data from P1 save it in reg R7 wait get another data from P1 save it in reg R6 wait get another data from p1 save it in reg R5

Port 2:
Port 2 occupies a total of 8 pins (pins 21 through 28). It can be used as input or output. Just like P1, port 2 does not need any pull-uresistors since it already has pull-up resistors internallyfollowing code will send out continuously to port 2 the alternating values 55H and AAH. That is, all the bits of P2 toggle continuously.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

BACK :

MOV A, # 55H MOV P2, A ACALL DELAY CPL A SJMP BACK

Port 2 as input:
To make port 2 an input, it must programmed as such by writing 1 to all its bits. In the following code, port 2 is configured first as an input port by writing 1s to it. Then data is received from that port and is sent to P1 continuously. MOV A, # 0FFH MOV P2, A BACK : MOV A, P2 MOV P1, A SJMP BACK ; ; ; ; ; ; A=FF hex make P2 an input port by writing all 1s to it get data from P2 send it to Port 1 keep doing that

Dual role of port 2:


In systems based on the 8751, 89C51, and DS5000, P2 in used as simple I/O. However, in 8031-based systems, port 2 must be used along with P0 to provide the 16-bit address for the external memory. As shown in Figure 4-1, Port 2 is also designated as A8-A15, indicating its dual function. Since an 8031 is capable of accessing 64K bytes of external memory, it needs a path for the 16 bits of the address.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the address. In other words, when the 8031 is connected to external memory, P2 is used for the upper 8 bits of the 16-bit address, and it cannot be used for I/O. From the discussion so far, we conclude that in systems based on8751,89C51, or DS5000 microcontrollers, we have three ports, P0, P1, and P2, for I/O operations. This should be enough for most microcontroller. That leaves port 3 interrupts as well as other signals, as we will see next.

Port 3:

Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used input or output. P3 does not need any pull-up resistors, the same as P1 and P2 did not. Port 3 has the additional function of providing some Although port 3 is configured as an output port upon reset, this is not the way it is most commonly used. extermely important signals such as interrupts. Table 4-2 provides these alternate functions of P3. This information applies to both 8051 and 8031 chips. P3.0 and P3.1 are used for the RxD and TxD serial communications signals. Bits P3.2 and P3.3 are set aside for external interrupts. Bits P3.4 and P3.5 are used for timers 0 and 1. Finally, P3.6 and P3.7 are used to provide the WR and RD signals of external memories connected in 8031-based systems. In systems based on the 8751, 89C51, or DS5000, pins 3.6 and 3.7 are used for I/O while the rest of the pins in Port 3 are normally used in the alternate function role.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

6.1 INTRODUCTION:
The 8-pin 555 timer must be one of the most useful ICs ever made and it is used in many projects. With just a few external components it can be used to build many circuits, not all of them involve timing! A popular version is the NE555 and this is suitable in most cases where a '555 timer' is specified. The 556 is a dual version of the 555 housed in a 14-pin package, the two timers (A and B) share the same power supply pins. The circuit diagrams on this page show a 555, but they could all be adapted to use one half of a 556. Low power versions of the 555 are made, such as the ICM7555, but these should only be used when specified (to increase battery life) because their maximum output current of about 20mA (with a 9V supply) is too low for many standard 555 circuits. The ICM7555 has the same pin arrangement as a standard 555. The circuit symbol for a 555 (and 556) is a box with the pins arranged to suit the circuit diagram: for example 555 pin 8 at the top for the +Vs supply, 555 pin 3 output on the right. Usually just the pin numbers are used and they are not labelled with their function.

Standard 555 and 556 ICs create a significant 'glitch' on the supply when their output changes
www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

state. This is rarely a problem in simple circuits with no other ICs, but in more complex circuits smoothing capacitor (eg 100F) should be connected across the +Vs and 0V supply near the 555 or 556. The input and output pin functions are described briefly below and there are fuller explanations covering the various circuits: Astable - producing a square wave Monostable - producing a single pulse when triggered Bistable - a simple memory which can be set and reset Buffer - an inverting buffer (Schmitt trigger)

THE 555 TIMER CONSISTS OF TWO COMPONENTS: 1.The upper comparator A1 is a non-inverting op-amp comparator having two inputs
threshold and control. In most applications, the control input (pin no 5) is not used, so that the control voltage equals + 2vcc/3, which serves as a reference voltage. Whenever the threshold voltage exceeds the control voltage, comparator A1 output changes to high, which sets the flipflop. 2.The lower comparator A2 is an inverting op-amp comparator, to which the trigger (pin 2) is applied to the inverting terminal. The non-inverting input of lower comparator A2is

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

at a fixed voltage of +vcc/3. When the trigger input is slightly less than +vcc/3, the compartor A2 output changes to high and the flip-flop is thus reset.

The reference voltage for the two comparators are obtained from an internal voltage divider consisting of three equal resistors R of 5Kohm each. The threshold comparator A 1 is referenced at +2/3 Vcc and the trigger comparator A2 is referenced at +1/3Vcc.. The output of threshold and the trigger comparator are connected to S and R inputs of flip-flop respectively.

THE PINS USED IN 555 IC ARE AS FOLLOWS:

6.2 GENERAL CHARACTERISTICS:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

SUPPLY VOLTAGE OPERATING TEMPERATURE POWER DISSIPATION TYPICAL ACCURACY OUTPUT CURRENT PACKAGE

: 4.5V-15V max : 00C-+700C : 60mv max : + 0.5% 100 usec + 2% mints : 200mA Max : 14 Pin Dip Plastic Package

1.PIN 1 (Ground).

2.PIN 2(Trigger): An external trigger plus is applied to this pin. The output of the timer
depends on the amplitude of the trigger pulse. If the trigger voltage is less than +1/3V cc,the timer output is high.

3.PIN 3 (output): The output of timer is taken from Q output of SR flip-flop. A load is
connected to this terminal in two ways. i) The load can be connected between pin 3 and pin 1 (ground). The current through the ground load is zero, when the output is zero. This is called as normally off load. ii) The load can be connected between pin 3 and pin-8 (supply voltage +v cc) and the load is called as normally on. When the output is low, the load current flows through the load into the output terminal and it is called sink current. On the other hand,when the output is high,the current through the load is zero.
www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

However, when the output is high, the output terminal supplies current to the normally off load. This current is called the source current.

4. PIN 4 (Reset): The 555 timer can be reset by applying a negative pulse to this pin. When the
reset function is not used, it will be connected to +Vcc..

5. PIN 5 (Control): An external dc voltage may be applied to this pin to change the threshold
and trigger voltage level. By varying the control voltage, it is possible to vary the pulse width of the timer output. If no external dc voltage is used, the control pin is at +2/3 Vcc and this pin is bypassed to the ground to eliminate the noise.

6. PIN 6 (Threshold): It is the non-inverting input terminal of comparator A1. The thershold
voltage (the reference voltage of comparator A1) is +2/3 Vcc.When the voltage at threshold pin is above +2/3 Vcc. When the voltage at threshold pin is above +2/3 Vcc,the output of

comparator A1 goes high,which changes the timer output to low.

7. PIN 7 (Discharge): This pin is connected internally to the collector of discharge transistor Q.
When the timer output is high, Q is cut-off.When the timer output is low,Q is saturated.

8. PIN 8 (Vcc): A supply voltage of +5v to +18v is applied to this pin w.r.t. ground (pin 1).
7.1 LCD OPERATION:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

In recent years the LCD is finding widespread wide spread use replacing LED (seven segments LED or other multi segment LED). This is due to the following reasons: 1. 2. The declining prices of LCD. The ability to display numbers, characters, and graphics. This is in contrast

to LED, which are limited to numbers and a few characters. .

7.2

Table of Pin Descriptions for LCD:

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

PIN 1 2 3 4

SYMBOL VSS VCC VEE RS

I/O I Ground

DESCRIPTION

+5V Power Supply Power Supply to Control Contrast RS =0 to select command Register RS=1 to select Data Register

R/W

R/W=0 to Write R/W=1 to Read

6 7 8 9 10 11 12 13 14

E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7

I/O I/O I/O I/O I/O I/O I/O I/O I/O

Enable The 8 Pin Data Bus The 8 Pin Data Bus The 8 Pin Data Bus The 8 Pin Data Bus The 8 Pin Data Bus The 8 Pin Data Bus The 8 Pin Data Bus The 8 Pin Data Bus

7.3 Explanation of Pin Descriptions


The LCD discussed in this section has 14 pins. The function of each pin is given in Figure shows the pin positions for various LCD.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

VCC, VSS, and VEE:


While V CC and V SS provide +5V and ground, respectively, V EE is used for controlling LCD contrast.

RS, register select:


There are two very important registers inside the LCD. The RS pin is used for their selection as follows. If RS=0, the instruction command code register is selected, allowing the user to send a command such as clear display, cursor at home, etc. IF RS=1 the data register is selected, allowing the user to send data to be displayed on the LCD.

R/W, read/write:
R/W input allows the user to write information to the LCD or read information from it. R/W=1 when reading; R/W=0 when writing .

E, enable:
The enable pin is used by the LCD to latch information presented to its data pins. When data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450 ns wide.

Data Pins of LCD (D0 - D7):


The 8-bit data pins, D0 - D7, are used to send information to the LCD or read the contents of the LCDs internal registers.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

To display letters and numbers, we send ASCII codes for the letters A - Z, a - z, and numbers 0 - 9 to these pins while making RS=1. There are also instruction command codes that can be sent to the LCD to clear the display or force the cursor to the home position or blink the cursor. Table 12-2 lists the instruction command codes. We also use RS = 0 to check the busy flag bit to see if the LCD is ready to receive information. The busy flag is D7 and can be read when R/W=1 and RS = 0, as follows: if R/W = 1, RS = 0. When D7 = 1 (busy flag = 1), the LCD is busy taking care of internal operations and will not accept any new information. When D7 = 0, the LCD is ready to receive new information. Note: It is recommended to check the busy flag before writing any data to the LCD.

9.4

LCD Command Codes:


Code Command to LCD Instruction (Hex) 1 2 Register Clear display screen Return home

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

4 6 5 7 8 A C E F 10 14 18 1C 80 C0 38

Decrement cursor (shift cursor to left) Increment cursor (shift cursor to right) Shift display right Shift display left Display off, cursor off Display off, cursor on Display on, cursor off Display on, cursor blinking Display on, cursor blinking Shift cursor position to left Shift cursor position to right Shift the entire display to the left Shift the entire display to the right Force cursor to beginning of 1st line Force cursor to beginning of 1st line 2 lines and 5x7 matrix

8.1

ADVANTAGES:
Railway accidents is minimised. Man power is reduced and economy of railway department isincreased Since Microcontroller is used, it consumes less power. More reliable and flexible. More accuracy.
www.final-yearproject.com | www.finalyearthesis.com

1.
2. 3. 4. 5.

EAUTOMATION FOR TRAINS

8.2

APPLICATIONS:
Automatic Railway gate controlling is achieved with no man. This can adopted in Homes, factories etc. Automatic parking system .

1.
2. 3.

FUTURE SCOPE
We expect that our next generation will develop this automation for trains with GSM modem In our project we connected all the sensors to micro controller with the wires.

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

In future this can be developed as monitoring can be done globally by using GSM modem and also in place of magnetic sensors we can replace it by IR Transmitters and Receivers.

CONCLUSION
The Project E-AUTOMATION FOR TRAINS has been successfully designed and tested. E-AUTOMATION FOR TRAINS is not Limited for any Particular Application. It can be used in daily applicances with little modifications according to the requriments. This Concept is not only ensures that our work will be usable in the future but also provides the flexibility to adapt and extend, as needs change.
www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

In this project work we had studied and implemented a complete working of gate control, track cut and anti collision. This work includes the study of automation for trains in many applications. Finally, we conclude that E-AUTOMATION FOR TRAINS is an emerging field and there is a huge scope for usage of this application.

BIBILIOGRAPHY
1. Electronic Communication Systems -- George Kennedy. 2. Radio Engineering -- G. K. Mithal. 3. Principles of Electronics

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

-- V. K. Mehta. 4. Programming & Customizing the 8051 Microcontroller -- Myke Predko. 5. Embedded System Design using 8051 Microcontroller --Prof. Satish Shah

APPENDIX
PROGRAM FOR STEPPER MOTOR:
mov p1,#0ffh up: mov c,p1.0 jnc aclk sjmp up back1:mov c,p1.0 jnc clk sjmp back1 clk: acall delay1 mov a,#11h

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

up1: mov p2,a acall delay rr a djnz r0,up1 sjmp up aclk: acall delay1 mov a,#11h up2: mov p2,a acall delay rl a djnz r1,up2 sjmp back1 delay1: clr p3.0 mov tmod,#10h mov r3,#125 again: mov tl1,#08 mov th1,#01 setb tr1 back: jnb tf1,back clr tr clr tf1 djnz r3,again setb p3.0 ret delay: mov r2,#05fh mov r3,#0ffh here: djnz r3, here djnz r2, here ret

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

PROGRAM TO DISPLAY TRACK CUT:


MOV P1,#0FFH UPP: SETB P1.0, A1 SJMP UPP A1: MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV A,#38H COMMAND A, #0EH COMMAND A, #01H COMMAND A, #06H COMMAND A, #86H COMMAND A, # T ; init. LCD 2 lines, 5x7 martix ; issue command ; LCD on, cursor on ; issue command ; clear LCD command ; issue command ; shift cursor right ; issue command ; cursor: line 1, pos. 6 ; command subroutine ;

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV ACALL MOV SJMP

DATA _ DISPLAY A, # R DATA _MDISPLAY A, # A DATA _MDISPLAY A, # C DATA _ DISPLAY A, # K DATA _ DISPLAY A, # DATA _ DISPLAY A,#C DATA _ DISPLAY A, # U DATA _ DISPLAY A, # T DATA _ DISPLAY A, # A DATA _ DISPLAY A, # H DATA _ DISPLAY A, # E DATA _ DISPLAY A, # D UPP

; ;

; ;

; ; ; ; ; ;

COMMAND: ACALL MOV CLR CLR SETB CLR RET DATA_DISPLAY: ACALL MOV

READY P0, A P2. 0 P2. 1 P2. 2 P2. 2

; is LCD ready? ; issue command code ; RS=0 for command ; R/W=0 for command ; E=1 for H-toL pulse ; E=0, latch in

READY P0, A

; is LCD ready? ; issue data

www.final-yearproject.com | www.finalyearthesis.com

EAUTOMATION FOR TRAINS

CLR CLR SETB

P2. 0 P2. 1 P2. 2

; RS=1 for data ; R/W=0 to write to LCD ; E=1 for H-toL pulse

READY: SETB P0.7 CLR SETB CLR SETB JB RET SJMP P2.0 P2.1 ; make P1.7 input port ; RS=0 access command reg ; R/W=1 read command reg ; read command reg and check busy flag ; E=1 for H-to-L pulse ; E=0 H-to-L pulse ; stay until busy flag=0 ; STAY HERE

BACK:

P2.2 P2.2 P1.0, BACK HERE

HERE:

CONTACT DETAILS

www.final-yearproject.com | www.finalyearthesis.com

Potrebbero piacerti anche