Professional Documents
Culture Documents
CHAPTER 1
INTRODUCTION
In this modern era, all commercial as well as industrial tasks are done at a more accurate and less time consuming rate. Everything is done at a much easier level which is the aim of todays fast developing technology. Be it commercial or an industrial one, we expect maximum accuracy. Under these circumstances, the routine task of manually switching and monitoring seems very monotonous and time consuming. It is even more disturbing when one realizes that the track switching unnecessarily leads to so many accidents. Keeping this in mind, we have come up with a project which can completely stop collision of trains. Rail transport is the most commonly used mode of long distance transportation in India. Rail operations throughout the country are run by the State-owned Company, Indian Railways. The rail network traverses through the length and breadth of the country, covering a total length of 63,140 km (39,200 miles). RFID tags are mounted on the locomotive which continuously transmits a specific code assigned to each TAG. The RFID receivers are placed at regular intervals on the locomotive track. When the locomotive moves over the receiver, it detects the precise TAG code. This detected code is transmitted to the control room at the base stations using radio communication. The information received at the control room is continuously monitored by a computer. The computer detects any collision occurring chance (i.e. if two locomotives are on the same track commencing in opposite directions, any fault in the track. . . . . . .). It warns the locomotive operator about the danger. The warnings can be of two types:
1. 2.
The track controlling circuit is directed to change one of the locomotives track. The locomotive is directed to stop with the assistance of track traffic light or by some
other means.
CHAPTER 2
Block diagram
RFID Receiver
RFID Transmitter
To Microcontroller
2.45GHz
DESCRIPTION It will give data high signal Transmit data (TTL level) o/p from module to serial interface
Pin no.8
RxD
Buzzer will buzz for 280ms when tag is detected LED will glow for 280ms when tag is detected It will give data low signal Loop antenna should be connected
integrated circuit in the tag to power up and transmit a response. Most passive tags signal by backscattering the carrier signal from the reader. This means that the antenna has to be designed to both collect power from the incoming signal and also to transmit the outbound backscatter signal. The response of a passive RFID tag is not necessarily just an ID number; the tag chip can contain non-volatile EEPROM for storing data. Unlike passive RFID tags, active RFID tags have their own internal power source which is used to power any Integrated Circuits that generate the outgoing signal.
RFID is so called Radio Frequency Identification system which consists of two main parts: transmitter and receiver. The labels, access cards and even passports in some countries they have RFID transponders integrated. These transponders are called tags. The user can store RFID card/tag details in the module memory. When the user shows the card, the ID is read and compared with the stored card memory. When there is a match the unit activates a relay provided on the baseboard. This relay when connected to the Door Closure mechanism can open for a certain period for the person to enter after which it closes the door once again. If the RFID card shown does not match with the stored database, then the door remains closed. Facility has been provided to add and delete the card numbers using a Master Card. Beep and LED are provided for Audio and Visual indication of various conditions.
2.4.1 ADDING AND DELETING CARDS (TAGS): After making master card you can add or delete cards from the memory. To add or to delete cards first show master card, you will get single short BEEP and LED flashes at faster
rate. Then show new cards to be added in the memory. For every addition you will get a single short Beep. For deletion you will get two short Beeps. Show the Master Card once again to complete the Addition or Deletion Process. If the memory is full while adding cards it will give long BEEP and comes out. LED starts blinking at normal rate to show power ON status.
2.4.2 TECHNICAL DETAILS 1. Card memory: Up to 40 Cards (For Consecutive Numbers) or up to 25 Cards (For Random Numbers) Up to 150 Cards (For Consecutive Numbers) or up to 100 Cards (For Random Numbers) 2. Relay ON timing: 4 Seconds 3. Maximum Time between Read to Activations of Relay: 350 milliseconds520 milliseconds. 4. Input Voltage: 8V to 12V DC. 5. Frequency of Operation: 125 kHz 6. Read Range: up to 8 cm 7. Serial Interface Format: 9600 bps, No Parity, 8 Data bits, 1 Stop bit
2.5 Applications:
Access control Time and attendance Vending machines Industrial and other applications where Reading and comparing of the same is required for permission to access.
2.6 Advantages:
Tag detection not requiring human intervention reduces employment costs and eliminates human errors from data collection. As no line-of-sight is required, tag placement is less constrained. RFID tags have a longer read range than, e.g., barcodes. Tags can have read/write memory capability, while barcodes do not. An RFID tag can store large amounts of data additionally to a unique identifier. Unique item identification is easier to implement with RFID than with barcodes. Tags are less sensitive to adverse conditions (dust, chemicals, physical damage etc.). Many tags can be read simultaneously. RFID tags can be combined with sensors. Automatic reading at several places reduces time lags and inaccuracies in an inventory. Tags can locally store additional information; such as distributed data storage may increase fault tolerance of the entire system. Reduces inventory control and provisioning costs.
CHAPTER 3
AT 89C51 MICROCONTROLLER
The AT89C51 microcontroller used here is a low power, high performance CMOS 8-bit microcontroller with 4KB of Flash memory. The device is manufacturing using Atmels high density nonvolatile memory technology and is compatible with the industry standard MCS51 instruction set and pin outs. The on-chip flash allows the program memory to be reprogrammed. By combining a versatile 8-bit CPU with flash on a monolithic chip, the AT89C51 is a powerful microcontroller that provides a highly flexible and cost effective solution to many embedded control applications.
3.1 FEATURES
8-bit CPU optimized for control applications Extensive Boolean processing capabilities 64K program memory address space 64K data memory address space 4K bytes of on-chip program memory 128 bytes of on-chip data RAM 32 bi-directional and individually addressable I/O lines Two 16-bit timers Full duplex UART 6-source/5 vector interrupt structure with two priority levels On-chip clock oscillator Easy interface to all microprocessors/microcontrollers Operates ratio metrically or with 5V DC or analog span adjusted voltage reference No zero or full-scale adjust required 8-channel multiplexer with address logic 0V to 5V input range with single 5V power supply Outputs meet TTL voltage level specifications Standard hermetic or molded 28-pin DIP package Resolution of 8 bits Total Unadjusted Error 1 /2 LSB and 1 LSB Low power up to 15mW Conversion Time of 100s
PORT0
Port0 is an 8-bit open drain bi-directional I/O port. As an output port each pin can sink 8 TTL inputs. When 1s are written to port0 pins, the pins can be used as high-impedance inputs. Port0 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. Port0 also receives hex code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. Each bit of this SFR P0 corresponds to one of the pins on the microcontroller. For example, bit 0 of Port0 is pin P0.0, bit 7 is pin P0.7. Writing a value 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level.
PORT1
Port1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port1 output buffers can sink/source four TTL inputs. When 1s are written to Port1 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port1 also receives the low order
address bytes during Flash programming and verification. Each bit of this SFR P1 corresponds to one of the pins on the microcontroller. For example, bit 0 of Port1 is pin P1.0, bit 7 is pin P1.7. Writing a value 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level.
PORT2
Port2 is an 8-bit bidirectional I/O port with internal pull-ups. The port2 output buffers can sink/source four TTL inputs. When 1s are written to Port2 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port2 pins that are externally being pulled low will source current because of the internal pull-ups. Port2 emits the high-order address byte during fetches from external program memory and during access to external data memory that uses 16-bit addresses (MOVX @DPTR). In this application it uses strong internal pull-ups. Each bit of this SFR P2 corresponds to one of the pins on the microcontroller. For example, bit 0 of Port2 is pin P2.0, bit 7 is pin P2.7. Writing a value 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level. While the 89C51 has four I/O port (P0, P1, P2 and P3), if our hardware uses external RAM or external code memory (i.e., our program is stored in an external ROM or EPROM chip or if we are using external RAM chips) we may not use P0 or P2. This is because the 89C51 uses ports P0 and P2 to address the external memory. Thus if we are using external RAM or code memory we may only use ports P1 and P3 for your own use.
PORT3
Port3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port3 output buffers can sink/source four TTL inputs. When 1s are written to Port3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port3 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port3 also serves the functions of various special features of the AT89C51 as listed below:
P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) P3.6 WR (external data memory write strobe) P3.7 RD (external data memory read strobe)
Each bit of this SFR P3 corresponds to one of the pins on the microcontroller. For example, bit 0 of Port3 is pin P3.0, bit 7 corresponds to pin P3.7. Writing a value 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level.
The 128 bytes of internal RAM are subdivided as shown on the memory map. The first 8 bytes (00h 07h) are register bank 0. By manipulating certain SFRs, a program may choose to use register banks 1, 2, or 3. These alternative register banks are located in internal RAM in addresses 08h through 1Fh. Bit memory also resides in from addresses 20h through 2Fh. The 80 bytes remaining of Internal RAM, from addresses 30h through 7Fh, may be used by user variables that need to be accessed frequently or at high-speed. This area is also utilized by the microcontroller as a storage area for the operating stack. This fact severely limits the 89C51s stack since, as illustrated in the memory map, the area reserved for the stack is only 80 bytes--and usually it is less since these 80 bytes have to be shared between the stack and user variables.
a) Register Banks
The 89C51 microcontroller uses registers in many of its instructions. These R registers are numbered from 0 through 7 (R0, R1, R2, R3, R4, R5, R6 and R7). These registers are generally used to assist in manipulating values and moving data from one memory location to another. For example, to add the value of R4 to the Accumulator, we would execute the following instruction: ADD A, R4 Thus if the Accumulator (A) contained the value 6 and R4 contained the value 3, the Accumulator would contain the value 9 after this instruction was executed. However, as the memory map shows, the R register R4 is really part of Internal RAM.
Specially, R4 is address 04h. ADD A, 04h This instruction adds the value found in Internal RAM address 04h to the value of the Accumulator, leaving the result in the Accumulator. Since R4 is really Internal RAM 04h, the above instruction effectively accomplished the same thing.
b) Bit Memory
The 89C51 gives the user the ability to access a number of bit variables. These variables may be either 0 or 1. There are 128 bit variables available to the user, numbered 00h through 7Fh. The user may make use of these variables with commands such as SETB and CLR. For example, to set bit number 24 (hex) to 1 we would execute the instruction: SETB 24h
SM0
SM1
SM2
REN
TB8
RB8
TI
RI
Serial Port Control Register (SCON) The next bit, SM2, Is a flag for Multiprocessor communication. Generally whenever a byte has been received the 89c51 will set the RI (receive interrupt) flag. This let the program know that a byte has been received and that it needs to be processed. However, when SM2 is set the RI flag will only be triggered if the 9th bit received is 1. That is to say, if SM2 is set and a byte is received whose 9th bit is clear, the RI flag will never set. This can be useful in certain advanced serial applications. For now it is safe to say that we will almost always want to clear this bit so that the flag is set upon reception of any character. The next bit, REN is Receiver Enable. If we want to receive data via the serial port, set this bit. The last four bits (bits 0
through 3) are operational bits. They are used when actually sending and receiving data--they are not used to configure the serial port. The TB8 bit is used in modes 2 and 3. In modes 2 and 3, a total of nine data bits are transmitted. The first 8 data bits are the 8 bits of the main value, and the ninth bit is taken from TB8. If TB8 is set and value is written to the serial port, the data bits will be written to the serial line followed by a set ninth bit. If TB8 is clear the ninth bit will be clear. The RB8 also operates in modes 2 and 3 and functions essentially the same way as TB8, but on the reception side. When a byte is received in modes 2 and 3, a total of nine bits are received. In this case, the first eight bits received are the data of the serial byte received and the value of the ninth bit received will be placed in RB8. TI means Transmit Interrupt. When a program writes a value to the serial port, a certain amount of time will pass before the individual bits of the byte are clocked out the serial port. If the program were to write another byte to the serial port before the first byte was completely output, the data being sent would be garbled. Thus, the 89C51 lets the program know that it has clocked out the last byte by setting the TI bit. When the TI bit is set, the program may assume that the serial port is free and ready to send the next byte. Finally, the RI bit means Receive Interrupt. It functions similarly to the TI bit, but it indicates that a byte has been received. That is to say, whenever the 89C51 has received a complete byte it will trigger the RI bit to let the program know that it needs to read the value quickly, before another byte is read.
172,797.
The first line of the above code segment waits for the 89C51 to set the RI flag; again, the 89C51sets the RI flag automatically when it receives a character via the serial port. So as long as the bit is not set the program repeats the JNB instruction continuously. Once the RI bit is set upon character reception the above condition automatically fails and program flow falls through to the MOV instruction that reads the value.
3.5 Interrupts
Interrupts are events that cause program flow to deviate from sequential execution. They provide a mechanism to suspend normal program flow, execute a subroutine and resume program flow. The subroutine is called an interrupt handler. The event may be one of the timers overflowing, receiving a character via the serial port, transmitting a character via the serial port, or one of two external events. The 89C51 may be configured so that when any of these events occur the main program is temporarily suspended and control passed to a special section of code related to the event that occurred. Once complete, the control would be returned to the original program. The ability to interrupt normal program execution when certain events occur makes it much easier and much more efficient to handle certain conditions. If it were not for interrupts we would have to manually check in our main program whether the timers had over flown, whether we had received another character via the serial port, or if some external
event had occurred. Besides making the main program ugly and hard to read, such a situation would make our program inefficient since wed be burning precious instruction cycles checking for events that usually dont happen. Luckily, this isnt necessary. Interrupts let us forget about checking for the condition. The microcontroller itself will check for the condition automatically and when the condition is met will jump to a subroutine (called an interrupt handler), execute the code, then return. Instead of a normal RET instruction we have a RETI instruction. The RETI instruction does the same thing as a RET instruction, but tells the 89C51 that an interrupt routine has finished. You must always end your interrupt handlers with RETI. Obviously we need to be able to distinguish between various interrupts and executing different code depending on what interrupt was triggered. This is accomplished by jumping to a fixed address when a given interrupt occurs.
Source
EI
--
ET2
ES
ET1
EX1
ET0
EX0
--
--
PT2
PS
PT1
PX1
PT0
PX0
A high priority interrupt cannot be interrupted. A high-priority interrupt may interrupt a low-priority interrupt. A low priority interrupt may occur if no other interrupt is already executing. If two interrupts occur at the same time, the interrupt with higher priority will execute first. If both interrupts are of the same priority the interrupt that is serviced first by polling sequence will be executed first.
CHAPTER 4
Alternate Track
COMPUTER or MICRO-CONTROLLER
FM Transmitter Amplifier
As shown in the block diagram, this unit mainly consists of the following blocks: 1. Microcontroller 2. Track Monitoring Circuit 3. Track Controlling Circuit 4. Power Supply 5. RFID Tag & Reader 6. RS232 Interface 7. FM Transmitter
4.1 INTERFACING
RFID Tag: The RFID tags have a unique eight-digit code number, which are mounted on the
train. Tags continuously transmit code in RF frequency.
RFID Reader: The code transmitted by the tag is received by RFID reader modules which are
placed on the track. They convert radio waves received from the RFID tags in to a form that can be passed on to micro controllers.
Max-232: This module is primary when RS-232 is interfaced with microcontroller. It converts
TTL logic to RS-232 logic or vice versa.
RS-232: RS-232 is used for serial communication to connect RFID reader to microcontroller. Track controlling circuit: DC motor is used to change the track. Relay circuit is used to
change the polarities of the batteries connected to DC motor.
IR sensors: IR sensors are used to locate and find the presence of train. IR sensors are used
near railway crossing.
4.2 DESCRIPTION:
Here the RFID reader will read the details of the incoming train. And if it is the authorized train then it will let the train go to the station. , if not it will not let the train go . Instead.. it will lead the train through the other track by changing the track of the train and it will also inform the station nearer of this. By keeping The RFID reader in different predetermined places .we can provide more security for trains. We can avoid the collision of two trains which will be using the same track. Each train will have a RFID tag which contains information about the train. When the train passes the RFID reader which is placed near the station, it reads the information near the RFID tag of the train. This RFID tag will pass on that information to the computer on the station which will refer to the stable present near the information sent by the RFID reader. And the train will be the correct one then it will be let in to enter the station . if not it will change the track of the train with the help of the track switching circuit, so that the train will be not allowed inside the station. There by avoiding any chance of collision with another train standing on the same track as the train this is coming from the other end. Our project is designed using 89C51 microcontroller to avoid railway accidents happening at unattended railway gates. The project utilizes the powerful IR transmitters and two receivers:; one pair of transmitters and receivers is fixed at upside(from where the train comes) at a level higher than a human being in exact alignment and similarly the other pair is fixed at down side of the train direction. Sensor activation time is adjusted by calculating the time taken at a certain speed to cross at least one compartment of standard minimum size of the Indian railway . We have considered 5 seconds for this project . Sensors are fixed at 1 km on both sides of the gate. We call the sensor along the train direction as foreside sensor and the other as aft side sensor. When foreside receiver gets activated , the gate motor is turned on in one direction and the gate is closed and stays closed until the train crosses the gate and reaches
aft side sensors .when upside receiver gets activated motor turns in opposite direction and gate opens and motor stops. Buzzer will immediately sound at the fore side receiver activation and gate will close after 5 seconds, so giving time to drivers to clear gate area in order to avoid trapping between the gates and stop sound after the train has crossed. The same principle is applied for track switching. Consider a situation where in an express train and a local train is traveling in opposite directions on the same track; the express train is allowed to travel on the same track and the local train to switch on the other track. Two sensors are placed at the either side of the junction where the track switches. If the train approaching the other side, and another sensor placed along that direction get activated and will send a interrupt service routine switches the track. Indicator light have been provided to avoid collisions. Here the switching operation is performed using a stepper motor. Assuming that with a certain delay, and train passes the track and is switched back to its original position, allowing the first train to pass without any interruption. This concept of track switching can applied at 1km distance from the stations.
CHAPTER 5
HARDWARE DESCRIPTION
5.1 Power Supply Unit:
The power supply unit is the heart of any circuit or system. So here for project purpose, we implement a DC power supply derived from AC. A DC power supply which maintains the output voltage constant irrespective of AC mains fluctuations or load variations is known as regulated DC power supply offers excellent line and load regulation and output voltages of +5V and +12V at output currents up to one amps.
Regulator Filter Rectifier Transformer
Here the capacitor C1 is used for filtering purpose and connector across the rectifier output. It filters AC component present in the rectifier DC and gives steady DC Voltage. As a rectifier voltage increases, it charges the capacitor and also supplies current in the load. When capacitor is charged to the peek value of the rectifier voltage, rectifier voltage starts to decrease. As the next voltage peek immediately recharges the capacitor, the discharge period is of very small duration. Due to this continuous charge-discharge-recharge cycle very little ripple is observed in the filtered output. Moreover, output voltage is higher as it remains substantially near the peak value of the rectifier output voltage. This phenomenon is also explained in other form as: the stunt capacitor offers low reactance path AC components of current and open circuit to DC component. During positive half-cycle the capacitor stores the energy in the form of electro-static field. During the negative half-cycle the filter capacitor releases the stored energy to the load.
Output current up to 1A Output voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V Thermal overload protection Short circuit protection
Description
The LM7805 series of three terminal positive regulators are available in the TO-220/DPAK package and with several fixed output voltages, making them useful in a wide range of applications. Each type employs internal current limiting, thermal shutdown and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output current. Although designed primarily as fixed regulators, these devices can be used with external components to obtain adjustable voltages and currents.
5.2 MAX232:
This module is primary of interest for people building their own electronics with an RS232 interface. Off-the-shelf computers with RS-232 interfaces already contain the necessary electronics, and there is no need to add the circuitry as described here. Serial RS-232 communication works with voltages (-15V to -3V for high) and (+3V to +15V for low) which are not compatible with normal computer logic voltages. On the other hand, classic TTL computer logic operates between 0V to +15V. So the maximum RS-232 signal levels are far too high for computer logic electronics and the negative RS-232 voltage for high cant be grokked at all by computer logic. Therefore to receive serial data from an RS-232 interface the voltage has to be reduced and the low and high voltage level inverted. In the other direction (sending data from some logic over RS-232) the low logic voltage has to be bumped up and a negative voltage has to be generated. RS-232 TTL Logic
------------------------------------------------15V -3V <-> +2V +5V <-> high +3V +15V<-> 0V +0.8V <-> low
The MAX232 from Maxim was the first IC which in one package contains the necessary drivers (two) and receivers (also two), to adapt the RS-232 signal voltage levels to TTL logic. It became popular because it just needs one voltage (+5V) and generates the necessary RS-232 voltage levels (approx. -10V and +10V) internally. This greatly simplified the design of circuitry. Circuitry designers no longer need to design and build a power supply with three voltages (e.g. -12V, +5V and +12V), but could just provide one +5V power supply, e.g. with the help of a simple 78x05 voltage converter. The MAX232 (A) has two receivers (converts from RS-232 to TTL voltage levels) and two drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS232 signals can be converted in each direction.
MAX232 to RS-232 DB9 Connection as a DCE MAX232 Pin No. 7 8 9 10 11 12 13 14 15 T2out R2in R2out T2in T1in R1out R1in T1out GND CTS RTS RTS CTS TX RX TX RX GND RS-232 RS-232 TTL TTL TTL TTL RS-232 RS-232 0 7 8 n/a n/a n/a n/a 3 2 5 MAX232 Pin Name Signal Voltage DB9 Pin
5.3 RS-232:
RS-232 is the mostly widely used interfacing standard. This standard is used in PCs and numerous types of equipments. However since the standard was set long before the advent of the TTL logic family. Its input and output levels are not TTL compatible. In RS-232, a1 is represented by -3 to -25 volts while a 0 bit is represented by +3 to +25 volts, making -3 to +3 undefined. For this reason, to connect any RS-232 to a microcontroller system we must use voltage converter such as MAX232 to convert the TTL logic levels to the RS-232 voltage level and vice-versa.
5.3.1 Features
Supply Voltage range: Supply Current: Transmitter o/p voltage swing: Data Rate: 5mA 7.8V
4.5 to 5.5V
220Kbps
Pin 1 2 3 4
Description Data Carrier Detect (DCD) Received Data (RxD) Transmitted Data (TxD) Data Terminal Ready (DTR)
5 6 7 8 9
Signal Ground (GND) Data Set Ready (DSR) Request To Send (RTS) Clear To Send (CTS) Ring Indicator (RI) Table5.2: RS-232 pin description
Fig5.4: IC 555 Timer No 1 2 3 4 Name GND TR Q R Ground, low level A short pulse high low on the trigger starts the timer Purpose
During the timing interval, the output stays at +VCC A timing interval can be interrupted by applying a reset pulse to low (0V)
5 6 7 8
Control Voltage allows access to the internal voltage divider (2/3 VCC) The threshold at which the interval ends (it ends if U.thr > 2/3 VCC) Connected to a capacitor whose discharge time will influence the timing interval The positive supply voltage which must be between 5V and 15V, high level Table5.3: IC 555 Timer pin description
The 555 is an integrated circuit (chip) implementing a variety of timer and multi-vibrator applications. The 555 timer has three operating modes:
Monostable Mode: In this mode, the 555 timer functions as a one-shot. Applications include timers, missing pulse detection, bounce free switches, touch switches, frequency divider, capacitance measurement, pulse width modulation etc.
Astable Free Running Mode: The 555 timer can operate as an oscillator. Uses include LED and lamp flashers, pulse generation, logic clocks, tone generation, security alarms, pulse position modulation etc.
Bistable Mode: The 555 can operate as a flip-flop, if the discharge pin is not connected and no capacitor is used. Uses include bounce free latched switches etc.
Fig5.5: Astable Multivibrator ASTABLE MULTIVIBRATOR OPERATION: Astable or free running multivibrator is a two stage amplifier with AC-coupled feedback from output to input. One transistor stage is ON while other is OFF until the stages switch conducting states repeatedly at a specific frequency. The oscillation frequency is set by the resistor and capacitor values connected to the base terminal of each stage. This RC network determines how long the transistor stays in the OFF position. This circuit is not stable in either state. It continuously oscillates from one state to the other, in other words it produces a continuous train of pulses at any frequency we require. It usually generates a square wave. This is used to set the frequency of transmission of LEDs.
5.5 IR Sensors
This circuit has two stages, a transmitter unit and a receiver unit. The transmitter unit consists of an infrared LED and its associated circuitry. 5.5.1 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 5 volts. It is required to switch ON the IR LED.
Fig5.6: IR Transmitter
Resistors Capacitors
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 momentarily transmits 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 the track switching. The IR receiver circuit is shown in the figure below.
Fig5.7: IR Receiver
Fig5.8: FM Transmitter Block Diagram The microphone converts sound pressure wave to electrical signals. These audio voltages are amplified by the audio amplifier. The amplified audio is used to control the deviation of the frequency controlled oscillator. The oscillator frequency is at the carrier frequency, in the 88108 MHz FM band. The low power of the frequency modulated carrier is boosted by the Radio Frequency amplifier. The aerial is driven by the amplifier and produces an electromagnetic wave. Under normal conditions the transmitted signal will travel as far as the horizon. 5.6.2 FM
RECEIVER Fig5.9: FM Receiver Block Diagram Most of these blocks are discussed individually, and in more detail, on other pages. See filters, mixers, frequency changers, am modulation and amplifiers. The FM band covers 88-108 MHz. There are signals from many radio transmitters in this band inducing signal voltages in the
aerial. The RF amplifier selects and amplifies the desired station from the many. It is adjustable so that the selection frequency can be altered. This is called TUNING. In cheaper receivers the tuning is fixed and the tuning filter is wide enough to pass all signals in the FM band. The selected frequency is applied to the mixer. The output of an oscillator is also applied to the mixer. The mixer and oscillator form a FREQUENCY CHANGER circuit. The output from the mixer is the intermediate frequency (IF.) The IF is a fixed frequency of 10.7 MHz. No matter what the frequency of the selected radio station is, the IF is always 10.7 MHz. The IF signal is fed into the IF amplifier. The advantage of the IF amplifier is that its frequency and bandwidth are fixed, no matter what the frequency of the incoming signal is. This makes the design and operation of the amplifier much simpler. The amplified IF signal is fed to the demodulator. This circuit recovers the audio signal and discards the RF carrier. Some of the audio is fed back to the oscillator as an AUTOMATIC FREQUENCY CONTROL voltage. This ensures that the oscillator frequency is stable in spite of temperature changes. The audio signal voltage is increased in amplitude by a voltage amplifier. The power level is increased sufficiently to drive the loudspeaker by the power amplifier.
5.7 DC MOTOR
Department of Electronics and Communication Engineering St. Joseph Engineering College
Fig5.10: DC motor Motor means a permanent magnet, direct-current (DC) motor of the sort used in toys, models, cordless tools and robots. These motors are particularly versatile because both their speed and direction can be readily controlled; speed by the voltage or duty cycle of their power supply and direction by its polarity. We use a relay driver circuit to interface the motor and the Microcontroller. DC motor runs on low voltage DC. In our project DC motor is used for the mechanical movements of track changing setup. They can be controlled either by software or by hardware. In our project we control the DC motor using microcontroller.
A rely is a mechanical switch operated by an electromagnet. The relatively small current that energizes the electromagnet (the coil) can control a larger current through the relay switch.
Relay driver circuit as shown in the diagram uses ICs ULN2003 and TDS-0502L. Here ULN2003 acts as driver for the relay and TDS-0502L is the relay IC. A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and they are double throw (changeover) switches. Relays allow one circuit to switch a second circuit which can be completely separate from the first. There is no electrical connection inside the relay between the two circuits, the link is magnetic and mechanical. Most relays are designed for PCB mounting but you can solder wires directly to the pins providing you take care to avoid melting the plastic case of the relay. Advantages are: Relays can switch AC and DC. Relays can switch high voltages. Relays are a better choice for switching large currents (> 5A). Relays can switch many contacts at once. Relays are components which allow a low-power circuit to switch a relatively high current on and off, or to control signals that must be electrically isolated from the controlling circuit. To make a relay operate, we have to pass a suitable pull-in and holding current (DC) through its energizing coil. And generally relay coils are designed to operate from a particular supply voltage often 12V or 5V. TDS-0502L is a relay IC which uses 5V 2A supply. Size of the IC is 21x10x12mm. It is an eight pin IC and it is designed for PCB mounting. We can solder wires directly to the pin.
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. Suppression diodes are included for inductive load driving and the inputs are pinned opposite the outputs to simplify board layout. These versatile devices are useful for driving a wide range of loads including solenoids, relays DC motors, LED displays filament lamps, thermal print heads and high power buffers. ULN2003A are supplied in 16 pin plastic DIP packages with a copper lead frame to reduce thermal resistance. They are available also in small outline package (SO-16) as ULN2003D.
5.8.2 FEATURES
500mA rated collector current(Single output) High-voltage outputs: 50V Inputs compatible with various types of logic. TTL/CMOS/PMOS/DTL compatible inputs
Relay driver application Integrated suppression diodes form inductive loads Outputs can be paralleled for higher current
CHAPTER 6
SOFTWARE ASPECTS
START
6.1 Flowchart:
INITIALIZE I/O PORT DISPLAY SHATABDI EXPRESS
NO NO
YES
IF THE TRAIN(TAG)CODE=045h
PASS THE TRAIN(046) AND AFTER SOME DELAY BRING THE TRACK TO NORMAL POSITION
STOP
/*Read RFID code serially */ mov tmod,#20h mov th1,#-3 mov scon,#50h start: nop mov r5,#13 mov r1,#40h setb tr1 up: clr ri rpt: jnb ri,rpt mov a,sbuf mov @r1,a inc r1 /*Store the read data into Ram*/ /*Serial comm mode config*/
djnz r5,up
/* Bring the RF data stored in ROM to RAM */ clr a mov dptr,#rfdat mov r0,#50h mov r2,#08
back1: clr a movc a,@a + dptr mov @r0,a inc dptr inc r0 djnz r2,back1
/*Check the RFID code of train with the stored database */ mov r2,#04h mov r0,#57h mov r1,#4ch acall compare jz last ajmp down last: setb p1.0 setb p1.2 acall display acall delay1 clr p1.0 clr p1.2 setb p1.1 acall delay1
/* Subroutines */ compare: nop cmp1: clr a mov a,@r1 xrl a,@r0 jz next1 sjmp next2 next1: dec r1 dec r0 djnz r2,cmp1 next2: ret
display: mov dptr,#mycom1 acall command mov dptr,#mydata1 acall mydata ret
command: nop command1:clr a movc a,@a+dptr acall comwrt jz retrn inc dptr sjmp command1 retrn: nop ret
mydata: nop mydata1:clr a movc a,@a+dptr acall datawrt inc dptr jz retn1 sjmp mydata1 retn1: ret
/* Display initilasation*/ comwrt: acall ready mov p2,a clr p3.5 clr p3.6 setb p3.7 clr p3.7 ret
/* Dataword initilasation*/ datawrt: acall ready mov p2,a setb p3.5 clr p3.6 setb p3.7 clr p3.7 ret
here:
delay1:acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay acall delay ret ready: setb p2.7 clr p3.5 setb p3.6 back2: clr p3.7 setb p3.7 jb p2.7,back2 ret
CHAPTER 7
Using Doppler radar RFID we can find the speed of the train. As the tracking technology advances, railways of larger zones can be controlled and monitored.
Railways can install anti-collision device (ACD), which is an on-board train protection device, so as to reduce chances of collisions.
Bibliography
http://www.ieeexplore.org http://en.wikepedia.org http://www.google.com http://howstuffworks.com http://www.scribd.com http://www.kpsec.freeuk.com http://www.datasheetcatalog.com http://www.highimpactip.com http://electronicdesign.com http://www.technovelgy.com
http://www.hobbyprojects.com http://www.atmel.com