Search Your Query

Custom Search
Showing posts with label Switching Circuits. Show all posts
Showing posts with label Switching Circuits. Show all posts

Monday, 30 May 2011

Automatic Railway Gate Control & Track Switching


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

Gate Control
:
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.
Railway crossing
Gate control
Track Switching
Using the same principle as that for gate control, we have developed a concept of automatic track switching. Considering a situation wherein an express train and a local train are travelling 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. Indicator lights have been provided to avoid collisions .Here the switching operation is performed using a stepper motor. In practical purposes this can be achieved using electromagnets.
Track Switching
Track Switching


Hardware Description
The project consists of four main parts:
  1. 8051 microcontroller
  2. IR Transmitter
  3. IR Receiver
  4. Stepper Motor Circuit
8051 Microcontroller
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. More details of the 8255 are given later.
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.
Block diagram of 8051 Microcontroller
Block diagram of 8051 Microcontroller
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 Transitter
The transmitter circuit consists of the following components:
  1. IC 555
  2. Resistors
  3. Capacitors
  4. IR LED
The IR LED emitting infrared light is put on in the transmitting unit. To generate IR signal, 555 IC based astable multivibrator is used. Infrared LED is driven through transistor BC 548.
IC 555 is used to construct an astable multivibrator which has two quasi-stable states. It generates a square wave of frequency 38kHz and amplitude 5Volts. It is required to switch ‘ON’ the IR LED.
IR Transmitter
IR Transmitter
IR Receiver
The receiver circuit consists of the following components:
  1. TSOP1738  (sensor)
  2. IC 555
  3. Resistors
  4. Capacitors
The receiver unit consists of a sensor and its associated circuitry.  In receiver section, the first part is a sensor, which detects IR pulses transmitted by IR-LED. Whenever a train crosses the sensor, the output of IR sensor momentarily transits through a low state. As a result the monostable is triggered and a short pulse is applied to the port pin of the 8051 microcontroller. On receiving a pulse from the sensor circuit, the controller activates the circuitry required for closing and opening of the gates and for track switching. The IR receiver circuit is shown in the figure below.
IR Receiver
IR Receiver
Stepper motor circuit
Stepper motor circuit
Stepper motor circuit
Here a stepper motor is used for controlling the gates.  A  stepper motor is a widely used device that translates electrical pulses into mechanical movement. They function as their name suggests – they “step” a little bit at a time.  Steppers don’t simply respond to a clock signal. They have several windings which need to be energized in the correct sequence before the motor’s shaft will rotate. Reversing the order of the sequence will cause the motor to rotate the other way.

Intelligent switch




This intelligent switch circuit en- ables automatic switching on of an emergency light system during darkness in the event of mains failure. The mains power failure condition is detected by the section consisting of mains step-down transformer X1 followed by bridge rectifier comprising diodes D1 through D4 and smoothing capacitor C1. If the mains is available then it causes energisation of relay RL1 which has two sets of changeover contacts. The light/darkness condition is detected by the circuit comprising photo-transistor FPT100/2N5777 followed by Darlington pair comprising transistors T2 and T3. However, this section will function only when mains supply is not available (i.e. when relay RL1 is in de-energised state) since battery supply (negative lead) path gets completed via lower N/C contact of relay RL1. During daylight, photo transistor conducts and places transistor T2 base near ground potential. Thus Darlington pair remains cut-off and relay RL2 remains de-ene- rgised. However, during darkness, ph- oto transistor is cut-off and therefore transistor T2 receives forward base bias via resistor R1 (connected to positive rail), as resistor R2 is no more grounded (via photo-transistor T1). As a result, relay RL2 gets energised. Thus it would be observed that when mains is absent (relay RL1 de-energised) and it is dark (relay RL2 energised), the switch output path is complete. In any other condition switch output path would get broken. The switch output terminals can be used (in series with supply) to control a lighting system directly or indirectly through another contactor/heavy-duty relay depending upon the load. The working of the intelligent switch is summarised in the table.

Sound Operated Switch

Description
A sound operated switch with a relay driver.



sound switch


Notes
This sensitive sound operated switch can be used with a dynamic microphone insert as above, or be used with an electret (ECM) microphone. If an ECM is used then R1 (shown dotted) will need to be included. A suitable value would be between 2.2k and 10kohms.

The two BC109C transistors form an audio preamp, the gain of which is controlled by the 10k preset. The output is further amplified by a BC182B transistor. To prevent instability the preamp is decoupled with a 100u capacitor and 1k resistor. The audio voltage at the collector of the BC182B is rectified by the two 1N4148 diodes and 4.7u capacitor. This dc voltage will directly drive the BC212B transistor and operate the relay and LED. It should be noted that this circuit does not "latch". The relay and LED operate momentarily in response to audio peaks.

The gain of the circuit and sensitivity is controlled by the 10k variable resistor on the emitter of the first (left hand side) transistor. A preset may be used if gain is fixed, a potentiometer should be used to trigger at different sound levels.

The relay contacts close and then open (momentary action) in response to audio peaks, these can be used to switch other circuit. The diode across the relay is the usual back emf diode and a 1N4003 or 1N4004 will work well here, preventing damage to the transistor.

Digital Combination Lock

Description
A multiple input combination loack using CMOS counter IC's. Flexibility and code change is allowed by changing output connections.

Click on image to open it in new window

Notes
The circuit above above makes use of the CMOS 4017 decade counter IC. Each depression of a switch steps the output through 0 - 9. By coupling the output via an AND gate to the next IC, a predefined code has to be input to create the output. Each PBS switch is debounced by two gates of a CMOS4001 quad 2-input NOR gate. This ensures a clean pulse to the input of each CMOS 4017 counter. Only when the correct number of presses at PBS A will allow PBS B to become active. This is similar for PBS C and PBS D. At IC4, PBS D must be pressed 7 times. Then PBS C is again pressed 7 times, stepping from output 1 to output 8. The AND gate formed around CMOS4081 then goes high, lighting the LED. The Reset switch can be pressed at any time. Power on reset is provided by the 100n capacitor near the reset switch. Below is a picture of one that I made about 15 years ago:

Lock PCB


Unfortunately, this board was part of a much larger project containing multiple power supplies. One day whilst working on another circuit , I slipped with a wire and splashed 24 volts DC onto this board. There was a small spark, and puff of smoke before all this chips were cooked! If anyone does consider building such a circuit, then my advice would be to stop and look in your local electronic parts catalogue. There are now dedicated combination lock IC's with combinations many times greater than this circuit. Incidentally the numberof combinations offered here is 10 x 10 x 10 x 10 x 9 = 90,000. 

Electronic Night Light

Description
This circuit for an electronic night light was submitted by Adam from Canada. I have provided the notes.



Circuit Notes
The two transistors are used as a direct coupled switch, Adam used 2SC711 but any general purpose transistor will do e.g. 2N3904, BC109C. The CDS photocell, type ORP12 is normally illuminated, therefore its resistance is low. The 50k control, the 1k resistor and the photocell form a potential divider which biases the first transistor. This transistor is on, its collector being held low, turns the last transistor and hence lamp and relay off.

In darkness, the resistance of the photocell becomes high and the first transistor switches off. The base voltage for the second transistor goes high, switching this transistor on and illuminating the lamp. Although Adam used a secondary supply of 3V , you could use any voltage and any lamp here. Make sure the relay contacts can handle the load. If using a large relay, it is preferable to wire a 1N4001 in reverse polarity across the coil. This will prevent the back EMF of the relay from damaging the transistors.

Electronic Doorbell with Counter

Description
This circuit uses a synthesized sound chip from Holtek, the HT-2811. This reproduces the sound of a "ding-dong" chiming doorbell. Additionally, the circuit includes a CMOS 4026 counter display driver IC to count your visitors.

doorbell counter


Circuit Notes
The Holtek HT-2811 is available from Maplin electronics in the UK, order code BH69A. The operating voltage must remain within 2.4 to 3.3 Vdc and standby current is minimal. The reset switch zeroes the count,and the 7 segment display is a common cathode type. To save power consumption the display can be enabled or disabled with a switch as shown in the above diagram. The count will still be held in memory. The IC pin out for the 4026 is shown in pin order below:

Pin 1 is the clock input
Pin 2 is the clock enable
Pin 3 is display enable
Pin 4 enables the carry output
Pin 5 is the carry output
Pin 6 is display segment f Pin 7 is display segment g
Pin 8 is 0 V.
Pin 9 is display segment d Pin 10 is display segment a
Pin 11 is display segment e Pin 12 is display segment b
Pin 13 is display segment c Pin 14 is the2 output
Pin 15 is reset
Pin 16 is +Vcc

The envelope of the chime is set by the 220k, 330k, 3u3 and 4u7 resistors and capacitors. These values are the manufactures default values, but may be adjusted to alter the length and delay of the chime.The combination of the 2k2, 22k and 47u resistor capacitor network has a double function. It provides a debouncing circuit for the bell press and at the same time has a sufficiently long time constant. This ensures that anyone rapidly pressing the doorbell switch, only advances the count once.The 47u capacitor may be increased in size, if needed.

Circuit Expansion
The count may be expanded for up to 99 visits by cascading two CMOS 4026 IC's and using an additional 7 segment display. This is achieved by wiring pin 5 ( the 10's output ) of the first CMOS4026 to pin 1 (the clock input) of the second IC.

Remote Doorbell Warning Switch

Description
This circuit will light a lamp at a remote location when the doorbell switch is pressed. This circuit should only be used with the solenoid type doorbells, the electronic type that play tunes will not work here.



Notes
It is quite easy to miss the sound of a doorbell if you are watching TV , this circuit gets round the problem by providing a visual indication. As an alternative, a LED could also be used. You could just parallel a lamp across the doorbell, but this would mean extra drain from the doorbell batteries or transformer.

A series resistor, R1 is wired in series with the doorbell and reduces current flow, thereby increasing battery life. The value of R1 is chosen so that about 0.6 to 0.7 volts is developed across it, when the doorbell switch is pressed. I used a combination of a 22 ohm resistor in parallel with a 50 ohm. The voltage drop across R1 is sufficient to switch on the transistor, the lamp in series with the collector will then illuminate. I also used an electromechanical counter in parallel with the lamp. This registered each time someone pressed the switch....in fact.

PBS Switch De-Bouncer

Description
This circuit will remove the transient spikes and contact bounces from a non-latching push button switch.

debounce circuit


Notes:
Using a 555 timer as a monostable circuit, it is easy to build a good switch debouncer circuit. There are many circuits for SPDT debouncing, but not many for a normally open, push-to-make press button switch (PBS). The 555 monostable gives an output pulse of around 20 msec with component values shown. The formula for determining the output pulse is:

tout = 1.1 R1 C1


With the values in my circuit this equates to:

tout = 1.1 x 1.8x106 x 10x10-9 = 0.0198 sec or 19.8ms

The 555 circuit can be re-triggered if the input is held low longer than the output pulse. To prevent this happening, I have included a further timing circuit comprised of the 1Meg resistor and 47n capacitor. Normally, the 47n capacitor is discharged via the 1 Meg resistor. When the switch is pressed the capacitor quickly charges and provides a brief negative pulse to the 555 input. When the capacitor is fully charged, the potential across the voltage divider formed by the 10k and 1Meg resistors is insufficient to retrigger the monostable. Releasing the switch quickly discharges the capacitor. The output of a 555 monostable is suitable for connecting to TTL and CMOS logic circuits.

Light Detector Circuit




Notes
Variable resistor R1 adjusts the light threshold at which the circuit triggers. R1's value is chosen to match the photocells resistance at darkness. The circuit uses a CMOS 4001 IC. Gate U1a acts as the trigger, U1b and c form a latch. S1 resets the circuit. The output device may be a low power piezo buzzer.

Electronic Door Release

Description
The IC is a quad 2 input "AND" gate, a CMOS 4081. These gates only produce a HIGH output, when BOTH the inputs are HIGH. When the key wired to 'E' is pressed, current through R1 and D1 switchs Q5 on.The relay energises; and Q5 is 'latched on' by R8. Thus, the Alarm is set by pressing a single key,say one of the two non-numeric symbols.



Notes
The IC is a quad 2 input "AND" gate, a CMOS 4081. These gates only produce a HIGH output, when BOTH the inputs are HIGH. When the key wired to 'E' is pressed, current through R1 and D1 switchs Q5 on.The relay energises; and Q5 is 'latched on' by R8. Thus, the Alarm is set by pressing a single key,say one of the two non-numeric symbols.The alarm will switch off when the 4 keys connected to "A,B,C,D" are pushed in the right order.The circuit works because each gate 'Stands' upon its predecessor.If any key other than the correct key is pushed, then gate 1 is knocked out of the stack, and the code entry fails. Pin 1 is held high by R4. This 'Enables' gate 1; and when button 'A' is pressed, the output at pin 3 will go high. This output does two jobs.It locks itself 'ON' through R2 and it 'Enables' gate 2, by taking pin 5, high. Now, if 'B' is pressed, the output of gate 2, at pin 4 will go high. This output does two jobs. It locks itself 'ON' through R3 and it 'Enables' gate 3 by taking pin 12 high.
Now, if 'C' is pressed, the output of gate 3 will lock itself 'ON' through R5 and, by taking pin 8 high, 'Enable' gate 4. Pressing 'D' causes gate 4 to do the same thing; only this time its output, at pin 10, turns Q4 'ON'. This takes the base of Q5 to ground, switching it off and letting the relay drop out. This switches the alarm off.
Any keys not connected to 'A B C D E' are wired to the base of Q1. Whenever 'E' or one of these other keys is pressed, pin 1 is taken low and the circuit is reset. In addition, if 'C' or 'D' is pressed out of sequence, then Q2 or Q3 will take pin 1 low and the circuit will reset. Thus nothing happens until 'A' is pressed.Then if any key other than 'B' is pressed, the circuit will reset.
Similarly, after 'B', if any key other than 'C' is pressed,the circuit will reset. The same reasoning also applies to 'D'.
The Keypad needs to be the kind with a common terminal and a separate connection to each key. On a 12 key pad, look for 13 terminals. The matrix type with 7 terminals will NOT do. Wire the common to R1 and your chosen code to 'A B C D'. Wire 'E' to the key you want to use to switch the alarm on. All the rest go to the base of Q1.
The diagram should give you a rough guide to the layout of the components, if you are using a stripboard. The code you choose can include the non-numeric symbols.In fact, you do not have to use a numeric keypad at all,or you could make your own keypad.
I haven't calculated the number of combinations of codes available, but it should be in excess of 10 000 with a 12 key pad; and, after all, any potential intruder will be ignorant of the circuit's limitations. Of Course, if you must have a more secure code, I can think of no reason why you shouldn't add another 4081 and continue the process of enabling subsequent gates. Or you could simply use a bigger keypad with more "WRONG" keys.
Any small audio transistors should do. The 27k resistors could be replaced with values up to 100k. And the only requirements for the 4k7 resistors is that they protect the junctions while providing enough current to turn the transistors fully on.
Capacitors (C1 C2 C3 C4 C5) are there to slow response time and overcome any contact bounce. They are probably unnecessary.

Frost Alarm

Description
A simple thermistor triggered switch with adjustable threshold. It triggers with cold temperatures so may be used as a frost alarm or cold temperature switch.

frost alarm


Circuit Notes
The thermistor used has a resistance of 15k at 25°C and 45k at 0° Celsius. A suitable bead type thermistor can be found in the Maplin catalogue. The 100k pot allows this circuit to trigger over a wide range of temperatures.

If using a different thermistor then the control should match the new thermistor at its highest resistance, or be higher in value. The op-amp in this circuit is the ubiquitous 741. It may be catalogued as LM741, CA741 etc, all types will work. In this circuit it is used as a comparator. The non-inverting input (pin 3) is biased to half the supply voltage. The inverting input is connected to the junction of the thermistor and potentiometer. The control is adjusted so that the circuit is on when the thermistor is at the required temperature range. Once the thermistor is outside the temperature range its resistance alters and the op-amp output changes from near full supply to around 1 or 2 volts dc. There is insufficient voltage to turn on the transistor and the relay will not energise.

A slight amount of hysteresis is provided by inclusion of the 270k resistor. This prevents rapid switching of the circuit when the temperature is near to the switching threshold.

PCB Layout
Below is a PCB layout made with Kicad. There are many possibilities for PCB layouts, this one is single sided with the 3D layout shown below.
Silk Screen
The top (component) layer is shown below. Drawn on the silk drawn are component outlines and component references.
The schematic drawn is kicad is shown below to match PCB component references.
Silk Screen
Below is an actual size (1:1) view of the copper layer. It is advisable to print this off first on paper and then see if the outline of components matches the physical side. Of particular importance is the relay. A relay with 2 changeover contacts is used. This relay is made by Finder Electronics type 40.52. PDF brochure with physical dimensions.
Download all the PCB files in kicad format: FrostAlarm
Related Posts Plugin for WordPress, Blogger...