It's an expensive hobby that I just don't have the money to keep going but I do have a little amount of HO and N scale trains that I like to set up and watch the trains go round and round. I had not set up my model trains for a very long time and last week I got the HO trains out of their box but locomotive's wheels had a buildup of dirt and the track had gotten very rusty and dirty and was more than I could clean off to make the trains run.
So I put the HO trains back in their box and moved on to the N scale box but unfortunately they had suffered the same fate as the HO model trains. After a while I came across a box in my storage closet with some old blue track toy trains and I wondered if they still worked. So I pulled a small circle of track out of the box and some locomotives and some wagons, flicked the go switch and they worked.
After watching the toy train go around in circles for a while I wondered if I could get my HO scale trains to run off battery power and to be able to change direction. So after half an hour of thinking about this I came up with some ideas on how to do it.
(Disclaimer, the following electrical diagrams may or may not work so use at your own risk and remember electricity can kill so be careful. Use at own risk, I take no responsibility for any electrocution or if you hurt yourself attempting to build any of the following prototypes.)
For starters the train had to be able to go forwards and reverse and stop. Therefore I needed a way to control the direction the electricity flows. My first idea to do that was to have switches on the bottom of the locomotives so that when they were moved by something on the track it would change the switch setting and thus change the direction of the train or stopping it.
Then I thought about having a magnet on the track and uses it to toggle a reed switch to change direction to forwards or reverse.
The second thing I had to work out was how to get a circuit to be able to switch the direction of a motor. Now I had tried to do this with one of my Blue Track trains toy trains a very long time ago but it didn't work out.
I could not get the power to flow through the motor as the power would just run back to the battery in an unintentional short caused by both the positive and negative connections of the motor both having a positive and negative input.
The solution was to use relays to control the flow of power in and out of the motor. A relay is an electromagnet that either opens or closes a switch on a different circuit (there are other types but they use the same principles).
There are two sorts of relays modes; an inverter and a duplicator. An inverter when given an electrical current turns off a secondary switch. A duplicator by default when there is no electrical current has the switch in the secondary circuit off but when it has electricity passing through it closes the secondary switch.
By using an inverter and a duplicator it becomes possible to control the follow of electricity to the motor by using a duplicator followed by an inverter relay.
The way this circuit works is when the forward is selected on the switch a set of relays turns the forward power on and turns the reveres return to the battery off. Likewise when reverse is selected a second set of relays turns on the reveres power and the forward return to the battery off. This system should allow for changing the direction of the trainÃÂ¬ÃÂ¬ without the circuit shorting like it did in the previous circuit.
So that's all fine and dandy but what if you want the train to slow down and then stop? This is made possible with an arduino or similar micro controller that you can program to speed up and slow down the motor when a switch is triggered.
This circuit should work much the same as the previous one except when the reed switch is triggered by a magnet it sends a signal to the arduino that executes code to slow down the train and change direction. Note that an a arduino may run on a different voltage as to the one that the motor does so it may be necessary to use a voltage regulator to insure that the arduino does not get fried.
After designing the control device it's time to build it and test it out and program the arduino to control the train. I don't have the money to do this right now but when I do, I will write a follow up article explaining the process.
However if you want to learn more about relays and how more advanced things like "and," "or," "nor" and "nand" gates work I'd suggest having a read of chapter 6 of "Foundations of Computing and the Information Technology Age" by John Thornton as it's a decent read on the advanced and non-advanced use of relays.
Zach Radloff lives on the Gold Coast and is studying IT technology at university.
Zach Radloff's previous articles may be viewed at www.pressserviceinternational.org/zach-radloff.html