Software apps and online services
Controlling a model train layout with a wired throttle and turnout controllers might be a good start for beginners but they pose a problem of non-portability. Also, the wireless controllers which come in the market can either control only some locomotives or are a bit too expensive. So, in this tutorial, let's learn how to make a simple wireless model train layout control setup with a smartphone so you can sit back, relax on your couch and have a control on your layout. Let's get started!
Before starting to build, make sure you have all of the following parts, materials, tools, and supplies:
- An Arduino board, preferably an Arduino UNO, MEGA, Leonardo, or similar ones which can be attached to an Adafruit motor driver shield.
- An Adafruit motor driver shield.
- A 12-volt DC power source.
- A DTMF decoder.
- Wires to connect the track power and turnouts(click on the image to know more).
- Wires to connect the DTMF decoder to digital pins and power(click on the image to know more).
- A smartphone equipped with a DTMF tone generator app.
- A crosshead screwdriver.
- A 1KΩ - 10KΩ resistor.
If you don't have Arduino IDE on your computer, download it from here. The library for the Adafruit motor driver shield can be found here, in case you don't have it in your IDE. Make sure you install this in your IDE before compiling the program. If you need help installing a library, check this link out.
Look for an LED on the board marked as 'DV', it lights up whenever the DTMF decoder receives an appropriate audio signal. Trace its path to the chip(make sure you are not following the GND connection) and solder a wire where the copper trace connects the chip's pin to the resistor connecting to the LED.
The test layout which I made is made up of a small oval loop along with two yard-sidings.
Connect a 'pull-down' resistor between the pins GND and A0. Plug the AF motor shield on the Arduino board by carefully aligning the pins of the shield to the sockets on the Arduino board and pushing the shield down to secure it firmly on the Arduino board.
Make the following wiring connections:
- Connect any one of the two turnouts to the screw terminal blocks marked 'M4'.
- Connect the second turnout to the screw terminal blocks marked 'M3'.
- Connect the wires of the power feeder track to the screw terminal block marked 'M1'.
- Connect the digital outputs of the DTMF decoder to the analog inputs of the Arduino board as follows:
- D0 to A1
- D1 to A2
- D2 to A3
- D3 to A4
- DV to A0
We'll just use two locomotives for testing purposes. You may even use one.
Make sure you have DTMF tone-generator app installed on your smartphone. Turn on the Bluetooth receiver and turn on the smartphone's Bluetooth, go to Settings> Bluetooth and find the receiver's name and pair it with your smartphone.
Open the DTMF tone generator app and test your layout. The default controls are as follows:
- 2: Accelerate the locomotive forward.
- 8: Accelerate the locomotive backward.
- 5: Stop the locomotive.
- 1 and 3: 1st turnout controls.
- 4 and 6: 2nd turnout controls.
The remaining buttons are unused and can be used to control even more turnouts by modifying the Arduino program.
If the locomotive starts to move in the wrong direction, turn off the power and swap the wires of the power feeder track with each other.
Now you can sit back, relax on your couch and control your trains and turnouts with your mobile phone.
There are a lot of unused buttons left on the control pad. So, go ahead by adding more functions to your layout and share your creation with the community. All the best!