10 Steps to Create Model Train Ran with a Smartphone and Arduino Uno
Model railroads have long been a favorite hobby – the 21st-century twist is a model train you can run with your smartphone! Here at Vilros, we love this project inspired by YouTuber Tech Build that will show you how to construct a model train layout you can control with your mobile phone.
In just 10 easy steps, you can be running your own trains:
1. Check Out This Video
The first thing you’ll want to do is watch this video so you know what this project is all about. Just look at what your train will be able to do!
2. Supplies & Equipment You’ll Need
Here’s a list of all the tools and materials you will need for this project. Make sure you have everything, and you’re ready to begin:
• Arduino board (ideally UNO, MEGA, Leonardo or another version compatible with an Adafruit motor driver shield)
• Adafruit motor driver shield
• DC power source (12 volts)
• DTMF decoder
• Wires (you’ll need to be able to connect the track power and turnouts as well as connect the DTMF decoder to digital pins and power)
• Your smartphone – with the DTMF toner generator app
• Screwdriver (crosshead)
• Resistor (1K- 10KΩ)
3. Program Your Arduino Board
Next, you’ll need to program your Arduino board. You’ll need the Arduino IDE, plus the library for the Adafruit motor drive shield. If you need help installing a library, check out this guide.
4. Make the Necessary Changes to Your DTMF Decoder
Here’s how to modify your DTMF decoder: first, find an LED on your board labeled DV (this will light up when the DTMF decoder receives an appropriate signal). Next, trace the path to the chip and solder a wire to the copper trace connects the pin to the resistor connecting with the LED.
5. Create Your Layout
Next, create a layout for your train track. For example, you may want a loop with multiple yard-sidings.
Pro tip: it’s smart to create a simpler layout when you’re first building this project and testing out the connections. Once you know everything is working, you can have fun and get creative designing more complex layouts.
6. Wire It Up
Here are the wire connections you’ll need to make:
• Connect a pull-down resistor between the GND and A0 pins (plug the AF motor shield on your Arduino board by aligning to shield pins to the board’s sockets and securing it firmly in place)
• Connect one of the turnouts to the M4 screw terminal blocks
• Connect the other turn out to the M3 screw terminal blocks
• Connect the power feeder wires to the M1 screw terminal block.
• Connect the following DTMF decoder digital outputs to these Arduino board analog inputs:
o D0 – A1
o D1 – A2
o D2 – A3
o D3 – A4
o DV – A0
7. Get Your Train Set-Up on the Track
You’re ready to get your train on the track! When starting out, it’s easiest to test with just one train, but once you’re up and running you’ll be able to have multiple trains going.
8. Connect Your Smartphone via Bluetooth
Make sure that the DTMF tone generator app is installed on your mobile phone and that your Bluetooth is turned on. Find your receiver’s name under Settings>Bluetooth and pair.
9. Testing, Testing…
Now you’re ready to test your layout. Open the DTMF tone generator app on your phone and these should be your default controls:
• 2 – forward acceleration
• 8 – backward acceleration
• 5 – stop
• 1 & 3 – your first turnout controls
• 4 & 6 – your second turnout controls
10. Go Bigger!
Now you can run your model train with your smartphone! To go to the next level, try creating more complex track layouts and running more than one train.
All of us at Vilros hope you have fun running your model train 21st-century style! For more project ideas with Arduino, check out www.vilros.com