Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Discussion about computers: Hardware, Problems, etc.

Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby trmike999 » Fri Jul 26, 2019 5:27 pm

Hi All,

I recently got a Teensy board. Works pretty good. But I got curious...

I've seen certain people make special controllers that actually interact with the game, and people make special programs (like ThirdRails), all using RailDriver.dll / RailDriver64.dll to interface with the game itself.

The problem though is that Arduino/Teensys can't really directly work with .dll files directly since they can't handle windows-based code or something along the lines of that. Because of this, you need an inbetween program to communicate between RW and the Arduino/Teensy itself.

I've been trying to search for a program to do this, but I haven't had much luck. Most things I've found had dead websites or were just completely unavailable. I tried using the wayback machine, but that didn't work either.

The only available program I could find so far was on facebook while I was trying to see how someone got their cab simulator working with railworks. The only problem is that it's in Czech, and I can't read it. I don't want to try messing with it since I'm sort of worried I'll screw up my drivers or something. (Are outside links allowed here?)

My current idea if I can get this to work is to create an external cab signal display. I'm mostly doing this for fun, but it's also a neat idea when your camera is outside the cab and you want to know if the cab signal switches on you all the sudden.

I've created a basic concept so far. It has a cutout switch and a lamp test button. Here's what it looks like:
Off.jpg


And here's what it looks like doing a Lamp Test:
LampTest.jpg


Any ideas? I'm not too experienced with this here, so I figured I'd ask around and see if anyone has any possible solutions. I could give the Czech program a go, but I'd need a translator so I don't screw up my computer *!lol!*
You do not have the required permissions to view the files attached to this post.
`
Image Image
Desert Pacific Re-Paintz Beta Team
http://desertpacificrwy.wix.com/desert-pacific
User avatar
trmike999
 
Posts: 25
Joined: Sat Mar 12, 2016 10:26 pm
Location: Somewhere on Long Island

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby trev123 » Sat Jul 27, 2019 7:45 pm

Maybe ask on the rail driver forums. http://forum.xkeys.com/forum/viewcategory.php?2
Intel i5-10600K CPU, Asus TUF GAMING Z490-Plus (Wi-Fi) MB, Graphics Asus RTX 3060 TI 8GB OC TUF gaming card Windows 11 Home 64 bit, 16 GB Corsair Vengeance DDR4 ram, Viewsonic VX2728 LED 1080P FHD Monitor, Samsung 1TB SSD + other conventional drives, Corsair 750W PSU.
User avatar
trev123
 
Posts: 2353
Joined: Mon May 19, 2014 9:40 pm
Location: Home Of The Americas Cup

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby trmike999 » Sun Jul 28, 2019 10:51 am

trev123 wrote:Maybe ask on the rail driver forums. http://forum.xkeys.com/forum/viewcategory.php?2


Hmm, I could, but it looks like the forum has been overrun by spam bots trying to sell foot massages... *!sad!*

Although, I don't think that'd be the right place to ask since it only deals with RailDriver itself. I'm just looking for some program (or any other ideas) to communicate between the micro-controller and the train sim itself.
Sorry if I made that sound confusing !!**sorry**!!
`
Image Image
Desert Pacific Re-Paintz Beta Team
http://desertpacificrwy.wix.com/desert-pacific
User avatar
trmike999
 
Posts: 25
Joined: Sat Mar 12, 2016 10:26 pm
Location: Somewhere on Long Island

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby trmike999 » Sun Aug 11, 2019 4:03 pm

Quick update on this

I tried using both the Czech program and this other program called "TSConductor" that I found on a german website. Neither could work with the .dll for some reason. I tried checking to make sure that the .dll wasn't corrupt by using Macroworks with my raildriver...and it worked.
So macroworks can work with the .dll, yet other programs can't...I wonder why that is.

Unless if I can figure something out, this puts a dead halt to my project idea. Bummer *!sad!*
`
Image Image
Desert Pacific Re-Paintz Beta Team
http://desertpacificrwy.wix.com/desert-pacific
User avatar
trmike999
 
Posts: 25
Joined: Sat Mar 12, 2016 10:26 pm
Location: Somewhere on Long Island

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby MacGe » Fri Aug 16, 2019 8:52 am

Hi fellows,

I have me registered extra for this topic. I'm a man from Germany who is interested in American railways (from prototype to models to virtual).

I had used "TSConductor" for years. But with the unsupported TS 64bit, I have switched to "TS-Bridge". I wrote the program "TS-Fireman" its similar to "Raildriver Joystick Interface". It converts Joystick inputs into TCP commands.

But back to the communication via TCP. There are two versions of the TCP-server, one for 64bit (TS-Bridge x64) and another for 32bit (TS-Bridge x86). It has the same commands.
GetControllerListExtended(FLAT)
GetControllerListExtended(RAW)
GetLocoName()
GetControllerValue(ControllerID;0)
GetControllerValueMultiplyRaw(ControllerID:ControllerID:ControllerID) answer: ControllerID:ControllerValue::ControllerID:ControllerValue::ControllerID:ControllerValue::
SetControllerValue(ControllerID;0)

I am also working on an Arduino project. The Arduino as a TCP client works fine, but sometimes there are connection issues. I had no success with the Czech program. So I wrote a small program as a test that sends a value via COM. Currently, it's the speed, but everything is possible. My sample sketches you will find at the German forum "Rail-Sim.de". Also my small TS_TCP_and_COM program. It was formerly a test for my planned locomotive information display in American style (IFD).
MacGe
 

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby gehringerg » Sat Mar 21, 2020 9:56 am

Have you gotten any further on your quest to get the signal indications ?
I too am looking for a way to read the current signal, but the Raildriver API does not have any functions to return the current signal's value.
gehringerg
 

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby MacGe » Sun Mar 22, 2020 9:37 am

You can only get the data via RailDriver.dll that the loco has. There is a program named "Raildriver and Joystick Interface" that can do more. For this, you must modify the loco script (LUA?). I haven't tried it. I don't want to edit the files.

Currently, I make some tests with my new TCP2COM program that can send up to 9 values via COM.
MacGe
 

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby BB22210 » Tue Aug 03, 2021 12:27 am

Hello,
Did you succeed in interfacing your console with TS2020 finally?
I am also looking to create a new console without a raildriver, based on Arduino, as I did with OpenRails where the features are 99% operational.
see at : https://www.facebook.com/AlpiSim

Any advice ?

Rgds
BB22210
Last edited by BB22210 on Fri Aug 13, 2021 5:01 am, edited 1 time in total.
BB22210
 

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby MacGe » Tue Aug 03, 2021 12:12 pm

If you build a console based on Arduino, you just have to make sure that it works as a joystick interface with 32 buttons for input. Then you can integrate it into the TS very easily. With the help of "Raildriver and Joystick Interface" or my "TS-Fireman with TS-Bridge". With the latter, I can accurately transfer all functions (5 axis and 32 buttons) from my driver console/control stand to the TS. The "Raildriver and Joystick Interface" is more extensive and in some areas better (keyword: irregulated notch lever).

For the output on an Arduino I have written the program (TCP to COM) for Windows, but the part on the Arduino is still missing. Unfortunately, I still have no time for this.
MacGe
 

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby BB22210 » Fri Aug 13, 2021 5:00 am

Hello,
Thanks for your quick reply.
If things are clear for OpenRails (ORTS) where 99% datas can be exchanged, something escapes me in the overall connection architecture between the PC / TS and the Arduino.
Do you have a schema / diagram which explains graphically what must be connected between the arduino, its ino and libs, the dll and TS, and what protocols are used ?

Then, in the second step, how will you get ALL the PWM data from TS and then send them to the Ammeters, voltmeters or manometers (servos or stepmotors) ?
Do we have to developpe our own C# or Python program to make datas transfer works ?

Rgds
BB22210
BB22210
 

Re: Getting Arduino/Teensy microcontrollers to talk to RailDriver.dll?

Unread postby MacGe » Mon Aug 16, 2021 12:44 pm

Hi,

I use the TCP server "TS-Bridge". This is connected to the RailDriver.dll and provides and changes its data.

For the input, I use an Arcaze, but an Arduino also works. This is configured as an HID device and connected to the PC as a joystick. This should allow 6 axes and 32 buttons for input. My program "TS-Fireman" converts joystick input to TCP messages which are sent to TS via TS-Bridge. For this, each loco is configured individually. The other possibility would be the "Raildriver and Joystick Interface", but I can't say anything about its configs, because I don't use it.

For the output, I wrote some small sketches (ino). I had also tried to run the Arduino as a TCP client, with little success. Therefore I wrote the program TCP2COM. But now the software part for the Arduino is still missing. All my achievements to output the data with the Arduino you can find here: My topic at the German Rail-Sim Board. So far I have only worked out the control of LEDs and a moving coil instrument (Ammeter as speedometer via PWM).

I use the scripting language AutoIt to write my Windows programs. Programming is a hobby, not my profession. I'm a craftsman.
MacGe
 


Return to Geek Speak

Who is online

Users browsing this forum: No registered users and 2 guests