Unmanned Railway Gate
- Pages: 17
- Word count: 4065
- Category: History
A limited time offer! Get a custom sample essay written according to your requirements urgent 3h delivery guaranteedOrder Now
2. EMBEDDED SYSTEM
2. Examples Of Embedded Systems
3. Microprocessor and Microcontroller
4. Microprocessor verses Microcontroller
3. BLOCK DIAGRAM
3.1.1 Block Diagram Description
3.1.2 555 Timers
3.1.3 Infrared Sensor
3.1.4 Microcontroller (89S52)
3.1.5 Power Supply
4. CIRCUIT DIAGRAM
4.1.1 555 Timers
4.1.2 Infrared Emitted Diode(TSAL 6200)
4.1.3 IR Receiver(TSOP)
4. DTMF generator
5. COMPONENTS & THEIR
5.1.2 Description Of 8952 Microcontroller
5.1.3 Features Of Microcontroller
5.1.4 Block Diagram Of Microcontroller
5.1.5 Pin Configurations
5.1.6 Pin Description
1. Pin Connection
8.2 Back EMF
8.3 Driving a stepper motor
10. SOURCE CODE
11. CIRCUIT DIAGRAM
12. KEIL SOFTWARE
12.1 Software Description
The railway gate is to be controlled so that the road traffic is to be predicted .The railway gate is to be closed when a train is passing by the way. The opening and closing of the gate is to be done using DC motors and this DC motor is controlled by micro controller. The signaling of the train is also controlled depending upon the gate position. Only when gate is closed the red signal is otherwise green signal. So in this project the railway signaling includes the gate control is done using microcontroller. The automatic opening and closing of the gate and also the signaling which depending on the gate position that will be controlled by the microcontroller.
Present project is designed using 8051 microcontroller to avoid railway accidents happening at unattended railway gates, if implemented in spirit. This project utilizes two powerful IR transmitters and two receivers; one pair of transmitter and receiver is fixed at up side (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 so 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 1km 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 aft side 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. Considering a situation wherein an express train and a local train are traveling in opposite directions on the same track; the express train is allowed to travel on the same track and the local train has to switch on to the other track. Two sensors are placed at the either sides of the junction where the track switches. If there’s a train approaching from the other side, then another sensor placed along that direction gets activated and will send an interrupt to the controller. The interrupt service routine switches the track. Indicator lights have been provided to avoid collisions. Here the switching operation is performed using a stepper motor. Assuming that within a certain delay, the train has passed the track is switched back to its original position, allowing the first train to pass without any interruption. This concept of track switching can be applied at 1km distance from the stations.
The project is simple to implement and subject to further improvement.
2 EMBEDDED SYSTEMS:
Embedded system is a combination of hardware and software, it is also named as “Firm ware”. An embedded system is a special purpose computer system, which is completely encapsulated by the device it controls. It is a computer-controlled system. An embedded system is a specialized system that is a part of a larger system or machine. As a part of a larger system it largely determines its functionality. Embedded systems are electronic devices that incorporate microprocessors with in their implementations. The main purpose of the microprocessors are simplify the system design and improve flexibility. In the embedded systems, the software is often stored in a read only memory (RAM) chip. Embedded systems provide several major functions including monitoring of the analog environment by reading data from sensors and controlling actuators.
2.2 EXAMPLES OF EMBEDDED SYSTEMS:
Embedded systems are found in wide range of application areas. Originally they were used only for expensive industrial control applications, but as technology brought down the cost of dedicated processors, they began to appear in moderately expensive applications such as automobiles, communication and office equipments and television Today’s embedded systems are so inexpensive that they are used in almost every electronic product in our life. Embedded systems are often designed for mass production.
Some examples of embedded systems:
• Automatic Teller Machines
• Cellular telephone and telephone switches
• Computer network equipment
• Computer printers
• Disk drives
• Engine controllers and antilock break controllers for automobiles • Home automation products
• Handheld calculators
• Household appliances
• Medical equipment
• Measurement equipment
• Multifunction wrist watches
• Multifunction printers
2.3 MICROPROCESSOR AND MICROCONTROLLER:
1. Microprocessors and microcontrollers are used in embedded system products. An embedded product uses a microprocessor ( or microcontroller ) to do one task and one task only. 2. Microprocessor as the term come to be known is a general purpose digital computer central processing unit. Although popularly known as a “computer on chip”, the microprocessor is in no sense a complete digital computer. 3. Microprocessor CPU contains Arithmetic Logical Unit, a program counter, a stack pointer, some working registers, a clock timing circuits and interrupt circuit. 4. The hardware design of microprocessor CPU is arranged so that a small or very large system can be configured around the CPU as the application demands. The internal CPU architecture as well as the resultant machine level code that operates that architecture is comprehensive but as flexible as possible.
The prime use of microprocessor is to read data perform extensive calculations on that data and store those calculations in mass storage devices or display the results for user use. The program is used by microprocessor are stored in the mass storage devices and loaded into RAM as the user directs. A microcontroller is a computer on a single chip .Micro suggests that the device is small and controller tells that the device is used to control objects, process or events. A microcontroller is a general purpose device but one that is meant to read data, perform limited calculations on that data and control its environment based on those calculations. The prime use of microcontroller is to control the operation of machine using a fixed program that is stored in ROM that does not change over the life time of the system.
The advantages of microcontroller over microprocessor are:
• cost is less
• speed is more
• power consumption is less
• compact device
• external components are minimum
2.4 MICROPROCESSOR VERSES MICROCONTROLLER:
The contrast between microprocessor and microcontroller is best exemplified by the fact that: Most microprocessor has operational codes for moving data from external memory to CPU, microcontroller may have one or two. Microprocessor may have one or two types of bit handling instructions microcontroller will have many. Microprocessor concerned with rapid movement of code and data from external address to the chip, microcontroller is concerned with rapid data movement of bits with in chip. Microcontroller can compute function as a computer with out addition of external devices, but microprocessor must have many additions to operations.
3.1 BLOCK DIAGRAM DESCRIPTION:
The block diagram of the embedded security system consists of the following modules • 555 timer
• IR Receiver
• Buzzer alarm
• Power supply
3.2 555 TIMERS:
The 555 timer has been employed to generate a square wave of 56 KHz frequency. The 555 timer has connected for astable operation. With an astable operation, the frequency and duty cycle accurately controlled by two external resistors and capacitor connected to the 555 timer. The output signal for this module is used to drive the Infrared Emitting Diode. 3.3 INFRARED SENSOR:
This project makes use of an infrared sensor module, which consists of an Infrared emitting IR receiver TSOP 1356. The output of IR receiver is connected to pin 1 of the microcontroller 8952. This sensor is used near the door. Whenever the door is opened, it sense the obstacle and a logic low appear at the pin 1 of the microcontroller.
3.4 MICROCONTROLLER (89S52):
This project employs the 8-bit microcontroller from ATMEL(AT89S52). The microcontroller in our security system is used for sending signals to the auto dialer and buzzer alarm. A number is already stored in the EEPROM of the microcontroller. When a logic low signal appears at the pin 1 of the microcontroller, the number stored in the memory is sent to the auto dialer. 3.5 BUZZER ALARM:
When the security system detects an intruder, the microcontroller activates the buzzer alarm and the telephone auto dialer. The buzzer alarm serves the following three functions: • It alerts the occupants and neighbors that someone has broken into the building. • It drives the intruder away.
• It signals to the police which house has been broken into. 3.6 POWER SUPPLY
Supply of 230V, 50Hz ac signal from main supply board is given to a step down transformer. The transformer is selected such that its output ranges from 10V to 12V, which is supplied to the power supply block for making the output compatible with the TTL logic supply. This TTL logic supply acts as the power supply for the microcontroller, IR sensor, auto dialer, timer circuit and buzzer. Thus the main function of the power supply is to give the voltage supply required for the logic families, which is an output of +5V. For example a 5V regulated supply can be shown as below
Similarly, 12v regulated supply can also be produced by suitable selection of the individual elements. Each of the blocks is described in detail below and the power supplies made from these blocks are described below with a circuit diagram and a graph of their output: TRANSFORMER:
A transformer steps down high voltage AC mains to low voltage AC. Here we are using a center-tap transformer whose output will be sinusoidal with 36volts peak to peak value.
The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not suitable for electronic circuits unless they include a rectifier and a smoothing capacitor. The transformer output is given to the rectifier circuit.
A rectifier converts AC to DC, but the DC output is varying. There are several types of rectifiers; here we use a bridge rectifier. [pic] The Bridge rectifier is a circuit, which converts an ac voltage to dc voltage using both half cycles of the input ac voltage. The Bridge rectifier circuit is shown in the figure. The circuit has four diodes connected to form a bridge. The ac input voltage is applied to the diagonally opposite ends of the bridge. The load resistance is connected between the other two ends of the bridge. For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas diodes D2 and D4 remain in the OFF state.
The conducting diodes will be in series with the load resistance RL and hence the load current flows through RL. For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the load resistance RL and hence the current flows through RL in the same direction as in the previous half cycle. Thus a bi-directional wave is converted into unidirectional. The output waveform of the rectifier is shown as below
The varying DC output is suitable for lamps, heaters and standard motors. It is not suitable for electronic circuits unless they include a smoothing capacitor. SMOOTHING:
The smoothing block smoothes the DC from varying greatly to a small ripple. The ripple voltage is defined as the deviation of the load voltage from its DC value. Smoothing is also named as filtering. Filtering is frequently effected by shunting the load with a capacitor. The action of this system depends on the fact that the capacitor stores energy during the conduction period and delivers this energy to the loads during the no conducting period. In this way, the time during which the current passes through the load is prolongated, and the ripple is considerably decreased. The action of the capacitor is shown with the help of waveform. The waveform of the rectified output after smoothing is given below: [pic]
A regulator eliminates ripple by setting DC output to a fixed voltage Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) [pic]
Railways being the cheapest mode of transportation are preferred over all the other means .When we go through the daily newspapers we come across many railway accidents occurring at unmanned railway crossings. This is mainly due to the carelessness in manual operations or lack of workers. We, in this project has come up with a solution for the same. Using simple electronic components we have tried to automate the control of railway gates. As a train approaches the railway crossing from either side, the sensors placed at a certain distance from the gate detects the approaching train and accordingly controls the operation of the gate. Also an indicator light has been provided to alert the motorists about the approaching train.
4.1 555 TIMERS:
NE 555 is a highly stable controller capability of producing accurate
timing pulses. In this circuit, 555 timer has been connected in astable mode to accurately generate a square wave of frequency 56KHz. For the astable mode, we connect two external resistors (R1, R2) and one capacitor (C1). • Pin 8 is connected to +5V power supply.
• Pin 1 is grounded and pin 3 is connected to the Infrared emitting diode (TSAL 6200). 4.2 INFRARED EMITTING DIODE (TSAL 6200): TSAL 6200 is a high efficiency infrared emitting diode modeled in clear gray tinted plastic packages. The pulse current through the LED can vary from 100mA to well over 1A. In order to get an acceptable control distance, the LED currents have to be as high as possible. A trade-off should be made between LED parameters and maximum control distance. Average power dissipation of the LED should not exceed the maximum value though. We adopt modulation technique to ensure that our IR message gets across to the receiver without errors. With modulation, we make the IR light source blink in a particular frequency.
The IR receiver will be tuned to that frequency, so it can ignore everything else. In our IR sensor module, we have chosen a carrier frequency of 56kHz. Hence the current pulses are at a frequency of 56 kHz. There are several manufacturers of IR receivers in the market. Siemens, Vishay and Telefunken are main suppliers. Vishay has its TSOP product series (TSOP 13xx, TSOP 48xx, TSOP 62xx where xx indicates the modulation frequency of 30, 33,36,38,40 or 56 kHz). The anode of LED is connected to pin 3 of 555 timer and the cathode of the LED is grounded through a resistor (R3) of 500 ohms. 4.3 IR RECEIVER (TSOP 1356):
TSOP 13xx series are miniaturized receivers for infrared remote control systems. PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter. The demodulated output signal can directly be decoded by a microprocessor. TSOP 13xx is the standard IR remote control receiver series, supporting all major transmission codes. • Pin 1 is grounded.
• A capacitor (C3) of 4.7 micro farads connected between pin 1 and pin 2. • Pin 2 is connected to a supply of +5V through a resistor (R4) of 1k ohms. The output of TSOP 1356 is active low. When there is a proper transmission and reception between the LED and IR receiver, the output of TSOP 1356 is logic high. The carrier frequency should be close to 56 kHz. Whenever there is no link between IR transmitter and receiver, the output pin 3 of TSOP 1356 will be logic low.
4.4 DTMF GENERATOR (UM95089):
The UM95089 is a low threshold voltage, field implanted metal gate CMOS integrated circuit. It interfaces directly to a standard telephone line and generates all dual tone multi-frequency pairs required in tone dialing systems. • A crystal oscillator (3.579545MHz) is connected between pin 7 and pin 8. • Pin 16 is connected to the base of NPN transistor BC 547 • The emitter of transistor is grounded through a resistor (R6) of 10k ohms. • The collector of the transistor is connected to the telephone line trough a 1:1 transformer. In the concerned project 8052 microcontroller is used. Here microcontroller used is AT89S52, which is manufactured by ATMEL laboratories.
5.COMPONENTS & DESCRIPTION
The microcontroller used in this project is AT89S52, which is a 40 pin IC. • Pin 40 is connected to +5v power supply
• Reset circuit is connected to pin 9 of 8952 to provide reset condition when the microcontroller is powered off. The reset circuitry comprises of 10 micro farads(C6) and a resistor (R5) of 8.2k ohms. • Pin 31 (EA\VPP) is tied to VCC for internal program execution. • The crystal oscillator (11.0592MHz) is connected across pin 18 and pin19. • Pin 1 (port 1.0) is connected to the output (pin 3) of the IR receiver (TSOP 1356). • Pin 2 (port 1.1) is connected to the buzzer.
• Pin 3 (port 1.2) is connected to the Chip Enable input (pin 2) of the DTMF generator (UM95089). • Port 2 of the microcontroller is used to transfer the data from the microcontroller to the DTMF generator. • P2.0 (pin 21) of the AT89S52 is connected to pin 14(R1) of UM95089. • P2.1 (pin 22) of the AT89S52 is connected to pin 13 (R2) of UM95089. • P2.2 (pin 23) of the AT89S52 is connected to pin 12 (R3) of UM95089. • P2.3 (pin 24) of the AT89S52 is connected to pin 11 (R4) of UM95089. • P2.4 (pin 25) of the AT89S52 is connected to pin 3 (C1) of UM95089. • P2.5 (pin 26) of the AT89S52 is connected to pin 4 (C2) of UM95089. • P2.6 (pin 27) of the AT89S52 is connected to pin 5 (C3) of UM95089. P2.7 (pin 28) of the AT89S52 is connected to pin 9 (C4) of UM95089 5.1.2 Description of 8952 Microcontroller:
The AT89S52 provides the following standard features: 8Kbytes of Flash, 256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power down Mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next hardware reset. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications with MCS-51 Products.
5.1.3 Features of Microcontroller (8052):
• 8 Kbytes of In-System Reprogrammable Flash Memory
• Endurance: 1,000 Write/Erase Cycles
• Fully Static Operation: 0 Hz to 24 MHz
• Three-Level Program Memory Lock
• 256 x 8-Bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-Bit Timer/Counters
• Eight vector two level Interrupt Sources
• Programmable Serial Channel
• Low Power Idle and Power Down Modes
In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes.
The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. 5.1.4 Block Diagram of Microcontroller
5.1.5 Pin Diagram of 8952
5.1.6 Pin Description
Pin 40 provides Supply voltage to the chip. The voltage source is +5v GND.
Pin 20 is the grounded Port 0 is an 8-bit open drain bidirectional I/O port from pin 32 to 39. As an output port each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 may also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode P0 has internal pull-ups.Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during program verification. External pull-ups are required during program verification. Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups from pin 1 to 8. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and program verification.
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups from pin 21 to 28. The Port 2 output buffers can sink / source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups from pin 10 to 17. The Port 3 output buffers can sink / source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C51 as listed below:
Special Features of 89S52:
• Port 3 also receives some control signals for Flash programming and programming verification. RST
Pin 9 is the Reset input. It is active high. Upon applying a high pulse to this pin, the microcontroller will reset and terminate all activities. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG
Address Latch is an output pin and is active high. Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN