You are on page 1of 63

AUTOMATIC RAILWAY GATE DESCRIPTION LIST OF FIGURE LIST OF TABLES CONTENTS PAGE NO.

ABSTRACT CHAPTER -1 INTRODUCTION TO AUTOMATIC RAILWAY SYSTEM


1.1 Introduction 1.2Embedded systems 1.3 Examples of embedded systems

07

08 08 09

CHAPTER -2 BLOCK DIAGRAM OF AUTOMATIC RAILWAY GATE


2.1 2.2 2.3 2.4 Block diagram Power supply Transformers Rectifiers 2.4.1 Types of Rectifiers 2.5 Micro controller (AT89S51) 2.5.1 2.5.2 2.5.3 2.6 Description Features Block diagram and pin diagram 11 11 12 13 13 16 16 17 18 22

Oscillator

B.TECH(EEE),H.I.T.S (COE)

Page 1

Department of EEE

AUTOMATIC RAILWAY GATE

CHAPTER -3
3.1 IR COMMUNICATIONS 23 25 26 26 28 30 31 34 37 39 39 43 46 49 52 52 3.1.1 IR Generation 3.2 IR LED AND IR SENSOR

3.2.1 Schematic circuit of IR sensors 3.3 3.4 IR TRANSMITTER IR RECEIVER 3.4.1 Use of Infrared detector 3.4.2 Theory of sensor circuit 3.4.3 3.5 Applications of sensors

Introduction to dc motors Introduction Main parts of dc motors Working of dc motor Speed control of dc motor

3.5.1 3.5.2 3.5.3 3.5.4 3.6

Motor driver circuit (H-bridge) Operating modes of H-bridge

3.6.1

B.TECH(EEE),H.I.T.S (COE)

Page 2

Department of EEE

AUTOMATIC RAILWAY GATE

CHAPTER-4 SOFTWARE EXPLANATION


4.1 4.2 Introduction to KEIL software KEIL software tools (STEPS) 54 55

CHAPTER -5 CONCLUSION BIBILOGRAPHY REFRENCES 61 62 62

B.TECH(EEE),H.I.T.S (COE)

Page 3

Department of EEE

AUTOMATIC RAILWAY GATE

LIST OF FIGURES
FIGURES
1.1 INTERNAL PART OF EMBEDDED SYSTEM 2.1 BLOCK DIAGRAM OF PROJECT 2.2 COMPONENTS OF POWER SUPPLY 2.3 AN ELECTRICAL TRANSFORMER 2.4 FULL WAVE RECTIFIER 2.5 POSITIVE CYCLE FULL WAVE RECTIFIER 2.6 NEGATIVE CYCLE OF FULL WAVE RECTIFIER 2.7MICRO CONTROLLERS 2.8 BLOCK DIAGRAM OF MICRO CONTROLLER 2.9 PIN DIAGRAM OF MICRO CONTROLLER 2.10 OSCILLATOR CONNECTIONS 2.11 EXTERNAL CLOCK DRIVE CONFIGURATION 3.1 VISIBLE SPECTRUMS 3.2 CIRCUIT DIAGRAM OF IR SENSOR 3.3 IR LED 3.4 OP AMPS 3.5 IR EMITTER AND IR PHOTO TRANSISTOR 3.6 CIRCUIT DIAGRAM OF INFRARED REFLECTANCE SENSOR

PAGE NO
9 11 12 12 15 15 15 16 18 18 22 22 23 28 28 30 31 32

B.TECH(EEE),H.I.T.S (COE)

Page 4

Department of EEE

AUTOMATIC RAILWAY GATE 3.7 SCHEMATIC DIAGRAM OF SINGLE PAIR IR TRANSMITTER 3.8 SCHEMATIC OF SINGLE SENSOR 3.9 DESCRIPTION OF OPERATION OF A TYPICAL CIRCUIT 3.10 OPERATION OF LEDS 3.11 CHARACTERISTICS OF LEDS 3.12 COMMUTATORS 3.13 BRUSHES 3.14 COMMUTATORS AND COMMUTATOR RING 3.15 POSITIVE AND NEGATIVE COUNTER CLOCKWISE ROTATION 3.16 WORKING OF DC MOTOR 3.17 PERIPHERAL OF DC MOTOR 3.18 CONSTRUCTION AND WORKING OF DC MOTOR 3.19 SPEED CURVE OF DC MOTOR 3.20 MOTOR TORQUES LOADING 3.21 H-BRIDGE CONNECTED TO A MOTOR 3.22 CURRENT FLOWING IN HIGH SIDE AND LOW SIDE 33 34 35 35 36 43 44 45 46 47 48 48 49 50 52 53

B.TECH(EEE),H.I.T.S (COE)

Page 5

Department of EEE

AUTOMATIC RAILWAY GATE

LIST OF TABLES
TABLES
2.1 COMPARISONS OF RECTIFIERS 2.2 OPERATIONS OF PORTS 3.1 DIFFERENT MATERIALS AND THEIR WAVE LENGTHS 3.2 TRUTH TABLE

PAGE NO
13 19 39 53

B.TECH(EEE),H.I.T.S (COE)

Page 6

Department of EEE

AUTOMATIC RAILWAY GATE

ABSTRACT:
The railroad industrys own desire to maintain their ability to provide safe and secure transport of their customers hazardous materials has introduced new challenges in rail security. Addressing these challenges is important as railroads, and the efficient delivery of their cargo, play a vital role in the economy of the country. The train driver always observes the signals placed beside the track. These signals are controlled from the control room. The green light denotes that the track is free and red light denotes the track is busy. These signals are controlled based on the train position which is sensed by the using the IR sensors placed along the track. The present project is designed to satisfy the security needs of the railways. This system provides the security in two ways: Automatic gate opening/closing system at track crossing, signaling for the train driver. The automatic gate opening/closing system is provided with the IR sensors placed at a distance of few kilometres on the both sides from the crossing road. These sensors give the train reaching and leaving status to the embedded controller at the gate to which they are connected. The controller operates (open/close) the gate as per the received signal from the IR sensors.

B.TECH(EEE),H.I.T.S (COE)

Page 7

Department of EEE

AUTOMATIC RAILWAY GATE

CHAPTER-1
INTRODUCTION TO AUTOMATIC RAILWAY GATE
1.1 INTRODUCTION

Whenever ir senses the coming up of train then automatically gate will be closed. If there is no obstacle found in between ir pairs then gate will be opened.This particular operation will be handled by the dc motor along with h-bridge interfaced with micro controller. Firstly, the required operating voltage for Microcontroller 89C51 is 5V. Hence the 5V D.C. power supply is needed by the same. This regulated 5V is generated by first stepping down the 230V to 9V by the step down transformer. The step downed a.c. voltage is being rectified by the Bridge Rectifier. The diodes used are 1N4007. The rectified a.c voltage is now filtered using a C filter. Now the rectified, filtered D.C. voltage is fed to the Voltage Regulator. This voltage regulator allows us to have a Regulated Voltage which is +5V. The rectified; filtered and regulated voltage is again filtered for ripples using an electrolytic capacitor 100F. Now the output from this section is fed to 40th pin of 89c51 microcontroller to supply operating voltage.The microcontroller 89c51 with Pull up resistors at Port0 and crystal oscillator of 11.0592 MHz crystal in conjunction with couple of capacitors of is placed at 18th& 19th pins of 89c51 to make it work (execute) properly. 1.2 EMBEDDED SYSTEM: An embedded system is a special-purpose system in which the computer is completely encapsulated by or dedicated to the device or system it controls. Unlike a generalpurpose computer, such as a personal computer, an embedded system performs one or a few predefined tasks, usually with very specific requirements. Since the system is dedicated to

B.TECH(EEE),H.I.T.S (COE)

Page 8

Department of EEE

AUTOMATIC RAILWAY GATE specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, benefiting from economies of scale. Personal digital assistants (PDAs) or handheld computers are generally considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand. With the introduction of the OQO Model 2 with the Windows XP operating system and ports such as a USB port both features usually belong to "general purpose computers", the line of nomenclature blurs even more. Physically, embedded systems ranges from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. In terms of complexity embedded systems can range from very simple with a single microcontroller chip, to very complex with multiple units, peripherals and networks mounted inside a large chassis or enclosure.

Fig.1.1 INTERNAL PART OF EMBEDDED SYSTEM

B.TECH(EEE),H.I.T.S (COE)

Page 9

Department of EEE

AUTOMATIC RAILWAY GATE 1.3 APPLICATIONS OF EMBEDDED SYSTEMS: Avionics, such as inertial guidance systems, flight control hardware/software and other integrated systems in aircraft and missiles Cellular telephones and telephone switches Engine controllers and antilock brake controllers for automobiles Home automation products, such as thermostats, air conditioners, sprinklers, and security monitoring systems Handheld calculators Handheld computers Household appliances, including microwave ovens, washing machines, television sets, DVD players and recorders Medical equipment Personal digital assistant Videogame consoles Computer peripherals such as routers and printers. Industrial controllers for remote machine operation.

B.TECH(EEE),H.I.T.S (COE)

Page 10

Department of EEE

AUTOMATIC RAILWAY GATE

CHAPTER-2
BLOCK DIAGRAM OF AUTOMATIC RAILWAY GATE 2.1 BLOCK DIAGRAM:

Fig:2.1 Block Diagram of project 2.2 POWER SUPPLY: The power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronic circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A d.c power supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is known as Regulated D.C Power Supply. For example a 5V regulated power supply system as shown below:

B.TECH(EEE),H.I.T.S (COE)

Page 11

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 2.2 Components of power supply 2.3TRANSFORMER: A transformer is an electrical device which is used to convert electrical power from one Electrical circuit to another without change in frequency.Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase in output voltage, step-down transformers decrease in output voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils; instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.

Fig: 2.3An Electrical Transformer

B.TECH(EEE),H.I.T.S (COE)

Page 12

Department of EEE

AUTOMATIC RAILWAY GATE 2.4 RECTIFIER: A circuit which is used to convert ac to dc is known as RECTIFIER. The process of conversion ac to dc is called rectification 2.4.1 TYPES OF RECTIFIERS: Half wave Rectifier Full wave rectifier 1. Centre tap full wave rectifier. 2. Bridge type full bridge rectifier. Comparison of rectifier circuits:

Type of Rectifier Parameter Number of diodes 1 PIV of diodes Vm 2Vm Vm 2 4 Half wave Full wave Bridge

D.C output voltage

Vm/

2Vm/

2Vm/

Vdc,at no-load

0.318Vm

0.636Vm

0.636Vm

Ripple factor Ripple

1.21

0.482

0.482

B.TECH(EEE),H.I.T.S (COE)

Page 13

Department of EEE

AUTOMATIC RAILWAY GATE frequency Rectification efficiency Transformer Utilization Factor(TUF) RMS voltage Vrms Vm/2 Vm/2 Vm/2 0.287 0.693 0.812 0.406 0.812 0.812 f 2f 2f

Table: 2.1 Comparisons of rectifiers FULL-WAVE RECTIFIER: From the above comparison we came to know that full wave bridge rectifier as more advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier circuit. BRIDGE RECTIFIER: A bridge rectifier makes use of four diodes in a bridge arrangement to achieve fullwave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig (a) to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.

B.TECH(EEE),H.I.T.S (COE)

Page 14

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 2.4 Full wave rectifier OPERATION: During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b) with dotted arrows.

Fig: 2.5 Positive cycle full wave rectifier During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the fig (c) with dotted arrows.

Fig: 2.6 Negative cycle of full wave rectifier

B.TECH(EEE),H.I.T.S (COE)

Page 15

Department of EEE

AUTOMATIC RAILWAY GATE 2.5 MICRO CONTROLLER (AT89S51) 2.5.1 DESCRIPTION: The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmels highdensity non-volatile memory technology and is compatible with the industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed insystem or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O interfaces such as serial port, parallel port timer or counter, interrupt controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog converter, integrated on to a single silicon chip. If a system is developed with a microprocessor, the designer has to go for external memory such as RAM, ROM, EPROM and peripherals. But controller is provided all these facilities on a single chip. Development of a Micro controller reduces PCB size and cost of design. One of the major differences between a Microprocessor and a Micro controller is that a controller often deals with bits not bytes as in the real world application. Intel has introduced a family of Micro controllers called the MCS-51.

Fig: 2.7 Micro controllers

B.TECH(EEE),H.I.T.S (COE)

Page 16

Department of EEE

AUTOMATIC RAILWAY GATE 2.5.2 FEATURES: Compatible with MCS-51 Products 4K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes .

B.TECH(EEE),H.I.T.S (COE)

Page 17

Department of EEE

AUTOMATIC RAILWAY GATE 2.5.3 BLOCK DIAGRAM AND PIN DIAGRAM:

Fig: 2.8 Block diagram of micro controller

PIN DIAGRAM:

Fig: 2.9 Pin diagram of micro controller

B.TECH(EEE),H.I.T.S (COE)

Page 18

Department of EEE

AUTOMATIC RAILWAY GATE

PIN DESCRIPTION:
VCC - Supply voltage. GND - Ground. Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can 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. 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 loworder address bytes during Flash programming and verification.

Table: 2.2 Operations of ports

B.TECH(EEE),H.I.T.S (COE)

Page 19

Department of EEE

AUTOMATIC RAILWAY GATE Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulledlow will source current (IIL) because of the internal pull-ups. Port 2 also receives the highorder 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. 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 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S51, as shown in the following table.

RST: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.

B.TECH(EEE),H.I.T.S (COE)

Page 20

Department of EEE

AUTOMATIC RAILWAY GATE ALE/PROG: Address Latch Enable (ALE) is an 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: Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP: External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2: Output from the inverting oscillator amplifier.

B.TECH(EEE),H.I.T.S (COE)

Page 21

Department of EEE

AUTOMATIC RAILWAY GATE 2.6 OSCILLATOR: XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figs 6.2.3. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2.11.There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

Fig: 2.10 Oscillator Connections

Fig: 2.11 External Clock Drive Configuration

B.TECH(EEE),H.I.T.S (COE)

Page 22

Department of EEE

AUTOMATIC RAILWAY GATE

CHAPTER-3
3.1 IR COMMUNICATIONS IR wireless is the use of wireless technology in devices or systems that convey data through infrared (IR) radiation. Infrared is electromagnetic energy at a wavelength or wavelengths somewhat longer than those of red light. The shortest-wavelength IR borders visible red in the spectrum. The longest-wavelength IR borders radio waves. The name means below red, the Latin infra meaning "below". Red is the color of the longest wavelengths of visible light. Infrared light has a longer wavelength (and so a lower frequency) than that of red light visible to humans, hence the literal meaning of below red. INFRARED ENERGY is light that we cannot see, but our bodies can detect as heat. It is part of the electromagnetic spectrum that includes radio waves, X-rays and visible light. All of these forms of energy have a specific frequency, as represented in the chart below.

Fig: 3.1 Visible spectrums Infrared energy is comprised of those frequencies that exist just below the red end of the visible spectrum, and for cooking properties they have a very unique benefit - when they strike organic molecules (such as any type of food), they cause the molecules to vibrate, thereby creating heat. Although almost any type of electromagnetic energy can cause heating, for the purpose of cooking, infrared energy is the perfect choice. IR wireless is used for short- and medium-range communications and control. Some systems operate in line-of-sight mode; this means that there must be a visually unobstructed straight line through space between the transmitter (source) and receiver (destination). Other systems

B.TECH(EEE),H.I.T.S (COE)

Page 23

Department of EEE

AUTOMATIC RAILWAY GATE operate in diffuse mode, also called scatter mode. This type of system can function when the source and destination are not directly visible to each other. An example is a

televisionRemote-control box. The box does not have to be pointed directly at the set, although the box must be in the same room as the set, or just outside the room with the door open. IR wireless technology is used in intrusion detectors; home-entertainment control units; robot control systems; medium-range, line-of-sight laser communications; cordless microphones, headsets, modems, and printers and other peripherals.Infrared is an energy radiation with a frequency below our eyes sensitivity, so we cannot see it. Even that we cannot "see" sound frequencies, we know that it exist, we can listen them.

Even that we cannot see or hear infrared, we can feel it at our skin temperature sensors. When you approach your hand to fire or warm element, you will "feel" the heat, but you can't see it. You can see the fire because it emits other types of radiation, visible to your eyes, but it also emits lots of infrared that you can only feel in your skin. INFRARED IN ELECTRONICS Infra-Red is interesting, because it is easily generated and doesn't suffer electromagnetic interference, so it is nicely used to communication and control, but it is not perfect, some other light emissions could contains infrared as well, and that can interfere in this communication. The sun is an example, since it emits a wide spectrum or radiation. The adventure of using lots of infra-red in TV/VCR remote controls and other applications, brought infra-red diodes (emitter and receivers) at very low cost at the market. From now on you should think as infrared as just a "red" light. This light can means something to the receiver, the "on or off" radiation can transmit different meanings. Lots of things can generate

B.TECH(EEE),H.I.T.S (COE)

Page 24

Department of EEE

AUTOMATIC RAILWAY GATE infrared, anything that radiate heat do it, including out body, lamps, stove, oven, friction your hands together, even the hot water at the faucet. To allow a good communication using infra-red, and avoid those "fake" signals, it is imperative to use a "key" that can tell the receiver what is the real data transmitted and what is fake. As an analogy, looking eye naked to the night sky you can see hundreds of stars, but you can spot easily a faraway airplane just by its flashing strobe light. That strobe light is the "key", the "coding" element that alerts us. Similar to the airplane at the night sky, our TV room may have hundreds of tinny IR sources, our body and the lamps around, even the hot cup of tea. A way to avoid all those other sources, is generating a key, like the flashing airplane. So, remote controls use to pulsate its infrared in a certain frequency. The IR receiver module at the TV, VCR or stereo "tunes" to this certain frequency and ignores all other IR received. The best frequency for the job is between 30 and 60 kHz, the most used is around 36 kHz 3.1.1 IR GENERATION To generate a 36 kHz pulsating infrared is quite easy, more difficult is to receive and identify this frequency. This is why some companies produce infrared receives, that contains

the filters, decoding circuits and the output shaper, that delivers a square wave, meaning the existence or not of the 36kHz incoming pulsating infrared.It means that those 3 dollars small

B.TECH(EEE),H.I.T.S (COE)

Page 25

Department of EEE

AUTOMATIC RAILWAY GATE units, have an output pin that goes high (+5V) when there is a pulsating 36kHz infrared in front of it, and zero volts when there is not this radiation. A square wave of approximately 27uS (microseconds) injected at the base of a transistor, can drive an infrared LED to transmit this pulsating light wave. Upon its presence, the commercial receiver will switch its output to high level (+5V).If you can turn on and off this frequency at the transmitter; your receiver's output will indicate when the transmitter is on or off. Those IR demodulators have inverted logic at its output, when a burst of IR is sensed it drives its output to low level, meaning logic level = 1. The TV, VCR, and Audio equipment manufacturers for long use infra-red at their remote controls. To avoid a Philips remote control to change channels in a Panasonic TV, they use different codification at the infrared, even that all of them use basically the same transmitted frequency, from 36 to 50 kHz. So, all of them use a different combination of bits or how to code the transmitted data to avoid interference. 3.2 IR LED AND IR SENSOR 3.2.1 SCHEMATIC CIRCUIT IR SENSOR IR LED is used as a source of infrared rays. It comes in two packages 3mm or 5mm. 3mm is better as it is requires less space. IR sensor is nothing but a diode, which is sensitive for infrared radiation.

This infrared transmitter and receiver are called as IR TX-RX pair. It can be obtained from any decent electronics component shop and costs less than 10Rs. Following snap shows 3mm and 5mm IR pairs. Color of IR transmitter and receiver is different. However you may come across pairs which appear exactly same or even has opposite

B.TECH(EEE),H.I.T.S (COE)

Page 26

Department of EEE

AUTOMATIC RAILWAY GATE colorsthan shown in above picture and it is not possible to distinguish between TX and RX visually. In case you will have to take help of multi-meter to distinguish between them. Here is how you can distinguish between IR TX-RX using DMM:

Connect cathode of one LED to +ve terminal of DMM Connect anode of the same LED to common terminal of DMM

(means connect LED such that It gets reverse biased by DMM )


Set DMM to measure resistance up to 2M Ohm. Check the reading. Repeat above procedure with second LED. In above process, when you get the reading of the few hundred Kilo Ohms on DMM, then it indicated that LED that you are testing is IR sensor. In case of IR transmitter DMM will not show any reading. Following snap shows typical DMM reading obtained when IR receiver is connected

to it as mentioned above. Second snap shows how sensors resistance increases when it is covered by a finger. Note that, these are just illustrative figures and they will depend upon sensor as well as DMM that you are using.

While buying an IR sensor, make sure that its reverse resistance in ambient light is below 1000K. If it is more than this value, then it will not be able to generate sufficient voltage across external resistor and hence will be less sensitive to small variation in incident light.

B.TECH(EEE),H.I.T.S (COE)

Page 27

Department of EEE

AUTOMATIC RAILWAY GATE The circuit diagram::Circuit diagram for IR sensor module is very simple and straight forward.

Fig: 3.2 Circuit diagram of IR sensor Circuit is divided into two sections. IR TX and IR RX are to be soldered on small general purpose Grid PCB. From this module, take out 3 wires of sufficiently long length (say 1 ft). Then, as shown above, connect them to VCC, present and to ground on main board. By adjustingpreset, you can adjust sensitivity of the sensor. VCC should be connected to 5V supply. 3.3 IR TRANSMITTER

Fig: 3.3 IR led

B.TECH(EEE),H.I.T.S (COE)

Page 28

Department of EEE

AUTOMATIC RAILWAY GATE IR LED emits infrared radiation. This radiation illuminates the surface in front of LED. Surface reflects the infrared light. Depending on the reflectivity of the surface, amount of light reflected varies. This reflected light is made incident on reverse biased IR sensor. When photons are incident on reverse biased junction of this diode, electron-hole pairs are generated, which results in reverse leakage current. Amount of electron-hole pairs generated depends on intensity of incident IR radiation. More intense radiation results in more reverse leakage current. This current can be passed through a resistor so as to get proportional voltage. Thus as intensity of incident rays varies, voltage across resistor will vary accordingly. This voltage can then be given to OPAMP based comparator. Output of the comparator can be read by uc. Alternatively, you can use on-chip ADC in AVR microcontroller to measure this voltage and perform comparison in software.

B.TECH(EEE),H.I.T.S (COE)

Page 29

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 3.4 Op amps 3.4 IR RECEIVER:

A photodiode is a type of photo detector capable of converting light into either current or voltage, depending upon the mode of operation. Photodiodes are similar to regular semiconductordiodes except that they may be either exposed (to detect vacuum UV or Xrays) or packaged with a window or optical fiber connection to allow light to reach the sensitive part of the device. Many diodes designed for use specifically as a photodiode will also use a PIN junction rather than the typical PN junction.

B.TECH(EEE),H.I.T.S (COE)

Page 30

Department of EEE

AUTOMATIC RAILWAY GATE 3.4.1USE OF INFRARED DETECTORS BASICS

Fig: 3.5IR Emitter and IR Photo transistor

An infrared emitter is an LED made from gallium arsenide, which emits near-infrared energy at about 880nm. The infrared phototransistor acts as a transistor with the base voltage determined by the amount of light hitting the transistor. Hence it acts as a variable current source. Greater amount of IR light cause greater currents to flow through the collector-emitter leads. As shown in the diagram below, the phototransistor is wired in a similar configuration to the voltage divider. The variable current traveling through the resistor causes a voltage drop in the pull-up resistor. This voltage is measured as the output of the device.

B.TECH(EEE),H.I.T.S (COE)

Page 31

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 3.6 Circuit diagram of infrared reflectance sensor

IR reflectance sensors contain a matched infrared transmitter and infrared receiver pair. These devices work by measuring the amount of light that is reflected into the receiver. Because the receiver also responds to ambient light, the device works best when well shielded from ambient light, and when the distance between the sensor and the reflective surface is small(less than 5mm). IR reflectance sensors are often used to detect white and black surfaces. White surfaces generally reflect well, while black surfaces reflect poorly. Of such applications is the line follower of a robot.

B.TECH(EEE),H.I.T.S (COE)

Page 32

Department of EEE

AUTOMATIC RAILWAY GATE

Schematic diagram for a single pair of infrared transmitter and receiver

Fig: 3.7 Schematic diagram of single pair IR transmitter

B.TECH(EEE),H.I.T.S (COE)

Page 33

Department of EEE

AUTOMATIC RAILWAY GATE 3.4.2 THEORY OF SINGLE SENSOR CIRCUIT

Fig: 3.8 Schematic of single sensor To get a good voltage swing , the value of R1 must be carefully chosen. If IR sensor = a when no light falls on it and IR sensor = b when light falls on it. The difference in the two potentials is: Vcc * { a/(a+R1) - b/(b+R1) } Relative voltage swing = Actual Voltage Swing / Vcc = Vcc * { a/(a+R1) - b/(b+R1) } / Vcc = a/(a+R1) - b/(b+R1) The resistance of the sensor decreases when IR light falls on it. A good sensor will have near zero resistance in presence of light and a very large resistance in absence of light. We have used this property of the sensor to form a potential divider. The potential at point 2 isRsensor / (Rsensor + R1). Again, a good sensor circuit should give maximum change in potential at point 2 for no-light and bright-light conditions. This is especially important is you plan to use an ADC in place of the comparator To get a good voltage swing , the value of R1 must be carefully chosen. If Rsensor = a when no light falls on it and Rsensor = b when light falls on it. The difference in the two potentials is: Vcc * { a/(a+R1) - b/(b+R1) } Relative voltage swing = Actual Voltage Swing / Vcc

B.TECH(EEE),H.I.T.S (COE)

Page 34

Department of EEE

AUTOMATIC RAILWAY GATE = Vcc * { a/(a+R1) - b/(b+R1) } / Vcc

fig: 3.9Description of operation of a typical circuit

fig: 3.10 Operation of leds If the emitter and detector (aka phototransistor) are not blocked, then the output on pin 2 of the 74LS14 will be high (app. 5 Volts). When they are blocked, then the output will be low (app. 0 Volts). The 74LS14 is a Schmitt triggered hex inverter. A Schmitt trigger is a signal conditioner. It ensures that above a threshold value, we will always get "clean" HIGH and LOW signals. Not Blocked Case: Pin 2 High Current from Vcc flows through the detector. The current continues to flow through the base of Q2. Current from Vcc also flows through R2, and Q2's Drain and Emitter to ground. As a result of this current path, there will be no current flowing through Q1's base. The signal at U1's pin 1 will be low, and so pin 2

B.TECH(EEE),H.I.T.S (COE)

Page 35

Department of EEE

AUTOMATIC RAILWAY GATE will be high. Therefore only the moderated signal from the light emitter can be detected. Of course the detector must not be saturated by ambient light; this is effective when the detector

Fig: 3.11 Characteristics of leds

the line position is compared to the centre value to be tracked, the position error is processed with Proportional /Integral/ Diffence filter. to generate steering command. The line following robot tracks the line in PID control that the most popular algorithm for servo control. The

B.TECH(EEE),H.I.T.S (COE)

Page 36

Department of EEE

AUTOMATIC RAILWAY GATE proportional term is the common process in the servo system. It is only a gain amplifier without time dependent process. The differential term is applied in order to improve the response to disturbance, and it also compensate phase lag at the controlled object. The D term will be required in most case to stabilize tracking motion. The I term that boosts DC gain is applied in order to remove left offset error, however, it often decrease servo stability due to its phase lag. When any line sensing error has occurred for a time due to getting out of line or end of line, the motors are stopped and the microcontroller enters sleep state of zero power consumption. Typical Examples of infrared Transmitter and Receiver installation. 3.4.3 APPLICATIONS OF SENSORS A photodiode is a type of photo detector capable of converting light into either current or voltage, depending upon the mode of operation. Photodiodes are similar to regular semiconductor diodes except that they may be either exposed (to detect vacuum UV or Xrays) or packaged with a window or optical fibre connection to allow light to reach the sensitive part of the device. Many diodes designed for use specifically as a photodiode will also use a PIN junction rather than the typical PN junction. PRINCIPLE OF POERATION A photodiode is a PN junction or PIN structure. When a photon of sufficient energy strikes the diode, it excites an electron thereby creating a mobile electron and a positively charged electron hole. If the absorption occurs in the junction's depletion region, or one diffusion length away from it, these carriers are swept from the junction by the built-in field of the depletion region. Thus holes move toward the anode, and electrons toward the cathode, and a photocurrent is produced. PHOTOVOTAIC MODE When used in zero bias or photovoltaic mode, the flow of photocurrent out of the device is restricted and a voltage builds up. The diode becomes forward biased and "dark current" begins to flow across the junction in the direction opposite to the photocurrent. This

B.TECH(EEE),H.I.T.S (COE)

Page 37

Department of EEE

AUTOMATIC RAILWAY GATE mode is responsible for the photovoltaic effect, which is the basis for solar cellsin fact, a solar cell is just an array of large photodiodes. PHOTOCONDUCTIVE MODE In this mode the diode is often (but not always) reverse biased. This increases the width of the depletion layer, which decreases the junction's capacitance resulting in faster response times. The reverse bias induces only a small amount of current (known as saturation or back current) along its direction while the photocurrent remains virtually the same. Although this mode is faster, the photovoltaic mode tends to exhibit less electronic noise (The leakage current of a good PIN diode is so low < 1nA that the JohnsonNyquist noise of the load resistance in a typical circuit often dominates.)Avalanche photodiodes have a similar structure to regular photodiodes, but they are operated with much higher reverse bias. This allows each photo-generated carrier to be multiplied by avalanche breakdown, resulting in internal gain within the photodiode, which increases the effective responsively of the device. PHOTOTRANSISTERS also consist of a photodiode with internal gain. A phototransistor is in essence nothing more than a bipolar transistor that is encased in a transparent case so that light can reach the base-collector junction. The electrons that are generated by photons in the base-collector junction are injected into the base, and this current is amplified by the transistor operation. Note that although phototransistors have a higher responsivity for light they are unable to detect low levels of light any better than photodiodes. Phototransistors also have slower response times. MATERIALS The material used to make a photodiode is critical to defining its properties, because only photons with sufficient energy to excite electrons across the material's bandgap will produce significant photocurrents. Materials commonly used to produce photodiodes include:

B.TECH(EEE),H.I.T.S (COE)

Page 38

Department of EEE

AUTOMATIC RAILWAY GATE

Material

Wavelength range (nm)

Silicon

1901100

Germanium

4001700

Indium arsenide

gallium

8002600

Lead sulphide

<1000-3500

Table: 3.1 Different materials and their wave lengths Because of their greater band gap, silicon-based photodiodes generate less noise than germanium-based photodiodes, but germanium photodiodes must be used for wavelengths longer than approximately 1 m. Since transistors and ICs are made of semiconductors, and contain P-N junctions, almost every active component is potentially a photodiode. Many components, especially those sensitive to small currents, will not work correctly if illuminated, due to the induced photocurrents. In most components this is not desired, so they are placed in an opaque housing. Since housings are not completely opaque to X-rays or other high energy radiation, these can still cause many ICs to malfunction due to induced photo-currents. 3.5 INTRODUCTION TO DC MOTORS: 3.5.1INTRODUCTION: The brushed DC motor is one of the earliest motor designs. Today, it is the motor of choice in the majority of variable speed and torque control applications.

B.TECH(EEE),H.I.T.S (COE)

Page 39

Department of EEE

AUTOMATIC RAILWAY GATE Advantages:


Easy to understand design Easy to control speed Easy to control torque Simple, cheap drive design

Easy to understand design The design of the brushed DC motor is quite simple. A permanent magnetic field is created in the stator by either of two means:

Permanent magnets Electro-magnetic windings

If the field is created by permanent magnets, the motor is said to be a "permanent magnet DC motor" (PMDC). If created by electromagnetic windings, the motor is often said to be a "shunt wound DC motor" (SWDC). Today, because of cost-effectiveness and reliability, the PMDC motor is the motor of choice for applications involving fractional horsepower DC motors, as well as most applications up to about three horsepower. At five horsepower and greater, various forms of the shunt wound DC motor are most commonly used. This is because the electromagnetic windings are more cost effective than permanent magnets in this power range. Caution: If a DC motor suffers a loss of field (if for example, the field power connections are broken), the DC motor will immediately begin to accelerate to the top speed which the loading will allow. This can result in the motor flying apart if the motor is lightly loaded. The possible loss of field must be accounted for, particularly with shunt wound DC motors. Opposing the stator field is the armature field, which is generated by a changing electromagnetic flux coming from windings located on the rotor. The magnetic poles of the armature field will attempt to line up with the opposite magnetic poles generated by the stator

B.TECH(EEE),H.I.T.S (COE)

Page 40

Department of EEE

AUTOMATIC RAILWAY GATE field. If we stopped the design at this point, the motor would spin until the poles were opposite one another, settle into place, and then stop -- which would make a pretty useless motor! However, we are smarter than that. The section of the rotor where the electricity enters the rotor windings is called the commutator. The electricity is carried between the rotorand the stator by conductive graphite-copper brushes (mounted on the rotor) which contact rings on stator. Imagine power is supplied: The motor rotates toward the pole alignment point. Just as the motor would get to this point, the brushes jump across a gap in the stator rings. Momentum carries the motor forward over this gap. When the brushes get to the other side of the gap, they contact the stator rings again and -- the polarity of the voltage is reversed in this set of rings! The motor begins accelerating again, this time trying to get to the opposite set of poles. (The momentum has carried the motor past the original pole alignment point.) This continues as the motor rotates. In most DC motors, several sets of windings or permanent magnets are present to smooth out the motion. Easy to control speed controlling the speed of a brushed DC motor is simple. The higher the armature voltage, the faster the rotation. This relationship is linear to the motor's maximum speed. The maximum armature voltage which corresponds to a motor's rated speed (these motors are usually given a rated speed and a maximum speed, such as 1750/2000 rpm) are available in certain standard voltages, which roughly increase in conjunction with horsepower. Thus, the smallest industrial motors are rated 90 VDC and 180 VDC. Larger units are rated at 250 VDC and sometimes higher. Specialty motors for use in mobile applications are rated 12, 24, or 48 VDC. Other tiny motors may be rated 5 VDC. Most industrial DC motors will operate reliably over a speed range of about 20:1 -- down to about 5-7% of base speed. This is much better performance than the comparable AC motor. This is partly due to the simplicity of control, but is also partly due to the fact that most industrial DC motors are designed with

B.TECH(EEE),H.I.T.S (COE)

Page 41

Department of EEE

AUTOMATIC RAILWAY GATE variable speed operation in mind, and have added heat dissipation features which allow lower operating speeds. Easy to control torque In a brushed DC motor, torque control is also simple, since output torque is proportional to current. If you limit the current, you have just limited the torque which the motor can achieve. This makes this motor ideal for delicate applications such as textile manufacturing. Simple, cheap drive design The result of this design is that variable speed or variable torque electronics are easy to design and manufacture. Varying the speed of a brushed DC motor requires little more than a large enough potentiometer. In practice, these have been replaced for all but subfractional horsepower applications by the SCR and PWM drives, which offer relatively precisely control voltage and current. Common DC drives are available at the low end (up to 2 horsepower) for under US$100 -- and sometimes under US$50 if precision is not important. Large DC drives are available up to hundreds of horsepower. However, over about 10 horsepower careful consideration should be given to the price/performance tradeoffs with AC inverter systems, since the AC systems show a price advantage in the larger systems. (But they may not be capable of the application's performance requirements). Disadvantages

Expensive to produce Can't reliably control at lowest speeds Physically larger High maintenance Dust

B.TECH(EEE),H.I.T.S (COE)

Page 42

Department of EEE

AUTOMATIC RAILWAY GATE 3.5.2 MAIN PARTS OF DC MOTOR Armature A D.C. motor consists of a rectangular coil made of insulated copper wire wound on a soft iron core. This coil wound on the soft iron core forms the armature. The coil is mounted on an axle and is placed between the cylindrical concave poles of a magnet. Commutator A commutator is used to reverse the direction of flow of current. Commutator is a copper ring split into two parts C1 and C2. The split rings are insulated form each other and mounted on the axle of the motor. The two ends of the coil are soldered to these rings. They rotate along with the coil. Commutator rings are connected to a battery. The wires from the battery are not connected to the rings but to the brushes which are in contact with the rings.

Fig: 3.12 Commutators Brushes Two small strips of carbon, known as brushes press slightly against the two split rings, and the split rings rotate between the brushes. The carbon brushes are connected to a D.C. source.

B.TECH(EEE),H.I.T.S (COE)

Page 43

Department of EEE

AUTOMATIC RAILWAY GATE


When the coil is powered, a magnetic field is generated around the armature. The left side of the armature is pushed away from the left magnet and drawn towards the right, causing rotation.

Fig: 3.13 Brushes When the coil turns through 900, the brushes lose contact with the commutator and the current stops flowing through the coil. However the coil keeps turning because of its own momentum. Now when the coil turns through 1800, the sides get interchanged. As a result the commutator ring C1 is now in contact with brush B2 and commutator ring C2 is in contact with brush B1. Therefore, the current continues to flow in the same direction.

B.TECH(EEE),H.I.T.S (COE)

Page 44

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 3.14Commutators and Commutator Ring PARAMETRS OF THE DC MOTRS: 1. Direction of rotation 2. Motor Speed 3. Motor Torque 4. Motor Start and Stop Direction of Rotation: A DC Motor has two wires. We can call them the positive terminal and the negative terminal, although these are pretty much arbitrary names (unlike a battery where these polarities are vital and not to be mixed!). On a motor, we say that when the + wire is connected to + terminal on a power source, and the - wire is connected to the - terminal source on the same power source, the motor rotates clockwise (if you are looking towards the motor shaft). If you reverse the wire polarities so that each wire is connected to the opposing power supply terminal, then the motor rotates counter clockwise. Notice this is just an arbitrary selection and that some motor manufacturers could easily choose the opposing convention. As long as you know what rotation you get with one polarity, you can always connect in such a fashion that you get the direction that you want on a per polarity basis.

B.TECH(EEE),H.I.T.S (COE)

Page 45

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 3.15Positive And Negative Counter Clockwise Rotation DC Motor Rotation vs Polarity: Facts: DC Motor rotation has nothing to do with the voltage magnitude or the current magnitude flowing through the motor. DC Motor rotation does have to do with the voltage polarity and the direction of the current flow. 3.5.3 WORKING OF DC MOTOR In any electric motor, operation is based on simple electromagnetism. A currentcarrying conductor generates a magnetic field; when this is then placed in an external magnetic field, it will experience a force proportional to the current in the conductor, and to the strength of the external magnetic field. As you are well aware of from playing with magnets as a kid, opposite (North and South) polarities attract, while like polarities (North and North, South and South) repel. The internal configuration of a DC motor is designed to harness the magnetic interaction between a current-carrying conductor and an external magnetic field to generate rotational motion.

B.TECH(EEE),H.I.T.S (COE)

Page 46

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 3.16Working of dc motor PRINCIPLE When a rectangular coil carrying current is placed in a magnetic field, a torque acts on the coil which rotates it continuously. When the coil rotates, the shaft attached to it also rotates and thus it is able to do mechanical work. Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field magnet(s), and brushes. In most common DC motors (and all that BEAMers will see), the external magnetic field is produced by high-strength permanent magnets1. The stator is the stationary part of the motor -- this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor (together with the axle and attached commutator) rotates with respect to the stator. The rotor consists of windings (generally on a core), the windings being electrically connected to the commutator. The above diagram shows a common motor layout -- with the rotor inside the stator (field) magnets. The geometry of the brushes, commentator contacts, and rotor windings are such that when power is applied, the polarities of the energized winding and the stator magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets. As the rotor reaches alignment, the brushes move to the next commentator contacts, and energize the next winding. Given our example two-pole motor, the rotation reverses the direction of current through the rotor winding, leading to a "flip" of the rotor's magnetic field, driving it to continue rotating.

B.TECH(EEE),H.I.T.S (COE)

Page 47

Department of EEE

AUTOMATIC RAILWAY GATE

In real life, though, DC motors will always have more than two poles (three is a very common number). In particular, this avoids "dead spots" in the commutator. You can imagine how with our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile, with a twopole motor, there is a moment where the commutator shorts out the power supply (i.e., both brushes touch both commutator contacts simultaneously). This would be bad for the power supply, waste energy, and damage motor components as well. Yet another disadvantage of such a simple motor is that it would exhibit a high amount of torque "ripple" (the amount of torque it could produce is cyclic with the position of the rotor).

Fig: 3.17 Peripheral of dc motor

Construction and Working

Fig: 3.18 Construction and working of dc motor

B.TECH(EEE),H.I.T.S (COE)

Page 48

Department of EEE

AUTOMATIC RAILWAY GATE 3.5.4 SPEED CONTROL OF DC Motor: Whereas the voltage polarity controls DC motor rotation, voltage magnitude controls motor speed. Think of the voltage applied as a facilitator for the strengthening of the magnetic field. In other words, the higher the voltage, the quicker will the magnetic field become strong. Remember that a DC motor has an electromagnet and a series of permanent magnets. The applied voltage generates a magnetic field on the electromagnet portion. This electromagnet field is made to oppose the permanent magnet field. If the electromagnet field is very strong, then both magnetic entities will try to repel each other from one side, as well as attract each other from the other side. The stronger the induced magnetic field, the quicker will this separation/attraction will try to take place. As a result, motor speed is directly proportional to applied voltage.

Fig: 3.19Speed Curve of Dc Motor Motor Speed Curve: One aspect to have in mind is that the motor speed is not entirely lineal. Each motor will have their own voltage/speed curve. One thing I can guarantee from each motor is that at very low voltages, the motor will simply not move. This is because the magnetic field strength is not enough to overcome friction. Once friction is overcome, motor speed will start to increase as voltage increase.The following video shows the concept of speed control and offers some ideas on how this can be achieved.

B.TECH(EEE),H.I.T.S (COE)

Page 49

Department of EEE

AUTOMATIC RAILWAY GATE Motor Torque: In the previous segment I kind of described speed as having to do with the strength of the magnetic field, but this is in reality misleading. Speed has to do with how fast the magnetic field is built and the attraction/repel forces are installed into the two magnetic structures. Motor strength, on the other hand, has to do with magnetic field strength. The stronger the electromagnet attracts the permanent magnet, the more force is exerted on the motor load. Per example, imagine a motor trying to lift 10 pounds of weight. This is a force that when multiplied by a distance (how much from the ground we are lifting the load) results in WORK. This WORK when exerted through a predetermined amount of time (for how long we are lifting the weight) gives us power. But whatever power came in, must come out as energycan not be created or destroyed. So that you know, the power that we are supplying to the motor is computed by P = IV Where P is power, I is motor current and V is motor voltage Hence, if the voltage (motor speed) is maintained constant, how much load we are moving must come from the current? As you increase load (or torque requirements) current must also increase.

Fig: 3.20Motor Torques Loading

B.TECH(EEE),H.I.T.S (COE)

Page 50

Department of EEE

AUTOMATIC RAILWAY GATE Motor Loading One aspect about DC motors which we must not forget is that loading or increase of torque cannot be infinite as there is a point in which the motor simply can not move. When this happens, we call this loading Stalling Torque. At the same time this is the maximum amount of current the motor will see, and it is refer to Stalling Current. Stalling deserves a full chapter as this is a very important scenario that will define a great deal of the controller to be used. I promise I will later write a post on stalling and its intricacies. Motor Start and Stop You are already well versed on how to control the motor speed, the motor torque and the motor direction of rotation. But this is all fine and dandy as long as the motor is actually moving. How about starting it and stopping it? Are these trivial matters? Can we just ignore them or should we be careful about these aspects as well? You bet we should!Starting a motor is a very hazardous moment for the system. Since you have an inductance whose energy storage capacity is basically empty, the motor will first act as an inductor. In a sense, it should not worry us too much because current cannot change abruptly in an inductor, but the truth of the matter is that this is one of the instances in which you will see the highest currents flowing into the motor. The start is not necessarily bad for the motor itself as in fact the motor can easily take this Inrush Current. The power stage, on the other hand and if not properly designed for, may take a beating. Once the motor has started, the motor current will go down from inrush levels to whatever load the motor is at. Per example, if the motor is moving a few gears, current will be proportional to that load and according to torque/current curves. Stopping the motor is not as harsh as starting. In fact, stopping is pretty much a breeze. What we do need to concern ourselves is with how we want the motor to stop. Do we want it to coast down as energy is spent in the loop, or do we want the rotor to stop as fast as possible? If the later is the option, then we need braking. Braking is easily accomplished by

B.TECH(EEE),H.I.T.S (COE)

Page 51

Department of EEE

AUTOMATIC RAILWAY GATE shorting the motor outputs. The reason why the motor stops so fast is because as a short is applied to the motor terminals, the Back EMF is shorted. Because Back EMF is directly proportional to speed, making Back EMF = 0, also means making speed = 0. 3.6 MOTORDRIVER CIRCUIT:(H-BRIDGE) The name "H-Bridge" is derived from the actual shape of the switching circuit which control the motion of the motor. It is also known as "Full Bridge". Basically there are four switching elements in the H-Bridge as shown in the figure below. 3.6.1 OPERATING MODES OF H-BRIDGE

Fig: 3.21H-Bridge Connected To a Motor As you can see in the figure above there are four switching elements named as "High side left", "High side right", "Low side right", "Low side left". When these switches are turned on in pairs motor changes its direction accordingly. Like, if we switch on High side left and Low side right then motor rotate in forward direction, as current flows from Power supply through the motor coil goes to ground via switch low side right. This is shown in the figure below.

B.TECH(EEE),H.I.T.S (COE)

Page 52

Department of EEE

AUTOMATIC RAILWAY GATE

Fig: 3.22Current Flowing in High Side And Low Side Similarly, when you switch on low side left and high side right, the current flows in opposite direction and motor rotates in backward direction. This is the basic working of H-Bridge. We can also make a small truth table according to the switching of H-Bridge explained above. Truth Table High Left On Off On Off High Right Off On On Off Low Left Off On Off On Low Right On Off Off On Description Motor runs clockwise Motor runs anti-clockwise Motor stops or decelerates Motor stops or decelerates

Table: 3.2 Truth table

B.TECH(EEE),H.I.T.S (COE)

Page 53

Department of EEE

AUTOMATIC RAILWAY GATE

CHAPTER-4
SOFTWARE EXPLANATION: 4.1 INTRODUCTION TO KEIL SOFTWARE: Softwares used are: *Keil software for c programming *Express PCB for lay out design *Express SCH for schematic design What's New in Vision4? Vision3 adds many new features to the Editor like Text Templates, Quick Function Navigation, and Syntax Colouring with brace high lighting Configuration Wizard for dialog based start-up and debugger setup. Vision3 is fully compatible to Vision4 and can be used in parallel with Vision4. What is Vision4? Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: A project manager. A make facility. Tool configuration. Editor. A powerful debugger. To help you get started, several example programs (located in the \C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided. HELLO is a simple program that prints the string "Hello World" using the Serial Interface. MEASURE is a data acquisition system for analog and digital systems.

B.TECH(EEE),H.I.T.S (COE)

Page 54

Department of EEE

AUTOMATIC RAILWAY GATE

TRAFFIC is a traffic light controller with the RTX Tiny operating system. SIEVE is the SIEVE Benchmark. DHRY is the Dhrystone Benchmark. WHETS are the Single-Precision Whetstone Benchmark. Additional example programs not listed here are provided for each device architecture. Building an Application in Vision4 To build (compile, assemble, and link) an application in Vision4, you must: 1. Select Project - (for example, 166\EXAMPLES\HELLO\HELLO.UV4). 2. Select Project - Rebuild all target files or Build target. 4.2KEIL SOFTWARE TOOL (STEPS): Click on the Keil vision Icon on Desktop

1.

The following fig will appear

2. 3.

Click on the Project menu from the title bar Then Click on New Project

B.TECH(EEE),H.I.T.S (COE)

Page 55

Department of EEE

AUTOMATIC RAILWAY GATE

4.

Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\

5. 6. 7.

Then Click on save button above. Select the component for u r project. I.e. Atmel Click on the + Symbol beside of Atmel

8.

Select AT89C52 as shown below

B.TECH(EEE),H.I.T.S (COE)

Page 56

Department of EEE

AUTOMATIC RAILWAY GATE

9. 10.

Then Click on OK The Following fig will appear

11. 12. 13.

Then Click either YES or NOmostly NO Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 as shown in next page.

14.

Click on the file option from menu bar and select new

B.TECH(EEE),H.I.T.S (COE)

Page 57

Department of EEE

AUTOMATIC RAILWAY GATE

15.

The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.

16. 17.

Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C

18.

Now right click on Source group 1 and click on Add files to Group Source

B.TECH(EEE),H.I.T.S (COE)

Page 58

Department of EEE

AUTOMATIC RAILWAY GATE

19.

Now you will get another window, on which by default C files will appear.

20. 21. 22.

Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen.

23. 24.

If the file contains no error, then press Control+F5 simultaneously. The new window is as follows

B.TECH(EEE),H.I.T.S (COE)

Page 59

Department of EEE

AUTOMATIC RAILWAY GATE

25. 26.

Then Click OK Now Click on the Peripherals from menu bar, and check your required port as shown in fig below

27.

Drag the port a side and click in the program file.

28.

Now keep Pressing function key F11 slowly and observe.

29. You are running your program successfully

B.TECH(EEE),H.I.T.S (COE)

Page 60

Department of EEE

AUTOMATIC RAILWAY GATE

CHAPTER-5
5.1 CONCLUSION: The accidents are avoided at places where there is no person managing the railway crossing gates. Here we use the stepper motor to open and close the gates automatically when it is rotated clockwise or anticlockwise direction. When the train arrives in a particular direction the transmitter IR senses and generates appropriate signal, then at the same time the receiver IR receives the signal and generates an interrupt. When the interrupt is generated the stepper motor rotates in clockwise direction. When the interrupt ends the stepper motor rotates in anti-clock wise direction.

B.TECH(EEE),H.I.T.S (COE)

Page 61

Department of EEE

AUTOMATIC RAILWAY GATE

BIBILOGRAPHY
The 8051 Micro controller and Embedded Systems -Muhammad Ali Mazidi -Janice GillispieMazidi The 8051 Micro controller Architecture, Programming & Applications -Kenneth J.Ayala Fundamentals Of Microprocessors and Micro computers -B.Ram Microprocessor Architecture, Programming & Applications -Ramesh S. Gaonkar Electronic Components -D.V. Prasad Wireless Communications Theodore S. Rappaport Mobile Tele Communications William C.Y. Lee

REFRENCES:
www.national.com www.atmel.com www.microsoftsearch.com www.geocities.com

B.TECH(EEE),H.I.T.S (COE)

Page 62

Department of EEE

AUTOMATIC RAILWAY GATE

STUDENT DATA
1. NAME: N.RAKESH PHONE NO: 9866576918 EMAIL ID: rakesha0218@gmail.com ROLE IN THE PROJECT: PROJECT LEADER PERMANENT ADDRESS:LIGH-527, PRASANTHI NAGAR, APHB COLONY, MOULA-ALI, 500040. 2. NAME: V.SANDEEP PHONE NO: 9494244100 EMAIL ID: sandeepkvsr@gmail.com ROLE IN THE PROJECT: INFORMATION GATHERER ABOUT EMBEDDED SYSTEM CIRCUIT VERIFIER PERMANENT ADDRESS:LIGH-529, PRASANTHI NAGAR, APHB COLONY, MOULA-ALI, 500040 3. NAME: G.SHIVA PHONE NO: 9493420053 EMAIL ID: gudevenkatasiva@gmail.com ROLE IN THE PROJECT: CIRCUIT DESIGNER AND COMPONENT GATHERER PERMANENT ADDERESS: UPPAL DEPOT.

B.TECH(EEE),H.I.T.S (COE)

Page 63

Department of EEE

You might also like