Silicon ChipLevel Crossing Detector For Model Railways - March 1994 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: It's your magazine - tell us what you want
  4. Feature: High Energy Batteries For Electric Cars by ABB Review
  5. Feature: What's New In Car Electronics by Julian Edgar
  6. Project: Intelligent IR Remote Controller by Ben Douchkov
  7. Project: Build A 50W Audio Amplifier Module by Darren Yates
  8. Order Form
  9. Feature: Electronic Engine Management; Pt.6 by Julian Edgar
  10. Project: Level Crossing Detector For Model Railways by John Clarke
  11. Feature: Switching Regulators Made Simple by Darren Yates
  12. Serviceman's Log: We all make mistakes sometimes by The TV Serviceman
  13. Project: Voice Activated Switch For FM Microphones by Darren Yates
  14. Book Store
  15. Feature: Amateur Radio by Garry Cratt, VK2YBX
  16. Project: Build A Simple LED Chaser by Darren Yates
  17. Feature: Computer Bits by Darren Yates
  18. Review: Bookshelf by Silicon Chip
  19. Feature: Remote Control by Bob Young
  20. Vintage Radio: Refurbishing a Trio 9R-59D communications receiver by John Hill
  21. Feature: Manufacturer's Data On The LM3876 IC by Leo Simpson
  22. Back Issues
  23. Product Showcase
  24. Market Centre
  25. Outer Back Cover

This is only a preview of the March 1994 issue of Silicon Chip.

You can view 34 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Build A 50W Audio Amplifier Module":
  • 50W Amplifier Module PCB pattern (PDF download) [01103941] (Free)
Articles in this series:
  • Electronic Engine Management; Pt.1 (October 1993)
  • Electronic Engine Management; Pt.1 (October 1993)
  • Electronic Engine Management; Pt.2 (November 1993)
  • Electronic Engine Management; Pt.2 (November 1993)
  • Electronic Engine Management; Pt.3 (December 1993)
  • Electronic Engine Management; Pt.3 (December 1993)
  • Electronic Engine Management; Pt.4 (January 1994)
  • Electronic Engine Management; Pt.4 (January 1994)
  • Electronic Engine Management; Pt.5 (February 1994)
  • Electronic Engine Management; Pt.5 (February 1994)
  • Electronic Engine Management; Pt.6 (March 1994)
  • Electronic Engine Management; Pt.6 (March 1994)
  • Electronic Engine Management; Pt.7 (April 1994)
  • Electronic Engine Management; Pt.7 (April 1994)
  • Electronic Engine Management; Pt.8 (May 1994)
  • Electronic Engine Management; Pt.8 (May 1994)
  • Electronic Engine Management; Pt.9 (June 1994)
  • Electronic Engine Management; Pt.9 (June 1994)
  • Electronic Engine Management; Pt.10 (July 1994)
  • Electronic Engine Management; Pt.10 (July 1994)
  • Electronic Engine Management; Pt.11 (August 1994)
  • Electronic Engine Management; Pt.11 (August 1994)
  • Electronic Engine Management; Pt.12 (September 1994)
  • Electronic Engine Management; Pt.12 (September 1994)
  • Electronic Engine Management; Pt.13 (October 1994)
  • Electronic Engine Management; Pt.13 (October 1994)
Items relevant to "Level Crossing Detector For Model Railways":
  • Level Crossing Detector PCB pattern [15203931] (Free)
Items relevant to "Switching Regulators Made Simple":
  • DOS software for Switching Regulators Made Simple (Free)
Items relevant to "Voice Activated Switch For FM Microphones":
  • Voice Activated Switch PCB pattern (PDF download) [01203941] (Free)
Articles in this series:
  • Amateur Radio (November 1987)
  • Amateur Radio (November 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (February 1988)
  • Amateur Radio (February 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (January 1989)
  • Amateur Radio (January 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (February 1990)
  • Amateur Radio (February 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (July 1990)
  • Amateur Radio (July 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (January 1991)
  • Amateur Radio (January 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (January 1992)
  • Amateur Radio (January 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (January 1993)
  • Amateur Radio (January 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (February 1994)
  • Amateur Radio (February 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (January 1995)
  • Amateur Radio (January 1995)
  • CB Radio Can Now Transmit Data (March 2001)
  • CB Radio Can Now Transmit Data (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • Stressless Wireless (October 2004)
  • Stressless Wireless (October 2004)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Dorji 433MHz Wireless Data Modules (January 2012)
  • Dorji 433MHz Wireless Data Modules (January 2012)
Items relevant to "Build A Simple LED Chaser":
  • Simple LED Chaser PCB pattern (PDF download) [08103941] (Free)
Items relevant to "Computer Bits":
  • DOS software for Computer Bits, March 1994 (BINARY.BAS/EXE) (Free)
Articles in this series:
  • Computer Bits (July 1989)
  • Computer Bits (July 1989)
  • Computer Bits (August 1989)
  • Computer Bits (August 1989)
  • Computer Bits (September 1989)
  • Computer Bits (September 1989)
  • Computer Bits (October 1989)
  • Computer Bits (October 1989)
  • Computer Bits (November 1989)
  • Computer Bits (November 1989)
  • Computer Bits (January 1990)
  • Computer Bits (January 1990)
  • Computer Bits (April 1990)
  • Computer Bits (April 1990)
  • Computer Bits (October 1990)
  • Computer Bits (October 1990)
  • Computer Bits (November 1990)
  • Computer Bits (November 1990)
  • Computer Bits (December 1990)
  • Computer Bits (December 1990)
  • Computer Bits (January 1991)
  • Computer Bits (January 1991)
  • Computer Bits (February 1991)
  • Computer Bits (February 1991)
  • Computer Bits (March 1991)
  • Computer Bits (March 1991)
  • Computer Bits (April 1991)
  • Computer Bits (April 1991)
  • Computer Bits (May 1991)
  • Computer Bits (May 1991)
  • Computer Bits (June 1991)
  • Computer Bits (June 1991)
  • Computer Bits (July 1991)
  • Computer Bits (July 1991)
  • Computer Bits (August 1991)
  • Computer Bits (August 1991)
  • Computer Bits (September 1991)
  • Computer Bits (September 1991)
  • Computer Bits (October 1991)
  • Computer Bits (October 1991)
  • Computer Bits (November 1991)
  • Computer Bits (November 1991)
  • Computer Bits (December 1991)
  • Computer Bits (December 1991)
  • Computer Bits (January 1992)
  • Computer Bits (January 1992)
  • Computer Bits (February 1992)
  • Computer Bits (February 1992)
  • Computer Bits (March 1992)
  • Computer Bits (March 1992)
  • Computer Bits (May 1992)
  • Computer Bits (May 1992)
  • Computer Bits (June 1992)
  • Computer Bits (June 1992)
  • Computer Bits (July 1992)
  • Computer Bits (July 1992)
  • Computer Bits (September 1992)
  • Computer Bits (September 1992)
  • Computer Bits (October 1992)
  • Computer Bits (October 1992)
  • Computer Bits (November 1992)
  • Computer Bits (November 1992)
  • Computer Bits (December 1992)
  • Computer Bits (December 1992)
  • Computer Bits (February 1993)
  • Computer Bits (February 1993)
  • Computer Bits (April 1993)
  • Computer Bits (April 1993)
  • Computer Bits (May 1993)
  • Computer Bits (May 1993)
  • Computer Bits (June 1993)
  • Computer Bits (June 1993)
  • Computer Bits (October 1993)
  • Computer Bits (October 1993)
  • Computer Bits (March 1994)
  • Computer Bits (March 1994)
  • Computer Bits (May 1994)
  • Computer Bits (May 1994)
  • Computer Bits (June 1994)
  • Computer Bits (June 1994)
  • Computer Bits (July 1994)
  • Computer Bits (July 1994)
  • Computer Bits (October 1994)
  • Computer Bits (October 1994)
  • Computer Bits (November 1994)
  • Computer Bits (November 1994)
  • Computer Bits (December 1994)
  • Computer Bits (December 1994)
  • Computer Bits (January 1995)
  • Computer Bits (January 1995)
  • Computer Bits (February 1995)
  • Computer Bits (February 1995)
  • Computer Bits (March 1995)
  • Computer Bits (March 1995)
  • Computer Bits (April 1995)
  • Computer Bits (April 1995)
  • CMOS Memory Settings - What To Do When The Battery Goes Flat (May 1995)
  • CMOS Memory Settings - What To Do When The Battery Goes Flat (May 1995)
  • Computer Bits (July 1995)
  • Computer Bits (July 1995)
  • Computer Bits (September 1995)
  • Computer Bits (September 1995)
  • Computer Bits: Connecting To The Internet With WIndows 95 (October 1995)
  • Computer Bits: Connecting To The Internet With WIndows 95 (October 1995)
  • Computer Bits (December 1995)
  • Computer Bits (December 1995)
  • Computer Bits (January 1996)
  • Computer Bits (January 1996)
  • Computer Bits (February 1996)
  • Computer Bits (February 1996)
  • Computer Bits (March 1996)
  • Computer Bits (March 1996)
  • Computer Bits (May 1996)
  • Computer Bits (May 1996)
  • Computer Bits (June 1996)
  • Computer Bits (June 1996)
  • Computer Bits (July 1996)
  • Computer Bits (July 1996)
  • Computer Bits (August 1996)
  • Computer Bits (August 1996)
  • Computer Bits (January 1997)
  • Computer Bits (January 1997)
  • Computer Bits (April 1997)
  • Computer Bits (April 1997)
  • Windows 95: The Hardware That's Required (May 1997)
  • Windows 95: The Hardware That's Required (May 1997)
  • Turning Up Your Hard Disc Drive (June 1997)
  • Turning Up Your Hard Disc Drive (June 1997)
  • Computer Bits (July 1997)
  • Computer Bits (July 1997)
  • Computer Bits: The Ins & Outs Of Sound Cards (August 1997)
  • Computer Bits: The Ins & Outs Of Sound Cards (August 1997)
  • Computer Bits (September 1997)
  • Computer Bits (September 1997)
  • Computer Bits (October 1997)
  • Computer Bits (October 1997)
  • Computer Bits (November 1997)
  • Computer Bits (November 1997)
  • Computer Bits (April 1998)
  • Computer Bits (April 1998)
  • Computer Bits (June 1998)
  • Computer Bits (June 1998)
  • Computer Bits (July 1998)
  • Computer Bits (July 1998)
  • Computer Bits (November 1998)
  • Computer Bits (November 1998)
  • Computer Bits (December 1998)
  • Computer Bits (December 1998)
  • Control Your World Using Linux (July 2011)
  • Control Your World Using Linux (July 2011)
Articles in this series:
  • Remote Control (March 1994)
  • Remote Control (March 1994)
  • Remote Control (May 1994)
  • Remote Control (May 1994)
Level crossing detector for model railways Add realism to your model train layout with this level crossing circuitry. It will detect the approach of a train, monitor its passing & provide an output to control circuitry to flash lights & sound a synthesised bell. By JOHN CLARKE Most model train enthusiasts will want to include at least one level crossing on their layout. Such a feature increases the realism since it is so commonplace on real railways and the effect is heightened if you have a convincing sound and lights display. This month we are presenting the level crossing detector circuitry and this will be followed next month with an accompany­ ing sound and lights module. This will flash the lights at a similar rate to the real live units and 38  Silicon Chip will even go so far as to simulate the distinctive ding ding of the bell, right down to the random variation in the bell ringing which is so characteristic of level crossing bells. The train detector circuit is suitable for both single and double track crossings and it also caters for situations where there are points to a siding in the track immediately before or after the crossing. This is often the case in rural areas. The circuit is designed to detect the train as it approach­es the crossing and start the lights and sound module. When the train has passed through the crossing, the lights and sound module is turned off. Two train sensors are required, one before the crossing and one after. They will need to be placed suffi­ciently far from the crossing to simulate realism. This will depend on the size of the layout, the length of trains being run and the operating speeds. The sensors are Hall Effect devices measuring 4.5 x 4.5 x 1.5mm and are placed directly between the sleepers of the train track. With typical ballast­ed track, they will be virtually invisible. They provide a signal in the presence of a magnetic field. At least two magnets must be concealed under each train, one under the leading locomotive and one under the last wagon at the end of the train. We expect that constructors will want to fit all their lo- ROAD LIGHTS 1A 2A TRACK SENSOR A SENSOR B 1B 2B LIGHTS MAGNET MAGNET REAR CARRIAGE Fig.1a (left): this diagram shows the general arrangement of a railway crossing with the sensors in place. Each sensor is placed at a realistic distance away from the intersection so that the crossing lights will provide sufficient warning of an approaching train. If the crossing also includes points, as shown in Fig.1b, a third sensor is required. MIDDLE CARRIAGE(S) ENGINE Fig 1a SENSOR C LIGHTS ROAD SENSOR B SENSOR A LIGHTS Fig 1b comotives and guards’ vans (cabooses) with magnets, as well as any wagons with end-of-train flashers. The circuitry is designed to count up to 15 magnets per train which should give a lot of versatility in how each train is made up. This will cater for double, triple and quadruple heading of locomotives. If the number of cars with magnets in a train exceeds 15, the circuit may briefly interrupt the sound and lights module while the train is passing through the crossing but this is unlikely to be noticed. Fig.1 shows the general arrangement of a railway crossing with the sensors in place. Each sensor is placed at a realistic distance away from the intersection so that the crossing lights will provide sufficient warning of an approaching train. If the crossing also includes points as shown in Fig.1b, a third sensor is required. Note that the level crossing detector will operate for A single PC board accommodates all the parts for the level crossing detector, except for the magnets & track sensors. trains travelling in either direction. If there are two tracks, then two separate train detector circuits will be re­quired and their outputs are connected in parallel. How it works Fig.2 shows the block diagram of the level crossing train detector. This shows three Hall effect sensors which detect the magnets under the train. The output from sensor A is amplified by op amp IC1a and then fed to a window comparator comprising IC2a & IC2b. Upon detection of a magnet by the sensor, the window com­parator clocks the DOWN input of counter IC3. Sensor B and sensor C, connected to op amp IC1b, are in parallel so that either sensor can detect the presence of a magnet. IC1b drives a window comparator comprising IC2c and IC2d which clocks the UP input of counter IC3. In effect, IC3 counts down the pulses from the first sensor and counts up those from the second sensor. As soon as the count of IC3 changes from zero (either up or down), zero detector circuit IC4 goes low, to turn on the sound and lights module. March 1994  39 RESET AMPLIFIER IC1a COMPARATOR IC2a,b SENSOR A COUNT DOWN COUNTER IC3 SENSOR B SENSOR C '0' DETECTOR OUTPUT IC4 COUNT UP IC1b IC2c,d Fig.2: the Level Crossing Train Detector uses Hall Effect sensors to detect magnets mounted under the train. The outputs from the Hall effect sensors are amplified & fed to two window comparators (IC2a,b & IC2c,d) which clock UP/ DOWN counter IC3. IC3 in turn drives zero detector stage IC4. Initially, IC3 is set to zero when power is first ap­ plied. As soon as a train is detected by sensor A, IC3 counts down by one and the zero detector switches to activate the sound and lights module. As each train magnet passes over sensor A, IC3 counts down by one. When the train passes over sensor B, IC3 counts up by one for each train magnet until the train has passed. Since the number of magnets which pass over sensor A must equal the number of magnets which pass over sensor B, IC3 will ultimately count back to zero and this will switch off the sound and lights module. In the unlikely event that there is some problem, there is a manual reset switch for the counter to be set back to zero. Now let’s have a look at the complete circuit for the train detector which is shown in Fig.3. The Hall effect sensors, A, B and C, are powered from 5V and provide an output voltage at their pin 3 which is about half supply. When the south pole of a magnet is brought near the labelled side of the sensor, the output swings high while for a north pole the output will swing low. Note that these Hall effect sensors are linear types without logic output circuitry. They have been specified because they have higher sensitivity. The sensors are AC-coupled to the following amplifier cir­cuits, IC1a for sensor A and IC1b for the B and C sensors. Trim­pots VR1, VR2 & VR3 provide facility to adjust the gain of the amplifier for each sensor so that the magnets can be detected reliably. The 0.1µF capacitors across the 1MΩ feedback resistors for IC1a and IC1b reduce the amount of noise at the amplifier outputs and prevent false triggering of the following comparator stages. IC1a and IC1b are biased at half supply by the 10kΩ voltage divider network at pins 3 & 5. As mentioned above, IC2a and IC2b comprise a window comparator. This is so-named because it has two voltage thresholds, the upper at +2.92V (pin 9) and the lower at +2.22V (pin 12). IC2a & IC2b have open-collector outputs and these are connected together and to a common 3.3kΩ pullup resistor. So when ever the commoned inputs at pins 8 & 11 are within the window, both com­ parator outputs are high. However, when the inputs are pull­ ed above +2.92V or below +2.22V, the commoned comparator output goes low and the negative transition is coupled to the COUNT DOWN input of IC3 (pin 4) via a 330pF capacitor. Both the upper and lower thresholds of the comparators have hysteresis, as set by 100kΩ resistors to pins 9 & 11. Thus, when the voltage at the output of IC1a goes above the 2.92V threshold of IC2a, IC2a’s output goes low. The 100kΩ resistor between pins 9 & 14 pulls pin 9 down to +2.72V so that IC1a’s output must go below this 2.72V threshold before IC2a’s output can go high again. This provides about 200mV of hystere­sis. Similarly, when the output of IC1a goes below the +2.22V threshold of IC2b, its output goes low and the 100kΩ resistor between pins 13 & 11 pulls the voltage at pin 11 down by a fur­ther 200mV. This again provides 200mV of hysteresis. Thus the commoned output of IC2a and IC2b goes low whenever the output of IC1a goes above +2.92V or below +2.22V. The window comparator comprising IC2c and IC2d works in exactly the same fashion. It drives the COUNT UP input of IC3 via a 330pF capacitor. Diodes D2 and D3 protect the count inputs of IC3 by clamping them to 0.6V above the 5V line, each time the window comparator outputs go high. IC3 is an up/down 4-bit binary counter which has a maximum count of 16. It is reset by a power-on reset provided by the 10µF capacitor and The position of the train is sensed by using two or more Hall effect sensors to detect magnets mounted in wagons at either end. The Hall effect sensors are mounted under the track, flush with the sleepers (see above). 40  Silicon Chip +5V 3.3k 100k 0.1 8.2k 0.1 +2.92V 1M 1 2 47 3 BP VR1 100k 2 3 SENSOR A UGN3503U 9 8 7 1 IC1a LM358 100W D2 1N4148 3 IC2a LM339 2.2k 14 LOAD 4 COUNT DOWN 100k 2.7k 13 IC2b RESET S1 12 +5V 14 COUNT UP 12 3 10k 8 CLEAR 100k C E VIEWED FROM BELOW 10k 10 8.2k B 5 +5V 10 +2.92V 2 VR2 100k 0.1 SENSOR B UGN3503U 2 7 100  47 3 BP SENSOR C UGN3503U D3 1N4148 7 6 QC QD 3 6 7 12 9 8 14 IC2c 2.2k 10 IC4b 4.7k 6 5 4 330pF 10k D1 1N4004 5 +2.22V VR3 100k 4 Q1 BC548 B C OUTPUT E 2.7k IC2d +5V IC4c 1 100k 1M +5V 1 6 IC1b QA 2 11 5 47 3 BP 1 100k 8.2k +5V B QB IC4a 13 4071 7 3.3k 1 9 D IC3 40193 11 LABEL SIDE 10 C +5V +2.22V 12 15 A 4.7k 4 11 16 330pF 2 180  0.5W +5V 12V INPUT 1000 16VW ZD1 5.1V 400mW 470 16VW 8.2k LEVEL CROSSING TRAIN DETECTOR USED ONLY FOR SWITCHED TRACK LAYOUTS Fig.3: the complete circuit for the Level Crossing Train Detector. When a sensor detects a train magnet, the output from its corresponding window detector goes low & clocks IC3 (the UP/DOWN counter). OR gates IC4a-4c detect the zero state & drive Q1 for all other counts. 100kΩ resistor at the clear input (pin 14). Switch S1, connected to the Clear input at pin 14, allows the counter to be reset at any time. The binary outputs of IC3 are monitored by 2-input OR gates IC4a and IC4b. These have a high output when any input is high. IC4a and IC4b are in turn monitored by OR gate IC4c. Its output goes high whenever any of the outputs of IC3 are high. Thus, the output of IC4c is low only when IC3 is reset or at “0”. IC4a drives transistor Q1 via a 10kΩ resistor. So let’s now recap on how the circuit works. The Hall effect sensors detect magnets under locomotives and carriages in the train as it passes. The magnets are counted up as the train passes over the first sensor and count­ ed down as they pass over the second sensor. The OR gate zero detector at the output of IC3 then determines whether the sound and lights module is turned on or off. Power is derived from a 12V supply via a 180Ω resistor and is regulated using 5.1V zener diode ZD1. D1 protects against reverse polarity connection and also provides isolation from ripple on the 12V supply which is decoupled using a 1000µF capacitor. Construction The train detector is constructed on a PC board measuring 140 x 79mm and coded 15203931. We used PC mounting terminal blocks for all external connections but PC stakes could be used as a cheaper alternative. Begin construction by checking the boards for any broken tracks or shorts on the copper pattern. Repair any faults that you do find, then install the resistors, link, PC stakes (if used) and ICs. Note that IC2 is oriented differently to the other ICs. Now install the transistor, zener diode and diodes, making sure that they are oriented correctly. The trimpots and capacitors can be mounted now but take care with the orientation of the electrolytic capacitors. The 47µF bipolar electrolytics can be mounted either way around. Finally, if you are using terminal blocks, mount these as well. Note that if you need to use a third sensor for points, you must install trimpot VR3 and its associated 47µF bipolar capacitor. March 1994  41 ZD1 2 2.2k 3.3k 100k 2.7k 100k 100k 10k 2.2k 1 IC4 4071 +12V GND GND + 1 3.3k 47uF BP D1 330pF 8.2k 8.2k 2 100 1 D2 4.7k 3 1 100k VR2 IC2 LM339 2.7k 1 IC1 LM358 0.1 2 D3 TO S1 IC3 40193 330pF 8.2k 1 100  1M 0.1 10k 47uF BP 3 SENSOR A 470uF VR3 1 SENSOR B 8.2k 10uF 100k SENSOR C 47uF BP 4.7k 3 1M 0.1 10k OPTIONAL PARALLEL INPUT Q1 SUPPLY OUTPUT 1000uF VR1 180  10uF Fig.4: install the parts on the PC board exactly as shown here & note that IC2 faces in the opposite direction to the other ICs. Once the PC board has been assembled, it is ready for testing. Temporarily connect the Hall Effect sensors (sensor A and sensor B) and switch S1. To see whether the output transistor Q1 is switching correctly, you will need a LED connected in series with a 2.2kΩ resistor from the collector to the +5V sup­ply. You will also need to connect up the power supply inputs (the +12V and GND terminals). Note that the power for the PC boards should be obtained from a 12V DC supply. If you built the Walkaround Throttle de­scribed in April & May 1988 or the infrared controller described in April, May & June 1992, you won’t need a separate supply as this facility is already provided. Before applying power, check that you have your multimeter ready to measure the DC voltages on the PC board. Set all trimpots to midway initially, then apply power and check that the voltage across ZD1 is close to +5V. If not, switch off and find the fault before applying power again. With power on, you can bring a magnet near one of the Hall sensors. The LED associated with Q1 should then light up. If all is operating satisfactorily, you can install the sensors beneath the track. We recommend that the wires for each sensor be bent at right angles and passed through holes on the lay- Fig.5: check your PC board against this fullsize etching pattern before mounting any of the parts. RESISTOR COLOUR CODES ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ No. 2 5 3 4 2 2 2 2 1 2 42  Silicon Chip Value 1MΩ 100kΩ 10kΩ 8.2kΩ 4.7kΩ 3.3kΩ 2.7kΩ 2.2kΩ 180Ω 0.5W 100Ω 4-Band Code (1%) brown black green brown brown black yellow brown brown black orange brown grey red red brown yellow violet red brown orange orange red brown red violet red brown red red red brown brown grey brown brown brown black brown brown 5-Band Code (1%) brown black black yellow brown brown black black orange brown brown black black red brown grey red black brown brown yellow violet black brown brown orange orange black brown brown red violet black brown brown red red black brown brown brown grey black black brown brown black black black brown This photograph shows how a magnet can be mounted on the bottom of a wagon. out. The sensors can be mounted flush with the sleepers and can be mount­ed with the label side up or down. Magnets can be attached to the underside of your locomo­ tives and carriages using glue or a screw and nut. For best results, try to mount all the magnets so that they are about the same height above the track. For some locomotives, there is very little room to mount a magnet on the underside. In some diesels, it should be possible to fit a magnet inside the fuel tank in place of the bottom sheet steel weight. In steam locomotive models, it may generally be easier to mount the magnet underneath the tender wagon. We used magnets from a variety of sources, including those supplied with cheap magnetic door catches. These can be cut down in size by firstly scoring a line where the break is required, then clamping the magnet in a vyce and breaking it at the score with a hammer. Use safety goggles when doing this, by the way. The magnets can be mounted with either their north or south poles facing down. Trimpots VR1 and VR2 for sensor A and sensor B (and VR3 for sensor C) will require adjustment for best results. To do this, connect your multimeter between ground and pin 1 of IC3 on the train detector PC board. Run the locomotive and carriages over the sensor and adjust the associated trimpot so that the multi­meter goes from a low to a high or from a high to a low once for each passing magnet. If the gain is too high (ie, the trimpot is too far anticlockwise), then the multimeter will go high or low several times per passing magnet. If the gain is too low (ie, the trimpot is too far clockwise), the multimeter may not change from PARTS LIST 1 PC board, code 15203931, 140 x 79mm 2 6-way PC mount terminal blocks 1 momentary contact pushbutton switch (S1) Magnets (minimum 2 per train), Tandy 64-1875 or salvage from magnetic door catches 1 20mm length of 0.8mm tinned copper wire 2 100kΩ horizontal trimpots (VR1,VR2) Semiconductors 1 LM358 dual op amp (IC1) 1 LM339 quad comparator (IC2) 1 40193, 74HC193 up/down counter (IC3) 1 4071 quad 2-input OR gate (IC4) 2 UGN3503U linear Hall effect sensors (sensors A & B) 1 BC548 NPN transistor (Q1) 1 1N4004 1A diode (D1) 2 1N4148 diodes (D2,D3) 1 5.1V 400mW zener diode (ZD1) Capacitors 1 1000µF 16VW electrolytic 1 470µF 16VW electrolytic 2 47µF 50V bipolar electrolytic low to high or high to low. Some final adjustments may be necessary once the PC boards have been incorporated in your train layout , so allow access to the trimpots during installation. These final adjustments will have to wait until the Sound and Lights 2 10µF 16VW electrolytic 3 0.1µF MKT polyester 2 330pF MKT polyester Resistors (1%, 0.25W) 2 1MΩ 2 3.3kΩ 5 100kΩ 2 2.7kΩ 3 10kΩ 2 2.2kΩ 4 8.2kΩ 1 180Ω 0.5W 2 4.7kΩ 2 100Ω Extras for switched track layout 1 3-way PC mount terminal block 1 UGN3503U Hall effect sensor (sensor C) 1 47µF bipolar electrolytic capacitor 1 100kΩ horizontal trimpot (VR3) Parts availability A kit of parts for this project should be available from Dick Smith Elec­ tronics, Jaycar Electronics and Al­ tron­ics. The UGN­3503U Hall Effect sensors are available separately from Farnell Electronics, phone (02) 645 8888. Magnets are available from Tandy Electronics or can be salvaged from the magnetic door catches sold in hard­ware stores. Module is built and involve running trains over the level crossing at various speeds. If any sensor fails to operate reliably, it’s simply a matter of adjusting its associated trimpot. The reset switch will come in handy during these adjust­ments should the circuit SC malfunction. March 1994  43