Building My Own Cab Controls

Discussion in 'Creators Club' started by krijba, Nov 17, 2020.

  1. krijba

    krijba New Member

    Joined:
    Nov 17, 2020
    Messages:
    7
    Likes Received:
    23
    Hi everyone!

    My name's Chris and I'm new to the form, but have been playing TS and later TSW for at least 10 years. I usually work as theatre technician in Switzerland, but as there ist not much theatre around lately, I have some time at my hands. So I have decided to build my own mini-cab for my personal simulation needs.
    I want to share my progress here to maybe find some other people who tried/are trying to do the same thing or could point out some potential problems that could pop up further down the way. Or maybe someone could be inspired to do the same thing and learn from my own mistakes, which I have already made and probably will make plenty of.

    Goals

    With TSW, I am not looking for realism, but for immersion. I don't really care at the moment if something is exactly like the original, as long as it feels like it could be original-like. For my project, this means I am not going for a replica of any one cab. I just want to eliminate the immersion-breaking feeling of a controller in my hands or searching for the right letter on the keyboard.
    At the moment I find the german routes the most interesting, mostly because of the way the signals let you drive with all the HUD off without learning too much about the route itself. I guess this will be represented in the general layout of the controls, but it is definitely the goal to drive other trains as well.
    I originally had a look at Raildriver, as its support was announced in the roadmap. However, I don't like the look of it and I don't think it offers what I want. Also, it is quite expensive. For the construction, I set myself a not so strict budget of 200.- CHF (around 20% cheaper than Raildriver).
    As my Computer is not super high end (although quite decent), I want to have the whole logic as external hardware or programmed on a microcontroller. This would mean that I don't have to run an extra piece of software next to TSW.

    Proof of Concept

    [​IMG]

    The whole thing is based on the open microcontroller-platform Arduino. I ordered a beginner's set with an Arduino Uno. With the components included in the set, I tested all the components I wanted for the main project. I used potentiometers for the levers and a 2x2 button matrix, which all worked fine. Unfortunately, it turned out that with the Arduino Uno, I cannot send any keyboard inputs to the computer. This is the way I want to control TSW. (this is why I really really hope there will be a keyboard option to open the doors soon) Therefore, I have to order an Arduino Leonardo. This is not the end of the world, but it obviously would have been preferable to buy an usable board at the first place.
    I ended up using Pullup-Resistors on the Input-Pins on the Arduino. The output pins are activated in turn to act as ground connection. This means all the buttons show a 1 when not pressed, and a 0 when pressed. I will go into more detail once the hardware is assembled and I start writing the software.

    Control Layout

    My favorite train at the moment is the Talent 2, therefore the layout I am going for is loosely based on this cab. The cab will consist of a main control panel, two levers for throttle and break and a foot pedal.

    [​IMG]

    The main control panel has 29 logical switches. It has 2 rotary knobs (double circles), 17 regular switches and 4 flick switches (diamonds).
    With one of the knobs, it will be possible to switch between control modes for different locos. For instance, for the class 101 I would replace the sand functionality with the gear shift. The control panel also features an LCD-Screen (mostly because I have one laying around), which will show the currently selected mode. A walking mode is also imaginable and would probably be quite useful.

    One switch is for the foot paddle. This adds up to 30 switches, which corresponds to a 5x6 button matrix. Additionally, there are two levers. Depending on the selected mode, one could be a combined throttle/break-lever, or two separate ones. I will be using two faders from a sound control desk, onto which I will build the handles. At the moment, I am planing to just detect if the lever is in the front or the back and therefore increase/decrease the power, just as it is with the triggers on the controller. As the faders are essentially potentiometers, it is possible to detect their position. I am hoping that there will be a possibility with the upcoming external hardware support that it will be possible to make it more realistic, so that full forward is 100% throttle, and half forward 50% and so on.

    Everything will be built from wood. The panel will be plywood on a lath frame. For the levers and the paddle, I will make a trip to the DIY-Store and have look what I could use.

    The logic behind it

    Unfortunately, I do only know the basics about electrics/electronics. With trial and error with my test contraption and some googling, I came to the following switching circuit.

    [​IMG]

    The reasoning behind this is, that I have not enough pins on the microcontroller for 30 buttons. Therefore, I build a matrix where each output is connected via a button with each input. Each output is activated separately and the software checks each input, if the button is pressed. Like this, I can check for 30 buttons while only using 11 pins.
    As the flick switches are a rather late addition to my plans, they are not yet included in the diagram. However, it would work just as with the rotary encoders on the top left. Top right are the potentiometers for the levers.

    First Step: The Core

    All in all, I have put together a list of about 100.- CHF worth of electronics components. These will be soldered to a development board. I call it "The Core".

    [​IMG]

    The above diagram shows the physical representation of the logic from the previous chapter. Each switch on the panel is between a yellow and a purple connection. The brown rectangles are the diodes (one for each switch) and the circles are capacitors. Red are the output connections, blue the input. Green handles the analog signals of the potentiometers.
    Everything is wired to plug connectors (S1/S2 for the levers, D1/D2 for the rotary encoders, A/B/C/D/H to the switches). This means that the core will be a self contained entity. As all the switches on the plugs are connected on adjacent pins, i can build a test switch to test the whole thing thoroughly before starting with the panel.

    Where to go from here

    In the next few days, I will order the parts. I am a bit unsure about the Arduinos usage of 5V, if it is enough to power the switches and the cables I intend to use. Until next time, I am very happy to discuss any input, tips and concerns here and will be back with a report on how my rusty soldering skills are holding up.

    Thanks for reading and continue to have fun driving trains :)
     
    • Like Like x 13
  2. breblimator

    breblimator Guest

    WOW! Great project! Fingers crossed. I am waiting for the photos! Good luck \o/ :)
     
    • Like Like x 2
  3. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Nice project. I did one as well 2 years ago using the same matrix approach. Don´t forget those diodes from the first drawing to avoid the ghostings. I followed a tutorial for the matrix boxes that included also an arduino script template, so you don´t need to start from scratch with the board programming. Take a look here if you need the original links:

    https://steamcommunity.com/app/530070/discussions/0/1694920442957618319/

    About the powers don´t worry as 5V are more than enough. The voltage loss due to the electronics themselves is minimal if they are average quality ones and you will feed it with the PC USB connection so board power will be stable. I even used 1N4007 diodes which are industrial ones I got at my work and not really required, 3 LEDs as well and board handles the whole thing well. In my case I used a Leonardo board, but both are similar for this purpose. The only thing to check is the LCD display, as that one may require external power supply. Read it´s specs before. I didn´t use any.

    The tutorial helped me a lot as I´m not an expert at all on electronics nor arduino. Once finished you will not be able to play without it :D Good luck mate!

    Cheers
     
    Last edited: Nov 18, 2020
    • Like Like x 2
  4. DTG Jamie

    DTG Jamie Staff Member

    Joined:
    Aug 24, 2020
    Messages:
    1,426
    Likes Received:
    5,353
    Hi Chris, great project, look forward to seeing your progress.
     
    • Like Like x 2
  5. krijba

    krijba New Member

    Joined:
    Nov 17, 2020
    Messages:
    7
    Likes Received:
    23
    Thanks for the links! I had a look and already found some very interesting techniques I surely will benefit from. I'm very glad to hear that a rather similar project has worked out so well. I particularly like the design of your box, I guess my wooden construction will not look this nice, but I am not very comfortable with any other materials than this. And it is also good to hear that the 5V is enough even for industrial grade switches. Now nothing stands in the way of sending my order to my local electronics store.

    Thank you guys! Very much appreciated. I will keep you posted :)
     
    • Like Like x 2
  6. geloxo

    geloxo Well-Known Member

    Joined:
    Nov 21, 2018
    Messages:
    956
    Likes Received:
    1,694
    Don´t worry about the wood now. I started with some plastic and a bunch of basic switches to test it and ended with this metal case. As soon as the thing grows and you see the results you will want to include more and more things hahahaha.

    Cheers
     
    • Like Like x 2
  7. krijba

    krijba New Member

    Joined:
    Nov 17, 2020
    Messages:
    7
    Likes Received:
    23
    Hi everyone! I just picked up the last German route I didn't have already during the sale and while I am waiting for the download, here an update about my home-built cab.
    Yesterday I went to the workshop and built the wooden structure for my mini-cab. Since the last time, I decided that it will incorporate a curve to feel more cab-like. I built the frames from 2x2cm wooden slats and a plywood cover for the front. As I am no carpenter, they are a little bit wonky, but I like them never the less.

    [​IMG]

    The long element is 42cm wide, the smaller ones 25. I had to re-cut some element, since I hadn't had my drill angles figured out, but after the second triangle, they practically built themselves. I was quite glad that I had all the tools that I could imagine (next to some I don't even know what they do), but I am confident that with more time, anyone could build them with a basic tool box. A quick test fit was a must after I came home.

    [​IMG]

    I already have two screens that could be added to the sides for a larger view screen, but I don't know yet if my graphics card is enough to handle them. But I would be satisfied is it is now. I am planing to make some triangle elements for in between, but only after everything works and can be used.

    While I am waiting for the electronic parts to arrive, I will design the layout of the buttons with labels in photoshop and print it onto black paper. I want to paste it onto the plywood. I used the technique before and the results were adequate, but never on an area this big. Alternatively, I could just paint them. I will later go on a hunt if I can find the textures of the train cabs to copy and paste the accurate symbols.

    Have a great day!
     
    • Like Like x 4
  8. breblimator

    breblimator Guest

    haha, superb \o/
     
    • Like Like x 1
  9. BjornGroen02NL

    BjornGroen02NL Well-Known Member

    Joined:
    Jan 24, 2019
    Messages:
    418
    Likes Received:
    854
    That looks absolutely awesome! It's really taking shape now. Can't wait to see the result :)
     
    • Like Like x 1
  10. krijba

    krijba New Member

    Joined:
    Nov 17, 2020
    Messages:
    7
    Likes Received:
    23
    Hey everyone! After a couple of exhausting days at work I found once again time to continue my project. Next up is the creation of the panels, before I finally start with the wiring.

    At first, I wanted to print the symbols on black paper, however even before trying I realised that one cannot print white on black. I decided that a white background will do, and by now I actually quite like it. I wanted then plaster a whole sheet of paper onto to wood, but this did not work, as the wet paper got too many folds and wrinkles and it looked awful. So I painted the wood white and cut the paper into smaller segments. It has now a bit of a patchy-feel, but it is in reality actually less visible than on the picture.

    [​IMG]

    Then I went down to the workshop and drilled the holes for the buttons and switches. It was a bit annoying since we had drilss from 3 to 10 in one milimeter steps, but after that only 15, 20 and so on, and I needed 11 and 16. But with a round file it was no problem, even the asymetric hole for the key turned out okay on the first try.

    The rectangular hole for the LCD-Screen was the most difficult, I drilled two large holes and used the padsaw to cut the shape out. I guess this would be the professional way to do it, but my lines turned out a bit shaky. It required a lot of sanding until the screen finally fitted in, but now it is pinched in there without the need for any screws.

    [​IMG]

    That is it now, I will start wiring this afternoon. I am already thinking about the programming, although the cable to connect the Arduino to the PC has yet to arrive. But a question remains anyway. To anyone out there who built something like this already: How did you work around the fact that there is no keyboard-button for opening and closing doors?
     
    • Like Like x 2
  11. bustinsrocks#1946

    bustinsrocks#1946 Member

    Joined:
    Jan 5, 2021
    Messages:
    34
    Likes Received:
    63
    That is really cool! Making a raildriver sort of thing. I too am a theater technician and I understand how hard it is right now.
     
    • Like Like x 1
  12. Rail Runner

    Rail Runner Well-Known Member

    Joined:
    Sep 9, 2018
    Messages:
    937
    Likes Received:
    970
    Love your ideas!
    I was thinking of making my own Cab set up for the PlayStation. I believe it can be possible by externally wiring buttons onto a USB Keyboard... the only trouble is, I cannot find a PlayStation keyboard layouts anywhere...
     
    Last edited: Jan 6, 2021
    • Like Like x 1

Share This Page