Keyboard Controlled Model Railway Layout V2.5 | PS/2 Interface

by KushagraK7 in Circuits > Arduino

1120 Views, 4 Favorites, 0 Comments

Keyboard Controlled Model Railway Layout V2.5 | PS/2 Interface

IMG_1391.png

Using Arduino microcontrollers, there are a lot of ways of controlling model railway layouts. A keyboard has a great advantage of having a lot of keys to add a lot of functions. Here let's see how can we start with a simple layout with locomotive and turnout control. This is an upgraded version of one of my previous projects. So, without further ado, let's get started!

Watch the Video

Keyboard controlled model train layout(V 2.5) | PS/2 interface | Arduino based

Get All the Stuff

IMG_1373.JPG

For this project you will need:

  • An Arduino microcontroller board.
  • An Adafruit motor driver shield V2.
  • A female PS/2 connector(Get the one shown in the picture, it will make work easier.)
  • 4 male to male jumper wires(For connecting the female PS/2 connector to the Arduino board.)
  • 4 male to male jumper wires(2 for each turnout.)
  • 2 male to male jumper wires(For connecting the track power.)
  • 12-volt DC power source with a current capacity of at least 1A(1000 mA).
  • A PS/2 keyboard(USB one will not work!)
  • A suitable USB cable for programming the Arduino board.

Program the Arduino Board and Plug on the Shield

Capture.PNG
IMG_1374.JPG

Get the library for PS/2 keyboard from here.

To install the library for Adafruit motor shield, goto Sketch>Include library>Manage libraries and search for Adafruit motor shield V2 library, install it and you're good to go.

Identify the Pin Connections of the PS/2 Connector and Connect It to the Arduino Board

td_libs_PS2Keyboard_pins.jpg
IMG_1343.JPG
IMG_1375.JPG

Using a multimeter set to continuity test and using the given picture as a reference, mark the pinouts of the PS/2 connector/extension cable wires and make the following wiring connections between the PS/2 connector and the Arduino board:

  • Connect the 'CLOCK' wire to pin D2.
  • Connect the 'DATA' wire to pin D3.
  • Connect the 'GND' wire to pin 'GND'.
  • Connect the '+5-volt/VCC' wire to +5-volt pin.

Connect Wires to the Motor Output Terminals

IMG_1376.JPG

Set Up a Test Layout

IMG_1379.JPG

Connect the Motor Output Wires to the Turnouts and Track Power

IMG_1380.JPG

Double-check all the wiring connections and make sure no wiring connections are loose.

Connect the Keyboard to the PS/2 Connector

IMG_1381.JPG
IMG_1382.JPG

Place the Locomotive and Some Rolling Stock on the Tracks

IMG_1383.JPG

Connect to Power and Turn It On

IMG_1384.JPG

Sit Back With Your Keyboard and Operate Your Layout

Keyboard controlled model train V2.5 | PS/2 interface | Arduino based

Go Further!

There are a lot of buttons left on the keyboard. Go ahead and try adding more turnouts and functions to your layout. Whatever you do, don't forget to keep trying new stuff!