Silicon ChipLi'l Pulser Model Train Controller, Mk.2 - July 2013 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Nuclear power is the answer
  4. Feature: 100 Years Of AWA by Kevin Poulter
  5. Feature: Cheap & Cheerful Smart TV Conversion by Julian James
  6. Project: DIY Wireless Audio Streaming by Nicholas Vinen
  7. Project: Li'l Pulser Model Train Controller, Mk.2 by John Clarke
  8. Feature: Secure Digital Cards: Clearing Up The Confusion by Nicholas Vinen
  9. Project: Add A UHF Link To A Universal Remote Control by John Clarke
  10. Subscriptions
  11. Project: Build A USB Port Voltage Checker by Nicholas Vinen
  12. Vintage Radio: Restoring an AWA B15 AM broadcast receiver by Rodney Champness
  13. PartShop
  14. Market Centre
  15. Advertising Index
  16. Outer Back Cover

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

You can view 19 of the 104 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 "DIY Wireless Audio Streaming":
  • Software for DIY Wireless Audio Streaming (Free)
Items relevant to "Li'l Pulser Model Train Controller, Mk.2":
  • Li'l Pulser Mk2 Revised PCB [09107134] (AUD $15.00)
  • Li'l Pulser Mk2 front & rear panels [09107132/3] (PCB, AUD $20.00)
  • Li'l Pulser Mk2 Revised PCB pattern (PDF download) [09107134] (Free)
  • Li'l Pulser Mk2 panel artwork (PDF download) (Free)
  • Li'l Pulser Mk2 PCB pattern (PDF download) [09107131] (Free)
Articles in this series:
  • Li'l Pulser Model Train Controller, Mk.2 (July 2013)
  • Li'l Pulser Model Train Controller, Mk.2 (July 2013)
  • Li'l Pulser Mk2: Fixing The Switch-Off Lurch (January 2014)
  • Li'l Pulser Mk2: Fixing The Switch-Off Lurch (January 2014)
Items relevant to "Add A UHF Link To A Universal Remote Control":
  • Infrared to UHF Converter PCB [15107131] (AUD $5.00)
  • UHF to Infrared Converter PCB [15107132] (AUD $10.00)
  • Revised 10-Channel Remote Control Receiver PCB [15106133] (AUD $12.50)
  • PIC12F675-I/P programmed for the IR-to-UHF Converter [1510713A.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC12F675-I/P programmed for the UHF-to-IR Converter [1510713B.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F88-I/P programmed for the revised 10-Channel Remote Control Receiver [1510613B.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware (ASM and HEX) files for the IR/UHF Link [1510713A/B.HEX] (Software, Free)
  • Firmware (ASM and HEX) files for the Revised Versatile 10-Channel Remote Control Receiver [1510613B.HEX] (Software, Free)
  • IR/UHF Link PCB patterns (PDF download) [15107131/2] (Free)
  • 10-Channel Remote Control Receiver revised PCB pattern (PDF download) [15106133] (Free)
  • Infrared/UHF Link lid panel artwork (PDF download) (Free)
Items relevant to "Build A USB Port Voltage Checker":
  • USB Port Checker PCB [24107131] (AUD $5.00)
  • USB Port Checker PCB pattern (PDF download) [24107131] (Free)

Purchase a printed copy of this issue for $10.00.

Into model railways? Then you’ll want to build the . . . L i’l Pulser M o del Tr ain Con t r oller, Mk.2 By JOHN CLARKE This project started out as a simple revision to our very popular Li’l Pulser train controller featured in the February 2001 issue. But while it fits into the same tiny case of the original design, this new controller has a lot more features and it can deliver four times as much current. It’s become the “Li’l Pulser that could!” U NLESS YOU ARE already using a previously published SILICON CHIP model train controller, this little feature-packed controller is likely to be better than any controller you have used. This is particularly true if you are using a commercially-made lowcost rheostat or series transistor train controller. Simple train controllers have plenty of shortcomings. To get the loco started, you have to wind the speed control way past the setting at which you would want it to run. Then the 32  Silicon Chip loco suddenly takes off like a startled rabbit. Once running, with reduced throttle setting, the loco then slows down whenever there is the slightest incline. So what makes Li’l Pulser so much better? Well, firstly it will control the loco at the speed you want, with smooth starts and not too much speed reduction on hills. In model railway jargon, “pulse power” is what makes this little train controller such a good performer. Don’t let the small case fool you. This little train controller has just about all the operational features of our best designs (such as the Railpower IV from September & October 2008). And there is no heavy mains transformer or mains wiring involved because you can use an original train controller supply, a 12V lead-acid battery charger or any 15-19V switchmode laptop PC power supply rated at up to 8A. Pulse power As noted earlier, our Li’l Pulser applies pulse power to the railway track. siliconchip.com.au The completed unit, shown here actual size, is quite compact but has lots of features and can deliver output currents up to 8A. Power comes from an external 15-19V DC supply rated up to 8A (eg, a laptop PC power supply). This involves applying 17V voltage pulses (typically) to the track, even at low throttle settings. These voltage pulses are much more effective at starting and running a loco, particularly at low settings. The pulses overcome track resistance and motor and gearbox stiction, thus providing a smooth-running loco motor. At low speeds, the 17V pulses are very short so that the average voltage is low and the motor runs at a slow speed. For faster operation, the pulses are wider, thus applying a higher average voltage to the motor. But pulse power is not the only feature of this latest Li’l Pulser model train controller. It also includes mon­ itoring of the motor back-EMF to provide very good speed regulation. Without this back-EMF control, the model locos would slow down unrealistically with any slight incline. siliconchip.com.au Naturally, Li’l Pulser Mk.2 has reverse polarity and overload protection (essential features for any but the simplest model train controller), together with an audible alarm which beeps briefly for momentary track shorts but which sounds for longer for more severe overloads. New features The original Li’l Pulser had very basic features: a speed control potentiometer, three LEDs to indicate power on, reverse and track voltage, and a switch for forward/reverse operation. By contrast, Li’l Pulser Mk.2 has several added features that vastly improve the realism of operation, including inertia (sometimes called “momentum”), braking and reverse lockout, plus minimum and maximum speed settings. The most useful added feature is Main Features • • • • • • Pulse power for smooth running • Adjustable inertia and braking rates • • • • • • • • Inertia on and off selection Excellent low speed control Speed regulation Speed control pot Inertia and braking simulation Minimum and maximum speed adjustments Power on indication Track voltage LED indication Reverse indicator Over-current/short circuit alarm Compact size Maximum current: 8A Power supply: 15-19V DC July 2013  33 Li’l Pulser Par t s Lis t 1 double-sided PCB, code 09107131, 129.5 x 100.5mm 1 front panel PCB, code 09107132, 132 x 30mm 1 rear panel PCB, code 09107133, 132 x 30mm OR 1 aluminium rear panel, 134 x 30 x 1mm (see text) 1 plastic instrument case, 140 x 110 x 35mm (Jaycar HB-5970, Altronics H 0472) 1 piezo buzzer (Jaycar AB-3459, Altronics S6104) 1 16mm 10kΩ linear PCB-mount potentiometer (VR1) 1 1MΩ miniature horizontalmount trimpot (VR4) 1 250kΩ miniature horizontalmount trimpot (VR5) 3 10kΩ miniature horizontal-mount trimpots (VR2,VR3,VR6) 1 1kΩ miniature horizontal-mount trimpot (VR7) 2 nuts and washer for VR1 1 19mm knob to suit potentiometer 1 8A DPDT PCB mount relay (Altronics S 4190D) (RELAY1) 4 SPDT PCB mount toggle switches (Altronics S 1421) (S1-S4) 1 2.5mm PC mount DC socket 1 black binding post 1 red binding post 2 white binding posts 4 6.3mm 45° chassis-mount spade terminals (Jaycar PT-4900, Altronics H 2251) 1 8A M205 fuse (F1) 2 M205 fuse clips 2 TO-220 insulating bushes 2 TO-220 silicone insulating washers 4 M3 x 5mm screws 2 M3 x 10mm screws 2 M3 nuts 7 PC stakes reverse lockout. This makes it impossible to throw the loco into reverse while it is moving in the forward direction. This is highly desirable, for two reasons. Firstly, it is more realistic and secondly it prevents derailments. Reverse lockout means that even if you inadvertently switch to change the direction of the train while it is moving, the controller won’t do anything until the train has come almost to a full stop. Inertia and braking add realism to loco operation. While you can simu34  Silicon Chip 1 200mm length of 8A hook-up wire Semiconductors 1 LM358 dual op amp (IC1) 1 LM324 quad op amp (IC2) 1 LM393 dual comparator (IC3) 1 4013 dual D-flipflop (IC4) 2 IRF1405 55V 169A Mosfets (Q1,Q2) 2 BC337 NPN transistors (Q3,Q5) 1 BC327 PNP transistor (Q4) 1 7812 3-terminal 12V regulator (REG1) 1 15V 1W zener diode (ZD1) 1 FR607 6A diode (D6) 2 1N4004 1A diodes (D1,D5) 4 1N4148 switching diodes (D2-D4, D7) 1 3mm 2-lead bi-colour LED (LED1) 1 3mm red LED (LED2) 1 3mm green LED (LED3) Capacitors 3 2200µF 25V low-ESR electrolytic (22mm high or less; eg, element14 1800659) 4 100µF 16V PC electrolytic 1 47µF 16V low-leakage PC electrolytic or tantalum 1 10µF 16V PC electrolytic 2 1µF 16V PC electrolytic 1 1µF monolithic ceramic (MMC) 1 220nF MKT polyester 2 100nF MKT polyester 1 22nF MKT polyester 1 10nF MKT polyester Resistors (1%, 0.25W) 1 1MΩ 5 4.7kΩ 1 470kΩ 3 2.2kΩ 1 220kΩ 2 1kΩ 5 100kΩ 2 470Ω 2 47kΩ 1 10Ω 9 10kΩ 2 0.1Ω 5W 5% late the slow increase in speed during starting and the slow decrease in speed during braking by careful adjustment of the speed control, the inertia and braking functions do it automatically and consistently. It means that the throttle can be preset and the starting and stopping done entirely using the inertia and braking functions. The brake typically slows down the loco at a faster rate than the start-up inertia rate. There are trimpots on the PCB to set these rates. But while simulated inertia is good most of the time, it can be a problem for shunting operations. So we’ve added a front panel switch to disable inertia when you don’t need it. Locos don’t buzz when stopped In case you are wondering, the Li’l Pulser does not cause locos to buzz when they are stopped. All model locomotives require a few volts DC before they will start moving and before that, pulse power will cause them to buzz. However, the minimum speed setting in the Li’l Pulser can be set to switch off the pulses whenever the loco is stopped. And as we implied above, the Mk.2 version of Li’l Pulser is muscle-bound compared to the original Li’l Pulser because it can now deliver up to 8A DC. This means that it can easily handle trains with double-headed locos, even if they have smoke generators, sound and lighting. This improvement is mainly due to a vastly better Mosfet than that used in the original design. With all these added features, the controller is still mounted in the same compact plastic case, measuring just 140mm wide, 35mm high and 110m deep. We have packed all the circuit features onto a double-sided PCB with plated-through holes. On the front panel, there are toggle switches for power, inertia, braking and forward/reverse switching. There is one knob for the throttle control and the three LEDs. The track LED is bi-coloured: green for forward and red for reverse. The reverse LED is red, to give an indication when a train is set to go backwards. There are four binding post terminals on the rear panel, two for the input power and two for the leads to the track. A DC socket is also included for power but be aware that these DC sockets are not rated for much above about 4A. So use the binding posts for higher current operation. Pulse width modulation Before having a look at the full circuit of the Li’l Pulser, we should describe how the circuit generates the varying width pulses which drive the loco motor. To do that, we have taken the core of the circuit, as shown in Fig.1. It basically consists of a ramp (triangle) wave generator based on IC1a and a comparator based on IC3b. siliconchip.com.au +17V +12V +12V 100k 100k 3 2 IC1a MOTOR IN TRAIN Vsmax 1 10k 47 F Vsmin (LM358) 100k 10k VR1 10k 220k K VS SPEED (LM393) 6 22nF A VP 5 VT TRACK TERMINALS D6 FR607 D 7 IC3b G Q1 IRF1405 S COMPARATOR (PWM GENERATOR) TRIANGLE WAVE GENERATOR Fig.1: the core of the circuit. IC1a generates a triangle waveform and this is compared with the output voltage from the speed pot (VR1) in comparator IC3b to produce a 160Hz pulse waveform. This then drives Mosfet Q1 which switches the supply voltage to the tracks each time it turns on. The IC numbers correspond to the same parts on the main circuit shown in Fig.3. IC1a is one half of an LM358 dual op amp and is configured to work as an oscillator running at about 160Hz. It works by charging and discharging a 22nF capacitor at its inverting input. The result is a triangle (ramp) waveform at pin 2 and a square wave at its output, pin 1. The triangle waveform is fed to the inverting input (pin 6) of IC1b, one half of an LM393 dual comparator. The comparator compares the triangle wave at pin 6 with the DC voltage from VR1, the speed control potentiometer. This is depicted in the waveforms shown in Fig.2, with the DC voltage from VR1 shown as the horizontal line VS. Whenever the triangle voltage VT is below VS, the output VP at IC3b’s pin 7 will go high. Similarly, when VT is above VS, VP will go low. The result is a 160Hz pulse waveform which drives the gate of Mosfet Q1, turning it on each time VP is high. Fig.2(a) shows the result when the speed pot VR1 is set for a high speed while Fig.2(b) shows the result for a low-speed setting. These waveforms are confirmed by the scope shots accompanying this article. Circuit description Now let’s have a look at the full circuit shown in Fig.3. It uses four lowcost ICs, two power Mosfets and a relay for forward/reverse switching. IC1a is on the lefthand side of the diagram, while IC3b and Mosfet Q1 are on the righthand side. Most of the rest of the siliconchip.com.au 160Hz 160Hz VS VT VT VS 0V 0V VP VP 0V 0V HIGH SPEED LOW SPEED Fig.2: this diagram shows the output waveform (VP) from comparator IC3b for high-speed and low-speed settings of VR1. The output is high when ever VS (from the speed control pot) exceeds the triangle wave VT from IC1a. circuitry is there to add the various operating features such as braking, inertia and overload protection. So let’s start at the top lefthand corner of the circuit which shows the DC input and Mosfet Q2 which has a rather odd configuration. It is actually in series with the negative return lead and we are using it for polarity protection instead of a silicon diode. It works in two ways. Initially, at switch-on, the Mosfet is off but its substrate diode (between drain and source) conducts to let current flow. Then, once the supply voltage across the three 2200µF input capacitors builds up, the Mosfet’s gate is biased on and so the Mosfet turns hard on and conducts with a very low forward voltage of only a few tens of millivolts; much lower than even a Schottky diode, since its drain source resistance is only 5.3 milliohms! Note that the Mosfet conducts even though its drain is negative with respect to its source electrode. If this seems a little puzzling, consider that a Mosfet will conduct in either direction, as long it has the correct gate voltage polarity; in this case, positive. If the supply polarity is reversed, there will be slightly negative gate bias (by virtue of reverse-biased zener diode, ZD1) and neither the Mosfet nor its substrate diode will conduct. Because the forward voltage loss across Mosfet Q2 is so low, the amount of power it dissipates at any current up to our rated circuit maximum is very low. In fact, at the rated circuit current of 8A, the power dissipated in Q2 is only around 340mW which means that, strictly speaking, it doesn’t need any heatsinking at all. The same general comment goes for Q1, which is also an IRF1405 automotive Mosfet. And minimum heat means that we can have a high-power circuit sitting in a small plastic case. Relay rating Given that the IRF1405 Mosfet is a high-power device, what actually sets our rated circuit current of 8A maximum? The answer is the reversing relay. Its contacts are rated to switch 8A DC. The other determinants of the maximum current are the two 0.1Ω 5W wirewound resistors at Q1’s source, as described later this article. July 2013  35 TERMINALS POWER F1 8A +17V 0V 3x 2200 F 25V 1k Q2 IRF1405 DC SOCKET REG1 7812 +17V D +12V OUT IN S4 GND 220nF G K S A 2.2k 100 F LOW ESR A +12V POWER  LED3 K ZD1 15V 1W +12V 100 F 4.7k 470 100k 100k LEVEL VR6 10k 8 5 6 4.7k 7 IC1b 100k 47k 1 220k VR2 10k 4 MAX SET TP1 22nF 4.7k 160Hz TRIANGLE GENERATOR 1 IC2a 3 MIN SET BRAKE 470 A D3 1N4148 TRACK VOLTAGE LOCKOUT 14 IC2d VR5 250k 10k 12 13 IC2: LM324 IC4: 4013B A POWER UP RESET 4 470k 10 10 F 2013 S1 VR4 1M 10k K SC  RUN 7 IC2b +12V TP GND 10k VR1 10k 5 S2 10k 1 F IC1: LM358 IC3: LM393 10k SPEED 6 ERROR AMP 4.7k IC1a 2 100k 10nF 100k 3 VR3 10k INERTIA 2 9 IC2c D2 1N4148 K 8 11 LI'L PULSER TRAIN CONTROLLER MK2 Fig.3: the complete circuit for the Li’l Pulser includes back-EMF monitoring based on error amplifier IC1b, to ensure good speed regulation. Also included are a relay (RELAY1) to provide forward & reverse direction, simulated inertia, overload protection (IC3a) and a lock-out feature to prevent a change of direction until the loco has been brought to a stop. Going back to the DC input, which can typically be 17V or more, after being fed in via the power switch S4, it then feeds 3-terminal regulator REG1 which provides 12V to all of the circuit except for Q1 which switches the 17V DC rail directly to the tracks. Speed control Let’s now look at how the basic circuit of Fig.1 has been refined. First, speed control potentiometer VR1 is fed via two op amps, IC2a and IC2b. These are connected as voltage followers, fed by trimpots VR2 and VR3. So VR2 provides the minimum speed setting (minimising the “dead spot” at the low setting of speed potentiometer VR1) and VR3 provides the maximum 36  Silicon Chip speed setting, so that you cannot apply more than the maximum rated voltage for the locos you are using. Typically, HO-scale locos run with a maximum of 12V DC and N-scale locos typically run with a maximum of 9V. The voltage from the wiper of speed control pot VR1 is fed via trimpot VR4 and switch S1 to the 47µF capacitor at pin 5 of IC3b. This provides the “inertia”. What happens is that when you wind up the speed control pot, the actual change in voltage appearing at pin 5 of IC3b is slowed down by the time-constant of VR4 and the 47µF capacitor. Higher settings of VR4 give more inertia, simulating the effect of a heavier train. For shunting operations, we don’t 1N4148 A K want inertia so it can switched off by S2 which shorts out VR4. Braking While inertia is for simulating heavy trains, in the scale world of models, we normally want to stop or slow down trains much more quickly than would be possible (or safe) in the full-scale world. So braking switch S1 is included. It is set to RUN when the loco is being driven normally and then to BRAKE when you need to bring it to a quick stop. In operation, setting S1 to BRAKE connects VR5 to the 47µF inertia capacitor and this has the effect of discharging the capacitor to the output of IC2b, the minimum speed op amp. siliconchip.com.au +12V 100 F +17V +12V LED1 TRACK  2.2k D6 FR607 K  1 F MMC 8 K C 6 A Q5 BC337 D 10 G 7 IC3b A Q3 BC337 Q1 IRF1405 B A D5 1N4004 10k K 2 x 0.1  5W (R1,R2) D4 1N4148 C E S D7 1N4148 4 A RLY1b E 5 K D1 1N4004 10k B 47 F RELAY1 TRACK TERMINALS RLY1a A 47k K +12V 100nF 2.2k 10k A +12V 1k 1 + 100 F Q4 BC327 – PIEZO SIREN E 5 2 IC3a 3 1 F REV 1M B C 4.7k OVERCURRENT CURRENT 1N4004, FR607 ZD1 K This means that the 47µF capacitor is only discharged to the point where Q1 is just turned off; any more and there would be more than the necessary delay when the brake was removed. Mosfet switching In our simplified circuit of Fig.1, we show the output pulses from 1C3b directly driving the gate of Mosfet Q1. However, that is not the most effective way to drive the Mosfet if we want to minimise its power dissipation. The problem is that Q1 has quite a high gate capacitance and if we just turn it on via IC3b’s 10kΩ load resistor (this an “open-collector” output), Q1 would turn on relatively slowly for each positive gate pulse. As a result, siliconchip.com.au A K FWD VR7 1k Q S 1 K 8 IC4a CLK R REVERSE  LED2 Q 2 9 6 4 11 S3 D S Q IC4b CLK Q Vss R 10 7 13 12 TP2 LEDS A 3 10k 100nF D 14 Vdd BC327, BC337 B K A E G C its dissipation would be higher than we want, as it would spend more time in partial conduction. For that reason, the gate drive is via transistor Q5 which is connected as an emitter follower. This pulls up Q1’s gate much faster, to minimise switchon time. Conversely, when IC3b’s output goes low, Q1’s gate is quickly pulled low via diode D7. Overload protection Comparator IC3a provides the overload current protection. Two 0.1Ω 5W resistors connected in parallel monitor the load current (ie, through Q1) and the resulting voltage is fed to IC3a’s pin 2 via a 47kΩ resistor. The associated 100nF capacitor provides filtering. 7812 IRF1405 D D GND IN S GND OUT The non-inverting input at pin 3 is connected to trimpot VR7, the current setting control. If the voltage at pin 2 exceeds that at pin 3, IC3a’s pin 1 output pulls pin 7 of IC3b low via diode D4. This removes gate drive from Q1. You then get a “hunt” condition whereby the removal of gate drive to Q1 stops the overload current, so IC3a’s output goes high and the Mosfet switches on again. This switching on and off is slowed down using a 1µF capacitor connected to IC3a’s output. IC3a also drives a piezo alarm via transistor Q4 to indicate when an overload is occurring. Speed regulation The loco’s motor generates a backJuly 2013  37 DC INPUT TERMINALS Fig.4: install the parts on the PCB as shown on this layout diagram. Be sure to orientate the ICs, Mosfets, diodes zener diodes and electrolytic capacitors correctly. TERMINALS TO TRACK VR1 10k 10 F 4004 2.2k 4004 S3 A LED2 REV LED1 TRACK It amplifies the voltage by a factor of about two and its output is used to control the pin 3 threshold voltage of triangle generator lC1b via a 100kΩ resistor. So, as the motor speed drops, the back-EMF decreases, and the DC level from pin 7 of lC1b drops. This causes the triangle waveform generated by IC1a to drop with respect to the DC voltage from speed control potentiometer VR1. This then results in wider positive gate pulses to Mosfet Q1 and more power fed to the motor to maintain the given speed setting. Trimpot VR6, at pin 5 of IC1b, is included to give some compensation for different motor characteristics; some motors generate more back-EMF than others. VR6 is set so that pin 7 of IC1b is at about mid-supply voltage (ie, 6V) when a motor is connected (more on that in the setting up procedure). Reverse lockout Forward and reverse switching is 100nF 2.2k 47k 10k IC4 4013B 10nF 100k 1 100k LEVEL 4.7k 47 F LL LED3 POWER EMF that is directly proportional to its speed. In other words, during the period that the motor is not driven by the pulses, it acts as a generator, supplying voltage at its output terminals. We use this back-EMF as a feedback signal to make sure that the controller maintains a relatively constant motor speed for a given throttle setting, regardless of variations in load. In operation, the motor’s back-EMF is monitored by D5 which conducts when Mosfet Q1 is off. Note that D5 monitors the negative terminal of the motor and any back-EMF will be negative with respect to the +17V rail. At low motor speeds, the back-EMF is close to the 17V supply. As the motor speeds up, it will generate more backEMF and so the voltage we measure will be lower (with respect to +17V). D5 feeds a 1µF capacitor via a voltage divider consisting of two 4.7kΩ resistors and the resulting filtered voltage is fed to the pin 6 inverting input of op amp IC1b (the error amplifier). TP1 S2 S1 BC337 FOR/REV 10k VR4 1M INERTIA 10k 10k RUN/BRAKE 470 TP GND 38  Silicon Chip Q3 INERTIA 250k VR5 STOP TRACK TRACK D6 100k 10k 1 VR2 K 100k 4.7k 100 F 100k 470k 4148 10k D3 SPEED A D2 4148 IC2 LM324 10k 10k MIN. 100 F 10k IC3 LM393 1k 1 F MMC 1M 470 1k VR3 S4 POWER C 2013 NIART LED O M RELL ORT N O C 09107131 13160190 TP2 220nF REG1 7812 D1 D5 VR6 10k 1 MAX. 10k 4.7k 1 F 100nF BC337 22nF 1 VR7 220k MODEL TRAIN CONTROLLER 1 F IC1 LM358 Q5 BC327 2.2k 100 F 4.7k Q4 OVERCURRENT R2 COM NC PIEZO LOW ESR 100 F R1 NO 10k + 2200 F 25V 47k 4148 + F1 4148 D7 D4 RELAY1 4.7k LOW ESR 0.1  5W 2200 F 25V LOW ESR 0.1  5W 2200 F 25V 15V 1W + 10 1k 8A + Q1 2x IRF1405 FR607 Q2 DC IN 0V ZD1 DC IN +17V Right: the prototype used the plastic front panel supplied with the case, plus a paper label. PCB front panels with pre-drilled holes and screened lettering are available from the SILICON CHIP Online shop. done by RELAY1. This turns on and reverses the loco when the Q output (pin 1) of D-type flipflop IC4a goes high and turns on transistor Q3. IC4a provides the forward/reverse lockout feature whereby the train’s direction cannot be changed unless the track voltage is reduced to zero. This works as follows: IC4a has its data input (pin 5) connected to either +12V via a 10kΩ resistor when the forward/reverse switch (S3) is open or to 0V when S3 is closed. The Q output at pin 1 changes to the level set at pin 5 when a positive clock pulse is fed to pin 3. So if the setting of the forward/ reverse switch is changed, the Q output of IC4a will not change until pin 3 gets a positive clock pulse. In practice, we prevent a clock pulse from arriving until the gate pulses to Mosfet Q1 are stopped. We do this by monitoring the voltage across the 47µF capacitor at pin 5 of IC3b (ie, the speed setting voltage) using op amp IC2d, ie, via the 10kΩ resistor to its pin 13 input. siliconchip.com.au SILICONE WASHER INSULATING BUSH 10mm LONG M3 SCREW M3 NUT Q1, Q2 PCB REAR OF CASE Fig.5: the mounting details for Mosfets Q1 & Q2. The metal tab of each device must be isolated from the rear panel using an insulating bush and a silicone washer. IC2d’s pin 12 is connected to a voltage divider between pin 1 of IC2a and pin 7 of IC2b. Hence, pin 12 will be very close to the minimum speed voltage from IC2b. So until the voltage across the 47µF capacitor drops below this minimum voltage (when the brake is applied, for example), IC2d’s output will be low and this will short out any clock pulse to IC4a (ie, from IC1a) by forward biasing D3. The clock pulses are derived from the output of IC1a, the same op amp that provides the triangle waveform. As soon as the voltage across the 47µF capacitor drops below pin 12 of IC2d, the clock pulses will get through to IC4a. It will then change state and so will the relay. Finally, op amp IC2c is included to give a power-on reset to IC4a, so that it has the 160Hz clock signal applied to give the correct setting of forward or reverse, as set by the forward/reverse switch. Thus, when power is first applied, the 10µF capacitor at pin 10 of siliconchip.com.au IC2c is discharged and since this is lower than pin 9, IC2c’s output is high. As a result, diode D2 pulls pin 13 of IC2d low, so pin 14 of IC2d is high and the clock signal cannot be shunted to 0V by D3. Finally, after about five seconds, the 10µF capacitor charges up, IC2c’s output goes high and the forward/reverse lockout facility operates normally. Construction Building the Li’l Pulser is easy, with all the parts assembled onto a PCB coded 09107131 and measuring 129.5 x 100.5mm. This is housed in a small instrument case measuring 140 x 35 x 110mm (W x H x D). Our prototype used an adhesive label attached to the plastic panel supplied with the case for the front panel. However, we’re making available a PCB front panel (code 09107132) with blue solder masking, screened lettering and all the holes pre-drilled for a really professional finish. This PCB panel is simply substituted for the supplied plastic panel. We’ve also designed a rear-panel PCB (code 09107133) and this has solder-masked copper on both sides to provide heatsinking for the two Mosfets (Q1 & Q2). The mounting areas for the Mosfets are clear of solder masking to improve thermal contact and there are numerous vias between the two sides of this PCB to improve ventilation and heat transfer out of the case. This PCB rear panel can be used for output currents up to about 5A. This should be more than adequate for the vast majority of layouts, including layouts running double-header (or even triple-header) locos with sound, steam and lighting. For layouts requiring more than 5A (up to 8A maximum), it’s best to use an aluminium rear panel for improved heatsinking (as in the prototype). You will have to cut this aluminium panel to size (134 x 32 x 1mm) and drill the holes yourself (details later). The original plastic panel supplied with the case is discarded. Fig.4 shows the parts layout on the PCB. Begin by inspecting the board carefully for any defects (rare), then start the assembly by installing the 0.25W resistors. Table 1 shows the resistor colour codes but you should also check each one using a digital multimeter before soldering it to the PCB. The diodes (including ZD1) can go in next. Be sure to use the correct type at each location and make sure they are all orientated correctly. That done, install the capacitors and the two 0.1Ω July 2013  39 Fig.6: this scope grab shows the operation of IC1a & IC3b. The green trace is the triangle output from IC1a while the blue trace is the DC voltage from speed pot VR1. The resultant pulse (yellow trace) from the output of IC3b is fed to the gate of Mosfet Q1. This is a low speed setting. 5W resistors (the latter can be mounted flush against the PCB, as they run only slightly warm). Take care with the orientation of the electrolytics – they all go in with their positive leads towards the rear of the PCB. Follow with the trimpots, relay, piezo buzzer (watch its orientation), switches, potentiometer VR1 and the DC socket. Don’t get the trimpots mixed up and be sure to trim VR1’s shaft to to suit the knob before soldering it to the PCB. The ICs can then be installed. Make sure their notched ends face the rear of the PCB as shown on Fig.4. Installing the Mosfets Regulator REG1 can now go in, followed by transistors Q3-Q5. Note that Q4 is a BC327 while Q3 & Q5 are both BC337s. Don’t get them mixed up. Fig.7: this scope grab shows the same signals as in Fig.6 but now the speed voltage from VR1 is higher, leading to wider positive output pulses from the output of IC3b. This corresponds to almost maximum speed. You can compare these scope grabs with the waveforms shown in Fig.2. Mosfets Q1 & Q2 can now be installed. First, slip the PCB assembly into the case and secure it by installing the two rear mounting screws. That done, slide the rear panel into position, then mount the two Mosfets on the PCB and temporarily fasten them, along with their insulating bushes, to the rear panel using machine screws and nuts (note: if you are using an aluminium rear panel, you will first have to download the artwork from the SILICON CHIP website and use it as a template drill the necessary holes). Check that the rear panel is pushed all the way down into its case slot, then carefully tack solder the two outside leads of each Mosfet to their pads on the top of the PCB. The PCB assembly can then be removed from the case and the Mosfet leads soldered on the underside. The next step is to fit PC stakes to the four external wiring points and to the three test points (TP1, TP2 & TP GND). Follow with the two fuse clips, making sure that each goes in with its end stop towards the outside (otherwise you will not be able to install the fuse). Installing the LEDs The PCB assembly can now be completed by fitting the three LEDs (LEDs1-3). Use the bi-colour LED for Table 2: Capacitor Codes Value 220nF 100nF 22nF 10nF µF Value IEC Code EIA Code 0.22µF 220n 224 0.1µF 100n 104 0.022µF 22n 223 0.01µF 10n 103 Table 1: Resistor Colour Codes o o o o o o o o o o o o o No.   1   1   1   4   2   9   5   3   2   2   1   2 40  Silicon Chip Value 1MΩ 470kΩ 220kΩ 100kΩ 47kΩ 10kΩ 4.7kΩ 2.2kΩ 1kΩ 470Ω 10Ω 0.1Ω 4-Band Code (1%) brown black green brown yellow violet yellow brown red red yellow brown brown black yellow brown yellow violet orange brown brown black orange brown yellow violet red brown red red red brown brown black red brown yellow violet brown brown brown black black brown not applicable 5-Band Code (1%) brown black black yellow brown yellow violet black orange brown red red black orange brown brown black black orange brown yellow violet black red brown brown black black red brown yellow violet black brown brown red red black brown brown brown black black brown brown yellow violet black black brown brown black black gold brown not applicable siliconchip.com.au The rear panel carries the four binding posts for the power supply and track connections. An on-board DC socket is also accessible via a hole in the rear panel and can be used instead of the red and black binding posts for currents up to about 4A. LED1 (Track), the red LED for LED2 (Reverse) and the green LED for LED3 (Power). To install the LEDs, first orientate each one in turn so that its anode lead is on the left (as viewed from the front), then bend its leads down by 90° about 8mm from its body. That done, solder the LEDs in place with their horizontal lead sections 5mm above the surface of the PCB (ie, in line with the switch centres). The easiest way to achieve this is to cut a 5mm-thick cardboard spacer and simply push the LEDs down onto this before soldering their leads. Final assembly Now for the final assembly. The first step is to wind a nut onto VR1’s threaded bush. Do this nut all the way up, then fit the front panel to the PCB assembly and secure it by fitting a second nut to VR1 (make sure the switches and LEDs all correctly protrude through the front panel before fitting this nut). Next, fit the four binding posts to the rear panel – red for the +12-19V terminal, black for 0V and white for the two track posts. Once they’re secure, attach a 45° 6.3mm chassis-mount spade terminal to each binding post and secure it using the two small endnuts (see photo). The spade terminal ends close to the siliconchip.com.au Making Your Own Rear Panel An aluminium rear panel will be necessary if you intend using the Li’l Pulser to deliver currents above 5A. This panel should be 1mm thick and should be cut to 134 x 30mm. Once you’ve cut the panel to size, download the rear-panel artwork (see Fig.10) from the SILICON CHIP website at www.siliconchip.com.au (go to “Shop”, then “Panel artwork”). Print this out onto both plain paper and photo paper. The paper version is used as the drilling template while the photo paper version is used as the label. Use a small pilot drill to start the holes, then carefully end-nuts should now all be trimmed so that the don’t later interfere with the relay and the DC socket when it’s all assembled in the case. This can be done using tin-snips and then filing them down. In addition, you will have to trim the ends of the posts so that they protrude no more than about 1.5mm beyond the end-nuts. If you can only get double-ended spade terminals, it’s simply a matter of cutting off the unwanted terminals. Once the spade terminals are in place, they can be connected to their respective PCB stakes via short lengths enlarge them to size as necessary using larger drills and a tapered reamer. Once the holes have been drilled, the label can be affixed to the lid using a suitable glue or silicone. The holes in the label can be cut out using a sharp hobby knife. Another alternative is to discard the case altogether and mount the PCB assembly under the layout. You could then mount the speed pot, switches and LEDs on a separate control panel and connect them back to the PCB via flying leads. The two Mosfets can then either be mounted on an aluminium heatsink or fitted with small finned heatsinks. of heavy-duty (8A) hook-up wire. Solder these wires to the PCB stakes first, then fit short lengths of heatshrink sleeving over the connections and shrink it down. This will stop the leads from flexing and breaking at the stakes. The other ends of the wires are then soldered to the spade terminals. That done, the completed assembly can be installed in the case and the PCB secured to the four corner pillars in the base using four M3 x 5mm screws. Don’t worry if the positive binding post terminal touches the adjacent fuse clip, as these are conJuly 2013  41 Another view inside the proto­ type. Mosfets Q1 & Q2 must be isolated from the rear panel, regardless as to the type of panel used (aluminium or PCB). nected together on the PCB anyway, so it doesn’t matter. Securing the Mosfets Regardless as to which type of rear panel is used (PCB or aluminium), Mosfets Q1 & Q2 must both be attached using an insulating bush, insulating washer and an M3 x 10mm screw & Fig.8: these scope waveforms were taken at the gate and drain of Mosfet Q1 to show its switching action. The yellow trace is the gate waveform from IC3b while the green trace is at the drain and shows the pulses applied to the track, with a resistive load connected. Note that when the gate is positive, the Mosfet switches on and pulls its drain low. 42  Silicon Chip Fig.9: these scope waveforms are again from the gate and drain of Mosfet Q1 but with a 12V permanent magnet motor connected. The green trace shows that when the Mosfet switches off, the voltage at the drain immediately rises to about 17V but then drops due to the back-EMF generated by the motor. At a higher throttle setting, the back-EMF would be higher, leading to a greater drop at Q1’s drain. siliconchip.com.au A hole can be drilled in the lid of the case, above the piezo buzzer, to let the sound escape. The buzzer provides audible indication of a track short circuit. nut. This is necessary to isolate their metal tabs from the panel. Fig.5 shows the mounting details. Once they are secured in place, check that their metal tabs are indeed electrically isolated from the PCB copper (or rear panel) using a digital multimeter set to a high ohms range. In each case, you should get a high megohms (or open circuit) reading. If not, undo the assembly and locate the source of the problem. Finally, a 6mm hole can be drilled in the lid of the case directly above the piezo siren, to let the sound out when an overload is detected. Be careful when marking out the position of this hole for drilling – the lid will only fit correctly in one direction. Testing As mentioned earlier, the Li’l Pulser train controller can be powered from a train power supply, a 12V battery charger or from a 15-19V switchmode laptop PC power supply. The current rating of the supply will depend on your individual requirements but around 5A will be more than sufficient for most applications. However, you will need a supply with an 8A rating if you want the Li’l Pulser to deliver its maximum 8A output capability. Before connecting the supply, go over your work carefully and check that all parts are in their correct locations and that all polarised parts are The final adjustments involve adjusting the minimum track voltage setting, setting the maximum speed and adjusting the inertia and braking trimpots. The steps are as follows: (1) Set the speed pot (VR1) to minimum and connect the Li’l Pulser controller to length of track with a loco. (2) Monitor test point TP1 and adjust trimpot VR6 for a reading of 6V. (3) With the speed pot at minimum, adjust VR2 fully anticlockwise and then slowly clockwise until there is a small amount of track voltage as indicated by noise in the loco motor. Back off the trimpot just a little from that point. (4) Remove the loco from the track, wind the speed pot fully clockwise and measure the DC voltage across the track terminals. Adjust VR3 for the maximum required track voltage. This is usually set for 12V but you may wish to make this lower to limit the maximum speed of the locos. (5) With the loco back on the track, check that it runs smoothly as the speed control is advanced. Adjust the inertia trimpot (VR4) and the brake trimpot (VR5) to give the required simulated inertia when accelerating and braking. Note that advancing VR4 past its mid-setting can also have an effect on the minimum speed. That means you may need to readjust the minimum and maximum speed settings (steps 3 SC & 4 above) after adjusting VR4. 0V +12 -19V Track + . siliconchip.com.au Final adjustments Power In Fig.10: this rear-panel artwork can be copied or downloaded from the SILICON CHIP website and used as a drilling template for an aluminium rear panel. For output currents up to 5A, use the suggested PCB rear panel (see text). the right way around. That done, connect the supply to either the DC socket or to the red and black binding posts. As stated, the DC socket is only rated up to about 4A. If your supply has a higher current rating, use the binding posts to make the supply connections. The unit can now be checked out by following this step-by-step procedure: (1) Apply power and check that there is 12V between pins 8 & 4 of IC1 (LM358). (2) Wind the speed pot (VR1) fully anticlockwise and adjust all trimpots to mid setting. (3) Check that the brake, inertia and reverse switches are all off (ie, in the up position), then advance the speed pot and check that the track LED lights green. Check that it gets brighter as you wind up the throttle. (4) Leave the speed pot at a high setting, switch to reverse and check that the reverse LED (LED2) stays off (ie, because of the lockout). (5) Wind the speed pot down and check that the reverse LED lights when the pot is almost fully anticlockwise. Now wind the speed pot up again; the track LED (LED1) should now be glowing red. If that all checks out, then the Li’l Pulser is working correctly and you can proceed to set the current limit. That’s done as follows: (1) Connect a multimeter between TP2 and TP GND. (2) Adjust VR7 for a reading of 50mV for each amp of the required current limit. For example, adjust VR7 for a reading of 150mV for a 3A current limit. Similarly, a 400mV reading will give the maximum 8A current limit. (3) Short the output terminals and slowly advance the speed pot. Check that the piezo alarm sounds to indicate a short. Note that the fuse should be changed to a lower rating if the current limit (and/or the supply rating) is lower than 8A. Use a fuse rating that corresponds to the current rating of the supply and set the current limit to be equal to or less than this value. July 2013  43