Introduction: Arduino MS Train Simulator Console

About: A rgraduate of Strayer University now holding a Bachelor's in Computer Science and Information Systems . I am currently looking for something in the field of computer science. Meanwhile my second interest is i…

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.

Step 1: Construction Plans

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

Step 2: 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.

Step 3: Software

Step 4: Wire the Buttons

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.

Step 5: Wiring Into the Arduino

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.

Step 6: Installing the Joysticks

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.

Step 7: Give It Life

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.

Step 8: It's Alive!

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.