Sunday, 22 September 2013

Euro Truck Simulator 2 - Prototype Real Dashboard


The game Euro Truck Simulator 2 (ETS2) has a telemetry API to allow plugins access to the data about the in-game vehicle. I've created a plugin to send the data down a serial port to an Arduino microprocessor, which then controls the servos, LEDs and an LCD screen.

 This initial prototype is made from cardboard, with the components just pushed through from the back.

This is the back of the dashboard, showing the Arduino board (blue) connected to the other components.

Video of it working is here:

Update:
You can download a copy of the plugin source and a pre-built plugin here:
http://downloads.silasparker.co.uk/dashboard_plugin_2.zip
http://downloads.silasparker.co.uk/ets2_dashboard_v3.zip (New version of code)
The code is now up on Github here: https://github.com/skyhisi/ets2_dashboard

Photo of final device made from MDF, the paint finish is terrible in bright light !
Update:
Video of how it works it here:

Update:
Fixed plugin built in wrong mode. Note, you may also need to install the Visual Studio 2010 Re-distributable package from here: http://www.microsoft.com/en-gb/download/details.aspx?id=26999
 

39 comments:

  1. hello i like your dash can you send me the plugin??

    ReplyDelete
    Replies
    1. Hi, I've updated the post to include a link to the source and a pre-built plugin for Windows.

      Delete
  2. Hello I love the dash but I need the pinout of display, servos,leds... Thx.

    ReplyDelete
    Replies
    1. Hi, you can see the pins used at the top of the arduino_controller.ino file in the source download zip. It doesn't matter too much what pins you use, it's sometimes easier to just wire it up and then change the software to match.

      Delete
    2. Thank you very much for your answer

      Delete
  3. can you crate a readme file or something explaining how to get your patch installed? as tried a couple of other videos, they show the system working with the Audrino, but when I tried with my Audrino then it doesn't seem to work with the servo's.

    ReplyDelete
    Replies
    1. Hi, to install the software on the Arduino, use the normal Arduino IDE to flash the board. For the plugin you should be able to just put the pre-built DLL into the plugins folder.

      To test the connection, wire up an LED (with resistor) to the indicator pins and use the indicators in the game. If the indicators work but not the servos, then the servos aren't compatible with the standard Arduino library. If the indicators don't work, then check the game log file (%USERPROFILE%\My Documents\Euro Truck Simulator 2\game.log.txt) for error messages, the Arduino must be on COM port 3.

      Delete
  4. you could show video where are placed the files from your download. His dash is very cool

    ReplyDelete
    Replies
    1. The DLL needs to go in the plugins folder (this is normally C:\Program Files (x86)\Steam\steamapps\common\Euro Truck Simulator 2\bin\win_x86\plugins).

      The ino file needs flashing to the Arduino.

      The other files are the source code for the DLL in case you want to add more features.

      Delete
  5. Silas Parker,I made myself this prototype using stepper motors. If you want to get more information (eg light, temperature, fuel level, etc. etc.) What should I do? Thank you for your work.

    ReplyDelete
    Replies
    1. Hi Antonio, I've uploaded a new version of the code that I hadn't yet made public. It's the v3 file linked to in the post. This new version provides much more information through to the Arduino board.

      You will need modify the arduino_controller.ino file to use more servos or LEDs, there is a new function in the code (read_serial_byte_set_servo) to make it easy to control more servos, see line 148 for an example.

      You may also need change and rebuild the plugin, which can be done by editing and running the build.bat file from the Visual Studio 2010 command line.

      Hope this helps.

      Delete
  6. thanks again, now I'm changing my project with the version of the three. Later, if you want to send the video of my project.

    ReplyDelete
  7. Dear Silas Parker v3 plug-in I can not get it to work. The computer does not send telemetry to Arduino. I also tried to build the plugin as your advice but nothing. Thank you.

    ReplyDelete
    Replies
    1. Have you also installed the options file ? I've posted the code on Github now with some instructions and a troubleshooting guide here: https://github.com/skyhisi/ets2_dashboard

      Delete
  8. Dear Silas Parker, i had not actually copied the files in the folder, now it works perfectly. Thank you again.

    ReplyDelete
  9. First of all, thanks for your work!

    English is not my main language.

    I have 2 questions.

    I have a real bus's dashboard and i've tested the speedmeter and rpm meter.

    Rpm meter works fine, but speedmeter that i have, the maximum speed is 165km/h.

    So the range of speed is different and it did not match up.

    I tried modify your arduino script, but i have no idea.

    Can you tell me the modifying point of script?

    the second question , I wanna make every gauges (like a voltage, temp, air pressure and etc) move.

    Can you make another version that all data moves with servo?

    Thanks again

    ReplyDelete
    Replies
    1. In version 3 of the code, most of the dashboard dials and lights are sent to the arduino, including battery voltage, air pressure, temperature.
      Version 3 of the plugin also has an options file "dash_plugin.txt" that allows you to easily scale the values sent to the board to adjust the servo range.

      Delete
    2. thanks to your reply

      i've studied your script and made my dashboard!

      http://www.youtube.com/watch?v=94zAlCzbNE8

      thanks again!

      Delete
    3. Nice video, your dashboard looks great :)

      Delete
  10. Hello!

    I would like to ask you, what type of servo can I use for dashboard?

    Thanks

    ReplyDelete
    Replies
    1. You can use any standard model servo (http://en.wikipedia.org/wiki/Servo_%28radio_control%29) that can be controlled by the Arduino Servo library. I used micro servos like the one here: http://www.hobbytronics.co.uk/hd1800a-micro-servo

      Delete
  11. Hi
    How connect LCD to arduino? How do I hook up the LCD pins for Arduino (12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2)
    for example LCD pin D4 connect to pin 12 in arduino

    Thanks

    ReplyDelete
    Replies
    1. This is using the standard LiquidCrystal library, just connect it up as described here: http://arduino.cc/en/Reference/LiquidCrystalConstructor

      You can use any of the variations if you want to connect up fewer pins.

      Delete
    2. Is there any advantages or disadvantages in using less pins?

      Delete
    3. If you only use 4 data pins (rather than 8) it will take twice as long to write to the LCD screen. This probably won't be a problem, as the refresh rate in the plugin is only 20 FPS, but if you notice any screen errors or slow response you might need to use 8 data pins.

      Delete
    4. I have got two servo motors but when i plug them on my arduino they start spinning around. Maybe you could point me to what may be wrong?

      Delete
    5. They are probably continuous rotation servos, you will need to use 'standard' or positioning servos.

      Delete
  12. Excellent plugins, how fabulous it is
    Thanks for it :D

    ReplyDelete
  13. Do I need any special module to communicate with the game? My arduino board is Arduino Duemilanove w/ ATmega168, and how to find where is COM3 of my computer?

    ReplyDelete
    Replies
    1. You need to install the DLL for the game into the plugins folder and load the software on the Arduino. The COM port is the one that you select within the Arduino IDE for programming. If the COM port is different on your computer, you can change it in the dash_plugin.txt options file.

      Delete
    2. Thanks! Finally it works, thank you so much!!!

      Delete
  14. I have a couple of questions about this.

    1) How did you make it talk with the game and is it possible to use with other games?
    2) How much power did it use?
    3) Can you use multiple LEDs for different things? (Like low fuel warning, air pressure etc)
    4) Is the LCD necessary?

    This seems like an amazing project which I'm going to end up making after I make my H shifter.

    ReplyDelete
    Replies
    1. This uses a plugin for ETS, so it might be able to work with other games but you would need to create a plugin or mod for the game.
      I don't think it used much power, it was running off the USB port which is limited to 500mw, the servos probably use the most power, but they aren't loaded so the current draw won't be too high.
      You could add more LEDs, the plugin and Arduino program have been extended to support the warning lights.
      The LCD isn't necessary, but I wanted something to give a precise readout so I could drive exactly on the limit and not trigger the speed cameras :)

      Delete
  15. My servos sweep backwards from right to left instead of left to right. Any idea how to get them to go the other way? Im speaking about the speedometer and tachometer. Thanks

    ReplyDelete
    Replies
    1. In the read_serial_byte_set_servo calls, change SERVO_DIR_INVERT to SERVO_DIR_NORMAL

      Delete
  16. tank you for this plug-in ^^
    i have a question
    how can i increase the refresh rate ? for exemple 50 FPS instead of 20 actually?

    ReplyDelete
    Replies
    1. You could increase the refresh rate by editing the plugin, but it isn't a great idea as it will slow the game down as the serial transfer will take too long. To support higher rates the plugin needs rewriting with a separate thread for the serial communication.

      Delete