You are on page 1of 43

S.N O.

1 2 3 4

SUBJECT INTRODUCTION CIRCUIT DIAGRAM FLOW CHART LIST OF COMPONENTS

PAGE NO.

5 6 7 8

DTA SHEET OF CONTROLLER & LM293D OPERATION AND WORKING APPLICATION REFERENCE

INTRODUCTION

Present project is designed using PIC microcontroller to avoid railway accidents happening at unattended railway gates, if implemented in spirit. This project utilizes two powerful IR transmitters and two receivers; one pair of transmitter and receiver is fixed at up side (from where the train comes) at a level higher than a human being in exact alignment and similarly the other pair is fixed at down side of the train direction. Sensor activation time is so adjusted by calculating the time taken at a certain speed to cross at least one compartment of standard minimum size of the Indian railway. We have considered 5 seconds for this project. Sensors are fixed at 1km on both sides of the gate. We call the sensor along the train direction as foreside sensor and the other as aft side sensor. When foreside receiver gets activated, the gate motor is turned on in one direction and the gate is closed and stays closed until the train crosses the gate and reaches aft side sensors. When aft side receiver gets activated motor turns in opposite direction and gate opens and motor stops. Buzzer will immediately sound at the fore side receiver activation and gate will close after 5 seconds, so giving time to drivers to clear gate area in order to avoid trapping between the gates and stop sound after the train has crossed. The same principle is applied for track switching. Considering a situation wherein an express train and a local train are traveling in opposite directions on the same track; the express train is allowed to travel on the same track and the local train has to switch on to the other track. Two sensors are placed at the either sides of the junction where the track switches. If theres a train approaching from the other side, then another sensor placed along that direction gets activated and will send an interrupt to the controller. The interrupt service routine switches the track. Indicator lights have been provided to avoid collisions. Here the switching operation is performed using a stepper motor. Assuming that within a certain delay, the train has passed the track is switched back to its original position, allowing the first train to pass without any interruption. This concept of track switching can be applied at 1km distance from the stations.

GateControl:
Railways being the cheapest mode of transportation are preferred over all the other means .When we go through the daily newspapers we come across many railway accidents occurring at unmanned railway crossings. This is mainly due to the carelessness in manual operations or lack of workers. We, in this project has come up with a solution for the same. Using simple electronic components we have tried to automate the control of railway gates. As a train approaches the railway crossing from either side, the sensors placed at a certain distance from the gate detects the approaching train and accordingly controls the operation of the gate. Also an indicator light has been provided to alert the motorists about the approaching train.

CIRCUIT DIAGRAM

CIRCUIT COMPONENTS
RESISTOR

A Resistor is a two-terminal passive electronic component which implements electrical resistance as a circuit element. When a voltage V is applied across the terminals of a resistor, a current I will flow through the resistor in direct proportion to that voltage. The reciprocal of the constant of proportionality is known as the resistance R, since, with a given voltage V, a larger value of R further "resists" the flow of current I as given by Ohm's law:

I=V/R
Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in most electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel-chrome). Resistors are also implemented within integrated circuits, particularly analog devices, and can also be integrated into hybrid and printed circuits.

The electrical functionality of a resistor is specified by its resistance: common commercial resistors are manufactured over a range of more than 9 orders of magnitude. When specifying that resistance in an electronic design, the required precision of the resistance may require attention to the manufacturing tolerance of the chosen resistor, according to its specific application. The temperature coefficient of the resistance may also be of concern in some precision applications.

Practical resistors are also specified as having a maximum power rating which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is mainly of concern in power electronics applications. Resistors with higher power ratings are physically larger and may require heat sinking. In a high voltage circuit, attention must sometimes be paid to the rated maximum working voltage of the resistor. They are not normally specified individually for a particular family of resistors manufactured using a particular technology. A family of discrete resistors is also characterized according to its form factor, that is, the size of the device and position of its leads (or terminals) which is relevant in the practical manufacturing of circuits using them. COLOUR CODING FOR RESISTOR:

CAPACITOR

A capacitor (formerly known as condenser) is a device for storing electric charge. The forms of practical capacitors vary widely, but all contain at least two conductors separated by a non-conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils separated by a layer of insulating film.A capacitor is a passive electronic component consisting of a pair of conductors separated by a dielectric (insulator).

A capacitor is a passive electronic component consisting of a pair of conductors separated by a dielectric (insulator). When there is a potential difference (voltage) across the conductors, a static electric field develops across the dielectric, causing positive charge to collect on one plate and negative charge on the other plate. Energy is stored in the electrostatic field. An ideal capacitor is characterized by a single constant value, capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. Capacitors are widely used in electronic circuits for blocking direct current while allowing alternating current to pass, in filter networks, for smoothing the output of power supplies, in the resonant circuits that tune radios to particular frequencies and for many other purposes. The capacitance is greatest when there is a narrow separation between large areas of conductor, hence capacitor conductors are often called "plates", referring to an early means of construction. In practice the dielectric between the plates passes a small amount of leakage current and also has an electric field strength limit, resulting in a breakdown voltage, while the conductors and leads introduce an undesired inductance and resistance.

Capacitor Construction:

The method of construction of these electronic components is also important. In some capacitors the plates may be flat, and normally these capacitors will have rectangular, or more exactly cuboid shapes. The final stage in the construction of an electronic capacitor is to place it in a protective casing. In some instances it may be dipped in an insulating coating, in others it may be contained within a metal can.

In essence the construction of an electronic capacitor is very simple, although in practice a lot of research and development has been put into capacitor technology. The basic electronics components consist of two plates that are insulated from one another. In between them there is an insulating medium known as the dielectric.

TYPES OF CAPACITOR: Ceramic capacitor


Ceramic capacitors are normally used for radio frequency and some audio applications. Ceramic capacitors range in value from figures as low as a few pico farads to around 0.1 microfarads. In view of their wide range and suitability for RF applications they are used for coupling and decoupling applications in particular. Here these ceramic capacitors are by far the most commonly used type being cheap and reliable and their loss factor is particularly low although this is dependent on the exact dielectric in use.

Electrolytic capacitor

Electrolytic capacitors are the most popular type for values greater than about 1 microfarad. Electrolytic capacitors are constructed using a thin film of oxide on an aluminium foil. An electrolyte is used to make contact with the other plate. The two plates are wound around on one another and then placed into a can that is often aluminium. Electrolytic capacitors have a wide tolerance. Typically the value of the component may be stated with a tolerance of -50% +100%. Tantalum capacitor Ordinary aluminium electrolytic capacitors are rather large for many uses. In applications where size is of importance tantalum capacitors may be used. These are much smaller than the aluminium electrolytic capacitors and instead of using a film of oxide on aluminium they us a film of oxide on tantalum. Tantalum capacitors do not normally have high working voltages, 35V is normally the maximum, and some even have values of only a volt or so. Silver Mica Capacitor Silver mica capacitorSilver mica capacitors are not as widely used these days as they used to be. In view of this one of their major uses is within the tuned elements of circuits like oscillators, or within filters. Values are normally in the range between a few picofarads up to two or possibly three thousand picofarads. For this type of capacitor the silver electrodes are plated directly on to the mica dielectric.

Polystyrene Film Capacitor Polystyrene capacitors are a relatively cheap form of capacitor. They are tubular in shape resulting from the fact that the plate / dielectric sandwich is rolled together. This adds some inductance and means that they are only suitable for relatively low frequency circuits, typically up to a few hundred kHz. In view of their relatively good tolerance levels they can be used in filter circuits, etc where values are of importance. They are generally only available as leaded electronics components. Polyester Film Capacitor

Polyester capacitorPolyester film capacitors are used where cost is a consideration as they do not offer a high tolerance. Many polyester film capacitors have a tolerance of 5% or 10%, which is adequate for many applications. They are generally only available as leaded electronics components.

Metallised Polyester Film Capacitor This type of capacitor is a essentially a form of polyester film capacitor where the polyester films themselves are metallised. The advantage of using this process is that because their electrodes are thin, the overall capacitor can be contained within a relatively small package. The metallised polyester film capacitors are generally only available as leaded electronics components. Polycarbonate capacitor Polycarbonate capacitors have earned a place as a reliable form of capacitor for use in a number of applications where performance is critical. The polycarbonate film is very stable and this enables high tolerance capacitors to be made which will hold their capacitance value over time. In addition they have a low dissipation factor, and they remain stable over a wide temperature range, many being specified from -55C to +125C. In 2000 the Bauer Corporation announced they would be ceasing manufacture of the raw dielectric. As a result many of the manufacturers of polycarbonate ceased production. Fortunately there are a few smaller manufacturers of these capacitors, so they can still be obtained. Read more about the polycarbonate capacitor Polypropylene Capacitor The polypropylene is sometimes used when a higher tolerance is necessary than polyester capacitors offer. As the name implies, this capacitor uses a polypropylene film for the dielectric. One of the advantages of the capacitor is that there is very little change of capacitance with time and voltage applied. They are also used for low frequencies, with 100 kHz or so being the upper limit. They are generally only available as leaded electronics component.

Summary of Capacitor Types:

Capacitor types

Capacitance Temperature Accuracy Leakage Comments & details range stability Polarised capacitor - widely used in power supplies for Electrolytic 0.1 F - ~1 F V poor V poor Poor smoothing, and bypass where accuracy, etc is not required. Exact performance of Ceramic 10 pF - 1 F Variable Variable Average capacitor depends to a large extent on the ceramic used. 0.1 F - 500 Polarised capacitor - very Tantalum Poor Poor Poor F high capacitance density. Rather expensive and large not widely used these days 1 pF - 3000 Silver mica Good Good Good except when small value pF accurate capacitors are needed. Polyester 0.001 F - 50 Inexpensive, and popular for Good Poor Good (Mylar) F non-demanding applications. High quality, often used in Polystyrene 10 pF - 1 F V good Good V good filters and the like where accuracy is needed. Used in many high tolerance 100 pF - 20 and hash environmental Polycarbonate V good V good Good F conditions. Supply now restricted. High performance and low Polypropylene 100pF - 50 F V good Good V good dielectric absorption. High performance - lowest Teflon 100 pF - 1 F V good V v good V v good dielectric absorption. Excellent for very harsh 10 pF - 1000 environments while offering Glass Good Good V good pF good stability. Very expensive. 100 pF - 0.1 Porcelain Good Good Good Good long term stability F

BUZZER WORKING:
Buzzer is an electromagnetic type audio signaling device, which has a coil inside which oscillates a metal plate against another, which when given voltage difference

produces sound of a predefined frequency. You must be aware of such sounds of buzzer like BEEP sound in many appliances.

A piezoelectric element may be driven by an oscillating electronic circuit or other audio signal source, driven with a piezoelectric audio amplifier. Sounds commonly used to indicate that a button has been pressed are a click, a ring or a beep.

FEATURES:
These high reliability electromagnetic buzzers are applicable to general electronics equipment. Compact, pin terminal type electromagnetic buzzer with 2048 Hz output. Pin type terminal construction enables direct mounting onto printed circuit boards.

APPLICATIONS:
Security Alerts, Clocks, travel watches, keyboards, toys, various alarms of equipments.

SPECIFICATION:

OPERATING CIRCUIT:
As the buzzer uses a coil, it has an inductive load. Protect the drive circuit by putting the diodes in parallel into the buzzer.

Piezo Buzzer mainly consists of a multi-vibrator circuit, piezoelectric buzzer films, and the resonance box, shell etc. Multivibrator constits of transistors or integrated circuits. When switched on, after (1.5 ~ 15V DC working voltage), multi-harmonic oscillator start-up, output 1.5 ~ 2.5kHZ of audio signals, which results in audible sound. Piezoelectric Buzzer contains zirconate titanate films from lead or lead magnesium niobate piezoelectric ceramic materials. On both sides of the ceramic coating on the silver electrode by polarization and aging treatment, and then with the brass plates or stainless steel sheets stick together.

DIMENSION:

Electromagnetic Buzzer works from the oscillator, the electromagnetic coil, magnet, diaphragm and shell so on. After power on, the audio oscillator signal current through the electromagnetic coil, so that the electromagnetic coil produces a magnetic field. Diaphragm in the electromagnetic coil and magnet interaction, periodically vibrating voice and thus the audible note. There are too Electromagnetic Buzzers which works without any oscillator. These work by the frequency produced by the make and break contacts to the coil in relation to the moving diaphragm.

FREQUENCY CHARACTERISTICS:

IC 555 TIMER
The 555 timer IC was first introduced around 1971 by the Signetics Corporation as the SE555/NE555 and was called "The IC Time Machine" and was also the very first and only commercial timer ic available. It provided circuit designers and hobby tinkerers with a relatively cheap, stable and user-friendly integrated circuit for both monostable and astable applications. The 555, come in two packages, either the round metal-can called the 'T' package or the more familiar 8-pin DIP 'V' package. About 20-years ago the metal-can type was pretty much the standard (SE/NE types). The 556 timer is a dual 555 version and comes in a 14-pin DIP package, the 558 is a quad version with four 555's also in a 14 pin DIP case. Inside the 555 timer, are the equivalent of over 20 transistors, 15 resistors, and 2 diodes, depending of the manufacturer. The equivalent circuit, in block diagram, providing the functions of control, triggering, level sensing or comparison, discharge, and power output. Some of the more attractive features of the 555 timer are: Supply voltage between 4.5 and 18 volt, supply current 3 to 6 mA, and a Rise/Fall time of 100 nSec. General Description: The LM555 is a highly stable device for generating accurate time delays or oscillation. Additional terminals are provided for triggering or resetting if desired. In the time delay mode of operation, the time is precisely controlled by one external resistor and capacitor. For astable operation as an oscillator, the free running frequency and duty cycle are accurately controlled with two external resistors and one capacitor. The circuit may be triggered and reset on falling waveforms, and the output circuit can source or sink up to 200mA or drive TTL circuits. Features: Direct replacement for SE555/NE555 Timing from microseconds through hours Operates in both astable and monostable modes Adjustable duty cycle Output can source or sink 200 mA Output and supply TTL compatible Temperature stability better than 0.005% per C

Pin Diagram:

Pin 1 (Ground):The ground (or common) pin is the most-negative supply potential of the device, which is normally connected to circuit common (ground) when operated from positive supply voltages. Pin 2 (Trigger):This pin is the input to the lower comparator and is used to set the latch, which in turn causes the output to go high. This is the beginning of the timing sequence in monostable operation. Triggering is accomplished by taking the pin from above to below a voltage level of 1/3V+(or,in general,one-half the voltage appearing at pin 5). Pin 3 (Output):The output of the 555 comes from a high-current totem-pole stage made up of transistors Q20 - Q24. Transistors Q21 and Q22 provide drive for source-type loads, and their Darlington connection provides a high-state output voltage about 1.7 volts less than the V+ supply level used. Pin 4 (Reset): This pin is also used to reset the latch and return the output to a low state. The reset voltage threshold level is 0.7 volt, and a sink current of 0.1mA from this pin is required to reset the device. These levels are relatively independent of operating V+ level;Thus the reset input is TTL compatible for any supply voltage. The reset input is an overriding function; that is, it will force the output to a low state regardless of the state of either of the other inputs.

Pin 5 (Control Voltage):This pin allows direct access to the 2/3 V+ voltage-divider point, the reference level for the upper comparator. It also allows indirect access to the lower comparator,

as there is a 2:1 divider (R8 - R9) from this point to the lower-comparator reference input, Q13. Use of this terminal is the option of the user, but it does allow extreme flexibility by permitting modification of the timing period, resetting of the comparator, etc. Pin 6 (Threshold):Pin 6 is one input to the upper comparator (the other being pin 5) and is used to reset the latch, which causes the output to go low. Resetting via this terminal is accomplished by taking the terminal from below to above a voltage level of 2/3 V+ (the normal voltage on pin 5). The action of the threshold pin is level sensitive, allowing slow rate-of-change waveforms. The voltage range that can safely be applied to the threshold pin is between V+ and ground. Pin 7 (Discharge):This pin is connected to the open collector of a npn transistor (Q14), the emitter of which goes to ground, so that when the transistor is turned "on", pin 7 is effectively shorted to ground. Usually the timing capacitor is connected between pin 7 and ground and is discharged when the transistor turns "on". The conduction state of this transistor is identical in timing to that of the output stage Pin 8 (V +):The V+ pin (also referred to as Vcc) is the positive supply voltage terminal of the 555 timer IC. Supply-voltage operating range for the 555 is +4.5 volts (minimum) to +16 volts (maximum), and it is specified for operation between +5 volts and +15 volts. The device will operate essentially the same over this range of voltages without change in timing period.

WORKING OF ASTABLE MULTIVIBRATOR:


The circuit diagram for the astable multivibrator using IC 555 is shown here. The astable multivibrator generates a square wave, the period of which is determined by the circuit external to IC 555. The astable multivibrator does not require any external trigger to change the state of the output. Hence the name free running oscillator. The time during which the output is either high or low is determined by the two resistors and a capacitor which are externally connected to the 555 timer. The above figure shows the 555 timer connected as an astable multivibrator. Initially when the output is high capacitor C starts charging towards Vcc through RA and RB. However as soon as the voltage across the capacitor equals 2/3 Vcc , comparator1 triggers the flip-flop and the output switches to low state. Now capacitor C discharges through RB and the transistor Q1. When voltage across C equals 1/3 Vcc, comparator 2s output triggers the flip- flop and the output goes high. Then the cycle repeats.

The capacitor is periodically charged and discharged between 2/3 Vcc and 1/3 Vcc respectively. The time during which the capacitor charges from 1/3 Vcc to 2/3 Vcc is equal to the time the output remains high and is given by where RA and RB are in ohms and C is in Farads. Similarly the time during which the capacitor discharges from 2/3 Vcc to 1/3 Vcc is equal to the time the output is low.

MONOSTABLE MULTIVIBRATOR:
In the monostable multivibrator, the one resistive-capacitive network (C 2-R3 in figure 1) is replaced by a resistive network (just a resistor). The circuit can be thought as a 1/2 Q2 collector voltage is the output of the circuit (in contrast it has a perfect square waveform since the output is not loaded by the capacitor).

In this figure Basic bistable multivibrator (suggested values: R1, R2= 1 k R3, R4 = 10 K

When triggered by an input pulse, a monostable multivibrator will switch to its unstable position for a period of time, and then return to its stable state. The time period monostable multivibrator remains in unstable state is given by t = ln(2)R2C1. If repeated application of the input pulse maintains the circuit in the unstable state, it is called

a retriggerable monostable. If further trigger pulses do not affect the period, the circuit is a nonretriggerable multivibrator.

For the circuit in Figure in the stable state Q1 is turned off and Q2 is turned on. It is triggered by zero or negative input signal applied to Q2 base (with the same success it can be triggered by applying a positive input signal through a resistor to Q1 base). As a result, the circuit goes in described above. After elapsing the time, it returns to its stable initial state.

BISTABLE MULTIVIBRATOR:
As the name implies, the bistable multivibrator has two stable states. If a trigger of the correct polarity and amplitude is applied to the circuit, it will change states and remain there until triggered again. The trigger need not have a fixed prf; in fact, triggers from different sources, occurring at different times, can be used to switch this circuit.

The bistable multi vibrator circuit and the associated waveforms are shown in figure 3-17, views (A) and (B), respectively. In this circuit, R1 and R7 are the collector load resistors. Voltage dividers R1, R2,and R5 provide forward bias for Q2; R7, R6, and R3 provide forward bias for Q1. These resistors also couple the collector signal from one transistor to the 1 base of the other. Observe that this is direct coupling of feedback. This type of coupling is required because the circuit depends on input triggers for operation , not on RC time constants inside the circuit. Both transistors use common emitter resistor R4 which provides emitter coupling. C1 and C2 couple the input triggers to the transistor bases In the bistable multi vibrator, both the resistive-capacitive network are replaced by resistive networks (just resistors or direct coupling).This circuit is similar to an astable multi vibrator, except that there is no charge or discharge time, due to the absence of capacitors. Hence, when the circuit is switched on, if Q1 is on, its collector is at 0 V. As a result, Q2 gets switched off. The results in more than half +V volts being applied to R4 causing current into the base of Q1, thus keeping it on. Thus, the circuit remains stable in a single state continuously. Similarly, Q2 remains on continuously, if it happens to get switched on first. Switching of state can be done via Set and Reset terminals connected to the bases. For example, if Q2 is on and Set

is grounded momentarily, this switches Q2 off, and makes Q1 on. Thus, Set is used to "set" Q1 on, and Reset is used to "reset" it to off state.

DATA SHEET OF CONTROLLER


1.0 DEVICE OVERVIEW This document contains device specific information for the following devices: This family offers the advantages of all PIC18 microcontrollers

namely, high computational performance at an economical price with the addition of high endurance, Enhanced Flash program memory. On top of these features, the PIC18F2525/2620/4525/4620 family introduces design enhancements that make these microcontrollers a logical choice for many high-performance, power sensitive applications.
1.1 New Core Features

1.1.1 nanoWatt TECHNOLOGY All of the devices in the PIC18F2525/2620/4525/4620 family incorporate a range of features that can significantly reduce power consumption during operation. Key items include: Alternate Run Modes: By clocking the controller from the Timer1 source or the internal oscillator block, power consumption during code execution can be reduced by as much as 90%. Multiple Idle Modes: The controller can also runwith its CPU core disabled but the peripherals still active. In these states, power consumption can be reduced even further, to as little as 4% of normal operation requirements. On-the-fly Mode Switching: The power managed modes are invoked by user code during operation, allowing the user to incorporate power-saving ideas into their applications software design. Low Consumption in Key Modules: The power requirements for both Timer1 and the Watchdog Timer are minimized. See Section 26.0 Electrical Characteristics fortime-out periods
1.1.2 MULTIPLE OSCILLATOR OPTIONS AND FEATURES

All of the devices in the PIC18F2525/2620/4525/4620 family offer ten different oscillator options, allowing users a wide range of choices in developing application hardware. These include: Four Crystal modes, using crystals or ceramic resonators Two External Clock modes, offering the option ofusing two pins (oscillator input and a divideby-4clock output) or one pin (oscillator input, with the second pin reassigned as general I/O) Two External RC Oscillator modes with the same pin options as the External Clock modes An internal oscillator block which provides an 8 MHz clock and an INTRC source (approximately 31 kHz), as well as a range of 6 user selectable clock frequencies, between 125 kHz to 4 MHz, for a total of 8 clock frequencie. This option frees the two oscillator pins for use asadditional general purpose I/O. A Phase Lock Loop (PLL) frequency multiplier, available to both the high-speed crystal and internal oscillator modes, which allows clock speeds of up to 40 MHz. Used with the internal oscillator, the PLL gives users a complete selection of clock speeds, from 31 kHz to 32 MHz all without using an external crystal or clock circuit. Besides its availability as a clock source, the internal oscillator block provides a stable reference source thatgives the family additional features for robust operation: Fail-Safe Clock Monitor: This option constantly monitors the main clock source against a reference signal provided by the internal oscillator. If a clock failure occurs, the controller is

switched to the internal oscillator block, allowing for continued low-speed operation or a safe application shutdown. Two-Speed Start-up: This option allows the internal oscillator to serve as the clock source from Power-on Reset, or wake-up from Sleep mode, until the primary clock source is available .
1.2 Other Special Features

Memory Endurance: The Enhanced Flash cells for both program memory and data EEPROM are rated to last for many thousands of erase/write cycles up to 100,000 for program memory and 1,000,000 for EEPROM. Data retention without refresh is conservatively estimated to be greater than 40 years. Self-programmability: These devices can write to their own program memory spaces under internal software control. By using a bootloader routine located in the protected Boot Block at the top of program memory, it becomes possible to createan application that can update itself in the field. Extended Instruction Set: The PIC18F2525/ 2620/4525/4620 family introduces an optional extension to the PIC18 instruction set, which adds 8 new instructions and an Indexed Addressing mode. This extension, enabled as a device configuration option, has been specifically designed to optimize re-entrant application code originally developed in high-level languages, such as C. Enhanced CCP module: In PWM mode, this module provides 1, 2 or 4 modulated outputs for controlling half-bridge and full-bridge drivers. Other features include auto-shutdown, for disabling PWM outputs on interrupt or other select conditions and auto-restart, to reactivate outputs once the condition has cleared. Enhanced Addressable USART: This serial communication module is capable of standard RS-232 operation and provides support for the LIN bus protocol. Other enhancements include automatic baud rate detection and a 16-bit Baud Rate Generator for improved resolution. When the microcontroller is using the internal oscillator block, the USART provides stable operation for applications that talk to the outside world without using an external crystal (or its accompanying power requirement). 10-bit A/D Converter: This module incorporates programmable acquisition time, allowing for a channel to be selected and a conversion to be initiated without waiting for a sampling period and thus, reduce code overhead. Extended Watchdog Timer (WDT): This Enhanced version incorporates a 16-bit prescaler, allowing an extended time-out range that is stable across operating voltage and temperature. See Section 26.0 Electrical Characteristics for time-out periods.
1.3 Details on Individual Family Members

Devices in the PIC18F2525/2620/4525/4620 family areavailable in 28-pin and 40/44-pin packages. Block diagrams for the two groups are shown in Figure 1-1 and Figure 1-2. The devices are differentiated from each other in five Ways 1. Flash program memory (48 Kbytes for PIC18FX525 devices, 64 Kbytes for PIC18FX620). 2. A/D channels (10 for 28-pin devices, 13 for40/44-pin devices). 3. I/O ports (3 bidirectional ports on 28-pin devices, 5 bidirectional ports on 40/44-pin devices). 4. CCP and Enhanced CCP implementation (28-pin devices have 2 standard CCP modules, 40/44-pin devices have one standard CCP module and one ECCP module).

5. Parallel Slave Port (present only on 40/44-pin devices). All other features for devices in this family are identical. These are summarized in Table 1-1. The pinouts for all devices are listed in Table 1-2 and Table 1-3. Like all Microchip PIC18 devices, members of the PIC18F2525/2620/4525/4620 family are available as both standard and low-voltage devices. Standard devices with Enhanced Flash memory, designated with an F in the part number (such as PIC18F2620), accommodate an operating VDD range of 4.2V to 5.5V. Low-voltage parts, designated by LF (such as PIC18LF2620), function over an extended VDD range of 2.0V to 5.5V.

PIC microcontroller
PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller". PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability. Microchip announced on February 2008 the shipment of its six billionth PIC processor.

Features
High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture 131 Powerful Instructions Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 16 MIPS Throughput at 16 MHz On-chip 2-cycle Multiplier Nonvolatile Program and Data Memories 16K Bytes of In-System Self-Programmable Flash Endurance: 10,000 Write/Erase Cycles Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation 512 Bytes EEPROM Endurance: 100,000 Write/Erase Cycles 1K Byte Internal SRAM Programming Lock for Software Security JTAG (IEEE std. 1149.1 Compliant) Interface

Boundary-scan Capabilities According to the JTAG Standard Extensive On-chip Debug Support Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface Peripheral Features Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode Real Time Counter with Separate Oscillator Four PWM Channels 8-channel, 10-bit ADC 8 Single-ended Channels 7 Differential Channels in TQFP Package Only 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
26 R & D MR. DEEPAK KUMAR DWIVEDI

Byte-oriented Two-wire Serial Interface Programmable Serial USART Master/Slave SPI Serial Interface Programmable Watchdog Timer with Separate On-chip Oscillator On-chip Analog Comparator Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated RC Oscillator External and Internal Interrupt Sources Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby I/O and Packages 32 Programmable I/O Lines 40-pin PDIP, 44-lead TQFP, and 44-pad MLF Operating Voltages 2.7 - 5.5V for ATmega16L 4.5 - 5.5V for ATmega16 Speed Grades 0 - 8 MHz for ATmega16L 0 - 16 MHz for ATmega16 Power Consumption @ 1 MHz, 3V, and 25C for ATmega16L Active: 1.1 mA Idle Mode: 0.35 mA Power-down Mode: < 1 A

Pin Descriptions
VCC Digital supply voltage. GND Ground. Port A (PA7..PA0) Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B (PB7..PB0) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B also serves the functions of various special features of the ATmega16 as listed on page 56. Port C (PC7..PC0) Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs. Port C also serves the functions of the JTAG interface and other special features of the ATmega16 as listed on page 59.

Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port D also serves the functions of various special features of the ATmega16 as listed on page 61. RESET Reset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. The minimum pulse length is given in Table 15 on page 36. Shorter pulses are not guaranteed to generate a reset. XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting Oscillator amplifier. AVCC AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. AREF AREF is the analog reference pin for the A/D Converter.

WORKING OPERATION

WORKING OPERATION

When an object come in front of train then light and sound is generated as an indication and the speed of the train is reduced automatically to avoid accidents. When train passes throught cross over gate, the gate will shut down and LED glow. Further we can add smoke and fire alarm in the train as a future implementation of our project. FM is placed at the station as an entertainment device for passengers

Transmitter section

Basically automotive locomotive consist of three parts. Power supply, transmitter, receiver section, and sensor and microcontroller section relay and power supply acts as a switching device. We can use bridge rectifier since its efficiency is very good. Capacitor is used after relay to remove jerk/spark which is produced by relay. In transmitter section transistor BC177 is used for switching as well as amplification. 555 timer is used for pulse generation as well as for oscillation. In this as we know that 555 timer works in three mode Astable mode, Multivibrator mode, monostable mode. But in our project 555 timer works in monostable mode

Receiver Section

In receiver section NPN transistor is used whose rating is BC 548. IR eye which acts as a sensor in receiver unit has a cabablity to sense upto 12 feet, so that major accidents can be prevented. Actually there are two sensors are used , GATE sensor as well as GATE sensor. When IR LED starts glowing oscillator starts generating frequency. Capacitor is grounded so that it can act as a low pass filter, which can pass low frequency signal through it and blocks high frequency signal. TSOP is used in place of REED switch, When photon energy falls on TSOP which acts as a mineaturised receiver for IR remote control system . Resistance is low and high frequency is generated. When input is present in 555 timer (oscillator circut) the output stage is low , but when there is no input, output become high. Demodulated output signal can be decoded by a

microcontroller unit. 4027 IC in receiver section acts as a flip flop. It acts as a controller of gate . Actually it is combination of hardware and software. In software we are using C language. Thus it is concluded that it is a minor part of C language. In transmitter section darlington amplifirer circuit is used . It consist of IR LED as well as resistances of trating 1k, 470 ohm, and 100 ohm. Red LED become active in day time and white LED become active in dark light as in tunnel..

CONTROL SECTION Model Railway Level Crossing Lights


The Automatic Railroad Crossing Controller (ARCC) is designed to operate signals and/or barriers as a train approaches a crossing, and then switch the signals off (and raise any barriers) once the end of the train is clear of the crossing. The system works by having four infra-red light beams across the track, as shown in Figure 1. The source of each infra-red beam is a suitable LED, positioned on one side of the track, and its light is detected on the opposite side of the track by a matching

phototransistor. Each of the four beams will be broken in sequence by the train as it travels along the track and over the crossing. If a train is approaching from the left, for example, the crossing signals, etc., are activated as the front of the train (locomotive) breaks beam A. The signals stay activated until the last car in the train has passed through beam C, and the beam is intact again. Similarly, for a train approaching from the right, the crossing signals area ctivated as beam D is broken, and continue until the complete train has passed through beam B. It is important to appreciate that all four beams are broken as the train moves through. When travelling from left to right, breaking beam B before beam D effectively tells the ARCC to ignore the breaking of beam D until the train has passed completely through the set of sensors, ie. until the last car has travelled beyond beam D. The ARCC is then returned to its "Ready" state, where the breaking of either beam A or D will trigger the crossing signals. A similar sequence applies for trains travelling from right to left, where the breaking of beam C stops the ARCC from re-triggering the crossing signals as soon as beam A is broken. One consequence of this mode of operation is that it is possible to confuse the ARCC by stopping and reversing the train while it is within the sensor area, ie. Positioned anywhere between beams A and D. The usual result is that the ARCC "sticks" in the state it was in when the train stopped. Normal operation can usually be restored by running the train forward again until it is completely beyond the sensor area, then reversing it back through all of the beams - at which point the ARCC should resume its "Ready" state with the crossing signals inactive. If this fails, then there is a Reset pushbutton fitted to the ARCC which, when operated, will sort out the mess. DUAL TRACK WORKING The ARCC is designed to handle only a single track, but it is possible to handle a railroad crossing with dual tracks, by fitting a second ARCC module, with its own set of four infra-red beam sensors. The two ARCCs are coupled together so that a train running in either direction, on either track, will operate the crossing signals. If

you have trains running across the crossing on both tracks simultaneously, then the first train to reach an outer sensor (its own A or D) will activate the crossing signals/barriers. These will stay active until BOTH trains are clear of their own inner sensors (the relevant B or C)Again, you can confuse the ARCCs by stopping and reversing a train on either track while within the sensor area - the best course of action is not to do it! SENSOR MOUNTING & ALIGNMENT Both the LED infra-red source and phototransistor detector are in standard T1 packages, 3mm in diameter. They are each mounted at one end of a short length of aluminium tubing (1/8in internal diameter by 3/4in long) to exclude interference from external lighting. The sensor pair are then carefully aligned, facing each other, on opposite sides of the track. If space is limited, the tubing could be cut down to, say, 1/2in long. In all cases, each sensor pair should be positioned in accordance with NMRA standard track clearances (S-7 Clearances). For HO scale this means that no part of the sensor assemblies should be closer than 26.2mm to the track centre line (although this could be reduced to 20.6mm on straight lengths of track). Each sensor pair is supplied ready wired to a 48in length of 4-core cable fitted with a plug to connect to the ARCC unit (see section 4 below), and with a pair of supporting plastic blocks. These blocks are made by NETLON, and are actually intended for some purpose in the garden or greenhouse but, for initial trials at least, they are a convenient means of supporting the sensors on either side of the track. There is probably no way the blocks could be disguised as scale trackside objects, but it is assumed that, ultimately, the sensors will be built into the layout landscaping or buildings. Details of the blocks are shown in Figure 2 below.

The end of the horizontal section holding the sensor shielding tube is drilled out to 5mm diameter, and the other end, where the LED or phototransistor is connected to the cable, is drilled out to 7mm diameter. The vertical hole below the sensor assembly is also made 7mm in diameter so that the LED or photransistor assembly can be passed through the block from below (via a suitable hole in the baseboard) before being positioned in the blocks horizontal section. This keeps the ARCC wiring reasonably tidy. The smaller, 3mm diameter, vertical hole in the block is used to secure it to the baseboard using a suitable screw or bolt. The sensor pair should be angled across the track, as shown in Figure 1, so that the ARCC does not .see. the inter-car gaps, ie. the beam stays broken for the complete length of the train. The angle is not critical (and does not have to be the same for each sensor pair) but should be at least 60 degrees for normal HO scale. The sensors will operate reliably over separations between LED and detector of at least 125mm (90mm between the ends of the shielding tubes) so that an angle of 45 degrees can be accommodated (as required for UK 00 scale, for example).

The really critical mounting dimension is the height of the beams. Each sensor pair must be positioned so that the beam is completely broken by each locomotive and car in the train for the total length of the train. If a beam can pass through some gap in the car structure, then the ARCC is liable to get a false indication that the end of the train has been detected, and the crossing signals will be switched off prematurely. The crossing signals can also be re-activated as the train continues through, leading to erratic, non-realistic operation. The optimum height setting is as shown in Figure 3, with the beams positioned 13mm (1mm) above top-of-rail, just below the floor level of each car. This is not absolutely foolproof as empty flat cars with a depressed loading platform , or some hopper cars with an open end-structure, can allow the beams to become reestablished momentarily. If you wish to run trains through the crossing with these types of cars, then it may be necessary to angle the sensor pairs downwards, as well as across the track, for example, to ensure 100% interruption of the beams by the available structure of the cars. A simpler alternative might be to modify the problem cars in some fashion to block the offending gaps - if this can be done without major departures from prototype scale. The plastic supporting blocks, as supplied, raise the sensor height to 20mm above the baseboard. Hence, if top-of-rail is less than 7mm above the baseboard, the blocks should be cut down to the appropriate height. Guide lines 3mm and 6mm from the base of each block have been scribed on to assist in cutting the blocks square.
12 R & D MR. DEEPAK KUMAR DWIVEDI

Once the two parts of the sensor pair are mounted on opposite sides of the track they should be carefully aligned. This can be done well enough by eye, but you can use a straight rod or bar laid in the grooves on top of the plastic blocks as an aid. A final check on sensor alignment can be done with the ARCC powered on, and using a high-impedance voltmeter to measure the voltage at the collector of each detector (at the base of Q2, Q4, Q6, or Q8 - see the attached circuit and board layout

diagrams). The voltage level should be around 0.2 volts - and definitely less than 0.5 volts. Adjust the sensor alignment for a minimum value. Sensor Cable Connections The sensors are supplied ready-wired to their connecting cables and plugs but, if it is necessary to make up replacements (to accommodate landscaping requirements, for example), then details are given in Figure 5. The leads of the emitter and detector should not be trimmed to less than 7mm from the body of the device, and soldering to the wires of the connecting cable should be done in the shortest time possible (consistent with making a reliable joint. Ensure that you observe the polarity of the devices as shown. Insulating sleeving over the joints is recommended to avoid short circuits as the sensors are manoeuvred into position

POWER SUPPLY

NO .

BLOCK DAIGRAM OF POWER SUPPLY

BRIDGE RECTIFIER Bridge rectifier circuit consists of four diodes arranged in the form of a bridge as shown in

ure.

PIC microcontroller
PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller". PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability. Microchip announced on February 2008 the shipment of its six billionth PIC processor.

Features
High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture 131 Powerful Instructions Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 16 MIPS Throughput at 16 MHz On-chip 2-cycle Multiplier Nonvolatile Program and Data Memories 16K Bytes of In-System Self-Programmable Flash Endurance: 10,000 Write/Erase Cycles Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation 512 Bytes EEPROM Endurance: 100,000 Write/Erase Cycles 1K Byte Internal SRAM Programming Lock for Software Security JTAG (IEEE std. 1149.1 Compliant) Interface Boundary-scan Capabilities According to the JTAG Standard Extensive On-chip Debug Support Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface Peripheral Features

Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode Real Time Counter with Separate Oscillator Four PWM Channels 8-channel, 10-bit ADC 8 Single-ended Channels 7 Differential Channels in TQFP Package Only 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
26 R & D MR. DEEPAK KUMAR DWIVEDI

Byte-oriented Two-wire Serial Interface Programmable Serial USART Master/Slave SPI Serial Interface Programmable Watchdog Timer with Separate On-chip Oscillator On-chip Analog Comparator Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated RC Oscillator External and Internal Interrupt Sources Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby I/O and Packages 32 Programmable I/O Lines 40-pin PDIP, 44-lead TQFP, and 44-pad MLF Operating Voltages 2.7 - 5.5V for ATmega16L 4.5 - 5.5V for ATmega16 Speed Grades 0 - 8 MHz for ATmega16L 0 - 16 MHz for ATmega16 Power Consumption @ 1 MHz, 3V, and 25C for ATmega16L Active: 1.1 mA Idle Mode: 0.35 mA Power-down Mode: < 1 A

Pin Descriptions
VCC Digital supply voltage. GND Ground. Port A (PA7..PA0) Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B (PB7..PB0) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B also serves the functions of various special features of the ATmega16 as listed on page 56. Port C (PC7..PC0) Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs. Port C also serves the functions of the JTAG interface and other special features of the ATmega16 as listed on page 59.

Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port D also serves the functions of various special features of the ATmega16 as listed on page 61. RESET Reset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. The minimum pulse length is given in Table 15 on page 36. Shorter pulses are not guaranteed to generate a reset. XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting Oscillator amplifier. AVCC AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. AREF AREF is the analog reference pin for the A/D Converter.

You might also like