This video is made to represent how I reworked an Ev3 metro dashboard (similar to Ezh3 in Russia) so that it can be connected to a PC for using it with simulators (in this video, for LOTUS, but it's similar in OMSI, Metrostoi, Train Simulator, Maszcyna... anything that is capable of exporting its values, like lights, meters...etc). WIthout such a feature, a dashboard can still be used as a game controller, for I don't know, openBVE or even Doom if you like to.
** DISCLAIMER **
I can't and don't even want to give advices where you can get parts like these. FB Marketplace, ad sites like OLX, flagma (in Russia/Ukraine). Here in Hungary, public transport companies sometimes (well, rarely) sell parts. For bus parts, you can look up bus scrapyards, private persons who disassamble their buses...etc. Also there are some train parts on ebay.
** Used parts **
Microcontroller: Arduino Due
Optocoupler: 4N25 (...you can use EL817 or anything similar)
BCD converter: CD4511B
2x7 LED display: DC08-11GWA
Step-down: DSN-1504-3A
MOS-FET: BS170 (n-channel)
Stepper-motor: x27-168
I bought an original Arduino from an auction site (vatera), but you can get same-functioning parts from china on ebay, aliexpress. I bought the step-down and other components in Hungarian electric retailers, but you can find alternatives on ebay...etc.
** Programme codes **
Sorry, I won't publish any of my code, bad programmer habit.
But the main goal is to read all switches/buttons in the main loop of the Arduino, and after that (with if-else-s) I send joystick button events (on/off commands). For the controllers I send joystick axis data, which will be decoded by LOTUS for distinct positions.
To make use of gauges, meters, warning lights...etc you need a plugin ingame. Of course it depends on the simulator, but in LOTUS you can scavange the data so you can later send it out in serial por, like this format (yes, the KOMSI format, with some modifications):
A0B0C0D0E0u000v000w000x000t000
...where A-E are the lights, the numbers after them (0/1) represent the lights (on/off). The other vars between u-t are the other gauges, where each number after them represent their values. Here, in every send I send this whole string to the Arduino, which then decodes it by selecting by the characters (whether they are a char or number).
The mentioned Arduino library for the X27-168 stepper motors:
guy.carpenter....
** What I forget to include in the video: amper meter **
I forgot to add the amper-meter implementation in the video, sry.
Here, the meter reads values in both directions in a way that its pins are switched-up (also it reads pretty low voltage, 75mV/full offset). I switch the legs with a common bridge-connection, similar what is used in electric motors to change rotation direction or in full-bridge DC to AC inverters.
I have 4 FETs, I drive 2-2 every time, so the meter is connectiond into one or another direction. The value is fed from the Arduino, through a series resistor (because the Due has a 3,3V (!) PWM output, which would simply burn the coils of the meter if I connected it to it directly).
Since here's no gain nor any suspicious black magic, the meter is driven directly from the Arduino. I don't even need optocouplers. You can also connect the battery and line voltage meter like so, if they work between 0-3,3V. If not, you need optocouplers and some kind of amplification circuit.
Bzmot332, 2022.
29 авг 2024