A fun noise maker to liven up your games and playtime.
BUILD TIME: 75 MINUTES
DIFFICULTY RATING: BEGINNER
There is something about steam trains that captivates many people, even those who otherwise have no interest in trains or machines at all. One of the most iconic parts of the steam train experience is the whistle. It’s a feature many railway modellers have always sought. While that is now handled by programmables and DDC (Digital Command Control) systems, there was a time when anyone wanting to build a whistle sound into a model train or any toy train or the like needed to build the circuit themselves.
This circuit dates from those times but has been modified a bit to suit our needs. It uses an integrated circuit (IC) that is old now but still readily available. You can build this circuit to just have fun, make a really different doorbell, or build it into a ride-on toy for a younger sibling. It’s up to you, really.
Steam whistles are actually far more complex than they sound. Physically, they involve pressurised and very hot steam rushing over a hole in a tube, like blowing across the top of a bottle. The size of the hole, the amount of steam, the pressure it’s under, and the direction it passes over the hole (directly or at an angle) all contribute to the sound. So does the shape of the body of the whistle after the part where the sound is made, as this contributes to the way the sound changes as it moves out of the whistle.
The sound itself is made up of many frequencies. There is a centre point, of course, but there are always two or more ‘chords’ in a whistle tone: Any musically inclined readers will know what that means. They’re sounds made up of more than one note that go together. Also in the mix is the hissing sound made by the steam itself. This is called ‘white noise’, and is made up of pretty much all frequencies the human ear can hear.
INSTRUCTIONS AND ADVICE
We encourage you to read all the way to the end of the article before you build. Not only will you then have a better feel for the overall picture as you build, but we sometimes discuss options or alternatives that you will need to have decided on.
You will need some basic hand tools for most builds. Small long-nosed pliers and flush-cut side cutters meant for electronics are the main ones. Materials like tape or glue are mentioned in the steps, too. We always produce a tools materials list if you have to go shopping, but anything that is lying around in most homes is just stated in the steps.
As always with Kids' Basics, we're building on a solderless breadboard. We avoid soldering to make Kids' Basics accessible to more people, but having an adult around can still be helpful. You won't need any particular skills besides being able to identify components at a basic level, and even then, we help as you go along. If, for example, you don't already know what a resistor is, you'll probably be able to work it out from the photos and description in each step.
We do provide a schematic or circuit diagram but this is just helpful if you already know how to read one. Don’t stress if you have never learned, but take the chance to compare the digital image of the breadboard layout (which we call a 'Fritzing' after the company that makes the software) to the schematic and see if you can work some things out. You can make this project from the Fritzing and photos alone. You might also like to check out our Breadboarding Basics from Issue 15.
|Parts Required:||ID||Jaycar||Altronics||Core Electronics|
|1 x Solderless Breadboard||-||PB8820||P1002||CE05102|
|1 x Pack of Breadboard Wire Links||-||PB8850||P1014A||CE05631|
|2 x Plug-to-plug Jumper Leads||-||WC6027||P1017||PRT-12795|
|1 x CD40106 Hex Schmitt Trigger IC||IC1||ZC4914||Z8450||COM-13952|
|1 x LM386 IC||IC2||ZL3386||Z2556||FIT0119|
|1 x 10Ω Resistor*||R13||RR0524||R7510||FIT0119|
|1 x 560Ω Resistor*#||R9||RR0638||R1058||FIT0119|
|2 x 10kΩ Resistors*||R11, R12||RR0596||R7582||FIT0119|
|4 x 15kΩ Resistors*||R1, R3, R7, R8||RR0600||R7586||FIT0119|
|1 x 22kΩ Resistor*||R2||RR0604||R7590||FIT0119|
|1 x 27kΩ Resistor*#||R5||RR0606||R7792||FIT0119|
|1 x 39kΩ Resistor*||R6||RR0610||R7596||FIT0119|
|1 x 47kΩ Resistor*||R4||RR0612||R7598||FIT0119|
|6 x 100nF Capacitors||C2, C3, C4, C5, C8, C10||RM7125||R3025B||CE05188|
|1 x 220nF Capacitor||C6||RM7145||R3017B||CE07789|
|3 x 100μF Electrolytic Capacitors*||C1, C7, C9||RE6130||R5123||CE05130|
|1 x 10kΩ Potentiometer||R10||RP7510||R2225||ADA562|
|1 x BC547 NPN Transistor||Q1||ZT2152||Z1040||CE07790|
|1 x Speaker||Speaker||AS3000||C0610||ADA1890|
|1 x Pushbutton Switch||SW1||SP0601||S1120||COM-00097|
|1 x 9 Battery||-||SB2423||S4970B||CE05337|
|1 x 9V Battery Snap||-||PH9232||P0455||CE05205|
* Quantity required, may only be sold in packs. #Use Nearest Value
The Electronics Build:
To make our frequencies, we’re going to use five of the six units in a 40106 Hex Schmitt Trigger IC. A Schmitt Trigger is a special arrangement of comparator, with a bunch of the components we need already integrated into it, helping keep our part count down and board layout neat. We’ll use the LM386 amplifier for sound output. All of it is powered by a 9V battery and fits in a standard breadboard.
We are going to do two things we really don’t like doing: Using resistors on their ends, and using wire links diagonally. We just can’t make this circuit fit on a breadboard any other way, without it becoming too crowded or using jumper wires over the top of the board, which we always avoid in Kids’ Basics because it makes things hard to see and fault-find.
The labels for the vertical resistors on the Fritzing above the CD40106 are hard to see, but the left-hand one is 'A', while the right-hand one is 'B'. The other two had space to lean over the IC, but as you'll see in the photos, they actually go vertically when you build.
Place the breadboard in front of you with the outer red (+) rail away from you and the outer blue (-) rail closest to you. Install the CD40106 and LM386 ICs, making sure they go in the correct way like you see in the photo. Also, add the wire links which join the matching supply rails.
Install the four 15kΩ resistors (brown-green-black-red- -brown) taking note of which rows they reach at each end. Pins 12, 8, 6, and 2 of the CD40106 are the targets, while the ends need to be two rows away from the IC at the top, and one row at the bottom.
Insert the 27kΩ resistor (red-purple-black-red- -brown) between pins 12 and 13 of the CD40106, above in the image, and the 22kΩ resistor (red-red-black-red- -brown) between pins 1 and 2, below in the image. Bend the leg of one side of each over so that it sits neatly. Check the other photos if you’re not sure.
Install the 39kΩ resistor (orange-white-black-red- -brown) between pins 8 and 9 of the CD40106, above in the image, and the 47kΩ resistor (yellow-purple-black-red- -brown) between pins 5 and 6, below in the image. Bend the leg of one side of each over so that it sits neatly.
Place the four 100nF capacitors between the blue (-) rails and pins 1, 5, 9, and 13. Two go above the IC in the image, and two below. You’ll need to bend the legs of the lower ones to reach the extra distance. Markings on these capacitors vary, but most will be either 104J100 or 0.1J100.
Insert four wire links from the lower blue (-) rail to their places on pin 7 of the CD40106, pins 2 and 4 of the LM386, and a spot just to the left of the LM386. Also, install the horizontally-placed wire link from pin 3 of the LM386.
Install two wire links from the upper red (+) rail to pin 14 of the CD40106 and pin 6 of the LM386. Also place a 100nF capacitor and a 100μF capacitor across the supply rails at the top, taking care that the striped (-) side of the electrolytic capacitor is in the blue (-) rail.
Place a 560Ω (blue-green-black-black- -brown) resistor from the lower pair of 15kΩ resistors to the lower blue (-) rail. Also, insert a wire link between the two pairs of 15kΩ resistors. This is the orange diagonal one in the image.
Insert a 220nF capacitor from the lower pair of 15kΩ resistors, toward the right. Place a 10kΩ potentiometer so that one end lines up with this capacitor, the wiper lines up with the horizontal wire link, and the other leg lines up with the wire link to the lower blue (-) rail.
Install a BC547 transistor with its flat side facing you and its left leg (collector) in the row beside the upper pair of 15kΩ resistors. Place a wire link diagonally from the wiper of the potentiometer to the collector of the BC547. Insert a wire link from the right-hand leg (emitter) to the upper blue (-) rail.
Place two 10kΩ resistors (brown-black-black-red- -brown), one between the middle leg (base) of the transistor and a spot to the right, and another between that spot and the upper red (+) rail. Also, place a 100μF capacitor with its striped (-) leg in the upper blue (-) rail and its other leg in the same row as the transistor base and 10kΩ resistor.
Insert a 100μF capacitor with its negative striped leg to pin 5 of the LM386. Place a 10Ω resistor (brown-black-black-gold- -brown) between pin 5 and a row to the right, and a 100nF capacitor between there and the upper blue (-) rail.
Cut a plug-to-plug jumper wire in half, bare the ends, and twist them through the terminals of a small speaker. Tape the joins carefully, but we left one exposed for you to see. Plug one end into the positive (unmarked) leg of the 100μF capacitor near pin 5 of the LM386, and the other into the lower blue (-) rail.
Cut a plug-to-plug jumper wire in half, bare the ends, and twist them through the terminals of a pushbutton switch. Tape the joins carefully then plug one lead into the upper blue (-) rail and the other into the place where the two 10kΩ resistors meet.
Insert the wires of a 9V battery snap into the power rails and plug in a battery. You should hear some noise straight away, but if you don’t, turn the potentiometer until you do. If there is still no noise, unplug the battery and check all the connections on the board.
If you get a slight noise, press the pushbutton. Now you should hear a louder and clearer noise from the speaker. Unfortunately, there will always be some noise from this circuit. Audio circuits are never great on a solderless breadboard, and there are leakage paths everywhere with this. While we were developing it, we tried it on a solder prototyping board and almost all the noise went away.
If this stray noise is really bothering you, we found that poking and prodding around the circuit often makes a lot of it go away. Much of the noise results from leakage paths and couplings that are related to the solderless breadboards, but if the noise is really loud, it's probably one or more poor connections. That's an unfortunate feature of solderless prototyping.
How it Works:
At the heart of the circuit is a new integrated circuit (IC) that we have not used before. The CD40106 contains six identical Schmitt Triggers. A Schmitt Trigger is a special arrangement of operational amplifier (we’ve used op-amps before if you want to go browsing past projects) that have a lot of the components we need already built-in. We add two extra components to make it into an oscillator; one resistor and one capacitor.
An oscillator is the name for a circuit whose output turns on and off over and over. Using Schmitt Triggers, it’s very easy to make an oscillator with a square wave output. This means that the output is either on or off, unlike a sine wave which can be anywhere in between. Square waves have a lot of ‘harmonics’ in them, which is the name for other frequencies besides the one we want to generate. This helps with the ‘noisy’ effect we want to replicate a steam whistle.
In this oscillator, the particular Schmitt Trigger we have chosen has an inverted output, so the output is high when the input is low. This means current flows via the feedback resistor for each unit (the resistor you change, keep reading for more) into its capacitor. As the capacitor charges, the voltage rises. When it gets to a threshold level, the output turns off, and the capacitor discharges by the same resistor into the output, which is at ‘ground’ and able to ‘sink’ current when it is low or off.
As soon as the capacitor is discharged below a threshold level, the output changes to high and the process repeats. The output is also fed to our amplifier and this is where we get the frequency of the sound from. The useful thing about the CD40106 is that it has ‘hysteresis’ built into its inputs. This means that the thresholds for on and off are separated. In a basic comparator (a type of circuit based on an op-amp where the output is only on or off, not in between like a regular amplifier), there is only one threshold.
As soon as the input is below it, the output is off. As soon as the input is above the threshold, the output is on. Note that you can have inverted circuits where that is the opposite. Hysteresis means there is a gap in the middle. For explanation’s sake, let’s say a normal comparator changes at exactly half the supply voltage. If the input is above it, the output turns on. Below it, the input turns off. Hysteresis means making the circuit so that the ‘on’ threshold might be two-thirds, while the ‘off’ threshold might be one-third. That means the input voltage turns the output on when it reaches two-thirds of the supply voltage, but has to fall below one-third to turn it off. In our circuit, the output is inverted (off when the input is high) but the principle is the same.
Going back to a regular comparator, if we were to take the output via a resistor and feed it to the input with a capacitor connected to it, then that one threshold would mean the output would turn on, then that would immediately be sensed at the input and the output would turn off. That would happen back and forth way too fast to be in the range of human hearing. That’s why hysteresis is so useful in this case.
We have chosen four different frequencies for this circuit. We kept the capacitors on the oscillators all the same, so all we had to vary was the resistors. We chose a 22kΩ R2, a 27kΩ R5, 39kΩ R6, and 47kΩ R4. Recently in the keyboard project, we detailed the maths needed to work out exact frequencies for that circuit. This time, it’s not really helpful so we’re not introducing the complications. This circuit is best modified by testing what ‘sounds good’ rather than calculating anything. If you want a different sound, try disconnecting three of the oscillators and changing the value of one at a time, to listen to the sound.
Before you disconnect any oscillators, you’ll need to know how they’re connected. That’s the purpose of the other resistors around the CD40106. They’re all 15kΩ (R1, R3, R7, and R8), and they form a resistive mixer by connecting the outputs of all the oscillators together. Disconnect all but one to play with sounds.
The end of the mixer, which involves a wire link on the breadboard for layout reasons, goes to a 220nF C6 capacitor to block any DC signals coming through. This is then sent to one side of a potentiometer R9.
The potentiometer R9 is grounded on the other side, and so forms a voltage divider to serve as a volume control. The wiper of R9 is connected via another wire link to the input of the LM386 amplifier IC2. This IC is also familiar to regular Kids’ Basics readers, and is a self-contained low-power audio amplifier. It has more than enough to drive the small speakers we use to a reasonable volume.
The output of this, from pin 5, is connected via a 100μF electrolytic capacitor C9 to a speaker. This blocks any DC and passes the wanted AC signals to the speaker. The other components on the same pin are a series-connected 100nF capacitor C8 and 10Ω resistor R12. These help keep the output regulated and are straight from the LM386’s datasheet.
The last circuit block is the one centred on the BC547 NPN transistor Q1. This consists of two 10kΩ resistors, R10 and R11, and a 100μF capacitor C7. Pushbutton Switch SW1 is also involved. When the circuit is first powered up, current flows through R10 and R11 to charge C7.
When the voltage across it rises enough as it charges, the base of Q1 becomes saturated and Q1 conducts. This grounds the signal from the wiper of R9, meaning the amplifier has no input. The input to the amplifier IC2 has a very high impedance, which means opposition to the flow of current. That makes it sensitive but also means the current will go through Q1 to ground when it can.
When the pushbutton is pressed, however, the current from the supply rail via R10 is diverted through the much lower-resistance switch, and C7 discharges via R11 as well. As the voltage across the capacitor falls, the base of Q1 slowly drops below saturation, gradually turning it off. This enables the soft-start sound effect as more and more of the audio signal from R9 flows to the input of IC2. This replicates the fact that the valve in a real steam whistle does not open instantly when the cord is pulled.
When the switch is released, current flows from the supply rail again via R10 and R11 to charge C7, gradually bringing Q1 back into saturation. The final points of note are capacitors C1 and C10. They are here to keep the supply rails stable.
The Craft Build:
To house our steam whistle, we decided to make it look a little like one. Using a spare cardboard box (we actually used a gift box from a dollar shop) and the cardboard tube from inside a roll of paper towel, we can make a reasonable model of a steam whistle. You’ll need to borrow an adult for this, as it involves a difficult cut.
Colours are up to you, but we chose pearl gold coloured paper from a dollar shop to cover our whistle body and look like brass, and vibrant green to cover the box, like our favourite steam engine, the 3801.
Hold the cardboard tube on the paper near one corner and draw a circle. Draw a bigger one some way out from this one, but it does not have to be perfect.
Cut out the bigger circle, and cut lines in toward the inner circle. Dispose of any loose bits left over.
Glue the tabs you’ve just cut, and place the circle on the end of the tube, folding the tabs down so they stick.
Cut the paper to length and cover it with glue. Roll it around the tube until the whole width is used up and the tabs from the steps above are well held down.
Toward the top (the end with the paper cap), have your adult cut a wedge shape out of the tube. This lets the sound out. Don’t go past half of the diameter of the tube, or it will be too weak to stand.
Cover the box in your choice of coloured paper. Glue one side at a time, then wrap another side around and glue it. Cut where necessary to go around corners. You’ll need more than one piece of paper.
Use a pencil to make a hole in one end of the box. Unplug the switch from the circuit and glue a piece of string to the head of the switch button with hot melt glue.
Pass the string out through the hole, then glue the switch so that the button is just higher than the hole. When the glue sets, test to make sure pulling the string down pulls the switch closed.
Unplug the speaker from the circuit and use a pencil to draw around it on top of the box. Have your adult cut out the centre of this hole, but small enough that you can still sit the cardboard tube on top.
Glue the speaker on the underside of the hole with hot melt glue, and the tube on top. Sit the circuit in the box, and plug back in the speaker and pushbutton leads.
Now you can plug in a battery and test out your steam whistle. You might like to add weight into the box so it doesn’t slide around so easily when you pull on the string. You'll have to unplug the battery from the circuit when you’re not playing with it to avoid the background noise it makes.
WHERE TO FROM HERE?
You can play with the frequencies of the sound by changing resistor values as described in the ‘How It Works’ section.
You can also alter the capacitors around the CD40106 to see what effect it has.
Besides that, if you have soldering skills you can try making this on one of the solder boards that are a hole-for-hole copy of the solderless breadboard. It will have much less stray sound.
Besides that, get creative!