Silicon Chip – May 2019

(Elliott) #1

96 Silicon chip Australia’s electronics magazine siliconchip.com.au


John Clarke’s September 2018 Steam
Train Whistle & Diesel Horn is a fan-
tastic project. But I wanted to build it
for my young grandchildren, so I need-
ed to modify it to be battery-powered
with automatic switch-off. In the off
mode, the current drain should be no
more than 2μA for good battery life.
You could achieve this with a bat-
tery on/off switch, but in my experi-
ence, young children always forget to
turn it off and so the battery would
soon be flat.
I decide to use a standard 9V battery,
two 5V regulators and a PIC12F617
microcontroller as a switch-off timer.
In sleep mode, it draws practically
no current.
REG2 is an ultra-low quiescent cur-
rent (~1μA) regulator which provides


the 5V supply for microcontroller IC4.
After 12 seconds, IC4 goes into sleep
mode, giving a total battery current of
less than 2μA. In this state, output pins
GP4 and GP5 (pins 3 and 2) are low
(0V), switching off N-channel Mosfets
Q1 & Q3 and PNP transistor Q2, so that
no current is fed to REG1, an LP2950
5V regulator.
When SOUND pushbutton S1 is
pressed, it pulls the GP2 input (pin
5) of IC4 low, bringing it out of sleep
mode. The GP5 output then goes high,
switching on Q1 which mutes the am-
plifier (IC2). At the same time, GP4
goes high, switching on Mosfet Q3
which pulls current from the base of
Q2, turning it on and allowing current
to flow to REG2.
REG2 then brings up the 5V rail

supplying IC1-IC3. After a short time,
GP5 is brought low again, releasing the
mute (which is required to prevent
clicks while the other ICs power up),
and output GP0 is driven high, trigger-
ing the whistle or horn sound effect.
If pushbutton S1 is pressed again a
short time later, GP0 again goes high,
re-triggering the sound effect.
If S1 is not pressed for 12 seconds
then microprocessor IC4 goes back to
sleep, switching off the power to the
rest of the circuit and again reducing
the battery current to less than 2μA.
The software for IC4 was written in
PICBASIC PRO, and the BASIC source
code (“Whistle sleep.bas”) and HEX
file (“Whistle sleep.HEX”) are avail-
able for download from the Silicon
chip website.
Les Kerr,
Ashby, NSW ($70).

CIRCUIT NOTEBOOK


Interesting circuit ideas which we have checked but not built and tested. Contributions will be
paid for at standard rates. All submissions should include full name, address & phone number.

Battery-powered Steam Train Whistle

Free download pdf