Model Train Controlled by Smartphone
Build a model train layout you can control with your smartphone using Arduino, DTMF decoder, and Bluetooth.
- Arduino
- Intermediate
- 90–120 minutes
- 6 steps
Shop this project
CartYou'll need
Prices from vilros.com. Tax and shipping at checkout.
Before you start, you'll need
- Arduino Uno (or compatible with Adafruit motor shield)
- Adafruit motor driver shield
- 12V DC power source
- DTMF decoder module
- Bluetooth module
- Jumper wires
- 1kΩ-10kΩ resistor
- Model train track and locomotive
Program the Arduino
About 20 minutes
Set up the Arduino IDE with the Adafruit motor shield library.
- Open Arduino IDE and install the Adafruit Motor Shield library (Sketch → Include Library → Manage Libraries, search for 'Adafruit Motor Shield').
- Create a new sketch for train control.
- The sketch will listen for DTMF tones from your phone and control the motor shield accordingly.
You should see
The Adafruit Motor Shield library is installed and ready.
Modify the DTMF decoder
About 15 minutes
Prepare the DTMF decoder to send signals to Arduino.
- Locate the DV LED on the DTMF decoder board (lights up when a tone is detected).
- Trace the path from the LED to the chip.
- Solder a wire to the copper trace connecting the pin to the resistor that connects to the LED.
- This wire will connect to Arduino's analog input.
You should see
A wire is soldered to the DTMF decoder's DV signal path.
Wire all components
About 30 minutes
Connect the motor shield, DTMF decoder, and Bluetooth module.
- Connect a pull-down resistor between Arduino GND and A0 pins.
- Plug the Adafruit motor shield onto the Arduino by aligning pins and securing firmly.
- Connect the track power feeder wires to the M1 screw terminal block on the motor shield.
- Connect turnout motors to M3 and M4 screw terminal blocks.
- Wire DTMF decoder outputs to Arduino analog inputs: D0→A1, D1→A2, D2→A3, D3→A4, DV→A0.
- Connect the Bluetooth module's RX/TX to Arduino's serial pins.
You should see
All components are wired and the motor shield is securely mounted.
Build your track layout
About 30 minutes
Set up a simple test track with turnouts.
- Start with a simple loop layout with 1-2 yard sidings for testing.
- Place the train locomotive on the track.
- Connect power feeders to ensure even power distribution.
- Test connections with a multimeter if available.
You should see
The track is assembled and ready for testing.
Connect via Bluetooth
About 10 minutes
Pair your smartphone with the Bluetooth module.
- Install a DTMF tone generator app on your smartphone.
- Turn on Bluetooth on your phone.
- Go to Settings → Bluetooth and find your Bluetooth module's name.
- Pair with the module (default PIN is usually 1234 or 0000).
You should see
Your phone is paired with the Bluetooth module.
Test train controls
About 15 minutes
Verify the smartphone can control the train.
- Open the DTMF tone generator app.
- Default controls: 2=forward, 8=backward, 5=stop, 1&3=first turnout, 4&6=second turnout.
- Press '2' to move the train forward.
- Press '5' to stop.
- Press '8' to reverse.
- Test turnout controls by pressing 1, 3, 4, and 6.
You should see
The train responds to DTMF tones from your smartphone.
It didn't work
Train doesn't move.
Check power supply to the track (M1 terminals). Verify motor shield is properly seated on Arduino. Test with a multimeter.
DTMF tones don't register.
Verify DTMF decoder wiring (D0-D3 and DV). Check that the Bluetooth audio is routing to the decoder. Test with a louder phone volume.
What to do next
- Smart Home BlindsBuild another automation project with motors.
- More Arduino projectsExplore intermediate Arduino builds.
Stuck? Contact Vilros Support with your board model and what you see on screen.