Silicon ChipSteam Train Whistle ... or Diesel Horn - March 2020 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Publisher's Letter
  5. Feature: The Fox Report
  6. Feature: Techno Talk by Mark Nelson
  7. Feature: Net Work by Alan Winstanley
  8. Project: Diode Curve Plotter by Tim Blythman
  9. Project: Audio DSP by Design by Phil Prosser, Words Nicholas Vinen
  10. Project: Steam Train Whistle ... or Diesel Horn by JOHN CLARKE
  11. Project: Galvanic Skin Response by Jim Rowe
  12. Feature: PIC n’ Mix by Mike Hibbett
  13. Feature: Circuit Surgery by Ian Bell
  14. Feature: AUDIO OUT
  15. Feature: Make it with Micromite by Phil Boyce
  16. Feature: Visual programming with XOD by Julian Edgar
  17. Feature: Max’s Cool Beans by Max the Magnificent
  18. Feature: Electronic Building Blocks by Julian Edgar
  19. PCB Order Form
  20. Advertising Index

This is only a preview of the March 2020 issue of Practical Electronics.

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

Articles in this series:
  • Techno Talk (February 2020)
  • Techno Talk (February 2020)
  • Techno Talk (March 2020)
  • Techno Talk (March 2020)
  • (April 2020)
  • (April 2020)
  • Techno Talk (May 2020)
  • Techno Talk (May 2020)
  • Techno Talk (June 2020)
  • Techno Talk (June 2020)
  • Techno Talk (July 2020)
  • Techno Talk (July 2020)
  • Techno Talk (August 2020)
  • Techno Talk (August 2020)
  • Techno Talk (September 2020)
  • Techno Talk (September 2020)
  • Techno Talk (October 2020)
  • Techno Talk (October 2020)
  • (November 2020)
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
  • Techno Talk (June 2025)
  • Techno Talk (July 2025)
  • Techno Talk (July 2025)
by JOHN CLARKE Relive the exciting days of steam-train travel with this Steam Train Whistle / Diesel Horn Sound Generator. Use it in your model railway layout, as a doorbell or just as a standalone sound effect. It can even simulate the Doppler effect, providing a change in pitch as if the train is passing by. Plus, the Whistle/Horn sound can be customised in a number of ways, to suit your project’s preferences. S team am trains are always corresponding sooty face! Our device simulates a steam-powered whistle by popular (well, to be precise mixing three separate oscillators with steam locomotives,, but we’ll the output of a white noise generator. stick to ‘trains’ here!) Many restored These oscillators generate the whistrains can be seen travelling tle chimes, with plenty of harmonics the countryside at heritage to ensure they have a rich sound, rail lines. Their popularity is while the noise generator provides proven by the crowds of people the sound of the steam rushing out. gathering to watch alongside the You can adjust the rise time of the track and the number of people volume at the start of the whistle. That enjoying the ride. simulates the rate at which the cord Along with the ‘chuff-chuff’ is pulled to open the steam valve to sounds of the steam engine, it is the the whistle. whistle that gives the most exciteAt the end of the whistle pement and nostalgia. Features riod, when the cord is released, It is the toot of the whistle as • Creates steam whistle or diesel horn sound effects the valve quickly shuts itself off the train departs; it is the sound of • Steam simulation using white noise due to steam pressure (in our case, the whistle as it passes you by and • Adjustable volume rate rise for the steam whistle in 100ms). the blast of the whistle as the train • Multiple trigger options If you elect to use Doppler efenters a tunnel or approaches a fect simulation, the situation is level crossing. • Adjustable whistle time somewhat different. In this mode, The great thing about this • Optional Doppler effect the rise in volume simulates circuit is that you can get that • Adjustable whistle frequencies the train whistle starting from a steam train sound without the 30 Practical Electronics | March | 2020 distance away and then increasing in volume as it approaches nearer. The decay in volume after the train passes (and after the frequency shifts) simulates the decrease in volume as the train moves away. The whistle/horn sound can be initiated with a manual pushbutton, a microswitch, reed switch, relay or by a signal from an external microcontroller. Design There have been many electronic steam engine effect designs; this new one boasts many novel features, including Doppler effect, despite using a simpler circuit. That’s because it is instead based around an inexpensive PIC microcontroller. The basic concept is as follows. The micro generates three different pulse trains, each with a fixed duty cycle and adjustable frequency. These pulse trains contain various frequencies including the fundamental and higher harmonics, which when mixed together, make a whistle or horn sound. When simulating a steam whistle, they are also mixed with white noise, as explained above. The mixed sound is then fed to an audio amplifier with a built-in 5-chime and 3-chime steam whistles and diesel horns The steam whistle featured in this article has three oscillators controlled by the microcontroller. This is ideal for simulating the sound of 3-chime steam whistles but many other steam locomotives had 5-chime whistles. Clearly, we could have designed the circuit with five oscillators but that would have a required a microcontroller with more pins and more passive components. However, since the simulated sound of this circuit is really quite convincing, we think this is a reasonable compromise. If you want the exact whistle for a particular locomotive, it would better to use our Super Digital Sound Effects Module (see August and September 2019 issues of PE) together with the correct WAV stored on its microSD card. These comments also apply to diesel locomotive horns. Some large diesel locomotives have 5-chime horns but many did have 3-chime or even 2-chime units. volume control circuit. The volume control signal comes from the same microcontroller which is producing the whistle/horn sounds. The amplifier then drives a speaker to produce the final sound. The length of the whistle/horn sound can be adjusted. If set to minimum, the whistle sound will only be for as long as the trigger switch is closed. Or it can be set to a longer time so that a brief press of the switch will initiate the sound for a fixed period. Depending on the mode, holding the switch down may or may not extend the sound beyond this set period. Circuit description The circuit is shown in Fig.2 and comprises three ICs: two PIC12F617 microcontrollers (IC1 and IC2) and a TDA7052A 1W Bridge-Tied-Load (BTL) mono audio amplifier with DC volume control (IC3). IC1 is the white noise source and runs an internal program that generates noise over the full audio spectrum. You’ll find a full description of its Steam Whistle / Diesel Horn Fig.1: IC1 produces white noise which is used to emulate steam sounds, while IC2 produces three pulse trains which are mixed together to give a whistle or horn sound. This signal is then fed to amplifier IC3 which drives the speaker. It is powered from a 5V DC or USB supply, and the sound is triggered by onboard switch S1 or an external switch or signal via CON2. Practical Electronics | March | 2020 31 Specifications • Power supply...........................5V at 300mA from an external supply via screw terminals or USB cable • Output power...........................about 1W into 8Ω • Regular whistle period.............100ms to 22.5s, extended if S1 held down (no Doppler effect) 2.5s to 22.5s, no extension (with Doppler effect) • Whistle volume rise time.........5ms to 8s • Whistle volume fall time..........100ms fixed (no Doppler effect) 5ms to 8s (with Doppler effect) • Whistle frequency range:.........244Hz to 1.053kHz • Frequency adjustment steps....3Hz at 250Hz, 6Hz at 333Hz, 12Hz at 500Hz, 24Hz at 666Hz, 48Hz at 1kHz • Simulated Doppler speed........80km/h operation in the White Noise Generator project published in the September 2019 issue of PE. It was designed so that it can be re-used in other circuits where a white noise source may be required. For now, all you need to know is that a white noise ‘hissing’ audio signal is produced at its pin 7 output. This noise signal is fed to the audio mixing point, at the junction of the 10kΩ resistor and 100kΩ resistor, via JP4, which can be used to disconnect the white noise source when simulating a diesel horn or while adjusting the oscillator frequencies. IC2 produces the whistle and horn sounds. It does this using three pulse trains from its GP1, GP0 and GP5 digital outputs (pins 6, 7 and 2). It also produces a DC control signal by filtering a PWM signal which is produced at pin 5. This is fed to the volume control input on amplifier IC3 and this is used as an ‘envelope’ for the whistle and horn sounds. IC2 also monitors an external switch via its GP3 input (pin 4, which is used to trigger the sound effects. And it reads the wiper position of trimpot VR1 using its AN3 analogue input (pin 3), which controls various options such as the component frequencies of the whistle/horn sound, the whistle/ horn time and the volume rise rate for the steam whistle. The pulse trains from the GP1, GP0 and GP5 outputs are fed to an audio mixing point, at the junction of the 100kΩ and 10kΩ resistors, via a 1kΩ series resistor for each output. The pulse trains from those three outputs are not quite square waves; a square wave has a duty cycle of 50% while the pulses from these outputs have a duty cycle of 43.75%. This provides a richer set of harmonics than a square wave. A square wave has only odd harmonics whereas this series of slightly shorter pulses also has even harmonics, which produces a more realistic sound. The supersonic harmonics of the mixed signal are filtered out by a 1nF capacitor to ground and the audio signal is then AC-coupled to input pin 2 of audio amplifier IC3 via a 470nF capacitor. This drives the speaker connected to CON1 in bridge mode. This chip has a volume control input on pin 4. A DC voltage is applied to this pin and the higher the voltage, the louder the output volume. This volume control signal is produced by microcontroller IC2 using filtered PWM, from its pin 5 PWM output. The 4.7kΩ resistor and 100nF capacitor form an RC low-pass filter with a −3dB point of 339Hz. The actual PWM frequency is 19.61kHz, which is so much higher than the filter corner frequency that the output of the filter is effectively a DC voltage, proportional to the PWM duty cycle. Initially, the pin 5 output is low, setting the attenuation in IC3 to its maximum value of more than −70dB, which mutes the audio output. The PWM pulse width is gradually increased to bring the average voltage at pin 4 up to 1V, resulting in an eventual amplifier gain of +20dB. The steam whistle/horn sound effect is triggered by pressing pushbutton S1 to pull the GP3 input (pin 4 of IC1) low. It is normally held high by a 10kΩ resistor to the 5V rail. You can also use an external switch between pins 1 and 2 of CON2 (which could be a set of relay contacts) or by applying at least 1.5V between pins 2 and 3 of CON2, which switches on NPN transistor Q1, pulling the GP3 input low. The circuit is powered from 5V, either applied to part of terminal block CON1 or via a micro type-B USB connector, CON3. When using CON1, diode D1 provides reverse-polarity protection. The supply is bypassed using a 220µF capacitor and several 100nF capacitors, one for each IC. Changing the sound Jumper shunts JP1-JP3 allow the frequencies of these pulse trains to be adjusted. Two of these jumpers are inserted at a time, shorting two of the pulse trains to ground and thus disabling them. This allows you to measure the frequency of the third pulse train and make adjustments using VR1. Pressing pushbutton S1 then saves the new frequency setting to EEPROM. Microcontroller IC2 detects whether any of the jumpers are inserted at start-up by enabling internal pull-up currents for the three output pins and then sensing whether any of them are held at ground potential. If so, it goes into adjustment mode. If none of the jumpers are present, all three outputs will be high and the software goes into the normal sound -effects generation mode. Fig.2: use this PCB overlay diagram and matching photo as a guide for building the Steam Whistle / Diesel Horn board. IC3 and CON3 are the only SMD components. Take care when soldering CON3 since the pins are small and close together, and easy to bridge. Don’t get IC1 and IC2 mixed up; while they are the same type of chip, they are programmed with different firmware. 32 Practical Electronics | March | 2020 A similar method is used to adjust the initial volume ramp rate for the horn/whistle. This is done by inserting all three shunts, rotating VR1 and then pressing S1 to store the new ramp time. Trimpot VR1 connects across the 5V supply and so its wiper voltage sweeps from 0V to 5V as its screw is rotated clockwise. This voltage is applied to the AN3 analogue input of IC2 and converted to a number using its internal analogue-to-digital convert (ADC). It is used to set the pulse train frequencies and initial volume ramp rate as described above Construction The Steam Train Whistle is built on a double-sided PCB coded 09106181, measuring 79 x 48mm, available from the PE PCB Service. It can be housed in a UB3 plastic utility box if desired. The overlay diagram, Fig.2, shows where the parts are fitted. Install SMD IC3 first as it is easier to solder the pins when there are no components surrounding it. You will need a fine-tipped soldering iron and 0.7mm diameter solder. First, align the IC pins onto the pads making sure the that chamfered side of the chip is positioned towards the pin 1 indicator on the board, as shown in Fig.2. Tack solder one of the outside pins to its pad and check that the IC alignment is correct. Re-melt the solder and realign if necessary. Then solder the remaining pins. Make sure you refresh the solder on the first pin at the end. If you accidentally bridge two pins, the excess solder can be removed with a dab of flux paste and some solder wick. The micro type-B USB connector is soldered in a similar manner to IC3. Align the leads to the pads and solder the two outer flanges on the sides of the USB housing first, followed by the five pins. Clear any pins that are shorted with solder wick. The resistors – do use a digital multimeter to check the values of each resistor before soldering it as the colour codes can be mistaken. Mount diode D1 next, with the striped end (cathode) oriented as shown in the overlay diagram. We recommend using an IC socket for IC1 and IC2. Take care with orientation when installing the sockets – use Fig.2 as a guide. Now fit headers for jumpers JP1-JP4 and the PC stake at the GND position. Follow with the capacitors, starting with the smaller MKTs and then the 220µF electrolytic capacitor. This capacitor is polarised and must be installed with the polarity shown, Practical Electronics | March | 2020 Parts list – Steam Whistle/Diesel Horn 1 double-sided PCB, coded 09106181, 79 x 48mm, available from the PE PCB Service 2 2-way screw terminals with 5.08mm pin spacing (CON1) 1 3-way screw terminal with 5.08mm pin spacing (CON2) 1 8Ω 1W loudspeaker [eg, Jaycar AS3030 or AS3004, Altronics C0603C] 1 PCB-mounting micro type-B USB socket (CON3) [Altronics P1309, Jaycar PS0922] 2 8-pin DIL IC sockets (for IC1,IC2) 1 momentary pushbutton switch (S1) [Altronics S1120, Jaycar SP0600] 4 2-way headers with 2.54mm spacings with shorting blocks (JP1-JP4) 1 PC stake Semiconductors 1 PIC12F617-I/P programmed with 0910618A.HEX (IC1) 1 PIC12F617-I/P programmed with 0910618M.HEX (IC2) 1 TDA7052AT/N2 1W BTL DC volume control amplifier (IC3) [Cat SC3551] 1 BC547 NPN transistor (Q1) 1 1N5819 1A schottky diode (D1) 1 3mm LED (LED1) Capacitors 1 220µF 16V PC electrolytic 1 470nF 63V or 100V MKT polyester 5 100nF 63V or 100V MKT polyester 1 1nF 63V or 100V MKT polyester Resistors (all 1%, 0.25W) 4 10kΩ 1 4.7kΩ 1 3.3kΩ 3 1kΩ 4 100kΩ 1 10kΩ mini horizontal trimpot, code 103 (3386F style) (VR1) with the longer lead through the hole marked ‘+’ (the striped side is negative). Install transistor Q1, switch S1 and trimpot VR1. Then you can mount terminal blocks CON1 and CON2. CON1 comprises two dovetailed 2-way screw connectors and CON2 is a 3-way screw connector. Ensure that all the terminal blocks are fitted with the wire entry holes to the outside edge of the PCB. Finally, LED1 can be soldered in place. We mounted it with the plastic lens 15mm above the PCB so that it would protrude through the lid of the UB3 Jiffy box, but you could mount it at a different height if necessary. Fit it with the longer anode lead soldered to the pad marked ‘A’ on the PCB. Although shown as a bare board, the Steam Train Whistle can be installed in a UB3 box. The PCB clips it into the moulded side rails on the inside of the box. Cutouts can then be made in the ends of 1 100Ω the box for the USB connector and the wires going to screw terminals CON1 and CON2. The loudspeaker is ideally mounted in a small box so that it has a good bass response. Testing With IC1 and IC2 out of their sockets, apply power either via a 5V DC supply connected to CON1, or using a USB cable from a computer or USB supply. Check that LED1 lights up and that there is around 5V between pins 1 and 8 of the sockets for IC1 and IC2. If power is applied to CON1, the reading will probably be closer to 4.7V due to diode D1. Regardless, you should get a reading between 4.5V and 5.25V. You can then remove power from the circuit. If you have purchased pre-programmed microcontrollers then you Assuming you’re building this for a model train layout, the PCB can be mounted ‘as-is’ wherever there is a suitable place on or in your layout. But it is also designed to clip into the side rails of a UB3 Jiffy box, as shown here, with the LED just poking through the front panel. Naturally, access holes will need to be drilled in the ends of the box to allow for power and speaker wiring, along with the external trigger switch. 33 Changing the whistle or horn sound Changing the whistle period With no jumpers inserted for JP1-JP3, rotate VR1 to adjust the whistle period, up to a maximum of 22.5s (fully clockwise). If you are not using the simulated Doppler effect, the whistle period can be extended indefinitely by holding down S1. Changing the volume rise rate and Doppler effect This applies to the steam whistle sound only (ie, not the diesel horn). Switch off power and insert jumper shunts for JP1, JP2 and JP3. Power up and set VR1 for the desired ramp time, with a more clockwise position selecting a longer ramp. To disable the Doppler effect, set VR1 to a position between fully anti-clockwise and halfway. With VR1 fully anti-clockwise, the initial volume ramp-up is almost instant, while if you set it just slightly less than its midpoint, you will get a ramp-up time of around eight seconds. Intermediate settings give a shorter ramp-up time. To enable the Doppler effect, set VR1 to a position between halfway and fully clockwise. The ramp setting is similar, ie, just above halfway will give you an almost instantaneous ramp-up while setting VR1 fully clockwise sets the ramp-up time to around eight seconds. In this mode, there is also a volume ramp-down period at the end of the effect and it is the same time as the ramp-up. When VR1 is set at the required position, press S1 so that the setting is stored in Flash memory. Switch off power and remove the three jumper shunts. Set VR1 back to the required position for the whistle period when you’ve finished. You can then power it back up and press S1 to test the new setting. Note that it’s generally a good idea to set the whistle period in Doppler Mode to be slightly longer than twice the ramp-up/ ramp-down time. This way, the volume will rise to maximum and then almost Sound effect immediately begin to fall again, as if the train has just passed. You may need to tweak the volume rate and whistle period a few times to get the desired effect. Changing the oscillator frequencies The table below shows some suggested sets of oscillator frequencies to simulate a steam whistle and various diesel horns, but note that you are not restricted to just using these frequencies. The first entry shown gives the frequencies that the unit will default to the first time it is powered up. The oscillator frequencies are changed one at a time. Start by switching off power and then place two jumper shunts on JP1-JP3, leaving out the jumper in the channel that you want to adjust. Remove JP4 to disable steam noise for the moment. Now attach a frequency meter (eg, a DMM with frequency measurement) to the right-most pin on the unused jumper header. Connect its ground reference to the ground PC stake (between S1 and CON2). Apply power and adjust VR1 until your meter reads the frequency required. It can be adjusted over the range of 2441053Hz. The frequency will change in steps of 3Hz at the low end, rising to 48Hz at the high end. You will be able to hear the oscillator if the speaker is connected. When you have settled on the required frequency, press S1 to store the value in Flash memory. To adjust another oscillator, disconnect power and move one of the jumper shunts, then re-apply power and go through the same procedure again. When you have finished, switch off and remove JP1-JP3. Re-install JP4 if you removed it earlier. Set VR1 back to the required position for the whistle period now that you have finished adjusting the oscillator frequencies. Oscillator 1 Oscillator 2 Oscillator 3 White noise Steam whistle (default) 740Hz 525Hz 420Hz Yes (JP4 in) 2-Car Diesel 600Hz 520Hz 420Hz No (JP4 out) 40-43, 4401-4440 Diesel 277Hz 329Hz 440Hz No (JP4 out) 422, 442, 73, 48126 Diesel 548Hz 322Hz 429Hz No (JP4 out) Suggested oscillator frequencies for various whistles or horns. can plug IC1 and IC2 into their sockets now, making sure that they are oriented correctly and that the correct programmed IC is in the correct socket. 34 The chip programmed as the noise generator is IC1. If your chips have not already been programmed, you will need to program The Doppler effect The Doppler effect is a phenomenon that occurs when an object is moving towards you. Any sound that it generates will appear to be higher in pitch than usual. And similarly, if that object is moving away from you, the sound will appear to be lower in pitch. For example, it is very obvious when a vehicle with a siren passes you at high speed. It happens because sound waves travel through the air at approximately 340m/s (1200km/h) and as the speed of the generating object (relative to you) becomes a significant fraction of that, the sound waves pass you at a noticeably different rate, thus altering the perceived pitch. To find out more about the Doppler effect, see: https://en.wikipedia.org/ wiki/Doppler_effect Since trains can travel quite fast, the Doppler effect can be very apparent, especially when they use their whistle or horn as they are passing you. At 80km/h, the pitch changes by about 6.5% in each direction and the overall 13% difference is very noticeable. So we have included a facility to simulate this. them first, using HEX files which can be downloaded from the March 2020 page of the PE website. (Do note that there are two different files for IC1 and IC2.) Connect the speaker to CON1 and apply power again. Set VR1 fully anticlockwise and press and hold S1. You should be greeted by the steam train whistle sound. If you don’t hear the steam noise in the background, check that JP4 has been inserted. Installation The board is too large to mount inside a locomotive, so if you want to use it as part of a model railway layout, the best place to put it would be underneath the layout; for example, near a station. You could then mount the speaker inside the station. It could be triggered manually or via a reed switch or microswitch as the train passes. Whatever kind of switch you are using, connect it between pins 1 and 2 of CON2. Or if you are using a microcontroller to trigger it, connect a digital output pin on that micro to pin 3 of CON2 with the micro’s ground going to pin 2. You can apply anywhere between 1.5V and 12V to this pin to trigger the unit. Reproduced by arrangement with SILICON CHIP magazine 2020. www.siliconchip.com.au Practical Electronics | March | 2020