Control Your Model Train Layout With Your KEYBOARD!

by KushagraK7 in Circuits > Arduino

4058 Views, 16 Favorites, 0 Comments

Control Your Model Train Layout With Your KEYBOARD!

Control your model train layout with a KEYBOARD!

In one of my previous Instructable, I showed you how you can control your model train with your TV remote. You can check out an upgraded version also here. In this Instructable, I will show you how to control a model train layout with a keyboard through a computer using Processing. So, let's get started!


Get All the Stuff!

IMG_0693.JPG
IMG_0696.JPG

So, before starting with the build, make sure you have all of these;

Any Arduino board compatible with Adafruit motor driver shield

An Adafruit motor driver shield

A crosshead screwdriver

3 pairs of male to male jumper wires(2 pairs for the turnouts and the third one for the power feeder track)

A power feeder track

2 turnout tracks(you can add as many as you want by modifying the Arduino and processing codes)

A 12 volt DC power supply

A suitable USB cable to connect your Arduino board to a computer

An external keyboard (Optional)

Get the Arduino Code and Upload It to Your Board

Capture Arduino code for keyboard controlled model train layout.PNG

Make sure you have the Adafruit motor shield library installed in your computer.

Plug on the Motor Driver Shield to Your Board

IMG_0688.JPG

Connect the Jumper Wires to the Motor Driver Shield

IMG_0694.JPG

Set Up Your Train Layout

IMG_0789.JPG
IMG_0749.JPG

Get your tracks and set up your model railway layout.

Set Up Your PC

IMG_0751.JPG

Connect the Power Feeder Track and the Turnout Switches to the Motor Driver Shield

IMG_0754.JPG

Set Up the Locomotive and Rolling Stock on the Tracks

IMG_0755.JPG
IMG_0756.JPG

Connect the Arduino Board to Power

IMG_0757.JPG

Wait! before powering up your setup make sure there are no loose connections, faulty components and derailed rolling stock or locomotive(s).

Connect the Arduino Board to the PC Via USB

IMG_0758.JPG
IMG_0759.JPG

Launch the Processing 3 IDE and Open the Code

lhhcd.PNG

Download the Processing IDE from here. Download the given code and open it in the IDE.

Test Your Layout

Testing the laptop controlled model train layout

Feel free to add more features to this layout by altering the codes, adding more turnouts and motor drivers. It's all up to you. I hope you will enjoy making this project. All the best for your build!