Silicon ChipAutomatic Level Crossing and Semaphore Control - October 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions
  5. Back Issues: Hare & Forbes Machineryhouse
  6. Publisher's Letter: Time for some new PICs
  7. Feature: Holy Spheres, Batman! by Max the Magnificent
  8. Feature: Net Work by Alan Winstanley
  9. Project: Automatic Level Crossing and Semaphore Control by LES KERR
  10. Project: Multi-Stage Buck-Boost Battery Charger by Tim Blythman
  11. Project: PIC & AVR Chips from Microchip by Tim Blythman
  12. Project: PIC AND AVR Breakout Boards by Tim Blythman
  13. Feature: Arduino Bootcamp – Part 10 by Max’s Cool Beans
  14. Feature: AUDIO OUT by Jake Rothman
  15. Feature: KickStart by Mike Tooley
  16. Feature: Circuit Surgery by Ian Bell
  17. PCB Order Form
  18. Advertising Index by Ian Batty

This is only a preview of the October 2023 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Items relevant to "Stewart of Reading":
  • Bookshelf Speaker Passive Crossover PCB [01101201] (AUD $10.00)
  • Bookshelf Speaker Subwoofer Active Crossover PCB [01101202] (AUD $7.50)
  • Bookshelf Speaker Passive and Active Crossover PCB patterns (PDF download) [01101201-2] (Free)
  • Bookshelf Speaker System timber and metal cutting diagrams (PDF download) (Panel Artwork, Free)
Articles in this series:
  • Easy-to-build Bookshelf Speaker System (January 2020)
  • Building the new “bookshelf” stereo speakers, Pt 2 (February 2020)
  • Building Subwoofers for our new “Bookshelf” Speakers (March 2020)
  • Stewart of Reading (October 2023)
  • Stewart of Reading (November 2023)
  • ETI BUNDLE (December 2023)
  • Active Subwoofer For Hi-Fi at Home (January 2024)
  • Active Subwoofer For Hi-Fi at Home (February 2024)
Automatic Level Crossing and Semaphore Control with ‘chuff’ and whistle sounds This project combines the Model Railway Level Crossing and Semaphore Signal projects with a Li’l Pulser Mk.2 train controller to automate a model railway layout. It also adds chuffing and whistle sounds to make it as realistic as possible. T he Automatic Train Controller makes your train pull up to the Semaphore Signal, triggering the Level Crossing, then proceed through the crossing when safe, all automatically and with accompanying sound effects. It made sense to integrate this with my Li’l Pulser Mk.2 Model Train Controller. All of the projects required to build the Automatic Train Controller are listed in the opposite panel; except the Carriage Lights which are optional. To make it more realistic, I added two sound modules, one to produce steam whistle sounds and another to add engine chuff noises. You can see a video of all these devices operating in concert at: https://bit.ly/pe-oct23-loco In that video, the Semaphore Signal goes up to alert the train to stop, then the train slows down and stops at the Signal. The barriers on 16 the Level Crossing close, the bells sound and lights flash, then the Signal goes down and after a delay, the train moves off slowly. As the train approaches the Level Crossing, the whistle sounds. Once the train has passed through the Crossing, it resets. An elegant feature of the Li’l Pulser Train Controller is its built-in inertia simulator, which means that the train slows down like its full-size version and moves off slowly. It does this simply by charging and discharging a capacitor. In case you only want to make the chuff sound module and not the train controller, I have split the design up into two separate circuits and PCBs. BY LES KERR Automatic train control The overall arrangement of the Train Controller is shown in the block diagram, Fig.1. It still allows you to operate the Level Crossing and Semaphore Signals manually by associated toggle switches. Double-pole, double-throw (DPDT) toggle switch S1 switches between automatic and manual control. In manual mode, the Li’l Pulser Train Controller operates as usual. So that the Crossing and Signal can be used in each mode, we use diode OR gates on their control inputs. This means that the automatic control board drives the control inputs of these modules when it is selected, while the manual switches drive them when the Automatic Controller is disabled. A reed switch under the track is used to start the automatic process. In automatic mode, a magnet on the engine closes this reed switch as Practical Electronics | October | 2023 Fig.1: the overall arrangement of the modules in this system. Most of them are linked to the Automatic Control Module (the Chuff module is not shown here as it operates independently). The Control Module can start or stop the train by using RLY1 to change how the Li’l Pulser operates. When required, it also triggers the Steam Whistle, Semaphore Signal and Level Crossing modules. Fig.2: this timing diagram shows the sequence of events. If this is unclear, see: https://bit.ly/pe-oct23-loco Three of the delays are adjustable using trimpots VR1-VR3 on the Control Module. the engine passes, starting the timing sequence shown in Fig.2. Timer 1 (adjustable from half a second to 10 seconds) starts, the Signal goes up and the relay on the PCB operates, closing contacts RLY1b. The closure of those contacts connects the 250kW brake potentiometer to the 47μF capacitor on the positive input of IC3b in the Li’l Pulser Train Controller, stopping the train. At the end of Timer 1’s period, the Signal goes down. Timer 1 is adjusted so that the Signal goes down one second after the train has stopped. Timer 3 (0.5 to 10 seconds) is adjusted for the driver’s reaction time to start the train. I set mine to one second. When Timer 3 expires, the Level Crossing closes and the relay is de-energised, opening contacts RLY1b. The 47μF capacitor is now connected to the 1MW inertia pot, causing the train to move off slowly as the capacitor charges. Then there is a fixed four-second delay before a signal is sent to operate Practical Electronics | October | 2023 the whistle in the sound module. The train runs on through the Level Crossing and then, when the train has passed and Timer 2 expires, the Level Crossing opens. Control circuit details The circuit of the Auto Control Module black box from Fig.1 is shown in Fig.3. It is pretty straightforward since most of the functions are provided by the PIC16F1455 microcontroller (IC1). When the reed switch closes, the RC1 input (pin 9) of IC1 that is usually held low by the 10kW resistor is pulled high. This triggers the software into action. It uses three identical 0.5-to-10-second timers, adjusted using trimpots VR1-VR3. The 680W padder resistors set the minimum voltage achievable for each pot’s wiper to about 0.5V, which corresponds to half a second. Taking Timer 1 as an example, VR1 adjusts the voltage at analogue input pin RC0 (AN4) of IC1. The 100nF capacitor filters out any ripple or interference, so there is a steady voltage at that pin. The microcontroller’s internal analogue-­to-digital converter (ADC) is used to turn this voltage into a number to calculate the time delay. The other two timers are similar, using VR2/RC2/AN6 and VR3/RA4/AN3. Projects needed to build the Automatic Train Controller Li’l Pulser Mk.2 Model Train Controller Model Railway Level Crossing Model Railway Semaphore Signal Model Railway Carriage Lights July 2014 July 2022 March 2023 November 2022 (optional) 17 Automatic Train Controller Fig.3: the Control Module is based around microcontroller IC1, which uses internal timers to generate the control signals at RA5, RC4 and RC5 when appropriate. Those timer durations are adjusted using trimpots VR1-VR3 that apply varying DC voltages to the AN4, AN6 and AN3 analogue inputs. The closure of the reed switch at pin 9 of IC1 (the RC1 input) starts the whole sequence. IC1’s RC3 digital output (pin 7) is used to switch NPN transistor Q1 which controls the coil of relay RLY1. IN4004 diode D1 protects the transistor from the back-EMF generated by the coil’s inductance when the relay switches off. Contact RLY1a switches yellow LED4 while contacts RLY1b are used to change the Li’l Pulser between the brake and run modes. IC1’s digital outputs (RA5, RC4 and RC5) are used to produce the three control signals to trigger the Semaphore Signal, Level Crossing and Whistle Sound modules, respectively. These signals are also applied to the LEDs (LED1-LED3) via 1kW current-limiting resistors so you can easily see when different modules are being triggered. Output RC4 (pin 6), when high, closes the Level Crossing and switches on blue LED2. Similarly, when output RC5 goes high (pin 5), the Signal goes up and red LED1 lights. Then, when output RA5 goes high (pin 2), the whistle module is triggered and white LED3 flashes for 200ms. The only other components are the 10kW pull-up resistor at the MCLR input of IC1 (pin 4), to prevent spurious resets, and the 100nF and 100μF supply bypass capacitors, mainly for the benefit of IC1. Chuff Sound circuit details My design for the ‘Chuffer’ circuit which produces the ‘chuff’ sound 18 of a steam locomotive is based on ideas developed by Greg Hunter. The voltage supplied to the locomotive is sensed to vary the chuff rate. The higher the voltage, the faster the ‘chuffs’. When the locomotive is stationary (no track voltage), it produces a ‘panting’ sound that is like an engine compressor running. The resulting circuit is shown in Fig.4. It is separate from the other modules; while they are great in combination, it can also be used as a standalone device. The voltage from the rails is applied to a bridge rectifier, and the resulting DC is reduced by an adjustable resistive divider, clamped to a safe level by an LM4040 IC acting like a 5V zener diode and filtered by a 10μF electrolytic capacitor. The result is a 0-5V signal applied to the GP2 analogue input (pin 5) of PIC12F675 microcontroller IC1 that, when VR4 is adjusted correctly, lets it measure at what speed the train is currently moving. VR4 is adjusted for 3.3V at its wiper when the train is running at a realistic maximum speed. Depending on the make of your controller, you might have to change the 15kW resistor value to achieve that. Note that this will not work with a DCC system because those systems do not vary the voltage across the tracks – instead, they send digital signals to the locomotives. Microcontroller IC2 and LM386 audio amplifier IC3 are powered from a separate 5V DC regulated supply. This 5V supply must be floating with respect to the track supply; one can be earthed, or the other, but not both. Otherwise, the supplies will be shorted out via the bridge rectifier. A separate 5V DC regulated plugpack is a good option here. The voltage applied to the GP2 input of IC1 is converted to an 8-bit digital number (0-255) by IC1’s internal ADC. This number is proportional to the locomotive speed. A nice feature of this PIC is its internal square-wave oscillator that can be programmed to produce 127 tones and 128 notes of white noise. To simulate the hissing noise of the engine, we use a couple of the white noise outputs. The output is switched on and off depending on the ADC voltage, so we get more chuff pulses as the train accelerates. The reverse happens when the train slows down. When the train is stopped, the panting sound is generated by another white noise channel with the pulses separated by a few milliseconds. These waveforms are applied to the GP1 digital output (pin 6), which is AC-coupled to the input of IC3 via a variable attenuator. In this configuration, IC3 has a gain of 20 and can deliver up to 300mW into the 8W speaker. The 1kW potentiometer VR5 determines the output volume. I used a 57mm diameter speaker with a 100mm square white card Practical Electronics | October | 2023 Model Train ‘Chuffer’ Fig.4: the Chuff Sound Module is pleasingly simple. The voltage across the rails is rectified, filtered, reduced and then applied to the GP2 analogue input of IC2 so it can sense the train speed. It produces the panting or chuff sounds at its pin 6 digital output (GP1), and these signals are fed to audio amplifier IC3 and ultimately, the speaker. mounted on its back to stop the reflected sound, which resulted in just the right amount of bass to match my Peckett tank engine. Depending on what you are running, you may have to experiment to get the optimal sound for your engine. Putting the speaker in a box will increase the bass. Construction The first build step is to assemble the PCB module(s). For the Li’l Pulser, Semaphore and Level Crossing modules, see the instructions in the July 2014, March 2023 and July 2022 issues respectively. The Train Control module is built on a single-sided PCB, coded 09109221 that measures 50 x 51mm and which is available from the PE PCB Service. The necessary parts are in the parts list, and the component layout (overlay) is shown in Fig.5. While the PCB is a single-sided design, if you buy it from our online shop, we will supply a double-sided board that will save you having to fit the two wire links. Start by fitting the PCB pins, followed by the IC and relay sockets. Take care to orient the sockets correctly. There is no onboard programming header, so you will need to remove the chip from the socket later if you wish to reprogram it. Next, fit the resistors (mounted vertically), followed by the capacitors and trimmer potentiometers. The electrolytic capacitors are polarised (longer lead to + pad), but the ceramic capacitors are not. If you have a single-sided PCB, fit the two wire links now using resistor lead off-cuts. Next, install the diode, LEDs and transistor. They all need to go in the right way round; check Fig.5 if you Practical Electronics | October | 2023 are unsure. Then plug in the relay, oriented as shown. Don’t plug in the PIC microcontroller yet. If you have a blank PIC then you will need to program it yourself; you can download the HEX file from the October 2023 page of the PE website at: https://bit.ly/pe-downloads You will need a PICkit 4, Snap programmer or similar to load the file, along with a socket adaptor for the PIC16F1455 device. PCB testing First, inspect the board for dry solder joints and check that the diode, capacitors and sockets are inserted correctly. Connect the PCB to a 5V DC power supply, switch it on and connect the negative lead of a voltmeter to pin 14 of IC1’s socket. Probe pin 1 of that socket with the positive lead and the meter should read close to +5V. If it doesn’t, check the power supply and socket polarity. Switch off power and plug in IC1, checking that it is correctly oriented, then adjust the three trimpots to their mid positions. Switch the power on and momentarily connect a wire link between the reed switch terminals, SW and SW+. Upon doing that, the red and yellow LEDs should light. About five seconds later, the red LED should go out. After a further five or so seconds, the yellow LED should extinguish and the blue LED should light. Four seconds later, the white LED should switch on for 200ms, and in a further five or so seconds the blue LED should go out. This shot shows off the semaphore signalling section of the project. 19 Fig.5: assemble the Control Module as shown here. It can be etched as a singlesided design, but then two wire links are needed (shown in red). They are already part of the commercially made double-sided PCBs we supply. When building it, watch the orientations of the IC, relay, diodes, transistor and electrolytic capacitors. If that all went well, power it off and give the bottom of the PCB a coat of clear varnish to protect it from corrosion. the whistle. If it sounds distorted, try turning the computer playback volume down and re-record it. Whistle Sound module My initial plan was to add the Whistle Sound to the Chuff generator, but it is difficult to produce a whistle sound electronically that covers the full range of possible locomotives. Instead, I decided to use the simple ISD1820-based sound recording and playback module. This means that you can choose and record a suitable locomotive whistle sound from the Internet. Another advantage of this approach is that the chuff sound and the whistle sound are present simultaneously. The first step in setting this up is to record the whistle sound onto the module. Connect the 76mm 8W loudspeaker (SPK1) to the green terminal block marked ‘speaker’, then wire a 5V DC supply between the terminals marked VCC and GND on the module. Looking at the component side of the module with the green terminal block on the left, ensure that the two slide switches marked FT and repeat are to the left-hand side (both open). if you have the jumper-based version (pictured opposite) then the jumper positions shown highlighted in red should be suitable. Next, find the whistle sound file you need via an Internet search. Hold the module so that the electret microphone is about 100mm from the computer’s loudspeaker and set the sound to maximum volume. Hold down the REC button on the module, then hit play on the computer. Continue holding down the record button until LED1 goes out (the maximum recording time is around 10 seconds). Now momentarily press the PLAYE button. You now should hear the recording of Chuff sound PCB assembly The Chuff circuit is built on a 59 × 30mm single-sided PCB, coded 09109222 and available from the PE PCB Service. Refer to its overlay diagram (Fig.6) during assembly. As mentioned earlier, it could be used independently, not just as part of the automatic system. Start assembly by fitting the PCB pins and the IC sockets, ensuring the latter are oriented correctly. Do note that just like the Control board, there is no provision for onboard programming of the microcontroller. Now add the resistors, mounted vertically, followed by the capacitors; the electrolytics are polarised (the longer lead goes to the + pad), but the others aren’t. Follow with the two trimmer potentiometers but don’t get the two different values mixed up. If using a single-sided board, you can fit the wire link now (which can be made from a component lead off-cut); it isn’t needed for the 20 Some ISD1820-based modules look a little different. However, the required connections are the same. double-sided version. Solder in the diodes next; they need to be the right way around. If using a 4.7V zener diode rather than the LM4040, solder its cathode (striped) end lead to the centre pad of the TO-92 footprint, and the other (anode) lead to the LM4040 pad closest to the edge of the board. Otherwise, if using the LM4040, mount it as shown in Fig.6. Temporarily connect the positive of the 5V power pack to the +5V PCB pin, and the negative to 0V. Also wire in the loudspeaker as shown. At this stage, do not plug in the audio amplifier (IC3) or the PIC microprocessor (IC2). If you have a blank microcontroller then you will now need to program it. Again, you can download the relevant HEX file from the October 2023 page of the PE website at: https://bit.ly/pe-downloads Use a PICkit 3, PICkit 4, Snap programmer or similar to load the HEX file into the chip via a socket adaptor. We recommend you use the free Microchip MPLAB IPE software. Testing the Chuff module First, inspect the board for dry solder joints and check that the diodes, capacitors and sockets are inserted correctly. Switch on the power supply and connect the negative lead of a voltmeter to pin 8 of IC2’s socket, with the positive lead to pin 1. The meter should read close to +5V. If it doesn’t, you have likely wired the power supply the wrong way round or the socket is reversed. Assuming it’s OK, switch off the power and insert the two ICs, checking that they are correctly oriented and not swapped. Adjust both potentiometers to the mid position. Switch the power on and you should hear a ‘panting’ sound coming from the speaker. Adjust VR5 so that the sound is at a comfortable level. Connect a 12V variable supply to the track inputs and slowly wind up the supply. The speaker should now emit a chuffing sound with the frequency increasing as the voltage rises. Finally, give the bottom of the PCB a coat of clear varnish to protect it from corrosion. Wiring it up Next, we need to determine where to place the reed switch in relation to the Semaphore Signal. To do this, we first have the locomotive running at a realistic speed in the normal mode and apply the brake. Measure its stopping distance and place the reed switch under and perpendicular Practical Electronics | October | 2023 Fig.6: assembly of the Chuff Sound Module is similar to the Control Module, just simpler as there are fewer parts. The parts where polarity is critical are the diodes, ICs and electrolytic capacitors. The LM4040 is ideal, but a 4.7V zener diode can be used instead, with the cathode (striped) end to the middle pad and the other lead to the bottom-most pad. to the rails at that distance before the Signal. I set the reed switch in a groove so that its cylindrical top was level with the bottom of the rail. You may well have to experiment with this, depending on the type of engine you have and where you place the magnet within it. Be careful not to place the magnet in direct contact with the reed switch, as this can demagnetise it, causing it to fail. I built the Li’l Pulser Mk2 Train Controller in a larger enclosure than originally specified (Jaycar HB6128 ABS), measuring 171 × 121 × 56mm. This was so that I would have more room to mount the Automatic Control PCB, its corresponding on/off switch, the manual Whistle push button, the manual Signal toggle switch and the manual Crossing toggle switch. If you have already built the Li’l Pulser Mk2 Train Controller into the smaller specified case, you will need another box to house these components. Either way, once you’ve mounted all those components in the box, it’s just a matter of connecting it up as per the wiring diagram shown in Fig.7. Parts List – Automatic Train Controller with Whistle Sounds 1 assembled Li’l Pulser Model Train Controller, Mk2 (July14) 1 assembled Steam Train Whistle module (March20) 1 assembled Level Crossing (July22) 1 assembled Semaphore Signal (March23) 1 assembled Chuff Sound module (see below) 1 ISD1820-based sound recording and playback module (MOD1) [eg, Jaycar XC4605, SC5081 – or eBay] 1 single-sided or double-sided PCB coded 09109221, 50 × 51mm available from the PE PCB Service 1 5V DC 500mA supply 3 5kW mini single-turn top-adjust trimpots (VR1-VR3) 1 16-pin DIL IC socket (for RLY1) 1 14-pin DIL IC socket (for IC1) 1 DPDT toggle switch (S1) [Jaycar ST0355] 1 SPST momentary pushbutton (S2) [Jaycar SP0711] 1 76mm 8W loudspeaker (SPK1) [Jaycar AS3006] 1 TE Connectivity V23105A5001A201 5V DC coil DPDT 3A relay or equivalent (RLY1) [element14 1652604, Digi-Key PB383-ND] 1 Comus RI80SMDM-0510-G1 miniature SPST reed switch [Digi-Key 1835-1161-1-ND] 1 small rare earth magnet [Jaycar LM1622] 11 1mm PCB pins various lengths of light-duty hookup wire Semiconductors 1 PIC16F1455-I/P microcontroller programmed with 0910922A.HEX, DIP-14 (IC1) 1 BC547 45V 100mA NPN transistor, TO-92 (Q1) 1 5mm red LED (LED1) 1 5mm blue LED (LED2) 1 5mm white LED (LED3) 1 5mm yellow LED (LED4) 1 1N4004 400V 1A diode (D1) 6 1N4148 75V 200mA signal diodes (D2-D7) Capacitors 1 100μF 16V radial electrolytic 8 100nF 50V radial multi-layer ceramic or MKT Practical Electronics | October | 2023 Resistors (all 1/4W 1% axial) 2 10kW 1 4.7kW 1 1.5kW 4 1kW 3 680W Chuff Sound module 1 single-sided or double-sided PCB coded 09109222, 59 × 30mm available from the PE PCB Service 1 5V DC regulated plugpack or other 5V floating supply (cannot be shared with the Train Controller module) 2 8-pin DIL IC sockets (optional; for IC2 and IC3) 1 10kW mini single-turn top-adjust trimpot (VR4) 1 1kW mini single-turn top-adjust trimpot (VR5) 1 SPDT toggle switch (S3) [Jaycar ST0335] 1 57mm 8W 250mW loudspeaker (SPK2) [Jaycar AS3000] 6 1mm PCB pins various lengths of light-duty hookup wire Semiconductors 1 PIC12F675-I/P 8-bit microcontroller programmed with 0910922C.HEX, DIP-8 (IC2) 1 LM386N-1 audio amplifier, DIP-8 (IC3) [Jaycar ZL3386] 1 LM4040 5V shunt regulator or 1N4732 4.7V zener diode (ZD1) 4 1N4148 75V 200mA signal diodes (D8-D11) Capacitors 2 100μF 16V radial electrolytic 1 10μF 16V radial electrolytic 1 100nF 50V radial multi-layer ceramic 1 47nF 63V MKT 1 22nF 63V MKT Resistors (all 1/4W 1% axial) 1 15kW 1 10kW 1 8.2kW 1 10W 21 Fig.7: once you’ve built all the modules, wire them up as shown here. The manual switches can still be used to control the Semaphore and Level Crossing if S1 is in the manual position. The Chuff Module wiring is shown separately, in Fig.6. Note that you will need to cut a track on the Li’l Pulser Mk2 PCB before adding the four wires that go to S1 and the Control Module. The only tricky part is interfacing with the Li’l Pulser Mk2 Train Controller. To do this, you must cut the connection between the middle contact of switch S1 and the 47μF capacitor and attach flying leads to the brake side of S1, the run side of S1, the central contact of S1 and the positive terminal of the 47μF capacitor – see Fig.7. Getting it all going Before applying power to the finished system, check the wiring to the modules. Attach the small magnet to the front of the locomotive, ideally on the underside near the front. Also check that the train rails and wheels are clean before proceeding. Switch the Auto on/off switch to off (manual). Increase the train’s speed to that previously used to determine where to place the reed switch. Now change the switch back to on (ie, automatic control) and adjust potentiometer VR1 on the Automatic Controller PCB so that the Signal goes green close to one second after the train has stopped. Next, adjust VR3 to what you think the driver’s reaction time should be to start the train once the Signal goes green. I set this to one second. Once the Semaphore goes off, the train should start to move away and the Level Crossing should close, flashing its LEDs and playing bell sounds. The whistle should sound four seconds after the train starts moving again. Finally, adjust VR2 so that the Crossing opens once the train has passed The Chuff Sound module is simple enough to breadboard yourself, or you can purchase a double-sided PCB from our online shop. 22 through. Note that if this time is set too long, the train could pass the reed switch again before the Crossing closes. The result is that the train won’t stop when it passes over the reed switch. Chuff Module wiring Connect the track input wires on the Chuff module to the railway tracks and wire in the on/off switch and power supply, as shown in Fig.6. Switch it on and adjust the speed controller so that the train is travelling at a maximum realistic speed (not necessarily the speed it runs with the controller supplying full voltage). Using a digital voltmeter, measure the voltage between the GP2 input (pin 5) of IC1 and ground, and adjust VR4 until the voltage reads 3.3V. Wind back the speed and the chuff rate should decrease until the train is stopped, at which point the sound will revert to panting. The sound level can be adjusted using potentiometer VR5. As mentioned earlier, if you can’t achieve 3.3V at pin 5 of IC1 by adjusting VR4, you’ll have to replace the 15kW resistor with a higher or lower value. You shouldn’t have to increase the value, but you might have to reduce it if you don’t get 3.3V at pin 5 of IC1 even with VR4 at its maximum. Reproduced by arrangement with SILICON CHIP magazine 2023. www.siliconchip.com.au Practical Electronics | October | 2023