This Blog describes the ongoing development of a 16mm scale 45mm gauge garden railway situated in the North West of England, UK from 2004 to the present day.
This blog describes ongoing progress in the development of a G gauge / 15mm scale / 1:20.32 / Fn3 scale Garden Railway from its inception to the present day.
NEW (October 2025)
The Fruit Special Train (featuring containerisation)
When I became interested in building my own garden railway I spent a considerable amount of time (and money) on books, videos, DVDs and scouring the internet for information, ideas and inspiration. When I eventually started construction, I used some of the ideas I had discovered, but also experimented with my own approaches. This blog outlines how I have gone about constructing my own garden railway. My aim is to provide the sort of information I was looking for when I was getting started, and also to share what I've learned (or 'borrowed' from others). I've tried to include a few 'How I ........' postings interspersed with occasional 'Progress Reports'. I do not profess to be any kind of expert - what I offer here is an opportunity for you to metaphorically look over my shoulder to see how I have gone (and am going) about this fascinating hobby.
As this is a blog, the various posts are presented in reverse chronological order (ie the most recent first). To see a categorised list of contents, go to the Blog Contents Page.
If you are thinking about building your own garden railway, then why not join the 16mm Association or the G Scale Society - you'll get plenty more advice and opportunities to visit other peoples' garden railways. Alternatively, browse through theG Scale Central website - there's plenty more guidance here and an opportunity to sound out the views of others through the G Scale Central discussion forum or the GardenRails.org forum
The Blog
The advantages of blogging are that it is immediate and uncomplicated when creating and uploading information. The other, of course, is that with Blogger it is free. The major disadvantage is that I have minimal control over how the postings are presented. The blogging system adds the most recent information to the start of the blog, hence the postings appear in reverse chronological order (most recent first, oldest last). Whilst there is a list of postings on the right-hand side, it's not particularly easy to see what is there. This introduction is an attempt to provide you with a contents list of the postings organised into categories so, hopefully, you see if what you are looking for is presented in this blog. To ensure that it always appears at the start of the blog, I update its content and set its presentation date into the future each time I add a new posting.
I wanted a simple but effective way of tipping 32mm gauge Binnie skip wagons without the intervention of "The Hand of God". After scratching my head, I came up with this simple solution - a couple of pieces of bent 00 rail.
Here's how I did it.
Bucket-tipping actuator
After some trial and improvement, I ended up with a tipping actuator arm with these dimensions.
These dimensions aren't critical but they seemed to work with my set-up.
The position of the arm was again discovered with a small amount of trial and improvement - just below the height of the rim of the skip bucket and protruding so that the leading edge makes contact as the wagon approaches.
As the skip wagon is propelled forward, the arm tilts the bucket, .....
..... until it over-balances and tips the rest of its way due to gravity.
I find that filling the bucket so there are more contents towards the tipping side helps.
Bucket-resetting actuator
The dimensions given, match the spacing of Peco SM32 sleepers.
I found that a 2.5mm hole drilled in the sleepers was enough to hold the actuator arm in place, though a dab or two of superglue stopped it from slipping out of alignment.
Once more, I positioned it by eye, making sure the front edge of the actuator ....
.... aligned with the tipped ridge of the bucket.
..... so that, as the skip wagon was drawn over the actuator, it forced the bucket upwards until its centre of gravity was restored to its normal, travelling position.
Originally, the sounds in my Ford(ish) railbus were provided by a cheap MP3
player with each track being triggered by flicking a switch on the transmitter
to move forwards and back through the various sound effects (See
How I used an MP3 Player as a soundcard). This was a bit cumbersome and there was a one second gap as each new track
was played.
More recently, I replaced with antiquated MP3 player with a
DF Player Mini module (See
How I used a DF Mini Player as a sound card). This has many similarities to the old MP3 Player in that it includes an
amplifier and also plays tracks from a Micro SD Card. Its advantage is
that it plays .WAV tracks with no noticeable gap when it loops a track or
switches to another. Its disadvantage was that the tracks still needed to be
triggered by flicking a switch on the transmitter and, as with the MP3 Player,
the horn could bot be sounded separately.
So, I speculated about using an Arduino microprocessor to automate some
of the switching of tracks and also providing the much-needed horn sounds. I
had previously used Arduino to provide radio control and sound effects for a
diesel loco (see
Arduino-based radio control). However, the radio control seemed a bit twitchy compared with my
Deltang/Micron based system and was not as precise. However, I gained
some useful experience in using an Arduino to switch MP3 tracks on a
DF Player Mini.
Armed with this knowledge (my blog is useful in reminding me how I did
something previously), I explored writing some similar code which would
respond to the input from the ESC on the DeltangRx61b
receiver/controller used in the railbus.
Voltage Divider
The first step was to transform the motor output from the ESC on the
Deltang receiver into something suitable for an Arduino analogue
input. Whereas, the ESC provides 0 - 12v PWM output, the Arduino can only
measure 0 - 5v input. Furthermore, the motor supply from the ESC is reversible
and so this needed to be rectified for the Arduino analogue input.
Fortunately, my mate in Australia is a dab hand with electronics and so guided
me through the voltage divider circuitry needed to convert the 0 - 12v
reversible PWM input into a more acceptable 0 - 5v output.
Note: R2 = 80/(Vb-8) kΩ. IF Vb is less than 8V you don't need R2.
So, with my supply voltage being around 12v, R2 = 80/(12-8)k = 20kΩ
Alternatively, you could purchase a ready made DFR0051 analogue voltage
divider module from Farnell at around £3.50 GBP (at current prices).
Voltage Regulator
The DF Player works on 5v and, although the Nano can work on up to 12v, it is happier on 5v. So, I needed to reduce the supply to these components. In the original railbus set-up, I soldered together a circuit with a 5v voltage regulator chip (L7805) but these days there are plenty of voltage regulator modules on eBay which actually work out just as cheap, without the faff of soldering the components together.
I used an adjustable voltage regulator which I bought very cheaply in a job lot. A digital multi-meter was used to make sure the output was just below 5v (rather than just above it), a small screwdriver being used to adjust the trimpot.
Connecting up the Arduino
I used an Arduino Nano as I had a couple in stock and also there is
plenty of space beneath the roof of the railbus to accommodate it.
VIN - connects to the 5v output from a voltage regulator
GND - connects to the negative (0v) output from the battery or voltage
regulator
A0 - connects to the output from the voltage divider above
D8 - connects to Pad 5 on the Deltang Rx61b (via a 1k resistor)
D10 - connects to Tx on the DF Player Mini
D11 - connects to Rx on the DF Player Mini (via a 1k resistor)
NOTE: If you decide to use two sets of batteries - one for the motor and one for
the electronics, make sure the negative leads for both batteries are
connected.
Connecting up the DF Player Mini
VCC - connects to the 5v positive
output from either the voltage regulator or the Arduino Nano
GND - connects to the negative (0v) output from the battery or voltage
regulator
Tx - connects to D10 on the Arduino Nano
Rx - connects to D11 on the Arduino Nano (via a 1k resistor)
SPK_1 - connects to an 8Ω speaker
SPK_2 - connects to an 8Ω speaker
I connected a Li-ion 3S battery pack, a Micron MR603, a motor, the
voltage regulator, the voltage divider circuitry, the Arduino Nano, the DF
Player Mini and a speaker together on a breadboard so that I could use it to
test my Arduino code.
NOTE: The Rx61b is a very early incarnation of Deltang's RC equipment for trains and did not have the facility to re-program 0v outputs on its pads. Consequently, the output from Pad 5 needed to be passed through a transistor inverter circuit to switch the 3.3v output to a 0v output to trigger the Arduino. I maybe could have adjusted the code to sense this input, but the inverter circuitry already existed in the original version of the sound system. Micron and later Deltang receivers can be programmed to give 0v outputs but, if you need to know the circuitry for the inverter see - How I trigger sounds with a Deltang Rx65 receiver.
The sound effects
The next job was to edit the sound files needed. Fortunately, I had
already purchased a series of suitable sound files of a Ford Model A car from the
StockMusic.com website and so was
able to incorporate these with other sounds captured from YouTube with
Audacity - a free open source audio editing package. See -
How I used Audacity to create sounds for my railbus
- for more information.
I ended up with ten sound files:
Track 001 = Engine start (6 sec)
Track 002 = Idle (24 sec)
Track 003 = Idle plus horn (1 sec)
Track 004 = Accelerate to cruise (31 sec)
Track 005 = Cruise (1 min 19 sec)
Track 006 = Cruise plus horn (2 sec)
Track 007 = Decelerate to idle (12 sec)
Track 008 = Engine off (3 sec)
Track 009 = Horn (1 sec)
Track 010 = Silence (15 sec)
These were copied on to a 512Mb Micro SD Card. I have found that, not
only do the files have to be numbered correctly - ie 001, 002, 003, 004 etc
- they have to be copied to the card in the correct order, otherwise the DF
Player gets confused. Also, it is advisable to reformat the card before
saving the files to it.
I'm sorry, but I can't share my sound files as this would infringe the
copyright agreement for the files I downloaded from
StockMusic.com
The code
I am no coding expert. I make copious use of the online reference
facility on the Arduino website and search online for pieces of code to do
specific jobs (eg to differentiate between a short press and long press of a
digital (push button) input). The beauty of coding is that you can keep trying
things out and, if it doesn't work as you expect, you can edit it and try
again - you get instant feedback.
OK, it is a bit more complicated than that as sometimes, you have no idea why
what you've written doesn't work and so you have to research the internet for
a better way of doing it, but the more you try, the better at it you become.
Here's the entire code for the sound
/* Arduino connections A0 - Motor input from voltage divider circuit DO NOT connect directly to motor leads!! D8 - 0v trigger for horn (short press) and engine start/stop (long press) D10 - Tx on DF Player Mini D11 - via 1k resistor to Rx on DF Player Mini VIN - 5v +ve GND - Ground (same as for Arduino)
int analogPin = A0; // ESC through voltage divider int Ch5Pin = 8; // 0v trigger for Horn (short press) and engine on/off (long press ) - Ch5 on Deltang or Micron Rx and Tx int Lights = 1; // Flag - 0 = lights off - 1 = lights on int Horn = 1; int Engine = 1; const int SHORT_PRESS_TIME = 1000; // Duration for long press on horn / engine trigger - 1000 milliseconds = 1 second
bool ch5Triggered = false; // the previous state from the input pin to test for short or long press int currentState; // the current reading from the input pin unsigned long pressedTime = 0; // When the horn/engine trigger was pushed unsigned long releasedTime = 0; // When it was released
int val = 0; //Current value of ESC output (subtracted from 1023 as Micron / Deltang ESC starts high and goes lower as speed increases) int maxval = 0; //Max value of output from ESC (as this will vary dependent on charge in battery pack) int minval = 1023; //Min value of output from ESC (How high the throttle reaches) int currentTrack = 10; //Track currently playing (starts off with silence)
void setup() { Serial.begin(9600); mySerial.begin(9600); myMP3.begin(mySerial); pinMode (Ch5Pin, INPUT_PULLUP); // Sets the horn / engine trigger to high initially delay(1000); // Helps prevent any falso triggers myMP3.loop(10); // Loop play silence }
void loop() {
currentState = digitalRead(Ch5Pin);// read the state of the horn / engine trigger input
if(currentState == LOW && !ch5Triggered) { // trigger button has been pressed ch5Triggered = true; pressedTime = millis(); // When the button was pressed } if(currentState == HIGH && ch5Triggered) { // button is released ch5Triggered = false; releasedTime = millis(); // When the button was released
long pressDuration = releasedTime - pressedTime;
if(pressDuration < SHORT_PRESS_TIME ) Horn = 0; // Sets the horn flag to 0 else Engine = 0; // Sets the engine flag to 0 }
val = analogRead(analogPin); // Read the input level from the ESC voltage divider circuit (NB 0 - 1023) if(val>maxval) maxval=val; // Records the max input level if(val<minval) minval=val; // Records min input
if (Engine == 0 && currentTrack == 10) { // If long press and current track is silence myMP3.play(1); // then play engine start delay(6000); // length of the engine start track (ie six seconds) myMP3.loop(2); //Now loop the idle sound track currentTrack = 2; Engine = 1; // Resets the long press trigger flag }
if (Engine == 0 && currentTrack == 2){ // If long press and current track is idle sound .... myMP3.play(8); // .... then play the engine cut off track currentTrack = 10; delay(3000); // Length of the engine cut off track (ie 3 seconds) Engine = 1; // Reset the long press trigger flag }
if (Horn == 0 && currentTrack == 2){ //If short press and current track is idle sound ..... myMP3.play(3); //.... then play the idle + horn track delay(1800); // Length of the horn + idle track (ie 1.8 seconds) myMP3.loop(2); // Carry on looping the idle sound track Horn = 1; // Reset the short press trigger flag }
if (Horn == 0 && currentTrack == 5){ // If short press and current track is cruise sound .... myMP3.play(6); // .... then play the cruise plus horn sound .... delay(2000); // ... for two seconds .... myMP3.loop(5); // .... and then carry on looping the cruise sound track Horn = 1; // Reset the short press trigger flag }
if (Horn == 0 && currentTrack == 10){ // If short press and current track is silence ..... myMP3.play(9); // .... then play the horn sound delay(1500); // ... for 1.5 seconds .... myMP3.loop(10); // ... then carry on looping silence Horn = 1; //Reset the short press triggee flag }
if(val < maxval - 10 && currentTrack == 2) { //If the input from the ESC voltage divider drops 10 units below the max value while idling .... myMP3.play(4); // ... then play the acceleration sound track .... delay(29000); // ... for 29 seconds .... myMP3.loop(5); // ... and then play the cruise sound track currentTrack = 5; val = 0; //Reset the input value to 0 to prevent triggering the next if loop }
if (val > minval+ 120 && currentTrack == 5){ //If crusing and the input value from the ESC rises 120 units above the minimum value ... myMP3.play(7); // ... then play the deceleration track .... delay(12000); // ... for 12 seconds .... myMP3.loop(2);// ....and then play the engine idle sound... currentTrack = 2; minval = 1023; // Reset the minimum input value .... maxval = 0; // ... and the maximim input value (just in case!) } Engine = 1; //Reset long press flag if it is pressed and triggers nothing Horn = 1; // Ditto for short press flag delay(100); //To help reduce false readings
}
Hopefully, the comments alongside each of the statements help explain how the
code works.
If you decide to follow in my footsteps, you will have to tweak the 'delay' timings, eg
if (Horn == 0 && currentTrack == 2){ //If short press and current track is idle sound ..... myMP3.play(3); //.... then play the idle + horn track delay(1800); // Length of the horn + idle track (ie 1.8 seconds) myMP3.loop(2); // Carry on looping the idle sound track Horn = 1; // Reset the short press trigger flag }
and the variables in the if statements eg
if(val < maxval - 10 && currentTrack == 2)
to suit your sound files and the ESC output values to match
the characteristics of your motor and model.
Once the railbus has been turned on, a long press on the bind button (Channel
5 input) will trigger the engine start sound and then loop the engine idle
sound. At any point, a short press on the bind button will sound the relevant
horn sound file. A small turn of the throttle knob on the transmitter will
make the gear grinding and acceleration sound file start. once this has
finished the cruising sound file starts. Reducing the speed of the railbus to
around half will trigger the deceleration sound file which then loops the idle
sound. A long press of the bind button while the idle sound in playing will
trigger the engine cut-off file to start which then leads to the silent sound
file looping.
It actually took me nearly two weeks to perfect the code. Even so, it's not
perfect and I might experiment with a revised version of it sometime in the
future, but for now it seems to work.
Costs
Arduino Nano = c£4.50 GBP (eBay) or c£1.99GBP (AliExpress)
DF Player Mini = c£4.00 GBP (eBay) or c£1.00GBP (AliExpress)
The DF Player Mini sound module has been around for quite a few years. It is modestly priced (c£3.50GBP on eBay or less than £2.00GBP on AliExpress), and is very versatile.
Basically, it is a compact MP3 player which can access tracks stored on a Micro SD card. What makes it particularly useful for use as a soundcard is that it has a built-in audio amplifier which will power a 3W speaker. Its operational voltage range is 3.2v - 5v and so will need to be connected to a voltage regulator if used with locos with a higher voltage battery pack (or track power).
VCC is the positive (+ve) input and either of the GND pins are the negative (-ve) input. The speaker is connected to SPK_1 and SPK_2.
Tracks stored on the SD card are played in the order in which they were uploaded to the card and need to be numbered 001, 002, 003, etc. They can be in .MP3 or .WAV format. .WAV files are better for our purposes as they can be accessed or looped with a hardly noticeable gap between them. The module can accept cards up to 32Gb and so can potentially access thousands of sound files. However, I only needed a couple of files and so used a 521Mb card.
It has been designed to interface with microprocessors such as Arduino but, for my purposes, sound files on the SD card can be triggered by connecting various pins to Ground (ie 0v or the negative side of the battery used to power it).
For simple soundcard purposes, the most useful pins are:
IO1 - Short press = Play previous track - Long press = Decrease volume
IO2 - Short press = Play next track - Long press = Increase volume
ADKEY_1 = Play first track (and loop if held down)
ADKEY_2 = Play fifth track (and loop it)
However, by connecting resistors to the ADKEYs particular tracks can be played or functions selected.
Armed with this knowledge, I was now in a position to create a simple soundcard for my IP Engineering Simplex loco.
Creating the sound files
Firstly, I needed to track down some suitable sound files. I would need the sound of a diesel loco similar to a Simplex running at a fairly constant speed, and also a horn sound.
There are various sound libraries on the internet where you can download sounds by paying a small fee. I used Sound fishing which is quite reasonably priced (eg 6 Euros for a month) - https://www.soundfishing.eu/premium.html
Once I had found a suitable sound file, I then highlighted a section of the recording which I felt was most appropriate for my needs, .......
.... and exported that Current Selection as a Mono WAV file.
I could now store this file on an SD Card (as 001) and then loop it using ADKEY_1 connected to ground to provide continuous sound for my loco.
Adding a horn sound
However, I also wanted to add a hooter or horn sound, triggered by pressing the Bind button on any of my Deltang or Micron transmitters.
After tracking down a section of video which featured a typical Simplex loco horn sound, I exported the short segment from Audacity (as above) and then re-opened the file of the steady Simplex engine sound which I had saved earlier.
I then imported .......
..... the short segment of horn sound which appeared on a new track below the steady engine sound track.
I moved the horn sound track slightly to the right and then trimmed the steady engine sound so it was slightly longer than the horn sound track. As you can see, the combined tracks last slightly under one second in total.
The new combined sounds were then exported as a WAV file.
The reason for overlaying the horn sound on to the steady engine note is so that when the horn sounds, the engine sound continues in the background.
To allow the two files to be played and triggered, I had to make use of the ADKEYs ability to trigger separate tracks using resistor inputs. This also required the tracks on the SD card to be arranged accordingly.
I found that, not only did I need to delete the original WAV file, I also had to reformat the SD card otherwise the sound files wouldn't play properly. The horn sound was loaded first on to the card and renamed 001.wav . The steady engine sound was uploaded second and renamed 002.wav .
The link from GND to ADKEY_1 was replaced with a 3k resistor (so Track 2 on the card would be played continuosly) and a link from ADKEY_1 to pad C on the Deltang Rx65b receiver was made. Pad C gives 0v output when the bind button is pressed on the transmitter (ie Channel 5)
So, when the loco is first turned on, the 3k resistor from ground to ADKEY_1 makes DF Player loop Track 2 (the steady engine sound) but when the bind button is pressed on the transmitter, the receiver connects ADKEY_1 to ground directly and so, while the bind button is being held down, track 1 (ie the horn sound) is looped.