Introduction
Why bother with an Arduino Uno when there are ready made products to
control our model railways? Well, the challenge of doing it for
yourself, the cost, (many components are available very cheaply),
but most important of all the ability to identify and build a
control system for my railway were, for me, the three main reasons.
I was able to buy a complete starter kit including the Arduino Uno
for about £18. The Arduino Uno, (I bought one recently for £3.99),
is an open source electronics platform. The program to control it is
a free download and there is a great deal of support on the Arduino
web site, ( www.arduino.cc ) and on YouTube. Also, additional
support was available from a group called the Micro Electronics
Railway Group (MERG), of which I am a member.
The Arduino Uno R3 board
Let’s start with the board itself. It’s a small collection of
input and output sockets of different sorts, voltage supplies, and a
storage area for the program that you have to write to in order to
make use of a variety of peripherals. It has a USB socket to connect
it to a computer and an external power supply socket which allows it
to be run independently of a computer. From the diagram shown below
you will see the groups of sockets it has. a group called Power, a
group called Analog IN and a large Digital output group of different
kinds.
The Arduino Software
As previously mentioned, working with the Arduino
board requires you to obtain a free downloadable program which is
straight forward to use but it’s necessary for you to know a little
of the programming language known as ‘C’. The Arduino program
provides a simple window into which you type various bits of code
that can then be tested for mistakes and once corrected can be
uploaded to the Arduino. The programming process works as follows:
First you have to name and
give a value to any constants that you are going to use.
e.g. int button_1 = 2
(the int part
identifies it as a number or
integer)
Next you set up the
necessary functions that use those variables from the previous
section and declare which of them is an input or output.
e.g. pinMode(button_1, INPUT);
(the semi colon at the end is important)
Finally you build up a
program in a loop that has a defined structure to control the
Arduino board. It calls on procedures to control lights, motors,
servos, steppers etc. in specific ways.
Next I joined MERG, The Model Electronic Railway group, to get extra support and advice.
A fuller explanation of my journey is to be had here as a pdf file downloadable by clicking Here.
Here is the outcome on its first trial:-
and here it is with a full load of coal in working condition. The coal gets in everywhere and under all the wrong places, so regular cleaning is necessary to keep things running smoothly
Shunting needs to be improved but the driver lacks the experience as yet!
Here is another view of the tippler in action. This time from the track bed.