Mindstorms for Train Simulators is a system of devices that utilzies Lego Mindstorms EV3 bricks to control cab systems for Train Simulator Classic, Train Simulator World, and OpenBVE.
Lego Mindstorms was discontinued in 2022, meaning that, although there are still a lot of systems still running, this system can be ported to newer Spike PRIME kits, if anyone is interested in joining.
There is also a possibility of using Raspberry Pi HATS that utilizes the newer LPF2 ports, doing away with the technic hubs.
Unfortunately, I do not have the money in buying the Spike PRIME kit.
⚠️ WiFi Issue: Unfortunately, the connection between the EV3 brick and the computer may result in the temporary loss of WiFi. There's not much I can do here. Luckily, you are driving an offline train that doesn't need WiFi. But this means that you can't play the game while watching a Youtube video. Not like you should do that anyways.
This project requires:
- Lego Mindstorms EV3 Brick, with three motors, a color sensor, a touch sensor, an infared sensor, and a infared beacon.
- Raspberry Pi
- Computer running the Train Simulator
This is the hardest part of the setup process! (You will also have to assemble your lego machine before this).
- Although the EV3 brick doesn't take much processing power, it is power hungry. It is recommended that you use the EV3 brick with a Battery Pack, rechargable AA batteries, or Battery Eliminator Kit rated for 6 AA batteries with no more than 9 volts and 2 amps, but no less than 7 volts, rated for inside use only. You might burn through a significant number of traditional AA batteries otherwise.
- The EV3 brick utilizes Micropython. Please follow installation instructions here needed to install the operating system, as well as installing VSCode and the necessary Micropython extension to connect to the EV3 brick. Transfer the files from the EV3CabControl Repository into the EV3 Brick.
- It is not neccessary to have VSCode to run the software, only to install and add new rolling stock configurations! When not updating or installing, navigate to
main.pyin the EV3 brick and run the script. - The system requires a plethora of motors and sensors. Three motors should be connected to port A, B, and C. Motor A will be the throttle, or throttle/brake. Motor B will be Automatic Brake. Motor C will be Independent Brake. However, the roles of these motors will shift depending on the type of rolling stock, especially in trains that do not have such a braking system. The color sensor will need to be connected to port 2, touch sensor to port 3, and infared sensor to port 4. Because this is legos, you have the full freedom to choose where to put your devices, as long as they are connected to the correct port!
- The color sensor will need to read three colors (black, yellow, and white) and in that order. Please implement this as a sliding lever along the color sensor.
- This is modular, and new train configurations can be added within the programs folder, allowing you to customize which locomotives to save.
- If the motors does not match the values in the simulator, run "Callibration". It should be saved for future runs.
- Connect to Computer: Use the USB connecting cable to connect the EV3 brick to your computer. Ensure that your EV3 brick is in tethering mode by going to
Wireless and Networks > Tetheringand checking theGadgetoption.- This is successful once an IP address is displayed on the top left of your EV3 brick.
- You will need your computer's IP address (
192.168.X.XXX) and to replace that in the/assets/specs.jsonfile under theHOSTkey. You can obtain this by going toNetwork & Internet > [Your EV3 Ethernet]and looking forIPv4 Address: 192.168.X.XXX.
- Install vJoystick.
- Download the VirtualHID program. It may give you a warning pop-up, but ignore it run the program anyways. It also prompt for connection permissions (this is necessary in order to listen to the EV3 brick), and it will launch a terminal to show you what the EV3 brick is sending, if at all. Feel free to ignore it!
- CobraOne released two programs for Train Simulator Classic and Train Simulator World. Install the one(s) that you need. The setup procedure will be the same for both versions.
- Download the
.xmlfile here. Then, open up the TSW or TSC interface and import it by pressing the yellow folder and selecting the.xmlfile. In the end, it should look like this:
Check out the projects located here for upcoming features and rolling stock support. Rolling stock configurations can be found here so that you can get used to each cab.