My Euro Raildriver

Discussion in 'TSW General Discussion' started by gazz292, May 19, 2022.

  1. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    This is still very much a work in progress

    I like to get pretty immersed in the simulator i'm driving, i've made a few controllers in the past, but this is the most complex one yet.

    i'm calling it a Euro RailDriver, as i've based it the controls found in a typical German loco, and i'm using the 'replacement PieHid64.dll' that allows an arduino running a simple sketch to be seen in TSW2 as a raildriver.
    https://forums.dovetailgames.com/threads/xinput-game-controller-raildriver-dll.45793/


    Driving Train.jpg Next to raildriver small.jpg

    It's about 90% 3D printed, at a scale of 62.5% (or 2 thirds)
    This is so it's portable and able to sit on the laptop desk i use (i have the real driving desk in my avatar, but no spare room to set it up in)


    The main feature i wanted was easily changeable notch wheels, so i can have the notches on my levers match those of the train i am driving..
    As the notch wheels are 3D printed i can easily make new ones up to match trains that are released in the future.

    Another feature is the brake levers are coupled together, pushing down on the dynamic brake knob uncouples them, so the dynamic brakes can be used without the air brakes,
    When the levers line up again they automatically re-couple.

    Brake levers render.jpg
    (I know the dynamic brake levers' knob should twist to uncouple, but it was too hard to model that mechanism in the space i had)

    The direction switch lever is removable, and doing so triggers a hall effect sensor that sends a joystick button press, so i can insert or remove the key and it will do the same in the simulator,
    And the rotational notches are set at 30 degrees like the real thing.

    Render of Direction Switch.jpg


    The first 2 photo's show the bare bones of the controller with the temporary 3D printed top panels, this is just to hold the levers in roughly the right places for testing,
    I will be making a laser cut box to house the levers, switches and electronics, so (hopefully) it will look something like this in the end :

    Euro RailDriver render.jpg

    I've tried to cover all the commonly used switches and levers found across German trains post ~1980. that's why there's things like the EMU style door push buttons, as well as the loco/dosto style door selector rotary switch and the white open/close lever switch,

    The controls on the sides of the box are for things like the handbrake winder, wiper lever, E-brake mushroom, AFB master switch and headlight rotary switches.



    The biggest thing that will make or break my controller is going to be getting it to fully work with TSW2,
    at the moment i have two STM32F boards for usb input, one sends the serial data from the levers to the RailDriver .dll,
    the other is running FreeJoy, to make it an 8 axis, 128 button joystick,
    Then i have to use Joy2Key to turn the joystick button signals from the switches into keyboard presses to move the switches in the sim.

    But there are some switches in the sim that do not have keyboard keys assigned to them, or some trains do and some don't, i.e. the brake lockout key, brake overcharge button, train line power switch and so on.

    I really hope we can get native joystick support soon, with the ability to assign joystick buttons / axis to any of the working buttons, switches or levers in the train cab,
    Or access to the loco's data to allow something like CobraOne's TSC raildriver joystick interface to work with TSW2... that would be amazing as it'd also allow things like train GPS data to be read, so working EBuLa's could be a reality.
     
    • Like Like x 25
  2. driverwoods#1787

    driverwoods#1787 Well-Known Member

    Joined:
    Feb 21, 2021
    Messages:
    9,516
    Likes Received:
    5,880
    Excellent idea and in the future this will work on ÖBB Locomotives like the 1293 Vectron ES64U2 1116 ES64U 1016 ES64U4 1216 Taurus. EMU ÖBB are 4758 Talent 3 4746 Siemens Desiro ML 4124 Talent 1.
    Have you tried using this with German multiple units DB BR612 422 425 423 High Speed 406 ICE 3M 403 ICE3 and Talent 2 442 Red 1442 Silver.
     
  3. moelkertje

    moelkertje New Member

    Joined:
    Jan 28, 2021
    Messages:
    26
    Likes Received:
    20
    Love this project already, it looks really promising. Hope you don’t mind the question but what kind of 3D printer do you use?
     
    Last edited: May 20, 2022
  4. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    3D Printer:
    i use a Prusa i3 MK3S, had it a year and a half now.
    Expensive initially, but i just assembled it from the kit and set it printing, it just...works,

    no faffing about constantly calibrating, adjusting things, using glues or tape on the bed, spending hundreds on upgrades etc.

    Send it a file and it will print it out, i have the printer in a different room to where i design things in Fusion360,
    i send it the sliced file via octoprint, so i'm not even in the room when it starts printing, no need as i know it's reliable, i just go and collect the finished print when it's done.

    i've had about 5 print fails out of the ~500 i've successfully printed, they were tall thin objects i forgot to use a brim on (one 'complaint' is prusa slicer needs a larger warning box to tell you when you've forgotten to use a brim, or select the paint on supports functions)

    :

    Multiple Units:
    When i drive an EMU i just ignore the levers that are not in use, as they will do nothing anyway (i don't have the BR612 DMU yet.. waiting for when its in a sale).


    But i fit the 'EMU' notch wheel on the power lever, which gives the notches you'd expect (and any that are different i can make a new notch wheel up for)

    This render shows the EMU notch wheel fitted,
    EMU Notch wheel.jpg
    i've highlighted the face of the wheel to show up the centre notches that the bearing in the notch lever would be pressing against to keep it in the upright OFF position.
    the spring loaded notch lever is hollow in the centre, so it traps the notch wheel in place side to side... so to change wheels i pull the lever down and just slide the notch wheel off, then slide the different one on.



    .


    .




    Brake Notch Wheel.jpg Here's a render of the Air Brake notch wheel, showing the positions as set out by the German standards, but i have noticed things in the sim like the Doso's have an extra braking notch etc.


    I've also got a set of 3 push buttons just for the EMU doors, as well as the loco/dosto style door side selector rotary switch, and the white switch to actually open and close the doors.... which i think is only replicated in 3 or 4 trains on the RailDriver (Please DTG, make all trains that have the same switches have them in the same place on the RailDriver)

    But until we get proper joystick support, i will have to come up with some code for the arduino to send the 'Y' or 'U' keystrokes depending on the position of the door selector and the door open/close switch to open and close the doors.

    switches.jpg This is the door open/close 'Sonderhebel' and the horn 'Standardhebel' i printed, it goes to the right of the brake levers.

    Switch Render.jpg And the render of the internals of a switch to show what's going on inside them,
    By changing the (red) plates that bolt onto the switch lever and the number and positions of the microswitches i can make it perform almost any switching arrangement,

    3 switches.jpg Like here are 3 different switches.
    The closest one is the 'Sonderhebel mit Walze' used for the pantograph... it's got 4 positions, normally it would be sitting at +17 degrees forwards in the off position,
    Pushing it forwards to +35 degrees is the pantograph raise position, where it springs back to the off position when released,
    Pull back to -17 degrees is the pantograph lower position, again it springs back to off.
    But pull it back past the -17 degree position and it will lock into the -35 degree emergency 'pantograph + sand' position it is in now.

    Middle switch is a 'Standardhebel' the most commonly used switch,

    Back one is a 'Sonderhebel mit Kugel' used for PZB Wachsam, Sand, and another function i can't remember right now.



    This is where i need access to more keyboard / joystick button commands, i believe about 3 maybe 4 loco's / dostos have raildriver buttons for door side select, then open and close,
    the others just use the 'door open left / right' buttons, pressed again to close them.

    Unfortunately i can't send raildriver button presses, the 'replacement PieHid64.dll' only accepts lever positions, and the guy who wrote it can't release the source code for others to add these things, and i believe he's moved onto other things now, so he can't add button support himself.


    So short of learning how to write a .dll, i'm stuck with trying to change things in the arduino code, which is how i am handling the different RailDriver lever assignments,
    The BR112 uses the independent / loco brake lever for the speed selector lever, and part of the power lever is 'force selector'

    I will have a multi position switch on the controller to switch between different bits of arduino code, and in the 112 position it maps the loco brake lever to my full travel power lever, and the force selector to another lever i choose.

    it also takes care of splitting the RailDrivers combined power/brake lever, so i get 2 full travel levers for power and dynamic brakes in loco's and dosto's, instead of the back 1/3rd of the combined lever's travel for power, the big dead band in the middle then the front 1/3rd of travel for dynamic brakes.
     
    • Like Like x 4
  5. moelkertje

    moelkertje New Member

    Joined:
    Jan 28, 2021
    Messages:
    26
    Likes Received:
    20
    Thanks another in depth post! Question about de EMU notch wheel. I know in some dutch EMU’s you have to push te button on top of the lever to be able to apply power. But for braking pushing this button is not necesarry You’re wheel has the same size of notches for applying power and braking. Does this lever work different in German EMU’s?
     
  6. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Yeah, Most German EMU's have the power lever lockout thing too, so do a lot of loco's / dosto's.

    but that is not modeled in the train sims i drive, so i didn't implement it,

    my power levers knob does press down, but it presses a switch embedded in the disc of the lever, and i use that for my SIFA button... as i use this on an overbed desk, i can't use a foot pedal for SIFA as it should be.

    I was working on another version of the power lever where the knob pushes the shaft down and that pushes a T / cross shaft... like the brake levers do, and that pushed on a lever on the side of the frame,
    So a lockout could be made and pushing the button would release it, but it's getting all the angles right so the side frame lever is pushed down the same amount no matter where the lever is in it's 90 degree movement etc.
     
    • Like Like x 1
  7. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Decided to make the door side release switch.
    i was originally going to use a 4 position 90 degree rotary switch, and just make up the knob and legend plate, but they are hard to find unless they are big industrial ones (and very expensive) and the small one i did get hold of does not allow continuous rotation.

    So the only way to get exactly what i wanted is to make it from scratch.

    Door side selector.jpg

    The camera always draws out the flaws in 3D printed stuff, i didn't notice the stringing on the letters until i took the photo, a quick rub with the brass brush will remove them.

    A view of the internals in fusion 360:
    Door Side Selector from side.jpg Door Side Selector internals.jpg
    Basically it's a multi plate construction, with bolts and nuts holding the upper and lower main plates the right distance apart.
     
    • Like Like x 4
  8. moelkertje

    moelkertje New Member

    Joined:
    Jan 28, 2021
    Messages:
    26
    Likes Received:
    20
    Are you planning share the files when it’s in a good state? Or will you sell them like Karl from https://www.737diysim.com/? Or is this just a project you do for yourself? It’s all okay either way but i for one would be verry interested.
     
  9. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    i will share the files when i've completed the project, probably the 3D (.step?) files as well as the .stl's, so people can modify things in a cad program easier.

    i've never been bothered about trying to turn my hobby's into money, takes all the fun out of it.
     
    • Like Like x 4
  10. moelkertje

    moelkertje New Member

    Joined:
    Jan 28, 2021
    Messages:
    26
    Likes Received:
    20
    I see, paying creates expectations.
     
  11. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    There is that too i guess,

    But i genuinely have no desire to turn any of my hobbies into money makers.

    When i started this project i had the idea all along that i would release the .stl files and let others replicate what i've built if they wanted, that's why i spent 3 months designing different lever assemblies, to try and make as much as possible 3D printable and to use off the shelf hardware.

    Then i kinda gave up on that idea and made stuff like the levers shafts and the rods that slide inside 2 of them, plus the cross rod for the brake lever coupler out of metal on my lathe and mill,

    That's why this early photo of me testing the bare levers has metal shafts:
    Levers.jpg
    Im driving a train in TSC there, hence i'm using TS-MFD to give me the working EBuLa and MFA screens on the tablets.. that stuff wont work on TSW2 unless DTG give us an API like there is in TSC to access the relevant data :(


    But then i made the axles that run in the main bearings out of 10mm precision ground rod, the drive pin for the notch wheels was a partially turned down M4 bolt, i was even considering turning down some 120mm diameter alli bar i have from another train controller i made to make the levers discs.

    Below is a controller i made ~2014, using some real German train/tram switches, the lever i turned on my local hackspaces lathe, as this was before i owned my own lathe etc.
    SBahn Fahrer.jpg



    But i found the difference in feel and operation of the turned parts in the Euro RailDriver's levers was very similar to the fully 3D printed ones that just need nuts, bolts and bearings to assemble, so i've gone back to 3D printing as much as possible.

    So i switched to using an M3 bolt for the notch wheel drive pin... not as nice as the smooth turned bolt i was using, but it does the same job and no lathe needed to replicate it,
    The axles are fully 3D printed, i do still use turned items for the main lever shafts, but i have made the files for printed ones, they just need spinning in a drill and sanding to make them smooth, as printing them laying down leaves a flat on the bottom.
    Printing them standing up would be a big challenge for a ~10mm dia x 70mm tall object (not to mention the 6x90mm inner shaft) also they'd also be weak due to the layer direction then.
     
    • Like Like x 4
  12. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Just finished printing the ZugSammelSchiene / Train Line Power switch:

    Train Line Power 1.jpg

    Basically a slightly smaller version of the door side selector switch, but instead of having constant rotation between 90 degree switching position, this one has 3 positions, with 2 of the positions being maintained (switch stays in those positions) and the AN / Start position is non maintained, so is springs back to the Ein / on position when i release the knob.

    I modeled the knob on the one found in the dosto's and BR146 locos, but i want to go for the earlier look, with individual switch and lever legend plates rather than the bank of switches in a single plate, so i made the top bezel and legend plate similar to how it is in the BR101.

    Then i had to make up the knob that goes with the BR101 style switch too:

    Trian Line Power.jpg

    I actually prefer the BR101 style switch, but i am not modeling my driving desk on any particular train, it'll be a mix of the bits i like from them all.
     
    • Like Like x 2
  13. Choo choo

    Choo choo Well-Known Member

    Joined:
    Apr 10, 2019
    Messages:
    148
    Likes Received:
    313
    That's really beautiful. I'm keeping an eye on this thread! :)
     
  14. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Made the brake lever lockout switch, as found next to the brake levers in German loco's / driving trailers to isolate the brake levers when using the cab at the other end (not sure if the driver is supposed to lock the brake levers in the emergency position when he leaves the cab, or just take the reversing switch lever out)

    Brake Lockout Key Switch.jpg

    The key part is fixed in my switch, i was going to make it with a magnet in it and have it removable, but that was getting awkward due to the size of everything, resulting in thin walls not having enough strength in the body to turn the shaft without splitting.

    The switch on my real driving desk uses a round bodied key, so i copied that style rather than the flat style key on more modern trains.

    This switch was a little more awkward to make as i had to make the body of the switch mechanism small, because there will be the brake overcharge button next to this switch,
    my last switch had a 45mm square body, this one has a 30mm square body... plus ~10mm for the microswitch on one side.


    Below is the mechanism... all 3D printed except the nuts, bolts, spring and micro switch.

    Brake Key Switch Mech Render.jpg
    The (shiny silver) bearing just below the blue notch lever is 5mm diameter.

    The yellow bit is the shaft that turns with the 'key/knob' it's made in 3 pieces to allow the switch cam (red) and notch plate to be seperate... easier to print and allows swapping them out easily.
    The shaft runs in bearings top and bottom like the other switches i made.
     
    • Like Like x 4
  15. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Decided i didn't like the 'key' i'd made for the brake lockout switch, so made one to resemble a flat style key, which allowed me to make the 'bow' (bit you hold to turn it) smaller and more to scale.
    Brake switch new key.jpg
     
    • Like Like x 1
  16. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    The Brake OverCharge Button was next to be modeled and printed.

    Brake Overcharge button.jpg

    A push button is a lot simpler than the rotary switches i made before, but the challenge was to get the threaded parts to screw together nicely when 3D printed.

    Brake OverCharge Button Render.jpg
    The main outer body i decided would have M20 x 1 threads, then a nut clamps it to the top panel of the driving desk,
    The microswitch holder screws onto the bottom, which traps the actual moving button and it's spring inside the outer body.

    Not owning a tap or die past M12 size meant i couldn't do as i did in the with the levers, and clean the printed threads up by running a tap/die down them,
    They were far too tight to screw together when i used Fusion 360's standard thread interfaces.


    Thankfully a video from CNC Kitchen about 3D printed threads showed me how to easily make the female threads on the nut and the micro switch body looser using the offset face command, and it also showed me the 'section analysis tool' that i never knew existed in F360 (i've only been 3D modeling for about a year)

    This is what the button looks like with the 'Section Analysis' tool in F360, i've already 'loosened' the female threads by 0.1mm:
    Brake Overcharge button sectioned.jpg Before i knew of this tool i faffed about making individual parts semi transparent to see the clearances where they fit together as i adjusted them, it's nice to learn things as i fumble about in Fusion 360 making these things.

    I just wish i could learn programming / coding, but it just does not click with me like mechanical stuff does.
     
    • Like Like x 2
  17. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    EMU door buttons:
    EMU Buttons.jpg

    I printed the button parts with clear PLA, so i can light them up in the future if we get an API that can read the relevant data from the trains/simulator (like we have for train simulator classic)

    They are a little bigger than the brake overcharge button, and i fitted lighter springs in these buttons,

    also due to two of them having letters in them that i wanted to keep pointing the right way, i made the micro switch push shaft square and made it part of the actual button, i'd made the round shaft of the brake overcharge button a separate screw in part so i could easily change it's length if needed.
    the micro switches are able to be rotated + and - 10 degrees to adjust how far down the button is pushed to activate the switch)
    EMU Button Mech.jpg
     
    • Like Like x 1
  18. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Wiper lever:
    Wiper Lever.jpg
    In the style found in the dosto's and some EMU's (BR425 i think) ... i.e. the ~1990's type that uses a big chunky metal lever to turn the valve.

    The real thing is an air switch / valve, not an electrical one, hence it's design and chunkiness.


    This lever is off scale, it's smaller than it should be for the 62.5% / 2/3rds scale that the rest of my levers and switches are aimed at, but this is because this lever has to fit on the front upright panel of the box that houses everything.
    So it was a case of make it fit the space i have available for it.

    The lever just rotates between 4 positions / notches, i didn't model the part where pushing the shaft of the lever towards the panel operates the screen wash, that's not operational in TSC or TSW2 anyway... i think i may have been able to do it, but it would have complicated things a lot.
    But the wiper speed adjuster knob does work, well it's connected to a 2nd potentiometer and rotates, but at present i don't think there's an input to change wiper speed in a train other than using the mouse.
     
    • Like Like x 1
  19. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Emergency brake lever and wiper lever, mounted in a 3D print of the front right controller box side panel, the black curved pieces are the ones i will be using to connect the 6 side pieces together on the final controller box:

    E-Brake and Wiper Switch.jpg E-brake Off

    E-brake and wiper switch on.jpg E-brake On

    Another way off scale lever, but like the wiper control, i have a place on the controller it has to fit, so it had to be made smaller than i'd have liked.

    This is what i based the above 2 controls on... the wiper and emergency brake panel in the Dosto:
    Dosto E-brake.jpg I 'think' the wipers symbols are in the wrong place here? i'm sure it goes 'park, off, intermittent, on/lasting' when you move the lever in the sim,
    And i wonder if on the real thing, the Park position would be spring loaded (why have an off and park position, and not just a park position which is also off)
    My real wiper lever is in storage so i can't check easily.


    I don't have enough room to mount the levers vertically like they should be, unless i want the controllers top to stand ~200mm above the desk, instead of the 76mm i want it to be, and mounting them in a recessed panel can't be done either, i've already had to make the mechanisms for these 2 levers as thin as possible, as right behind them will the be EMU door buttons bodies set in the top panel.



    In 2 days time i will be going to my local Hackspace to laser cut the controllers box, it will be 581 mm wide by 276 mm deep (238 mm in the middle) and 76 mm tall.
    The whole box could be 3D printed in sections, but i have access to a laser cutter so why not use it (Hackspaces are great for that)

    Euro RailDriver render 06-06-22.jpg
    The box will have cutouts in the bottom so it can sit over my laptop's keyboard, there's a bar across the front of the desk which stops the laptop sliding off, this will also stop the Euro RailDriver from sliding off too... as the laptop will be pushed backwards to the far edge of the desk to give room for the controller to fit.

    i've still got a rotary headlight switch to make, and switches for things like AFB on/off, PZB, LZB and Sifa isolators, PZB brake mode switch, handbrake and so on, these will all mount on the side panels like the wiper and E-brake levers do.

    So i'll hot glue the front and side panels in, then i can swap them out easily as i make the other switches.
     
    • Like Like x 1
  20. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    About an hour at my local hackspace using their laser cutter tonight, and i have a few bits of 3mm thick acrylic sheet in weird shapes with lots of holes cut out of them:
    Laser Cut Box.jpg

    I made a few duplicates of the front panels as i still have switches to make, and i will fit them to the 'spare' panels the 'old fashioned way' using a drill and a file to make the holes for now, as my 'local' hackspace is about 45 miles away.

    I plan to hold the box together with hot melt glue temporarily, this will allow me to pull up the lines of glue, (isopropyl alcohol releases hot melt glues grip) remove a panel to add holes for a new switch etc and put it back, and only when everything is finished will i glue the box together permanently with a proper plastic weld type glue.

    Laser Cut Box mockup.jpg
    I need to re-do the 3D printed corners i've discovered, they are about 1/2 a mm too wide, so the side panels can't slot together nicely, or i could shave 1/2 a mm off the side panels ends, have to decide on that tomorrow.
     
    • Like Like x 1
  21. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    What i've done over the last month on this project..... aka 2 million words to explain what 300 could have.


    Been to hackspace a few more times (120 mile round trip each time... my fault for living in the middle of nowhere) to laser cut acrylic sheets into the pieces that make up my controllers box / frame, i'm now on the 3rd version of the main box and have one more to cut that will hopefully be the final one.

    My controllers box is a tab and slot style assembly, the upright panels have tabs along the bottom sides that fit into slots cut in the base.

    Tab and Slot Box Render.jpg This render should show what i mean, the yellow and black dashes in the base panel are where the upright panels slot into, the curved corners are 3D printed parts, and the whole lot is turned into one solid box with a glue that partially melts the plastic and 'welds' it together (that will come back to bite me later)

    So in version one of this box i learnt that cast acrylic has a +/-15% tolerance, meaning 3mm thick sheets can be upto 3.45mm thick, not good when it needs to slot into 3.1mm holes to make a box (i thought the 0.1mm i added to the slots would be enough to allow for slight variations in thickness)

    The solution to that was to buy extruded acrylic for the sides, which has a +/-3% tolerance i discovered, it also gave me a chance to change the design a little and add in some strengthening bars,
    The box turned out to be a little too flexible for my liking, due to the cutouts in the base panel mentioned 2 posts ago that allow the controller to sit over my laptops keyboard, also because the box is essentially open topped, the top panel which the levers mount to needs to lift upwards (hinged at the back) to access the notch wheels when i need to change them



    So a lot more slots were added to the base panel design and strengthening bars drawn up in fusion 360, and to try and get as much rigidity as possible i switched to 5mm thick panels.
    That didn't work out due to an issue with the laser cutter, at the moment it's cutting on a slight angle, i didn't notice this angled cut issue in 3mm thick sheets, but in 5mm it was enough to make the side panels lean over too far to allow the corner pieces to slide into place.

    I figured out that 5mm thick panels were not needed after all, it's was the strengthening ribs that made all the difference.

    So i redesigned things for all 3mm sheet and ordered some more acrylic, deciding to use white for the sides this time to allow the switches that will mount on the front panels stand out better, as they will be mostly black.

    Yet another trip to hackspace to use the laser cutter, i'd also drawn up the lever and switch legend plates which i cut out of the spare black acrylic from the base panel.

    ERD V3.jpg So this is V3 of the controller box.
    The black legend plates on all but the PZB switches are 3mm acrylic, that's way too thick, even a real legend plate is only 1.5mm thick but i had cut these plates out of the remains of the base panel sheet, mostly to test their size (too big it turned out)

    The 3 PZB switch plates are 3D printed, this allowed me to alter their dimensions a few times until i got them looking right, the text is from a label printer using white on black tape, i need to use a slightly thinner tape so the screws do not scrunch the labels up as has happened on the PZB Frei switch.

    Getting black acrylic sheet in 1.5mm thickness is rather hard it seems (in the uk at least) if i wanted clear i could get it down to 1mm thick, but i found a different plastic sheet (HIPS) that does come in 1.5mm thickness, it's very cheap too, i just hope it will laser cut ok.



    This box structure could have been the one that was used for the final controller, except for 2 things,
    1) The white plastic i bought was called opal white... i didn't realise this meant it was slightly translucent, not really the end of the world tho.
    2) i went and glued the front right hand panel in flipped 180 degrees :mad:
    Remember that glue i used that welds plastic together, well that means there was no way to remove it to flip it around without destroying the base panel in the process.

    Wiper lever screw up.jpg The black panel is how the white panel should be installed, i tried putting the wiper and E-brake levers in the white panel, but the E-brake lever rotates left, and crashes into the wiper lever when they are on the wrong sides.

    So, yet another order for acrylic was made, i made sure i got solid white this time, and i'm waiting until i've finished another part of the project before i go over to hackspace for the 4th time to laser cut the panels, as this other part of the project will affect the position and size of some holes in the top panel that i will be re-cutting.... i'll mention that in the next post, but it's the reason for the empty holes in the top panel next to the loco brake lever (top right)
     
    • Like Like x 5
  22. VictoryWorks

    VictoryWorks Well-Known Member

    Joined:
    Sep 22, 2017
    Messages:
    263
    Likes Received:
    1,379
    This is incredible craftsmanship and very inspirational
     
    • Like Like x 1
  23. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    Thankyou for the kind words.

    i bumble my way through things, usually getting there in the end, making plenty of mistakes along the way but learning all the time.

    After i have finished this project i'll release the .stl files of course (and if i can, also the files from Fusion360 so others can alter things easily to suit their project)
    maybe others can use parts of this project to make a modular controller, perhaps start with a set of PZB/LZB switches that you can clamp to the desk next to your keyboard, just to make it nicer to operate the PZB controls than pressing keyboard buttons.

    Then move onto the levers for power and brakes etc... or keep using say throttle quadrants for the levers, and just add a few of your commonly used switches from the cab.... but i will warn you, it's easy to get carried away and end up trying to replicate the cab of a train at your computer desk :D

    CobraOne (who wrote the amazing 'raildriver joystick interface' for TSC) is working on a program that will read any USB joystick like devise (i.e. throttle quadrants, hotas's, or home made levers etc) and it will 'translate' the movement into "raildriver speak" and communicate with TSW2 as if it were a raildriver connected,
    it will also allow joystick buttons (or button boxes) to operate as the raildriver buttons and so on.
    So basically the missing link that might transform how you play TSW2... add the Burchfahrplans / UK timetables from Rail-Sim.de that can be printed or displayed on a tablet / 2nd monitor, and you can drive HUD'less too for even more immersion (hopefully one day we will get access to the trains data in tsw2 to make live EBuLa's that auto update as we move along the route etc)


    anyway, a "small" update on my EuroRailDriver project.


    I still need to get down to the HackSpace to laser cut some new acrylic side and bottom panels, after i messed up and glued a panel in flipped around 180 degrees, i also keep adding / changing things in the top panel, meaning i need to re cut that panel as well.
    But my local hackspace gets rather warm in a heatwave (i.e. like right now) it has non openable roof windows in a flat roof, so the heat gets in but cant get out, and i do not tolerate heat very well,
    so i will need to go down at about 3AM sometime and hope it is cooler inside, but i need to be sure i have the FINAL cutting files, as its a 120 mile round trip for me each time i do this (i do have closer hackspaces, but i like the one i'm with)


    So in the meantime, i have been working on some of the code for the arduino Due that will be the brains of the whole controller.
    As almost every train in TSW2 has a different controller map on the raildriver, i need to be able to change around what each lever and button on my controller operates in TSW2 depending on the train i'm driving,

    I also need to do things like split the combined throttle and brake lever input the raildriver expects, to work with my seperate levers for power and brakes on loco's .... getting rid of the horrible thing on a real raildriver where you only have 1/3rd of the combined power/brake lever operating the power lever in most German loco's.

    This is fairly easy with a load of 'if/else' statements in the arduino code (and something CobraOnes program will do itself) but in order to change between those 'if/else' statements on my arduino with no feedback from TSW2, i need to be able to select the train i am driving on my EuroRailDriver.


    I started out using a set of 3 BCD switches:
    BCD.jpg These allow you to set a number by pressing the + or - buttons, and it makes an electrical connection in binary.. so for 0 - 9 it uses just 4 wires plus a common ground. the idea is to set the train's BR number on these, and the arduino will read that and load the correct control mapping for the train.

    Of course 4 inputs to the arduino plus a common earth for each BCD, times 3 is 13 wires, and i soon realised i'd need to add a 4th BCD switch as some trains share the same number, but different DLC versions have different control maps (i.e. the BR423)

    So that's 16 inputs just to read the trains BR number once as the arduino starts up (better than 40 inputs if i used decimal switches i guess) and although i am using an "arduino Due" with 54 digital inputs like an arduino mega has, i can't bring myself to use 16 of them just for these BCD switches.

    Luckily i knew about shift registers, and using 2 x 74HC165 shift register boards that cost a couple of quid each, i can send 16 inputs down just 3 wires (the shift register takes a parallel input and turns it into a serial one basically... if you want to have outputs, use 74HC595's which convert serial to a parallel outputs)

    I will be using shift registers later on for the button inputs, i have some triple shift register boards, so 3 of them daisy chained can send 72 inputs down 3 wires... they will be on a different set of 3 inputs at the arduino, as the BCD switches will be read just once at startup, the button input ones will be read continuously to allow changing states... like joystick buttons are... it's just a matter of where you put the relevant code in the arduino program.


    So, i now have 4 BCD switches, i 3D printed a 1/3 size dummy with a single dot in it, to go between the 3rd and 4th BCD switch, so they read xxx.x, and i can now enter the trains BR code i'm driving as it's used in TSW2... i.e. the BR 776.2 dosto, or the 185.5, or 185.2 loco etc.

    I added a switch with a RGB led ring, and the idea was it'd show green when i'd selected a number that matches the one in the arduino and it's gone on and set the control map up for me, and red if i'd entered a number that is wrong / not in the system.


    i'd added the BCD and switch cutouts in the laser cutting files and made a new top panel, and only after that did i discover you can buy little 128 by 64 pixel black n white OLED displays for about £5, the screen being about the size of the BCD switches.

    Once i'd got one and started playing with it, that was it, i had to include it in my controller, a little bit of extra code on the arduino, a few days faffing about making up logo's and converting them to byte arrays etc and it was working:
    old oled.jpg Remember, i suck at coding, i was just reading up on the functions i wanted to add, and somehow managed to mangle them all together and get this working, i'd get one part working first, then add it to the main code, then try another.

    My code is probably like my write ups, 200 times longer than it needs to be, but it works.

    However the little OLED wasn't enough, some trains i needed to use the last digit to separate different DLC versions of the same one, and i wanted to say that on the OLED, so it'd need to have like 185.0 as one version, 185.1 as another, 185.2 as another and so on. and i just didn't have enough room on the little display to give that information.

    Thankfully this time i hadn't yet laser cut a new top panel with a hole to fit the little black n white OLED screen in it, and i went searching for a larger OLED screen, i found a colour one with 128 x 128 pixels, so the same width and twice as tall... it was actually a little wider, as the pixel pitch was a bit different, the old OLED was 0.96" vs 1.5"... or something like that.

    Ok this screen was quite a bit more expensive, £25 if i didn't want to order it from china, but i could do so much with a colour OLED double the height of the old one, so 2 days later i was playing with it, i also had to get an SD card reader board for the arduino if i wanted to use colour photo's of the trains from TSW2 on the screen, yet another thing i had to learn about programming for on the arduino (plus remembering that the arduino Due runs at 3.3 volts, not 5 volts of most other arduino's)


    And this is the end result for my train selector... it's all mounted in a 3D printed holder panel for now, it will be fitted in the top panel of the controller when i next go laser cutting:

    Please ignore the diagonal banding, that's the cameras shutter picking up the refresh of the screen, it's not visible through human eyes.
    Trains selected.jpg I enter the BR code for the train i am about to drive on the BCD's, press the silver button which resets the arduino,
    the arduino reboots and reads the BCD number, then runs through the if/else statements in setup until it finds the matching number, if it's got a train associated with the number it loads the image from the SD card of that train (which i 'nicked' from the train selection screen in TSW2) and the green led in the switch lights up.... then it will go on to switch the control inputs around to suit the train, but i havent got to that bit yet.... this all happens in a few fractions of a second, it takes longer to load the image from the SD card than run the setup part of the arduino program.

    If a train has multiple versions, i say so on the screen in red text at the top of the train picture, as can be seen on the last 2 selections above.

    If i select a number that is close to an actual train number, i.e. 112.0 for the BR112.1, it loads a picture of a blank train (i used the livery designer to quickly put question marks on a grey BR101 for this) and asks if i'm looking for the BR112.1? or whichever train i almost had the correct number set for, and the blue led in the button flashes.
    112.jpg Blink your eyes once every 500 milliseconds to get the flashing blue led effect :)
    And yes, i did run out of pixels to use the word 'you' on the top text :(

    And if i select a totally wrong number, it loads a different image, writes text on it to tell me, and flashes the red led:
    wrong code.jpg
     
    Last edited: Jul 20, 2022
    • Like Like x 1
  24. Perks390

    Perks390 Well-Known Member

    Joined:
    Dec 8, 2016
    Messages:
    352
    Likes Received:
    433
    Looks incredible, it gives me inspiration to try and make one myself but I never know where to start or learn how to do it. Does it work on Zusi too?
     
    • Like Like x 1
  25. gazz292

    gazz292 Well-Known Member

    Joined:
    Jun 15, 2018
    Messages:
    422
    Likes Received:
    879
    I actually started this as a Zusi project, originally it was for someone stuck in bed a lot to keep playing train games, but they discovered TSW2 and liked it more than zusi, and now they are happy using the bluetooth keyboard i modified as a stop gap to use until i'd have this project finished :
    TSW2 Keyboard.jpg

    Then i got hooked on TSW2 myself shortly after, so this project has kind of gone off in the direction of being a TSW2 controller. but nothing is stopping it being a zusi one too.


    The electricals are nothing more than a few potentiometers (the things that turn when you adjust the volume on a radio) and switches connected to an arduino, i have had it working connected to a joystick input board... which simply reads the potentiometer positions for the levers, and sends the data via USB to the computer as a normal joystick.

    so Zusi would work directly with that.

    the 'problems' are getting it to work with TSW2 which does not accept joystick input, hence having to trick it into thinking it's a raildriver, using an arduino to do that.


    The program CobraOne is working on will make things a lot easier, as it will take any USB joystick input and 'translate' the data to something TSW2 can work with (i.e. raildriver data)
    he's also going to make it so people can re-map their real raildrivers axes and buttons!

    So the electronics for a train driving controller could be based on a joystick input board that you simply connect the wires to from your switches and potentiometers to.
     
    • Like Like x 3
  26. CobraOne

    CobraOne Active Member

    Joined:
    Jun 3, 2022
    Messages:
    254
    Likes Received:
    190
    An Update regarding TSW Raildriver and Joystick Interface
    I now have a prototype program working that talks to TSW through a new DLL I wrote (with the help of Michael Huggins) to replace the official PieHid64.dll.
    This allows any Joystick or Raildriver to assign/reassign its levers to the in game raildriver levers. You can also assign keyboard keys to any of the buttons on your Joystick/Raildriver.
    The program format is very similar to my TSC version but, I am not able to get any information from TSW unfortunately.
    I am working as fast as time allows to get the full working version finished ready for release
     
    • Like Like x 6
  27. atledreier

    atledreier Member

    Joined:
    Aug 23, 2022
    Messages:
    88
    Likes Received:
    35
    Great news!

    Can't wait!

     
  28. CobraOne

    CobraOne Active Member

    Joined:
    Jun 3, 2022
    Messages:
    254
    Likes Received:
    190
  29. Philbo

    Philbo New Member

    Joined:
    Jun 28, 2023
    Messages:
    15
    Likes Received:
    7
    I watched you thread or post on the keyboard when you showed it first time. This controller though is next level.
    Your attention to details is to be commended.
    The 3D files I shan't need as I don't have a printer or know anyone with one. The Arduino files is what I am really interested in. I know they are cobbled together as you intimated, but even as they are, I can figure out what's what and adapt to suit my needs. I and prolly others here would appreciate access to those source files/scripts. For me the code is like a starting point or road map to what I will need.
    Needless to say I am so envious of your controller but we can all only hope to come close to your job. Luvly stuff mate.
    phil
     
    • Like Like x 1
  30. Shackamaxon

    Shackamaxon Well-Known Member

    Joined:
    Dec 10, 2021
    Messages:
    725
    Likes Received:
    1,070
    Just now discovered this thread !
    Great work, Gazz & Cobra. You guys are really rockin' it ! :D

    TSW2 Keyboard.jpg

    And this is the best thing I saw today.
    I wish my boss would allow me to use this on my work computer XD

    Keep up the good work folks :)
     

Share This Page