Silicon ChipA Train Detector For Model Railways - June 1995 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Computers can be a fire hazard
  4. Feature: Electronically-Controlled LPG System For Fuel Injected Engines by Julian Edgar
  5. Project: Build A Satellite TV Receiver; Pt.2 by John Clarke
  6. Project: A Train Detector For Model Railways by John Clarke
  7. Project: A 1-Watt Audio Amplifier Trainer by John Clarke
  8. Book Store
  9. Serviceman's Log: Faults that don't obey the rules by The TV Serviceman
  10. Review: Bookshelf by Silicon Chip
  11. Order Form
  12. Project: A Low-Cost Video Security System by Leo Simpson
  13. Project: Build A Digital Multimeter For Only $30 by Leo Simpson
  14. Feature: Remote Control by Bob Young
  15. Vintage Radio: The 5-valve Darelle superhet receiver by John Hill
  16. Product Showcase
  17. Review: The Audio Precision One Analyser by Bob Flynn
  18. Market Centre
  19. Advertising Index
  20. Outer Back Cover

This is only a preview of the June 1995 issue of Silicon Chip.

You can view 27 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 Satellite TV Receiver; Pt.2":
  • Satellite TV Receiver PCB pattern [02305951] (Free)
Articles in this series:
  • Introduction To Satellite TV (Build A Satellite TV Receiver; Pt.1) (May 1995)
  • Introduction To Satellite TV (Build A Satellite TV Receiver; Pt.1) (May 1995)
  • Build A Satellite TV Receiver; Pt.2 (June 1995)
  • Build A Satellite TV Receiver; Pt.2 (June 1995)
  • Satellite TV Receiver; Pt.3: Setting Up A Ground Station (July 1995)
  • Satellite TV Receiver; Pt.3: Setting Up A Ground Station (July 1995)
Items relevant to "A Train Detector For Model Railways":
  • Model Railway Train Detector PCB pattern (PDF download) [09306951-3] (Free)
Items relevant to "A 1-Watt Audio Amplifier Trainer":
  • 1-Watt Audio Amplifier Trainer PCB pattern (PDF download) [01306951] (Free)
Articles in this series:
  • Remote Control (June 1995)
  • Remote Control (June 1995)
  • Remote Control (March 1996)
  • Remote Control (March 1996)
  • Radio Control (April 1996)
  • Radio Control (April 1996)
  • Radio Control (May 1996)
  • Radio Control (May 1996)
  • Radio Control (June 1996)
  • Radio Control (June 1996)
  • Radio Control (July 1996)
  • Radio Control (July 1996)
  • Radio Control (August 1996)
  • Radio Control (August 1996)
  • Radio Control (October 1996)
  • Radio Control (October 1996)
A train detector for model railways If you want automatic signalling on a model railway, the first requirement is reliable train detection in each track section or “block”. This circuit provides detection of trains whether or not track voltage is present. It is based on a cheap & readily available quad comparator IC, the LM339. By JOHN CLARKE Sooner or later, most railway modellers want more realistic operation. They might have built one of our very popular train controllers but then they will want realistic signalling and points switching. As a first step towards this goal, you need to be able to detect the presence of a train or loco in a particular track section or “block”. 26  Silicon Chip By way of explanation, it is normal practice to divide the railway layout into sections which can normally be isolated by points switching. Most modellers do this as a step towards having more than one train on the layout, controlled by several train controllers. As things become more complicated and as the need for au­tomatic switch- ing arises, you need reliable train detection. If this is not done, the signalling system won’t make much sense because you won’t know if sections of track are clear or not. So one train detector is required for each block. The requirements for a reliable train detector are actually quite stringent. It should be able to detect the presence of a locomotive or even a single wagon or carriage, whether or not voltage from the controller is present on the track. So even if the track section is dead, you need to know if a loco is there or not. Also required is a sensitivity adjustment and a built-in time delay to prevent false triggering. The circuit must also work for positive or negative track voltages and function reli­ably whether the train controller output is smooth DC, unfiltered DC or pulsed DC. In order to meet all these require- -12V A OUT 7912 REG2 MODEL RAILWAY TRAIN DETECTOR I GO E C VIEWED FROM BELOW K B CURRENT DETECTOR TO TRAIN CONTROLLER 10  D1 VR1 5k IN 13.8V AC GIO 7912 7812 C1 330pF D2 2x1N5404 1k TRAIN DETECTOR POWER SUPPLY GND 10 16VW 470 25VW 470 25VW CENTRE TAP TRANSFORMER INPUT 10k 3.3k 3.3k TO TRAIN CONTROLLER OR BLOCK SWITCH TRACK TRACK 1k TO AC SIGNAL OR 25kHz OSCILLATOR -12V 0V GND +12V GND IN AC OUT 13.8V AC WINDOW COMPARATOR 12 1 IC1b 6 -0.35V 7 D3 1N4148 10 16VW OUT BUFFER 10 IC1a 4 LM339 2 4.7k 3 +0.35V 5 10k 7812 REG1 DELAY 10k 1 35VW IC1c 11  K DETECT LED1 A D5-D8 4x1N4004 220k SCHMITT TRIGGER 14 330k 13 2.2M Block detector Fig.1 shows the circuit for the basic block detector. It uses an LM339 quad comparator IC, four diodes, a few resistors, capacitors and a LED. The output is an open collector transistor which is turned on whenever a train is detected. The detector circuit connects to both sides of the track and to one side of the train controller output. In effect, the locomotive (or train) current flows through the detector circuit, specifically through trimpot VR1 and diodes D1 or D2, depending on the track polarity. As a result, the voltage developed across D1 or D2 is then detected by the following circuit. Trimpot VR1 is the sensitivity control. It is connected in parallel with the reverse connected diodes D1 & D2, via a 10Ω resistor. Hence, for very low currents drawn by the train, the voltage to be detected will be developed across trimpot VR1 and its series 10Ω resistor. Higher currents will pass through one of the diodes and thus the voltage detected will be limited to ±0.7V. The diodes are rated at 3A, which sets the limit on the maximum train current. The voltage developed across the diodes is connected to pins 4 & 7 of IC1a and IC1b. Together, these form a “window” comparator with the window voltage set to ±0.35V by diode D3, connected between pins 5 & 6. D3 is biased by 10kΩ resistors connected to the ±12V supplies and its anode and cathode are tied to sit above and 9 8 IC1d 10k ments, we have designed three PC boards. The first is the basic block detector; the second, a power supply for up to 30 detectors; and the third an optional high frequency AC power supply to enable the detector to work with pure DC train controllers. Since most modellers use controllers which are pulsed or unfiltered DC, they will not need the optional high frequency driver. OPEN COLLECTOR OUTPUT D4 1N4148 B 10 16VW E 0V GND OUTPUT C Q1 BC338 +12V 10 16VW Fig.1: the circuit of the block detector uses an LM339 quad comparator IC to sense the track current drawn by a locomo­tive. If the train controller is not present, or set for zero output, an AC signal at 50Hz or 25kHz provides a detectable current. June 1995  27 +12V 10k 10k 10k 5 IC1a 6 TL074 10k 10k 7 10 8 IC1b 9 .0022 -12V +12V 560pF 4.7k 13 12 IC1c 10k .0027 OSCILLATOR 10k +12V 10k 14 E .047 3 1.5k 2 IC1d 1 1 680  -12V x2 AMPLIFIER/ BUFFER 3.9k 2.2k 0V Q1 BD139 47uH 47W 0.5 1 11 10 16VW OUTPUT .015 E B Q2 BD140 C PLASTIC SIDE -12V x3 POWER AMPLIFIER 10 16VW E -12V below the 0V line by the associated 3.3kΩ resistors. Normally, with 0V across D1 or D2 (ie, no train current), the outputs of IC1a and IC1b are high (ie, “open”) because these outputs are “open collector” transistors. When D1 conducts to produce about 0.7V, pin 4 of IC1a goes above pin 5 and so the output of IC1a (pin 2) goes low. Alternatively, if D2 conducts, pin 7 input of IC1b goes below pin 6 and so pin 1 goes low. Pins 1 & 2 are connected together, so that if either output goes low, detect LED1 is lit and pin 11 of IC1c is pulled low. This causes pin 13 to go low. Below: block detection of trains or carriages on a section of a track is the first requirement of a reliable signalling & points control system. These three boards provide the basis of current detection. C B 25kHz SINE WAVE DRIVER Fig.2: this is the circuit for the 25kHz sinewave driver. IC1a is a Schmitt trigger oscillator which produces a sawtooth at pin 10. This is amplified & filtered to produce a sinewave & then buffered by complementary emitter followers Q1 & Q2. 28  Silicon Chip 4 LOW-PASS FILTER +12V -12V C B IC1c drives a delay circuit comprising 2.2MΩ and 330kΩ resistors and a 1µF capacitor. Schmitt trigger IC1d monitors the capacitor voltage. When IC1c is high (no train detected), the 1µF capacitor is charged up and IC1d’s output is low. When IC1c goes low, the capacitor is discharged via the 330kΩ resistor. After about 0.75 seconds, IC1d’s output goes high and this allows the 10kΩ pullup resistor to turn Q1 on via D1. Thus Q1 turns on whenever a train is detected. When IC1c goes high again, once the train has passed through the section, the 1µF capacitor charges via the 2.2MΩ and 330kΩ resistors. After about thee seconds, IC1d’s output goes low and Q1 turns off. These time delays are included to eliminate false train detection due to dirty track or intermittent contacts. As described so far, the circuit is based on a design fea­ tured in the March 1982 issue of “Model Rail­ roader”. But as presented so far, the circuit will not detect the presence of a locomotive unless track voltage is applied. The original cir­ cuit attempted to solve this problem by providing a DC bias to the track such that, while it was insufficient to operate a locomotive, or even train lighting, it would create a small current which could be detected. The drawback to this scheme is that a small throttle setting on the train controller could cancel the bias voltage and then you would have a situation where trains could not be detected. AC bias The way around this problem is to provide a 50Hz AC bias and this is shown fed to the track via a 1kΩ resistor. Now, regardless of the setting of the train controller or whether it is connected or not, the AC bias will always produce a current that can be detected by the window comparator. TO OTHER DETECTORS BLOCK SWITCH TRAIN CONTROLLER PULSED OR RAW DC +12V TRAIN DETECTOR 1 TRACK BLOCK 1 50Hz AC AC SIGNAL TRACK 0V -12V 13.8VAC POWER SUPPLY CENTRE TAP 13.8VAC TO POWER TRANSFORMER 0V Fig.3: the connection arrangement for a typical model railway using pulsed or unfiltered DC controllers. At left, there is a train controller, one side of which is fed via block switching to the track. The other side of the controller goes via the detector board to the other side of the track. TO OTHER DETECTORS BLOCK SWITCH TRACK BLOCK 1 L1 4mH 25kHz OUTPUT AC SIGNAL TRACK +12V TRAIN DETECTOR 1 +12V 0V 0V -12V -12V 25kHz SINEWAVE DRIVER 0V TRAIN CONTROLLER PURE DC POWER SUPPLY 13.8V CENTRE 13.8V AC TAP AC TO TRANSFORMER Fig.4: this arrangement is almost identical to Fig.3 except that it incorporates the 25kHz sinewave driver of Fig.2 & a 4mH inductor, for use with pure DC train controllers. There are still a few wrinkles to take care of, though. First, we have to cater for the situation where a train controller is connected to the track but is set to produce zero voltage. This can present a real problem with train controllers which produce a pure DC output. Why? Because they present a very low impedance across the track, no matter what their voltage setting. Usually, they also have a large electrolytic capacitor across their output and this compounds the problem – it effec­ tively shorts out the AC bias and so once again, we have a situa­tion where a train cannot be detected. The solution with pure DC controllers is to connect an inductor in series with their output so that the impedance is high at high frequencies but virtually zero at DC. The trouble is that if 50Hz AC is used, the inductor has to be very large to be effective. So One of these block detector boards is required for every section of track to be monitored. A small layout might require only five or six detector boards while a large layout might require up to 30 or more. June 1995  29 AC SIGNAL 1k 1k 3.3k 3.3k 10uF 4.7k TRACK LED1 K A D3 TRACK IC1 LM339 330pF D1 D2 10  10k 0V 1 VR1 0V +12V 2.2M 10k 10k 1uF 10k -12V 10uF OUTPUT D4 Q1 GND 330k 220k Fig:5(a): follow this component overlay diagram when building the detector PC board. rather than use a very large inductor we use a small one and then feed in a very high frequency AC signal to the track. Hence, we have designed a 25kHz sinewave driver to do the job. 25kHz sinewave driver Note that while one inductor is required for each pure DC controller, only one 25kHz sinewave driver is needed since it can supply as many as 20 train detectors. Fig.2 shows the circuit for the 25kHz sinewave driver. It’s based on a quad op amp and two output transistors. IC1a is connected as a Schmitt trigger oscillator. It charges and discharges the .0027µF capacitor via a 10kΩ resistor. The result of this is a 25kHz sawtooth waveform across the Fig.5(b): actual size artwork for the detector PC board. .0027µF capacitor at pin 10 of IC1b which functions as an amplifier with a gain of 2. IC1c forms a low pass filter which rolls off the sawtooth harmonics above 20kHz. This provides us with a clean sinewave which is then amplified further by IC1d and transistors Q1 & Q2. These transistors buffer the output of IC1d and enable it to deliver quite substantial current. Minimum detection loads As described so far, the detector circuit (Fig.1) and the 25kHz sine­ wave driver (Fig.2) will only detect locomotives and wagons which draw current from the rails. They will not detect wagons or carriages which do not draw current. This is undesirable If pure DC controllers are employed, the basic AC signal bias of the detector board will not work. The solution is to use an isolation inductor in series with each controller & use this 25kHz sinewave driver board. Only one of these boards is required for a complete layout. 30  Silicon Chip since you will want to be able to detect a rake of wagons on a siding or perhaps even a single wagon. To be detected, a wagon or carriage must draw some current from the rails, even it is only very small. To this end, if you want to be able to detect a carriage, is must have at least one axle with metal wheels. The minimum load which can be detected reliably is 12kΩ and this could be provided with a dab of metal­lic paint to provide a bridge across the insulation on one of the wheel sets. Alternatively, a 0.25W resistor can be soldered between the metal wheels, with the resistor body lying parallel to the axle. Fig.3 shows the connection arrangement for a typical model railway using pulsed or unfiltered DC controllers. At left, there is a train controller, one side of which is fed via block switch­ing to the track. The other side of the controller goes via the detector board to the other side of the track. Note that one side of the train controller is connected to the 0V line of the detec­tor board. This means that each controller on a layout must be completely independent of any other controller and two or more controllers cannot be run from a common power supply. Note that Fig.3 (and Fig.4) shows the detector board run from a power supply which is connected to a transformer with a centre-tapped 27.6V secondary (ie, 13.8V-0-13.8V). While this is what we did with our prototype, in practice any transformer with a centre-tapped winding of between 24V (ie, 12V-0-12V) and 30V (15V-015V) will do. Fig.4 is almost identical to Fig.3 3.9k E C B 2.2k 1.5k 1 560pF 10k 10k 10k 4.7k E C B OUTPUT Q2 0V -12V 10uF Power supply requirements For a large model railway layout, 20 or even 30 detectors may be required. Add to that the possible need for a 25kHz sinew­ave driver (Fig.2) and the power requirements become significant. Each detector has a current drain of 20mA and the 25kHz sinewave driver can draw up to 200mA or more, depending on how many detec­ tor boards are employed. Accordingly, we have designed a power supply board which will handle up to 30 detectors and the 25kHz driver. The power supply delivers ±12V rails and, if the maximum complement of 30 detectors and the 25kHz sinewave driver is used, the transformer should have a rating of 60VA or thereabouts. Fig.1, the detector circuit, includes the circuit for the power supply. Diodes D5-D8 form a full-wave rectifier across the full 27.6V winding of the 47 680  1 10k +12V 1 IC1 TL074 .0027 .0022 47uH .047 10k Fig.6(a): the parts layout diagram for the 25kHz sinewave driver board. 10uF Q1 .015 10k 10k 10k except that it incorpo­rates the 25kHz sinewave driver of Fig.2 and a 4mH inductor (L1), for use with pure DC train controllers. Again, note that each controller must be completely isolated from any other. Note also that the connection method of Fig.4 can be employed if you have a mixture of pulsed DC, unfiltered DC and pure DC con­trollers. A 4mH inductor must be connected in series with each pure DC controller. Fig.6(b): the actual size artwork for the 25kHz driver PC board. transformer. The centre tap becomes the 0V rail or ground, while the 470µF capacitors provide filtering of the rectified positive and negative supplies. These are then regulated to ±12V by the 7812 and 7912 3-terminal regula­ tors. The 10µF capacitors at the output of each regulator prevent instability. Construction That completes the circuit description of the three mod­ules. Now let us This Arlec battery charger & the accompanying power supply board will feed up to 30 detector modules & the 25kHz sinewave driver board. June 1995  31 +12V REG1 7812 470uF D6 D5 AC SIGNAL OUTPUT 13.8VAC 13.8VAC 0V 10uF CENTRE TAP REG2 7912 470uF D8 D7 -12V 10uF Fig.7(a): the component overlay diagram for the power supply board. look at their construction. To keep things straightforward, we’ll assume that you are building just one detector board, a 25kHz sinewave driver and the power supply board. The detector PC board is coded 09306951 and measures 74 x 51mm. Its component overlay diagram is shown in Fig.5(a). Begin construction Fig.7(b): this is the actual size artwork for the power supply board. by installing all the PC stakes. The resistors are next, followed by the diodes, trimpot VR1, the capacitors and the IC. Make sure that the electrolytic capacitors, diodes and the IC are oriented correctly. Finally, mount the transistor (Q1). The 25kHz sinewave PC board is coded 09306953 and measures 93 x 56mm. Its parts layout is shown in Fig.6(a). Again, begin by installing the PC stakes and then the two links. Next, install the IC taking care with its orientation. The same comment applies to the polarity of the electrolytic capacitors. Install the resistors next (check their values on a digital multimeter). The 47µH inductor may be a PC mounting type or an axial type which looks similar to a resis­tor. The latter type can be mount­ed end on in the PC board. Transistors Q1 and Q2 are mounted on small heatsinks. Apply a smear of heatsink compound to the mating surfaces before bolt­ing them down with a screw and nut. Make sure that you don’t inadver­tently swap the transistors. The BD139 is located adjacent the 47µH inductor while the BD140 is opposite the .015µF capacitor. The power supply PC board is coded 09306952 and measures 73 x 73mm. Its component overlay is shown in Fig.7(a). Begin by installing the PC stakes and then the four diodes. This done, solder in the capacitors, taking care to ensure that they are correctly oriented. The regulators are bolted to small heatsinks on the board. Use a smear of heatsink compound between the mating surfaces to aid in heat transfer. There is no need to provide insulation between each regulator and its heatsink. Battery charger transformer Inside the Arlec BC581 battery charger, showing the three connec­tions from the transformer to the power supply board. 32  Silicon Chip Most, if not all, the boards described for this project can be mounted under- PARTS LIST Train Detector Board (1 per block) This photo shows how a 12kΩ 0.25W resistor is soldered to the flanges of a metal wheelset. This will provide the minimum de­tectable load so that a carriage or wagon can be sensed on the track. 1 PC board, code 09306951, 74 x 51mm 9 PC stakes 1 20mm length of 0.8mm tinned copper wire 1 5kΩ miniature trimpot (VR1) Semiconductors 1 LM339 quad comparator (IC1) 2 1N5404 3A diodes (D1,D2) 2 1N4148 diodes (D3,D4) 1 BC338 NPN transistor (Q1) 1 5mm red LED (LED1) Capacitors 2 10µF 16VW PC electrolytic 1 1µF 35VW PC electrolytic 1 330pF ceramic If you are using the 25kHz sinewave driver, you will need an isolation inductor in series with each pure DC controller. This consists of 45 turns of 0.5mm enamelled copper wire on a Philips RCC/20/10/7 3C85 toroid. Resistors (0.25W, 1%) 1 2.2MΩ 1 4.7kΩ 1 330kΩ 2 3.3kΩ 1 220kΩ 2 1kΩ 1 15kΩ (for testing) 1 10Ω 4 10kΩ Power Supply Board neath the layout. However, the power transformer must be correctly wired and mounted in a case to make it safe. To this end, we opted to use a readily available Arlec BC581 battery charger. Normally priced at around $40, they are sometimes on special for as little as $29.95 in hardware stores. The Arlec charger comes in a neat plastic case which is safe and convenient for our purpose. All that is re­quired is to connect three wires, one to the centre tap and one to each of the 13.8V terminals on the secondary of the trans­former. The battery leads and remaining components on the charger can be left connected provided the leads are not shorted togeth­er. The accompanying photographs show the transformer connec­ tions inside the Arlec battery charger. Once the connections are made from the transformer to the power supply board, reassemble the battery charger case. Apply power and check the +12V and -12V outputs on the board. Isolation inductor As noted above, if you are using the 25kHz sinewave driver, you will 1 27.6V centre tapped 60VA transformer (Arlec BC581 bat­ tery charger; see text) 1 PC board, code 09306952, 73 x 73mm 2 mini-U heatsinks, 30 x 25 x 13mm or 25 x 28 x 28mm 7 PC stakes 2 3mm screws and nuts 2 470µF 25VW PC electrolytic capacitors 2 10µF 16VW PC electrolytic need an isolation inductor in series with each pure DC controller. This inductor consists of 45 turns of 0.5mm enamelled copper wire on a Philips RCC/20/10/7 3C85 toroid – see photo. Testing Connect the +12V, 0V, -12V and AC outputs from the power supply board to the detector PC board. Now connect a 15kΩ resis­tor between the track terminals on the detector PC board. Apply power and adjust VR1 so that the LED just lights. Disconnecting the resistor should extinguish Semiconductors 1 7812 3-terminal regulator (REG1) 1 7912 3-terminal regulator (REG2) 4 1N4004 1A diodes (D1-D4) 25kHz Sinewave Driver Board 1 PC board, code 09306953, 93 x 56mm 2 micro heatsinks, 19 x 18 x 9mm 4 PC stakes 1 40mm length of 0.8mm tinned copper wire 1 47µH PC mount inductor (250mA rating) 1 Philips RCC/20/10/7 3C85 core (4330 030 34471) per DC controller 1 2-metre length of 0.5mm ENCW per DC controller Semiconductors 1 TL074 quad op amp (IC1) 1 BD139 NPN transistor (Q1) 1 BD140 PNP transistor (Q2) Capacitors 2 10µF 16VW PC electrolytic 1 0.047µF MKT polyester 1 0.015µF MKT polyester 1 0.0027µF MKT polyester 1 0.0022µF MKT polyester 1 560pF MKT polyester or ceramic Resistors (0.25W, 1%) 8 10kΩ 1 1.5kΩ 1 4.7kΩ 1 680Ω 1 3.9kΩ 1 47Ω 1 2.2kΩ 2 1Ω the LED. Do not forget that there is a delay between the LED response and the output. Final testing can be done on the layout. Now check the 25kHz sinewave driver. Apply power and check that the transistors run cool. You can test the sinewave output by connecting a multimeter set on the AC range to the output. You should obtain a reading of around 8V. This will depend on your multimeter’s frequency response, though – some will not respond at 25kHz and will only produce a low SC reading. June 1995  33