Silicon ChipAutomatic Points Controller For Model Railways - March 2013 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Wind farms are now recognised as a serious health issue
  4. Feature: Oscium Test Instrument Add-Ons For The iPad by Nicholas Vinen
  5. Project: High Performance CLASSiC DAC; Pt.2 by Nicholas Vinen
  6. Project: Infrasound Detector For Low Frequency Measurements by Allan Linton-Smith & Ross Tester
  7. Feature: We Test Some New Hearing Aids by Ross Tester
  8. Project: Automatic Points Controller For Model Railways by Jeff Monegal
  9. Project: Capacitor Discharge Unit For Twin-Coil Points Motors by Jeff Monegal
  10. Project: Control Relays Via The Internet With Arduino by John Boxall
  11. Feature: Programmable Systems on a Chip (PSoC) by Nicholas Vinen
  12. Project: AAA-Cell LED Torch Driver by John Clarke & Ross Tester
  13. Vintage Radio: Seyon 2D 2-valve "wireless" and an old single-valve receiver by Rodney Champness
  14. Subscriptions
  15. PartShop
  16. Order Form
  17. Market Centre
  18. Advertising Index
  19. Outer Back Cover

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

You can view 20 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 "High Performance CLASSiC DAC; Pt.2":
  • CLASSiC DAC main PCB [01102131] (AUD $20.00)
  • CLASSiC DAC revised main PCB [01102134] (AUD $25.00)
  • dsPIC33FJ128GP306T-I/PT programmed for the CLASSiC DAC v1.02 [0110213B.hex] (Programmed Microcontroller, AUD $25.00)
  • Red & White PCB-mounting RCA sockets (Component, AUD $4.00)
  • SMD parts for the CLASSiC DAC (Component, AUD $80.00)
  • CLASSiC DAC front & rear panels [01102132/3] (PCB, AUD $20.00)
  • Firmware for the CLASSiC DAC [0110213B.HEX] (Software, Free)
  • CLASSiC DAC main PCB pattern (PDF download) [01102131] (Free)
  • CLASSiC DAC front and rear panel PCB patterns (PDF download) [01102132/3] (Free)
  • CLASSiC DAC front & rear panel artwork (PDF download) (Free)
Articles in this series:
  • High Performance CLASSiC DAC; Pt.1 (February 2013)
  • High Performance CLASSiC DAC; Pt.1 (February 2013)
  • High Performance CLASSiC DAC; Pt.2 (March 2013)
  • High Performance CLASSiC DAC; Pt.2 (March 2013)
  • High-Performance CLASSiC DAC; Pt.3 (April 2013)
  • High-Performance CLASSiC DAC; Pt.3 (April 2013)
  • High-Performance CLASSiC DAC; Pt.4 (May 2013)
  • High-Performance CLASSiC DAC; Pt.4 (May 2013)
Items relevant to "Infrasound Detector For Low Frequency Measurements":
  • Prechamp: 2-Transistor Preamplifier PCB [01107941] (AUD $5.00)
  • Champ: Single Chip Audio Amplifier PCB [01102941] (AUD $5.00)
Items relevant to "Automatic Points Controller For Model Railways":
  • Automatic Points Controller PCB [JWM-0812/09103131] (AUD $15.00)
  • "Frog" Relay PCB [09103133] (AUD $5.00)
  • TCRT5000 Reflective Optical Sensor (Component, AUD $2.50)
  • Automatic Points Controller PCB patterns (PDF download) [09103131-2] (Free)
  • Frog Relay PCB pattern (PDF download) [09103133] (Free)
Items relevant to "Capacitor Discharge Unit For Twin-Coil Points Motors":
  • Capacitor Discharge PCB for Twin-Coil Points Motors [09203131] (AUD $7.50)
  • Capacitor Discharge Unit (CDU) PCB pattern (PDF download) [09203131] (Free)
Items relevant to "AAA-Cell LED Torch Driver":
  • AAA LED Torch Driver PCB [16102131] (AUD $5.00)
  • AAA-Cell LED Torch Driver PCB pattern (PDF download) [16102131] (Free)
by Jeff Monegal Automatic Point for your Model R T his Automatic Points Controller can be used by itself on a model railway layout or in conjunction with the Automatic Reverse Loop Controller that was published in the October 2012 issue of SILICON CHIP. That project automated the process of switching track polarity in a reversing loop but the points themselves still had to be operated manually. The project presented here takes care of that problem. (Note that both projects are only suitable for reverse loops that use a single set of points. It will not work with reversing track systems that use more than one set of points, such as a ‘WYE’ network.) So as well as automating the points used in a reverse loop, this project can be used wherever points could benefit from automatic control. One example is a set of points used on a main line that branches to a siding. During layout operation a train may be shunted into this siding but the driver has forgotten to switch the points back, to allow the fast passen62  Silicon Chip ger train that is due soon, to pass the points without derailing. Using this project to control the siding points, the approaching passenger train will automatically align the points so that derailments are prevented. Let’s now have a look at the circuit in Fig.1 (overleaf). The IR sensors used to detect the approaching trains are made by Vishay, type TCRT5000. These contain an infrared LED and infrared phototransistor and they a designed as a reflective sensor, ie, the LED emits infrared and it needs to be reflected back to the phototransistor for the sensor to work. In use, the sensor is installed between the track sleepers and infrared is continuously emitted from the LED. An IR signal is constantly transmitted up between the sleepers of the track. As a train covers the IR emitter, a small amount of the IR energy is reflected back to be received by the IR phototransistor which is physically located near the IR emitter. The reason for choosing an IR sensor is that they operate just as well in normal ambient lighting conditions as they do in total darkness. How it works The controller relies on these tiny infrared sensors which fit between the track sleepers and detect when a train is passing over them. The two IR sensors operate in the same way. The heart of the circuit is an LM567 tone decoder which is used in an unconventional way. Normally, the LM567 is used in circuits which sense the presence of a signal within a designated passband. If the signal is present, the output at pin 8 goes low; when it is absent or siliconchip.com.au This project uses two IR sensors to detect an approaching train and then automatically switch a set of points to suit the track on which the train is travelling. This avoids the possibility of inadvertent derailments by the operator. It uses four cheap ICs, two Mosfets and it controls a standard twin-coil snap-action points motor. ts Controller Railway Layout not within the passband, the signal at pin 8 is high. The LM567 can be regarded as a specialised phase lock loop (PLL). A typical PLL has a voltage-controlled oscillator (VCO), a phase detector and loop filter and it is used in a radio receiver to keep the receiver locked onto an incoming carrier. By contrast, the LM567 has a VCO and two phase detectors (I & Q) and a loop filter but we use in a different way. We are using the chip’s on board VCO (voltage controlled oscillator) to produce the signal which drives the infrared LED and components connected between pins 5, 6 & 0V of IC1 set its frequency to around 1kHz. If the emitted IR signal is reflected back to the phototransistor (as when a loco is passing overhead) in the Vishay sensor, the resulting signal is fed from the sensor’s pin 3 to pin 3 of IC1 via a 100pF capacitor. The result is that the output pin 8 goes low. At other times, when no loco is on the track, no IR signal is reflected back to the phototransistor and the signal at pin 8 is high. Hence, when a loco is present above the sensor, pin 8 of IC1 goes low and this turns on PNP transistor Q2 to light LED1. At the same time, the positive-going signal from the collector of Q2 is coupled to NAND gate IC3c via a 100nF capacitor. Pin in 10 of IC3 now goes (Left): the main PCB for the Automatic Points Controller takes the output from the infrared sensors and drives the point motors to set the points according to the track in use. siliconchip.com.au March 2013  63 REFL IR SENSOR 1 REG1 7805 +5V OUT 2  1 100nF 3 3 5 560 10k 6 4.7k C B 15k Rt Ct 100nF Q1 BC548 C8050 E IN 100k 4 V+ OUT IC1 567 GND 7 8 4.7k B 47k 470nF 10 6 IC3c K 9 IC3b 1 IC4a D1 1N4148 1k K 4 390k B 5 7 2.2F A 100k 1k IC3: 4011B +5V REFL IR SENSOR 2 8 2 3 8  2.2F 22F 150k A LED1 A 1000F Q2 BC558 C 100nF Out 1 Filt Loop 2 Filt GND 10F E +12V IN IC4: LM358 2  1 100nF 3 3 5 560 10k 4.7k C B E 15k Q3 BC548 6 IN Rt Ct 100nF 100k 4 V+ OUT IC2 567 GND 7 8 E 4.7k B Loop 2 Filt 12 100nF C Out 1 Filt 150k Q4 BC558 2 13 A LED2 14 IC3d 5 6 22F 100k K 2.2F 3 7 IC4b 2.2F D2 1N4148 1k K 4  470nF IC3a 11 1 390k 22k C A 1k LEDS SC 2013 MODEL RAILWAY AUTO POINTs CONTROL low and this toggles the RS flipflop comprising gates IC3a and b. Pin 4 now goes high and pin 3 goes low. The low from pin 3 is coupled around to pin12 via a 22µF capacitor. This capacitor then charges via a 150kΩ resistor taking around 1.5 seconds to reach a level that will allow IC3d to be triggered by a high coming in on pin 13, from the other sensor circuit. When a trigger pulse comes in from either sensor the associated 22µF/150kΩ circuits stop the flipflop from being toggled back again within D1, D2 D3–D5 A K this 1.5-second period. This ensures that when a sensor toggles the points it cannot be toggled back again by a signal from the other sensor until the capacitor discharge unit (CDU) for the points drive circuit has charged up again. It also prevents the points swapping back and forth in the event that both sensors are detecting trains. During actual layout operation, the situation where two trains are approaching the same set of points, should not be allowed to occur; a serious crash could result. A K A K The outputs of the flipflop are fed to the non-inverting (+) inputs of two op amps, IC4a & IC4b. These op amps are there solely to increase the 5V signal from the sensor circuits to a level sufficient to reliably turn on either of the two Mosfets, Q5 & Q6. The outputs of each op amp are coupled to the Mosfet gates via 2.2µF capacitors. In conjunction with the 390kΩ resistors, this results in a gate pulse of around two seconds. Once the 2.2µF capacitors have charged, the Mosfets gate are pulled low via the 390kΩ resistors. A SENSOR 1 POINTS BLADE ACTUATOR TRAIN DIRECTION SENSOR 2 B TRAIN DISTANCES A & B (BETWEEN SENSORS AND POINTS BLADE) ARE NOT CRITICAL, BUT SHOULD BE AT LEAST ENOUGH TO ALLOW POINTS BLADE TO CHANGE POSITION BEFORE TRAIN ARRIVES AT THE BLADE. A DISTANCE OF 50CM SHOULD ALLOW FOR SLOW-ACTING POINTS MOTORS. 64  Silicon Chip DIREC TION The sensors are mounted on the approach side of the points from both tracks. In most circumstances, the distance from the sensors to the points is not critical. siliconchip.com.au D4 1N4004 2.2F D4 CDU 4001 4148 D2 D3 4001 D1 4148 22F A K A 4001 A D5 1000F 390k 390k 1k 1k 100k 150k IC3 4011B 22F IC4 LM358 K +12V K A Q5 100nF 100k BC548 560 A K POINT MOTOR 47k A B C GND K 2.2F Q6 MWJ REG1 7808 10F 2.2F K A MAIN UNIT Figs. 1&2: the main circuit diagram and its associated PCB. Full operation is explained in the text. When assembling the PCB, ensure that all polarised components are installed the right way around and check your completed board for missed solder joints, poor solder joints and errors in component placement. Together, they account for almost all problems with assembled projects. D Q6 IRFZ44Z* G 4.7k LED2 4.7k 100nF COIL2 *OR IRF540N, IRF2804, IRF2907 ETC. Q3 IC2 567 K SENS 2 1 3 2 K A 22k Q4 100k 10k TX COIL1 MWJ D3 1N4004 2 3 1 IR SENSOR 2 A RX S 15k K 2.2F 100nF G 100nF LED1 100nF 150k 470nF 1k BC548 560 A BC558 POINT MOTOR 4.7k 4.7k IC1 567 3 2 Q1 BC558 100k 15k SENS 1 1 21/80 TX MWJ Q5 IRFZ44Z* 2 3 1 IR SENSOR 1 10k +12V 0V D Q2 100nF A RX K 470nF 1k D5 1N4004 S CDU 0V BC548, BC558 B E IRFZ44Z, ETC G C D D S Using series capacitors ensures that the Mosfets only remain switched on long enough to ensure the points have changed position. Next time the flipflop toggles either one of the op-amp outputs must go low. Because the associated 2.2µF capacitor is charged to the positive rail, the voltage on the capacitor’s negative terminal will try to go below the 0V rail. Diodes D1 and D2 prevent this happening, to protect the Mosfet gates. When either Mosfet turns off, there will be a positive spike voltage generated at the drain electrode and this is quenched by diode D3 or D4. An add-on relay is provided for installations where polarity of the “frog” of the points is not automatically switched. Many modellers use points in which the frog is not switched according to the direction of the points. These points are commonly called “Electrofrog” and are beneficial when used on layouts operated by DCC. In these conditions the frog polarity must be controlled by external means. See Fig.2. The frog relay is controlled by an NPN transistor which is supplied base current from pin 4 of the flipflop. Each time pin 4 goes high the transistor switches on the relay. The SPST contacts of the relay are used to control the polarity of the frog. When this system is used with points of the “INSULFROG” variety then this relay is unnecessary as the frog is controlled by the switch contacts on the points itself. Assembly There is nothing special about assembling the points controller. Start by looking at the PCB under a magnifying glass looking for defects in the etched tracks. Once you are satisfied that the board is OK you can insert the resistors and diodes. Also on the PCB are four wire links. These can be made from the wire off cuts from some resistors. IC sockets are recommended for IC1, IC2, IC3 and IC4. Solder these in next (or the chips themselves if you choose not to use sockets). Next come the eight electrolytic capacitors and eight ceramic capacitors. The transistors and Mosfets can now be installed along with the regulator (in all cases, watch the polarity). The final components are the 3-pin RAILS SENSOR PCB * SENSOR * NOTE THAT DOMES OF IR COMPONENTS SHOULD SENSOR SLEEPERS PROTRUDE ONLY SLIGHTLY ABOVE SLEEPERS Here’s a close-up and diagram of how the sensors are mounted between the rail sleepers. You’ll need to prise the sleepers apart a little: the sensor is a tight fit! When completed and tested, a drop of glue will hold it permanently in place. siliconchip.com.au March 2013  65 +12V A D6 K 4004 1N4004 D6 RELAY 1 RELAY1 A TO IC3b B B 2.2k C C E Q8 BC548 BC548 At left is the Frog Switch Relay, with the simple circuit and PCB component layout show at right. The ponts “A, B & C” on the circuit diagram and overlay correspond to the same points on the main circuit diagram. TO FROG Q8 2.2k FROG A B C FROG SWITCH RELAY sockets for each of the two sensor leads and the points motor. The final two sockets are those for power input and the CDU in socket (two pins in both cases). Although not mandatory to use plugs and sockets it makes things easy if you have to remove the PCB at any time! Now you can assemble the two IR sensor PCBs. As only one component is used for each PCB assembly is not difficult but you must make sure that the components are oriented correctly. The sensor has a bevelled end and a straight end; the bevelled end should face towards the three terminals on the PCB. The three wires connecting the sensor to the main PCB should be soldered underneath the board (ie, on the copper side) so that they are not seen when the sensor is installed under the track. At this stage you should have no components left and no unused component holes in the PCBs. Take some time to go over your work. More than 70% of projects that don’t work after being assembled can be put down to soldering faults. The next most common fault is polarised components being installed incorrectly. These days faulty components are very rare so if your project does not work then don’t straight-away claim you have a faulty component and replace all semiconductors. Chances are that your components will not be the problem. Time to see if it will work Start by making sure the sensors are facing straight up on the test bench and are not covered. At this stage do not connect any power supply to the CDU input terminals. Use a current-limited power supply of about 12V, set to a current limit of about 500mA (this will ensure that no damage will result if a problem exists). Connect this supply to the power input 66  Silicon Chip terminals. The two LEDs will probably come on for a second or two, then the unit should settle down drawing less then 40mA. Wave your hand about 50mm above each of the sensors. The LED associated with the sensor you are testing should come on and stay on for about two seconds after you remove your hand. Try this on both sensors. If the LEDs come on then both sensors are working. Using a multimeter, CRO or logic probe look at the two flipflop output pins (3 and 4) on IC3. One should be high while the other is low. Again cover the sensors one at a time. The flipflop pins should toggle. Pin 3 of the flipflop should go high when sensor 2 is triggered and pin 4 should go high when sensor 1 is triggered. If all this is happening then you can be fairly sure that the whole project is working OK. Connect a power supply, preferably from the companion CDU unit that goes with this system, to the CDU input socket. If the CDU is not available then a DC supply of about 15V at 2A will do. The last step is to connect a twincoil points motor to the points socket. When you trigger the sensors the points motor should also swap positions. If all is OK then the system can be installed on your layout. If things have not gone as planned then do not slit your wrists just yet. Fault-finding is simple There is no microcontroller used in this project so fault-finding should be simple. Finding the problem is simply a matter of elimination. If both LEDs are working when they should then at least half the project is OK. In this case looking at IC3 pin3 and 4 as previously described will tell if IC3 and its components are working or not. Using your multimeter check the following places. IC4 pins 2 and 6 should be at about 2.5V DC. IC4 pins 1 and 7 are the opamp outputs. One should be high (about 10V DC) and the other should be low. They should swap over when the sensors are triggered. As previously stated, most likely the fault will be soldering related. Other components to check are diodes D1 and D2 in the Mosfet gate circuits. If these have be inserted backwards the drive signal to the Mosfets will not get through. If the sensors are not working then you have two of them to compare voltages. It is highly unlikely that both will not work. If that is the case then most likely you have reversed the IR components. Installation A look at the diagrams and photos will show how the sensors are installed. The IR components are placed under the track with the domes of the components facing up between the sleepers. The distance from the points back along the track to the sensor is not critical as long as the points have time to switch before the approaching train reaches it. 100mm would be about the minimum; we generally go for about double this. A small dob from a hot glue gun will make sure the sensors stay put. Wave your hand above the sensors at an increasing distance. The sensors should not detect your hand at more than about 100mm. Slow-motion points However, at this stage you may want to plan ahead so that this project will work with servo and slow-motion points motors such as the tortoise motor. If you intend to use these at a later date then you will need a sensor-topoints distance of at least 400 to 500mm. Using a slow motion motor gives a very realistic show of the points siliconchip.com.au Parts List - Automatic Points Switching 1 main PCB measuring 105 x 55mm, coded JWM-0812 2 sensor PCBs measuring 17 x 8mm 3 3-pin PCB mount sockets 2 2-pin PCB mount sockets 3 8-pin IC sockets 1 14-pin IC socket A close-up view of the under-side of the points motors. Obviously, enough clearance needs to be allowed under the tracks in your layout to accommodate the bulk of these motors. being switched. Once you have the sensors installed, connect them to the main PCB then power it up. Run a loco or carriage over the sensors and make sure the LEDs indicate a successful detection. The sensors should detect all types of carriages and locos. Once that is done you can complete the installation then sit back and enjoy another automated section of your layout. Off-track sensors During development of this system a sensor was installed inside a small electrical equipment box model that was then installed next to the track. As a train passed the electrical box the sensor reliably detected the passing of the train every time. Although the sensors need to be disguised somehow this is another idea on how to reliably detect the passing of trains and has the advantage of not having to disguise the sensors that are installed under the track. SC Semiconductors 2 LM567 tone decoders (IC1, IC2) 1 4011B quad Nand gate (IC3) 1 LM358 dual op amp (IC4) 2 Vishay TCRT5000 sensors (Sensor1,2) 2 BC548 NPN transistors (Q1, Q3) 2 BC558 PNP transistor (Q2, Q4) 2 IRFZ44 N-channel Mosfets [or equivalent] Q5, Q6) 2 1N4148 silicon signal diodes D1, D2) 3 1N4004 silicon power diodes (D3-D5) 2 5mm LEDs (red, green or yellow; LED1,LED2) 1 7805 3 terminal regulator Capacitors 1 1000µF 25V electrolytic 2 22µF 25V electrolytic 1 10µF 25V electrolytic 4 2.2µF 25V electrolytic 2 470nF MKT (code 470n or 474) 6 100nF MKT (code 100n or 104) Resistors (all 1/4 W carbon) 2 560Ω 4 1kΩ 4 4.7kΩ 1 22kΩ 1 47kΩ 4 100kΩ 2 10kΩ 2 150kΩ 2 15kΩ 2 390kΩ Extra components required for the Frog Switching relay 1 PCB, 37mm 27mm 1 SPDT relay 1 IN4004 power diode 1 2.2kΩ resistor 1 BC548 or C8050 NPN transistor [or equivalent] Currently the PCBs for this project can be purchased at the Silicon Chip website for $15.00 ($13.50 for magazine subscribers), directly from here: http://www. siliconchip.com.au/Shop/8/1940. This includes the main PCB (coded JWM-0812), and the two sensor boards (coded 09103132). All enquires for this project should be directed to the designer, Jeff Monegal. He can be contacted via email only: jeffmon<at>optusnet.com.au All emails will be replied to but please allow up to 48 hours for a reply. Resistor Colour Codes o o o o o o o o o o siliconchip.com.au No. 2 2 4 1 1 2 2 4 4 2 Value 390kΩ 150kΩ 100kΩ 47kΩ 22kΩ 15kΩ 10kΩ 4.7kΩ 1kΩ 560Ω 4-Band Code (1%) orange white yellow brown brown green yellow brown brown black yellow brown yellow violet orange brown red red orange brown brown green orange brown brown black orange brown yellow violet red brown brown black red brown green blue brown brown 5-Band Code (1%) orange white black orange brown brown green black orange brown brown black black orange brown yellow violet black red brown red red black red brown brown green black red brown brown black black red brown yellow violet black brown brown brown black black brown brown green blue black black brown March 2013  67