Arduino MS Train Simulator Console

by The Art of DHT in Circuits > Computers

12375 Views, 48 Favorites, 0 Comments

Arduino MS Train Simulator Console

IMG_3807.JPG

I am a big train buff loving everything there is about them, This also means I like to play Train Simulator from Microsoft. Using a keyboard to drive a train is not the most prudent way. I looked at rail driver but for 200 dollars, it wasn't my cup of tea. So I had the idea of making a train simulator console for about 50 dollars using the Arduino Leonardo. The Leonardo made it easy to implement controls because it has keyboard emulation that is reconfigurable for any game. It's used to make MAME arcade machine controllers which this is a variant of. I am going to show you how to make one of your own you can improve so I could see and probably improve mine.

Construction Plans

IMG_3475.JPG
IMG_3477.JPG
IMG_3478.JPG
IMG_3476.JPG
IMG_3479.JPG

I went to a maker shop and fashioned a 13x5 box out of wood. I used large pieces of wood as a support frame. To support the top. I encircled the interior top with pieces of dowel. I painted it black for a stained wood feel.

The lighted arcade button and joystick holes are 1-1/8

The holes for the reverser switch is 12.2. The other holes are 1/4-4

Materials

I'm listing these so you could choose the design of the box you want.

Mame Arcade Controller Stick

Three Lighted Arcade Buttons

Arduino Leonardo (Good for Keyboard Emulator)

SPDT Switch

Various momentary buttons of your choosing.

Software

Wire the Buttons

IMG_3486.JPG
IMG_3489.JPG
IMG_3490.JPG

The lighted arcade buttons I added to give this project a more spectacular look. You can choose what ever you like but you configure them the same way. Wire all of the buttons here by soldering the arduino GND into the button input. The output line is the NO pin and that is what you connect to the Arduino Pins. For the lighted buttons connect the 5v voltage into the light input line.

Wiring Into the Arduino

IMG_3485.JPG
traincontrollerschematic.jpg

The Arduino Leonardo is the heart of the console. The Leonardo is good for this implementation because it has a keyboard emulation good for Arcade Controllers. The MAME arcade controllers use this board like in Brainy Bits MAME Arcade Controller. You would do good to look up ASCII keyboard codes so you can design your own configuration.

I used a breadboard to wire the Arduino to the buttons. I would suggest wiring the 5V and GND into the board and connect the buttons to them. The outputs from the button NO goes into the arduino pins and the GND goes into the button power input. This corresponds with the LOW function in the code.

Installing the Joysticks

IMG_3802.JPG
IMG_3803.JPG
IMG_3804.JPG

The bread and butter, the joysticks.

The left joystick will be used for brakes. The right joystick will be used for the throttle. Install the joysticks and align them so the poles are dropping down the holes. They allow the sticks to move in the up and down direction.Glue the sticks onto the board after you have found the sweet spot. Wire the joysticks according to the wiring diagram up above.

I wired both so the increase direction is backwards. This simulates the real operation of locomotive levers. They pull backwards to increase speed or braking power because it's more ergonomic. The decrease direction is forward as is in real trains.

Give It Life

IMG_3805.JPG
IMG_3809.JPG

Now download the program into the Arduino Leonardo. There is a bug I can't seem to figure out that the board will run certain functions from your keyboard disrupting your computer. The computer corrects itself when you disconnect the USB. Run your train simulator program like 2001 Microsoft Train Simulator or Aurans Trainz. Plug it into your computer after you have boarded the train. It will run the train functions well and you will have an inexpensive train console.

It's Alive!

Arduino Train Simulator Controller

See it in action finally alive. It runs a little clunky but if you can live with it., you have an awesome MS Train Console.