Automatic Railway Gate Controlling System
Automatic Railway Gate Controlling System
Automatic Railway Gate Controlling System
1.ABSTRACT
OBJECTIVE: The aim of this project is to Automate unmanned railway gate using mechatronics. PROJECT DEFINATION: The objective of this project is to manage the control system of railway gate using the microcontroller. When train arrives at the sensing point alarm is triggered at the railway crossing point so that the people get intimation that gate is going to be closed. Then the control system activates and closes the gate on either side of the track. once the train crosses the other end control system automatically lifts the gate. For mechanical operation of the gates 1.8 step angle stepper motors are employed. Here we are using embedded controller built around the 8051 family (AT89C52) for the control according to the data pattern produced at the input port of the micro controller, the appropriate selected action will be taken.. The logic is produced by the program written in Embedded C language. The software program is written, by using the KEIL micro vision environment. The program written is then converted in HEX code after simulation and burned on to microcontroller using FLASH micro vision. WORKING METHODOLOGY: 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 after 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.
2.INTRODUCTION
AT89C51 Microcontroller
The Micro controller (AT89C51) is a low power; high performance CMOS 8-bit micro controller with 4K bytes of Flash programmable and erasable read only memory (PEROM). The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer, which provides a highly flexible and cost-effective solution to many embedded control applications. By using this controller the data inputs from the smart card is passed to the parallel port of the pc and accordingly the software responds. The IDE for writing the embedded program used is KEI L software.
3.CIRCUIT DIAGRAM
4.COMPONENTS
The project consists of three main parts: 8051 microcontroller IR Transmitter IR Receiver Stepper Motor Circuit 8051 CONTROLLER
The I/O ports of the 8051 are expanded by connecting it to an 8255 chip. The 8255 is programmed as a simple I/O port for connection with devices such as LEDs, stepper motors and sensors. The following block diagram shows the various devices connected to the different ports of an 8255. The ports are each 8-bit and are named A, B and C. The individual ports of the 8255 can be programmed to be input or output, and can be changed dynamically. The control register is programmed in simple I/O mode with port A, port B and port C (upper) as output ports and port C (lower) as an input port. IR CIRCUITS This circuit has two stages: a transmitter unit and a receiver unit. The transmitter unit consists of an infrared LED and its associated circuitry.
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
STEP MOTOR ADVANTAGES Step motors convert electrical energy into precise mechanical motion. These motors rotate a specific incremental distance per each step. The number of steps executed controls the degree of rotation of the motors shaft. This characteristic makes step motors excellent for positioning applications. For example, a 1.8 step motor executing 100 steps will rotate exactly 180 with some small amount of non-cumulative error. The speed of step execution controls the rate of motor rotation. A 1.8 step motor executing steps at a speed of 200 steps per second will rotate at exactly 1 revolution per second. Step motors can be very accurately controlled in terms of how far and how fast they will rotate. The number of steps the motor executes is equal to the number of pulse commands it is given. A step motor will rotate a distance and at a rate that is proportional to the number and frequency of its pulse commands. Step motors have several advantages over other types of motors. One of the most impressive is their ability to position very accurately. NMBs standard step motors have an accuracy of +/-5%. The error does not accumulate from step to step. This means that a standard step motor can take a single step and travel 1.8 +/-0.09. Then it can take one million steps and travel 1,800,000 +/-0.09. This characteristic gives a step motor almost perfect repeatability. In motor terms, repeatability is the ability to return to a previously held position. A step motor can achieve the same target position, revolution after revolution.
5.EMBEDDED SYSTEMS
Introduction:
An Embedded system is a combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a specific function. Embedded systems are usually a part of larger, complex system. Dedicated applications, designed to execute specific activities, are implemented and embedded in systems. These embedded applications are required to collaborate with the other components of an enclosed system. Embedded application components interact mostly with the non-human external environment. They continuously collect data from sensors or other computer components and process data within real-time constraints. Embedded systems are usually associated with dedicated hardware and specific software. Embedding an application into system Application and system are closely tied together Collaborative application Dedicated H/W and specific S/W Interaction with non-human external environment
Assembling components
Testing
Testing
Simulator S/W
DOWNLOAD
H/W
Introduction: Unlike software designed for general-purpose computers, embedded software cannot usually be run on other embedded system without significant modification. This is mainly because of the incredible variety in the underlying hardware. The hardware in each embedded system is tailored specifically to the application, in order to keep system costs low. As a result, unnecessary circuitry is eliminated and hardware resources are shared whenever possible. In order to have software, there must be a place to store the executable code and temporary storage for runtime data manipulation. These take the form of ROM and RAM, respectively. All embedded systems also contain some type of inputs and outputs. It is almost always the case that the outputs of the embedded system are a function of its inputs and several other factors. The inputs to the system usually take the form of sensors and probes, communication signals, or control knobs and buttons. The outputs are typically displays, communication signals, or changes to the physical world.
Memory
Inputs
Processor
Outputs
Example of an Embedded System Other common design requirement include Processing power Memory Development cost Number of Units Expected Lifetime Reliability
Processing power This is the amount of processing power necessary to get the hob done. A common way to compare processing power is the MIPS (millions of instructions per second) rating. Other important features of the processor need to be consider is register width, typically ranges from 8 to 64 bits. Memory: The amount of memory (ROM and RAM) required holding the executable software and data it manipulates. The amount of memory required can also affect the processor selection. In general, the register width off a processor establishes the upper limit of the amount of memory it can access. Development cost:
Expected lifetime: This indicates how long must the system continue to function? This affects all sorts of design decisions from the selection of hardware components to how much the system may cost to develop and produce. Reliability: How reliable must the final product be? If it is a childrens toy, it doesnt always have to work right, but if it is part of a space shuttle or a car, it had sure better do what it is supposed to each and every time. The Basic Design REALTIME: Designing Embedded systems is a challenging task. Most of the challenge comes from the fact that Embedded systems have to interact with real world entities. These interactions can get fairly complex. A typical Emebbed system might be interacting with thousands of such entities at the same time. For example, a telephone switching system routinely handles calls from tens of thousands of subscriber. The system has to connect each call differently. Also, the exact sequence of events in the call might vary a lot. Embedded systems have to respond to external interactions in a predetermined amount of time. Successful completion of an operation depends upon the correct and timely operation of the system. Design the hardware and the software in the system to meet the Realtime requirements. For example, a telephone switching system must feed dial tone to thousands of subscribers within a recommended limit of one second. To meet these requirements, the off hook detection mechanism and the software message communication
it is likely that the system may not be able to meet the Realtime requirement due to even mild congestion. Thus a simpler architecture has a better chance of meeting the Realtime requirements. Are the processing components powerful enough? A CPU with really high
utilization will lead to unpredictable Realtime behavior. Also, it is possible that the high priority tasks in the system will starve the low priority tasks of any CPU time. This can cause the low priority tasks to misbehave. Is the Operating System suitable? Assign high priority to tasks that are involved in processing Realtime critical events. Consider preemptive scheduling if Realtime requirements are stringent. When choosing the operating system, the interrupt latency and scheduling variance should be verified. o Scheduling variance refers to the predictability in task scheduling times. For example, a telephone switching system is expected to feed dialtone in less than 500 ms. This would typically involve scheduling three to five tasks within the stipulated time. Most operating systems would easily meet these numbers as far as the mean dialtone delay is concerned. But general purpose
6.MICROCONTROLLER
Introduction:
Microcontrollers are "embedded" inside some other device (often a consumer product) so that they can control the features or actions of the product. Another name for a microcontroller, therefore, is "embedded controller." Microcontrollers are dedicated to one task and run one specific program. The program is stored in ROM (read-only memory) and generally does not change. Microcontrollers are often low-power devices. A microcontroller has a dedicated input device and often (but not always) has a small LED or LCD display for output. A microcontroller also takes input from the device it is controlling and controls the device by sending signals to different components in the device. For example, the microcontroller inside a TV takes input from the remote control and displays output on the TV screen. The controller controls the channel selector, the speaker system and certain adjustments on the picture tube electronics such as tint and brightness. The engine controller in a car takes input from sensors such as the oxygen and knock sensors and controls things like fuel mix and spark plug timing. A
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM) based on the famous 8051 architecture. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. Features The AT89C51 provides the following standard features: Compatible with MCS-51 Products Endurance: 1,000 Write/Erase Cycles 4K Bytes of In-System Reprogrammable Flash Memory 128 bytes of Internal RAM (128 x 8-bit) 32 Programmable I/O Lines
BLOCK DIAGRAM:
PIN CONFIGURATIONS:
PIN DESCRIPTION
VCC Supply voltage.
GND Ground. Port 0: Port 0 is an 8-bit open-drain bi-directional 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 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 pullups are required during program verification. Port 1 Port 1 is an 8-bit bi-directional 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
Port 3 Port 3 is an 8-bit bi-directional 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 also serves the functions of various special features of the AT89C51 as listed below: Port Pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 Alternate Functions RXD (serial input port) TXD (serial output port) INT0 (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input) T1 (timer 1 external input) WR (external data memory Write strobe) RD (external data memory read strobe)
Port 3 also receives some control signals for Flash programming and verification.
RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
ALE/PROG 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 ALEdisable bit has no effect if the microcontroller is in external execution mode.
PSEN
Program Store Enable is the read strobe to external program memory. When the AT89C51 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 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-
XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2 Output from the inverting oscillator amplifier Oscillator Characteristics 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 Figure 1. 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. 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.
Figure1: Oscillator Connections Note: C1, C2 = 30 pF 0 pF for Crystals 1 = 40 pF 10 pF for Ceramic Resonators
Figure 2: External Clock Drive Configuration How Oscillator works When quartz crystal is subjected to mechanical pressure, they produce a measurable electrical voltage conversely when an electric current is applied to a crystal, it will induce mechanical movement. If an ac is passed through the crystal plate the charges oscillate back and front at the resonant frequency of crystal.
f=1/2 (((1+C/CP)/(LC)))
Quartz crystal exhibits a property called the piezo-electric effect that is they produce an electric voltage. When subjected to pressure along certain direction of the crystal because of this property quartz crystal has important application in electronics industry for controlling the frequency of radio waves.When piezo-electric crystal is used in place of LC circuit for higher frequency stability, the oscillator is called as crystal oscillator.
Crystal oscillator is used for stability frequency for a long period of time. The resolution of 0.01 nm/s can be obtained. Crystal operates between fp and fs frequency (a very narrow bandwidth). Status of External Pins during Idle and Power-down Modes Program Memory Internal External Internal External
ALE 1 1 0 0
PSEN
1 1 0 0
Program Lock Bits LB1 1 U LB2 U LB3 U Protection Type No program lock features MOVC instructions executed from external program memory are disabled from fetching code bytes from 2 P U U internal memory, EA is sampled and latched on reset, and further 3 4 P P P P U P programming of the Flash is disabled Same as mode 2, also verify is disabled Same as mode 3, also external execution is disabled
Programming the Flash The AT89C51 is normally shipped with the on-chip Flash memory array in the erased state (that is, contents = FFH) and ready to be programmed. The programming interface accepts either a high-voltage (12-volt) or a low-voltage (VCC) program enable signal.
Chip Erase H L Read Signature H L H Byte Note: Chip Erase requires a 10 ms PROG pulse. EXTERNAL PROGRAM MEMORY READ CYCLE
Parameter Oscillator Frequency Clock Period High Time Low Time Rise Time Fall Time
Min 0 41.6 15 15
Max 24
20 20
Units MHz ns ns ns ns ns
The diagram above shows a typical step motor based system. All of these parts must be present in one form or another. Each components performance will have an effect on the others. By altering the frequency of the pulse train, the pulse generator can instruct
The driver takes the pulses from the pulse generator and determines how and when the windings should be energized. The windings must be energized in a specific sequence to generate motion. Finally there is the step motor itself. A step motor has two primary parts; the rotor, the moving piece, and the stator, the stationary piece. The stator contains coils of wire called windings. The rotor spins on bearings or bushings inside the stator. All step motors operate through the principle of the rotor following a rotating magnetic field created by sequencing the flow of current through the stator windings. Each NMB step motor has two phases, which are groups of electrically connected windings. As current is passed through each phase, the motor takes steps or small movements to keep in synchronism with the magnetic field. The degree of rotation per step depends on the style of driver used and the construction of the motor. Step Motor Advantages: Accuracy & Repeatability Ability to position accurately. Responsiveness & Quick Acceleration Step motors have low rotor inertia, allowing them to get up to speed quickly. This makes step motors an excellent choice for short, quick moves. Excellent torque for their size Step motors have the highest torque per cubic inch of any motor. Positioning Stability Unlike other types of motors, step motors can be held completely motionless in their stopped position. Construction and Operating the Hybrid STEP MOTOR Figure 1a depicts a 1.8 hybrid step motor. The rotor contains a permanent magnet similar to those found in permanent magnet step motors. Hybrid rotors are axially
7.2 CAPACITORS
Introduction: An electrolytic capacitor is a type of capacitor typically with a larger capacitance per unit volume than other types, making them valuable in relatively high-current and lowfrequency electrical circuits. This is especially the case in power-supply filters, where they store charge needed to moderate output voltage and current fluctuations, in rectifier output, and especially in the absence of rechargeable batteries that can provide similar lowfrequency current capacity. They are also widely used as coupling capacitors in circuits where AC should be conducted but DC should not; the large value of the capacitance allows them to pass very low frequencies. The electrolytic capacitor was invented in 1886 by Charles Pollack. It was largely responsible for the development of mains-powered radio receivers, since it permitted the filtering of the 50-60 hertz power supplied to residences, after it was rectified to power the radio tubes. This was not practical without the small volume and low cost of electrolytic capacitors.
Construction
Aluminum electrolytic capacitors are constructed from two conducting aluminum foils, one of which is coated with an insulating oxide layer, and a paper spacer soaked in electrolyte. The foil insulated by the oxide layer is the anode while the liquid electrolyte and the second foil act as cathode. This stack is then rolled up, fitted with pin connectors and placed in a cylindrical aluminum casing. The two most popular geometries are axial leads coming from the center of each circular face of the cylinder, or two radial leads or lugs on one of the circular faces. Both of these are shown in the picture
Polarity
In aluminum electrolytic capacitors, the layer of insulating aluminum oxide on the surface of the aluminum plate acts as the dielectric, and it is the thinness of this layer that allows for a relatively high capacitance in a small volume. The aluminum oxide layer can withstand an electric field strength of the order of 109 volts per meter. The combination of high capacitance and high voltage result in high energy density. Unlike most capacitors, electrolytic capacitors have a voltage polarity requirement. The correct polarity is indicated on the packaging by a stripe with minus signs and possibly arrowheads, denoting the adjacent terminal that should be more negative than the other. This is necessary because a reverse-bias voltage will destroy the center layer of dielectric
These are the different schematic symbols for electrolytic capacitors. The minus or N marked side of the physical capacitor is equivalent to the node opposite to the plus sign on its symbolic equivalent. Tip: Take notice of the shape of the symbols and the placement of the positive and negative nodes, because most schematics do not print the "+", but rely on the symbol itself instead.
note: caps in metal can have the color mark at the minus side !
axial: the minus wire is connected to the case, the plus wire is isolated. radial = single ended: a vertical color stripe indicates the minus side.
Capacitance
The capacitance value of any capacitor is a measure of the amount of electric charge stored per unit of potential difference between the plates. The basic unit of capacitance is a farad, however this unit has been too large for general use until the invention of the Double-layer capacitor, so microfarad, nanofarad and microfarad are more commonly used. These are usually abbreviated to if or of, no and puff Many conditions determine a capacitor's value, such as the thickness of the dielectric and the plate area. In the manufacturing process, electrolytic capacitors are made to conform to a set of preferred numbers. By multiplying these base numbers by a power of ten, any practical capacitor value can be achieved, which is suitable for most applications. A standardized set of capacitor base numbers was devised so that the value of any modern electrolytic capacitor could be derived from multiplying one of the modern conventional base numbers 1.0, 1.5, 2.2, 3.3, 4.7 or 6.8 by a power of ten. Therefore, it is common to find capacitors with values of 10, 15, 22, 33, 47, 68, 100, 220, and so on. Using this method, values ranging from 0.1 to 4700 are common in most applications. Values are generally in microfarads (F). Most electrolytic capacitors have a tolerance range of 20 %, meaning that the manufacturer is stating that the actual value of the capacitor lies within 20 % of its labeled value. Selection of the preferred series ensures that any capacitor can be sold as a standard value, within the tolerance.
Super capacitor
MC and BC series super capacitors (up to 3000 farad capacitance) produced by Maxwell Technologies Super capacitors, also known as ultra capacitors or electrochemical double layer capacitors (EDLC), are electrochemical capacitors that have an unusually high energy density when compared to common capacitors, typically on the order of thousands of times greater than a high-capacity electrolytic capacitor. For instance, a typical D-cell sized electrolytic capacitor will have a storage capacity measured in microfarads, while the same size super capacitor would store several farads, an improvement of about 10,000 times. Larger commercial super capacitors have capacities as high as 5,000 farads. Super capacitors have a variety of commercial applications, notably in "energy smoothing" and momentary-load devices. Some of the earliest uses were motor startup capacitors for large engines in tanks and submarines, and as the cost has fallen they have started to appear on diesel trucks and railroad locomotives. More recently they have become a topic of some interest in the green energy world, where their ability to quickly soak up energy makes them particularly suitable for regenerative braking applications, whereas batteries have difficulty in this application due to slow charging times. If the LEES or Ester devices can be commercialized, they will make an excellent replacement for batteries in all-electric cars and plug-in hybrids, as they combine quick charging, temperature stability and excellent safety properties.
In a conventional capacitor, energy is stored by the removal of charge carriers, typically electrons, from one metal plate and depositing them on another. This charge separation creates a potential between the two plates, which can be harnessed in an external circuit. The total energy stored in this fashion is a combination of the number of charges stored and the potential between the plates. In contrast with traditional capacitors, super capacitors do not have a conventional dielectric, as such. They are based on a structure that contains an electrical double layer. In a double layer, the effective thickness of the "dielectric" is exceedingly thinon the order of nanometersand that, combined with the very large surface area, is responsible for their extraordinarily high capacitances in practical sizes. In an electrical double layer, each layer by itself is quite conductive, but the physics at the interface where the layers are effectively in contact means that no significant current can flow between the layers. However, the double layer can withstand only a low voltage, which means that super capacitors rated for higher voltages must be made of matched series-connected individual super capacitors, much like series-connected cells in highervoltage batteries.
Technology advantages
Due to the capacitor's high number of charge-discharge cycles (millions or more compared to 2001000 for most commercially available rechargeable batteries) there were no disposable parts during the whole operating life of the device, which makes the device environmentally friendly. storing energy from other sources for load balancing purposes and then using any excess energy to charge the batteries only at opportune times. Other advantages of super capacitors compared with rechargeable batteries are extremely low internal resistance or ESR, high efficiency (up to 97-98%), high output power, extremely low heating levels, and improved safety. According to ITS (Institute of Transportation Studies, Davis, CA) test results, the specific power of super capacitors can exceed 6 kW/kg at 95% efficiency The idea of replacing batteries with capacitors in conjunction with novel alternative energy sources became a conceptual umbrella of the Green Electricity (GEL) Initiative, introduced by Dr. Alexander Bell.
Resistor values are always coded in ohms, capacitors in microfarads (pF), inductors in micro henries (H), and transformers in volts.
band A is first significant figure of component value band B is the second significant figure band C is the decimal multiplier band D if present, indicates tolerance of value in percent (no color means 20%)
For example, a resistor with bands of yellow, violet, red, and gold will have first digit 4 (yellow in table below), second digit 7 (violet), followed by 2 (red) zeros: 4,700 ohms. Gold signifies that the tolerance is 5%, so the real resistance could lie anywhere between 4,465 and 4,935 ohms. Resistors manufactured for military use may also include a fifth band which indicates component failure rate (reliability); refer to MIL-HDBK-199 for further details. The Standard EIA Color Code Table per EIA-RS-279 is as follows:
Violet 7 Grey 8
Note: red to violet are the colors of the rainbow where red is low energy and violet is higher energy.
CIRCUIT DIAGRAM:
7805
230 V 1 AC SUPPL Y 50 HZ 4
5 6 8
IN4007
2 2
100u 1f
1k
1 LED
2 1000u
1
TRANSFORMER
IN400 7
POWER SUPPLY: To run the electronic gadget at home it is provided by some power supply. The microcontroller used (at89c51) requires 12v D.C supply. The DTMF receiver used (mt8870) requires 5v D.C. so design of these regulated power supply is also an important part in hardware design. The A.C power supply from mains is taken and regulated using the rectifiers. For design of a regulated power supply components used are: Transformer. Diodes. Rectifiers. Regulated IC chips. Capacitive filters. Trans former: A transformer is required to couple the mains to the actual power supply circuit. This is required to isolate the mains from the actual regulated power supply circuit and the other part of the kit. This isolation eliminates the dame of the kit to any power supply variations or from a faulty shock.
V1 = i2 = n1 V2 i1 n2
Diodes: In bride rectifier four diodes are used. The specifications of diodes are chosen as: PIV > input voltage. Si diode is better. Power dissipation is kept fixed with respect to current through the diode. Junction capacitance need not be considered for frequencies <1 kHz.
RECTIFIERS:
Rectification is a process of conversion of AC to DC. Here, the AC of transformer output is given to the rectifier input, which converts it to DC output. Basically, bridge rectifiers or diodes arranged in bridge called Diode arrangement are used for power supply design. 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
For both positive and negative swings of the transformer, there is a forward path through the diode bridge. Both conduction paths cause current to flow in the same direction through the load resistor, accomplishing full-wave rectification. While one set of diodes is forward biased, the other set is reverse biased and effectively eliminated from the circuit. Diode Bridge: A diode bridge is an arrangement of four diodes connected in a bridge circuit as shownbelow, that provides the same polarity of output voltage for any polarity of the input voltage. When used in its most common application, for conversion of alternating current (AC) input into direct current (DC) output, it is known as a bridge rectifier. The diagram describes a diode-bridge design known as a full-wave rectifier or Graetz circuit. Bridge Rectifier Circuit: This design can be used to rectify single phase AC when no transformer center tap is available
Capacitors:
Capacitive filters are used stabilized or perfect regulation of the voltage. The capacitive filters are opted because, they are more efficient. But they are also more costly. Different types of capacitors are: 1. Ceramic capacitors. 2. Electrolyte capacitors. 3. Paper/Mica capacitors. 4. Silver capacitors. 5. Tantalum capacitors. Ceramic, Paper/Mica, Silver are nonpolarized capacitors. Electrolyte and Tantalum are polarized capacitors. For high frequency, Ceramic capacitors are used. For low frequencies, Electrolyte capacitors are used.
ULN2803buffer:
Features: 500-mA Rated Collector Current (Single Output) High-Voltage Outputs . . . 50 V Output Clamp Diodes Inputs Compatible With Various Types of logic Relay Driver Applications Compatible with ULN2800A Series
description/ordering information: The ULN2803A is a high-voltage, highcurrent Darlington transistor array. The device consists of eight nun Darlington pairs that feature high-voltage outputs with commoncathode clamp diodes for switching inductive loads. The collector-current rating of each Darlington pair is 500 mA. The Darlington pairs may be connected in parallel for higher current capability. Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED and gas discharge), line drivers, and logic buffers. The ULN2803A has a 2.7-kseries base resistor for each Darlington pair for operation directly with TTL or 5-V CMOS devices.
Logic diagram:
M NEMONI CS
A useful mnemonic for remembering the first ten color codes matches the first letter of the color code, by order of increasing magnitude. There are many variations:
Bad Beer Rots Our Young Guts But Vodka Goes Well Bright Boys Rave Over Young Girls But Veto Getting Wed B. B. R O Y of Great Britain has a Very Good Wife Big Boys Race Our Young Girls But Violet Generally Wins Better Be Right Or Your Great Big Venture Goes West Black Beauty Ran Over Yellow Grass By Violent Grey Waters Bad Boys Race Over Yonder Green But Victory Goes Wanting Black Birds Roam Over Your Garden But Vultures Go West Bye Bye Rosie Off You Go Birmingham Via Great Weston
The word "Bad" in the first mnemonic and "Bright" in the second mnemonic are often replaced with the word "Black" since black comes before brown in the color code. While the second mnemonic is certainly the most offensive of these, all except the third lack a sobriety that might be desirable, especially in a teaching context. A more staid memory aide uses the fact that the central part of the code follows the color spectrum, without the i for indigo. That is,
The most common variation of the mnemonic for the EIA color code generally doesn't stay posted on this page for long due to its choice of words which is more offensive to many today than when it was originated (mid 1920's). Refer to the discussion for details. Besides the ten colors of the main value code, the tolerance code is often remembered as "for Gold or Silver" appended to the more offensive mnemonic, or "Get Some Now" where Now refers to none for 20%. If it is difficult to recall that black comes before brown in the color code, it may be helpful to use the position of white at the end of the color code as a key to remember that black (and not brown) is at the beginning.
Examples
Note: The sizes of the resistors depend only on the power they can dissipate, and do not affect their value.
Enough current flows to make the LED light up, but not so much that the LED is damaged. Later in this Chapter, you will find out how to calculate a suitable value for this resistor. (LEDs are described in detail in Chapter 5.) The 'box' symbol for a fixed resistor is popular in the UK and Europe. A 'zig-zag' symbol is used in America and Japan:
Resistors are used with transducers to make sensor subsystems. Transducers are electronic components which convert energy from one form into another, where one of the forms of energy is electrical. A light dependent resistor, or LDR, is an example of an input transducer. Changes in the brightness of the light shining onto the surface of the LDR result in changes in its resistance. As will be explained later, an input transducer is most often connected along with a resistor to to make a circuit called a potential divider. In this case, the output of the potential divider will be a voltage signal which reflects changes in illumination. Microphones and switches are input transducers. Output transducers include loudspeakers, filament lamps and LEDs. Can you think of other examples of transducers of each type?
How can the value of a resistor be worked out from the colours of the bands? Each color represents a number according to the following scheme: Number 0 1 2 3 4 5 6 7 8 9 Color black brown red orange yellow green blue violet grey white
The first band on a resistor is interpreted as the FIRST DIGIT of the resistor value. For the resistor shown below, the first band is yellow, so the first digit is 4:
When you want to read off a resistor value, look for the tolerance band, usually gold, and hold the resistor with the tolerance band at its right hand end. Reading resistor values quickly and accurately isn't difficult, but it does take practice!
8.SOFTWARE DISCRIPTION
8.1 KEIL MICROVISION
-An IDE for Microcontrollers
Introduction: Keil development tools for the 8051 Microcontroller Architecture support every level of software developer from the professional applications engineer to the student just learning about embedded software development. The industry-standard Keil C Compilers, Macro Assemblers, Debuggers, Real-time Kernels, Single-board Computers, and Emulators support all 8051 derivatives and help you get your projects completed on schedule The Keil 8051 Development Tools are designed to solve the complex problems facing embedded software developers.
When starting a new project, simply select the microcontroller you use from the Device Database and the Vision IDE sets all compiler, assembler, linker, and memory options for you. Numerous example programs are included to help you get started with the most popular embedded 8051 devices. The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051 device. Simulation helps you understand hardware configurations and avoids time wasted on setup problems. Additionally, with simulation, you can write and test applications before target hardware is available. When you are ready to begin testing your software application with target hardware, use the MON51, MON390, MONADI, or FlashMON51 Target Monitors, the ISD51 In-System Debugger, or the ULINK USB-JTAG Adapter to download and test program code on your target system.
The Vision3 IDE is a Windows-based software development platform that combines a robust editor, project manager, and make facility. Vision3 integrates all tools including the C compiler, macro assembler, linker/locator, and HEX file generator.
Vision3 helps expedite the development process of your embedded applications by providing the following:
Full-featured source code editor, Device database for configuring the development tool setting, Project manager for creating and maintaining your projects, Integrated make facility for assembling, compiling, and linking your embedded applications, Dialogs for all development tool settings, True integrated source-level Debugger with high-speed CPU and peripheral simulator, Advanced GDI interface for software debugging in the target hardware and for connection to Keil ULINK, Flash programming utility for downloading the application program into Flash ROM, Links to development tools manuals, device datasheets & users guides.
The Vision3 IDE offers numerous features and advantages that help you quickly and successfully develop embedded applications. They are easy to use and are guaranteed to help you achieve your design goals. The Vision3 IDE and Debugger is the central part of the Keil development tool chain. Vision3 offers a Build Mode and a Debug Mode. In the Vision3 Build Mode you maintain the project files and generate the application. In the Vision3 Debug Mode you verify your program either with a powerful CPU and peripheral simulator or with the Keil ULINK USB-JTAG Adapter (or other AGDI drivers) that connect the debugger to the target system. The ULINK allows you also to download your application into Flash ROM of your target system.
Build Mode: Allows you to translate all the application files and to generate executable programs. The features of the Build Mode are described under Creating Applications. Debug Mode: Provides you with a powerful debugger for testing your application. The Debug Mode is described in Testing Programs.
In both operating modes you may use the source editor of Vision3 to modify your source code. The Debug mode adds additional windows and stores an own screen layout. The following picture shows a typical configuration of Vision3 in the Debug Mode. The tabs of the Project Workspace give you access to:
o o o o o
Files and Groups of the project. CPU Registers during debugging. Tool and project specific on-line Books. Text Templates for often used text blocks. Function in the project for quick editor navigation.
The tabs of the Output Window provides: Build messages and fast error access; Debug Command input/output console; Find in Files results with quick file access. The Memory Window gives access to the memory areas in display various formats. The Watch & Call Stack Window allows you to review and modify program variables and displays the current function call tree. The Workspace is used for the file editing, disassembly output, and other debug information. The Peripheral Dialogs help you to review the status of the on-chip peripherals in the microcontroller.
Vision3 IDE
The Vision3 IDE combines project management, a rich-featured editor with interactive error correction, option setup, make facility, and on-line help. Use Vision3 to create your source files and organize them into a project that defines your target application. Vision3 automatically compiles, assembles, and links your embedded application and provides a single focal point for your development efforts.
Library Manager
The library manager allows you to create object library from the object files created by the compiler and assembler. Libraries are specially formatted, ordered program collections of object modules that may be used by the linker at a later time. When the linker processes a library, only those object modules in the library that are necessary to create the program are used.
Linker/Locator
The Linker/Locator creates an executable program file using the object modules extracted from libraries and those created by the compiler and assembler. An executable program file (also called absolute object module) contains no reloadable code or data. All code and data reside at fixed memory locations.
To program an Flash ROM or other memory devices, With the Vision3 Debugger for simulation and target debugging, With an in-circuit emulator for the program testing.
Vision3 Debugger
The Vision3 symbolic, source-level debugger is ideally suited for fast, reliable program debugging. The debugger includes a high-speed simulator that let you simulate an microcontroller system including on-chip peripherals and external hardware. The Vision3 Debugger provides several ways for you to test your programs on real target hardware.
Use the Keil ULINK USB-JTAG adapter for Flash downloading and software test of your program via on-chip debugging system like the Embedded ICE macro cell that is integrated in many ARM devices. Use the AGDI interface to attach use the Vision3 Debugger front end with your target system using other debuggers like Monitor, In-System Debugger, or Emulator.
At Keil Software, we are dedicated to provide you with the best embedded development tools and documentation available. If you have suggestions or comments regarding any of the on-line manuals accompanying this product, please contact us. If you think you have discovered a problem with the software, do the following before calling technical support. 1. Read the sections in this manual that pertains to the job or task you are trying to accomplish. 2. Make sure you are using the most current version of the software and utilities. Check www.keil.com/update to make sure that you have the latest software version. 3. Isolate the problem to determine if it is a problem with the assembler, compiler, linker, debugger, or another development tool. 4. Further isolate software problems by reducing your code to a few lines.
If you are still experiencing problems after following these steps, report them to our technical support group. Please include your product serial number and version number. We prefer that you send the problem via email. If you contact us by fax, be sure to include your name and telephone numbers (voice and fax) where we can reach you. Try to be as detailed as possible when describing the problem you are having. The more descriptive your example, the faster we can find a solution. If you have a single-page code example demonstrating the problem, please email it to us. If possible, make sure that
The menu bar provides menus for editor operations, project maintenance, development tool option settings, program debugging, external tool control, window selection and manipulation, and on-line help. The toolbar buttons allow you to rapidly execute Vision3 commands. A Status Bar provides editor and debugger information. The various toolbars and the status bar can be enabled or disabled from the View Menu commands. Keyboard shortcuts offer quick access to Vision3 commands and may be configured via the menu command Edit Configuration - Shortcut Key.
The following sections list the Vision3 commands that can be reached by menu commands, toolbar buttons, and keyboard shortcuts. The Vision3 commands are grouped mainly based on the appearance in the menu bar:
File Menu and File Commands Edit Menu and Editor Commands o Outlining Menu o Advanced Menu o Selecting Text Commands View Menu Project Menu and Project Commands Debug Menu and Debug Commands Flash Menu Peripherals Menu Tools Menu SVCS Menu Window Menu
Help Menu
CREATING APPLICATIONS
Home Creating Applications This chapter describes the Build Mode of Vision3 and is grouped into the following sections: Create a Project: explains the steps required to setup a simple application and to generate HEX output.
CREATE PROJECT
Home Creating Applications Create Project Vision3 is a standard Windows application and started by clicking on the program icon. About the Environment describes the different window areas of Vision3. Vision3 includes a project manager which makes it easy to design applications for an ARM based microcontroller. You need to perform the following steps to create a new project: Select the Toolset (only required for ARM Projects). Create Project File and Select CPU. Project Workspace - Books. Create New Source Files. Add Source Files to the Project. Create File Groups. Set Tool Options for Target Hardware. Configure the CPU Startup Code. Build Project and Generate Application Program Code. Create a HEX File for PROM Programming .
The section provides a step-by-step tutorial that shows you how to create a simple Vision3 project.
PROJECT TARGETS
AND
FILE GROUPS
Home Creating Applications Project Targets and File Groups By using different Project Targets Vision3 lets you create several programs from a single project. You may need one target for testing and another target for a release version of your application. Each target allows individual tool settings within the same project file. Files Groups let you group associated files together in a project. We have already used file groups in our example to separate the CPU related files from other
The Project Workspace shows all groups and the related files. Files are built and linked in the same order as shown in this window. You can move file positions with Drag & Drop. You may select a target or group name and Click to rename it. The local menu opens with a right mouse Click and allows you for each item: to to to to set tool options remove the item add files to a group open the file.
In the build toolbar you can quickly change the current project target to build.
PROJECT COMPONENTS
Home Dialogs Project You may add, delete, or re-arrange the items with the list box buttons in Project Targets, Groups, and Files. Project Targets Shows all Project Targets in your project. Project Targets let you create several programs form a single project. You may need one target for testing and another target for a release version of your application. Groups
Files
Shows all files of the selected File Group. Set as Current Target Set the selected Project Target as the current target. Add Files Add files to the selected File Group.
FILE EXTENSIONS
Home Creating Applications Tips and Tricks File Extensions The dialog Project Components, Environment and Books allows you to set the file extension for the various file types of a project. You can enter several extensions when you separate them by semi-colon. The file extensions are project specific.
Debugging
Home Debugging This chapter describes the Debug Mode of Vision3 and shows you how to use the user interface to test a sample program. Also discussed are simulation mode and the different options available for program debugging. You can use Vision3 Debugger to test the applications you develop. The Vision3 Debugger offers two operating modes that are selected in the Options for Target Debug dialog. Use Simulator configures the Vision3 Debugger as software-only product that simulates most features of a microcontroller without actually having target hardware. You can test and debug your embedded application before the hardware is ready. Vision3 simulates a wide variety of peripherals including the serial port, external I/O, and timers. The peripheral set is selected when you select a CPU from the device database for your target. Use Advanced GDI drivers, like the ULINK Debugger to interface to your target hardware. For Vision3 various drivers are available that interface to: o JTAG/OCDS Adapter: which connects to on-chip debugging systems like the ARM Embedded ICE.
Flash Programming
Home Flash Programming Vision3 integrates Flash Programming Utilities in the project environment. All configurations are saved in context with your current project. You may use external command-line driven utilities (usually provided by the chip vendor) or the Keil ULINK USB-JTAG Adapter. The Flash Programming Utilities are configured under Project - Options - Utilities. Flash Programming may be started from the Flash Menu or before starting the Vision3 Debugger when you enable Project - Options - Utilities - Update Target before Debugging.
The Files page in the Project Workspace shows the source files that compose the MEASURE project. The three application related source files that are located in the Source Files group. The function of the source files is described below. To open a source file, double-click on the filename.
Measures: contains the main C function for the measurement system and the interrupt routine for timer 0. The main function initializes all peripherals of the ARM and performs command processing for the system. The timer interrupt routine, timer0, manages the real-time clock and the measurement sampling of the system. MCommand.C: processes the display, time, and interval commands. These functions are called from main. The display command lists the analog values in floating-point format to give a voltage between 0.00V and 5.00V. GetLine.C: contains the command-line editor for characters received from the serial port. IRQ.S: is an interface module for the interrupt service routine.
Testing Measure
Home Example Programs Measure: A Remote Measurement System Testing Measure
Program Execution
Home Example Programs Measure: A Remote Measurement System Program Execution Before you begin simulating MEASURE, open the Serial Window #1 that displays the serial output with the View menu or the Debug toolbar. You may disable other windows if your screen is not large enough. You can use the Step toolbar buttons on assembler instructions or source code lines. If the Disassembly Window is active, you single step at assembly instruction basis. If an editor window with source code is active, you single step at source code level.
Call Stack
Home Example Programs Measure: A Remote Measurement System Call Stack Vision3 internally tracks function nesting as the program executes. The Call Stack page of the Watch Window shows the current function nesting. A double click on a line displays the source code that called the selected function.
Breakpoints Dialog
Home Example Programs Measure: A Remote Measurement System Breakpoints Dialog
9.CODING
PROGRAM HEX
CODE:
10. CONCLUSIONS:
Hence the Unmanned railway gates operate according to the data input from sensors to microcontroller. First an alarm is triggered and then the gate is operated. Specifications: Mechanical gate arrangement Atmel 89C51 an 8051 family microcontroller SN7404 for microcontroller interfacing. IR sensors for sensing train Stepper motor to operate gates ULN 2803 for driving Stepper motor
References:
Programming Embedded Systems: With C and GNU Development Tools by Michael Barr Basic electronics By: GROB Practical transistor circuit design and analysis By: GERALD E. WILLIAMS Sensor - Electronic circuit guide book Volume 1 By: JOSEPH J.CARR
Programming and Customizing the 8051 Micro-controller By: Mike Prado The concepts and Features of Micro-controllers - By: Raj Kamala
The 8051 Micro-controller Architecture, programming & Applications By: Kenneth J. Ayala
CMOS/TTL IC Data Manuals