Grade Crossing Hardware Description




Refer to the Grade Crossing Schematic

Operationally, the design is train direction independent so the sensors C1 and C3 are connected to the BS2 using a 74HC32 "or" gate. This saves a BS2 I/O bit and simplifies the code. Each controlled signal requires four BS2 I/O bits. Two are for the train sensors C1/C3 and C2. Each of the remaining two BS2 I/O bits connect to a lamp in the signals. All appropriate lamps from multiple signal stands at the grade crossing are wired in parallel. The flashing effect is created by changing the states of the BS2 I/O bits connected to the lamps.

The BS2 I/O pins that drive the lamps are buffered using a ULN2803. This device can sync up to 500 milliamps of current which is adequate for driving most incandescent lamps. The circuit uses 6 volt lamps powered at 5 volts to reduce brightness for a more proto-typical appearance. A resistor in series with each lamp can reduce brightness further if necessary.

An alternative lamp circuit using Led's is also shown. A single BS2 I/O pin can source up to 20 milliamps of current. Use care when connecting multiple Led's to the BS2 I/O pins. The total source current across all BS2 I/O pins should not exceed 40 milliamps. The 470 ohm resistor sets the led current to about 1 milliamp. Adjust this resistor value to obtain the desired Led brightness.

As used in this design, the infrared emitter/detector pairs work reliably for a distance up to about 5 inches using the 100 ohm emitter diode resistor. This distance can be improved by lowering the emitter diode resistor value to increase current. Do not exceed the maximum continuous forward current rating of the emitter diode. Some optical shielding may be necessary to prevent stray infrared emissions from affecting other detectors.

If greater distance or detector sensitivity is required, the 20K variable resistor and 2N3904 transistor circuit shown on the schematic can be added to any of the detector circuits. This makes the detector circuit very sensitive to room lighting conditions so detector light shielding must be done. Use the variable resistor to adjust the detector sensitivity level.

BS2 I/O bit sensor inputs for an unused signal position should be tied to ground.

An input pin of the Basic Stamp is connected to an on/off switch and used to enable/disable the crossing sounds. Only the crossing sounds (bell, passing train) are affected. All other crossing gate related functions (flashing lights, gates) are not affected.

An input pin of the Basic Stamp is connected to another dip switch and used to select normal or test mode program operation. When off (1), normal grade crossing functions as described herein are enabled. When on (0), test mode is enabled. A test/exercise routine is run in test mode. Crossing lights are each flashed three times. The crossing gates are lowered and sound 1 is played if enabled. The crossing gates are raised and sound 2 is played if enabled. Changing the switch from test to normal mode causes a software reset to be performed. All internal working variables are set to default conditions.

The normal/test mode pin is also connected to a led that serves as a heartbeat indicator. When the program mainloop timing is set properly, this indicator will flash once per second.

The ICCT sound module contains a playback IC that is programmed with two sounds. The sound module contains its own volume control and audio amplifier that can drive a speaker directly. The sound module is wired to the BS2 to permit program control of the sounds. The sound start inputs to the sound module are programmed to be level sensitive. That is, a sound will playback continuously as long as its start input is active. If building the non-ULN2803 version of the circuit, the polarity of the sound start bits must be changed in the code from active high to active low.

Each gate servo is connected directly to its corresponding BS2 I/O pin. No special drive circuits are required unless there is a very long distance between the BS2 and the servo. If erratic servo operation is noted, try a shielded twisted pair cable.

Color Bar

Navigation:   D&B Home   Buczynski.com Index

Copyright © 2006 Don Buczynski
San Diego, California