SimDash - getting started

SimDash - getting started

Project description:

In this project, we will connect a hardware dashboard to the driver simulator OpenDS 3.0. The interface between the simulator and the speedometer will be realized by an Arduino uno board. (To convert the data from the simulator, we will implement a Java API to send the data to the Arduino board) (optional). This board will send the data to the speedometer and additionally send them to the Android app. The interface between the Arduino and the speedometer will be a CAN-Bus. The app will retrieve the data via Bluetooth and analyze the data to display statistics over the last driving session.


1. Configure OpenDS3.0


Download OpenDS3.0 from the official website. To download the driving simulator you need an account and you must be logged in.




The driving simulator OpenDS3.0 requires the Java Runtime Enviroment Version 1.7. You can display the current installed JRE in your terminal. Just type: java -version.

The following output should display in the terminal.


Is there a versions mismatch or the command doesn’t work, you need to install the newest Java JRE.

First steps with OpenDS 3.0:

Initial you need to extract the downloaded file „“. Open a terminal and switch to the extracted folder.

Just type: java -jar OpenDS.jar


The driving simulator should now start correctly.

2. Importing the sources in eclipse

To do this step it’s recommend to use the newest version of eclipse. To import the sources just press on „File/Import.../General/Existing Projects into Workspace“. The path of the root directory is the path to the extracted files. Click on „Finish“ and the importing should start.


3. The simulator out of eclipse

To run the driving simulator out of eclipse, you need to collapse the packet „eu.opends.main“. Then click on the file („“) and choose „RunAs“ an application.




Continue reading
Rate this blog entry:
3467 Hits 0 Comments

Working with OpenDS3.0


In this project, we will connect a hardware dashboard (VW Polo R8 speedometer) to the driver simulator OpenDS 3.0. This will increase the “real driving” felling and the immersion for the driving person. The interface between the simulator and the speedometer will be realized by an Arduino uno board. Therefore, we use the serial conversion module of the Arduino to connect the Arduino via USB to the host (desktop computer). This data will also be send to the HC-05 Bluetooth module. This module will be connected via software serial interface implemented in JAVA. The simulator provides the data via TCP (client). We will implement the TCP server enabling the client to connect and to send the data. The Arduino uno board will send the data to the speedometer. The interface between the Arduino uno and the speedometer will be a CAN-Bus.

The app will retrieve the data via Bluetooth and analyze the data to display statistics over the last driving session. Additionally, we will display the life data, so the driving session can be monitored in progress. The displayed data will be the velocity, the rounds per minute of the engine, the turn signal status and the status of the high beams (on/off). The analyzed data will be the maximum speed, the average speed and the average rounds per minute to ensure a good driving habit. Otherwise, the driver could severely damage an engine in real life.

1. Retrieve data from OpenDS 3.0

OpenDS has an integrated CAN interface to retrieve the driving data. The interface is a simple TCP client connecting to the server to send the data. This feature requires some modifications in the source code of the simulator. Additionally, we need to implement a TCP server waiting for the data from the client.


Modifications OpenDS – Step 1 (DrivingTask):

The CAN interface must be activated for each “DrivingTask“. In this example we take Paris as simulation environment. The folder “assets/DrivingTasks/Projects/Paris/“ contains a “settings.xml“ file. This can be opened and edited in Eclipse.

The Node “CANInterface“ contains several parameters.

At first, the “enableConnection“ must be set to “true“. To test the connection, we set the loopback address The other parameters can be left as they are.


Modifications OpenDS – Step 2 (Source):

In the next step the “sendCarData()“ function in the file ““ needs to be activated. This method send the driving data periodically via TCP to the server. Additionally, the methods “timeDiff(…)“ and “forwardEvent(…)“ need to be reactivated (uncomment methods)

The field “framerate“ as well as “timeOfLasFire“ need to be uncommented in the declaration and the initialization within the constructor.

The “sendCarData“ will be adapted as shown:

publicsynchronizedvoid sendCarData()


  // break, if no connection established

  if(socket == null || errorOccurred)


  // generate time stamp

   Calendar currentTime = new GregorianCalendar();



     floatspeed = ((float) car.getCurrentSpeedKmhRounded()); // in kph

     floatheading = car.getHeadingDegree(); // 0..360 degree

     try {

          String positionString = "$SimCarState#" + speed + "#" + heading + "%";

          printWriter = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));



         } catch (IOException e) {

          System.err.println("CANClient_sendCarData(): " + e.toString());





After these modifications, the simulator can be tested. However, the program will crash, because it doesn’t have a server to connect to yet. Parts oft he error message are shown below.

DrivingTast with Paris/paris.xml.


2. TCP Server for OpenDS3.0

Simple TCP-Server for OpenDS3.0, listen on Port 4711

OpenDS TCP-Server Sample

Continue reading
Rate this blog entry:
2370 Hits 0 Comments

Working with OpenDS3.0 step 2

1. Parsing the data from TCP

To receive all important data from the driving simultor OpenDS, we adapt the sendCarData() method once more.

The speedometer needs the speed, the rpm of the engine, state of the turning singals and state of the light (high beam, low beam).


The data will be send as String via tcp. Therefore, we need to cast them back into float numbers as shown below.

The incoming String should look like this: "$SimCarState#0.0#750.0#Off#OFF%"







public static void parseMessage(String nachricht)


               if (nachricht.startsWith("$SimCarState")&&nachricht.endsWith("%")) {                             

                        nachricht= nachricht.replace("$SimCarState", "");

                         nachricht =nachricht.replace("%", "");


                         String [] splitNachricht = nachricht.split("#",5);

                         speed = Float.parseFloat(splitNachricht[1]);

                         rpm = Float.parseFloat(splitNachricht[2]);     

                         lightState = splitNachricht[3];

                        turnSignal = splitNachricht[4];


              } else {

               System.out.println("Something went horribly wrong!");





2. Communication Arduino Host (host computer)

The data will be send via the serial interface from the host computer to the Arduino because the communication via serial interface is already implemented by Arduino

2.1. Implementing the serial interface with java download the correct library to get the 64-bit library

SimLink: sudo ln -s /dev/ttyACM0 /dev/ttyUSB0

Use the RXTXcomm.jar from the installed Arduino IDE (/usr/share/arduino/lib).


java projekt serial

Example Poject in Eclipse


2.2. Arduino Example

// the setup routine runs once when you press reset:

void setup() {     Serial.begin(115200);     }

// the loop routine runs over and over again forever:

void loop() { Serial.print("Hallo");

delay(1000);               // wait for a second



2.3. Link to example Code

Example Code serial application

Continue reading
Rate this blog entry:
2193 Hits 0 Comments

Communication between the components

Communication between the components

In order to get the data from the dirving simulator OpenDS to the app, several steps are implemented in our project. At first the OpenDS application sends the data via TCP to the TCP server implemented in Java. This server takes the information for speed, rpm of the engine, state of the lights and state of the turning signals and concatenates all the data into one string. Additionally, a start and end byte are eded to determine the beginning and the end of a full package. This string is send via the serial interface to the Arduino uno board. The board then sends the data to the speedometer via the CAN shield. In Addition, the Arduino uno sends the data to the connected bluetooth interface. From there the data will be send via bluetooth to the android app. The app takes the streamed String and parses it into the original data from the OpenDS application. The following image shows the communication paths for the data in our project.




The frequency of the data being send via bluetooth can be configured in the TCP server as the Arduino uno only takes the stream and sends it to the bluetooth interface wihtout any further actions. It functions as a relay in this context. However, for sending the data to the speedometer, the Arduino needs to take the string apart. The app retreives the data and shows the live values. Additionally, it provides some statistics for the driving session such as maximum speed and average speed and some more. We will send the data via Bluetooth 4.0. We do not use the low energy mode as we will send the data in intervals of about 50 to 100 milliseconds or even faster. For these intervals a build-up and tear-down of the connection would be too much overhead in this situation. With these short intervals it will be an additional task to design the app as energy efficient as possible so the battery doesn't drain out after a short time. To accomplish this goal, the statistics get calculated at the end of a driving session. The end of such a session needs to be singaled manually, as the app cannot foresee the end of the session or the user's intentions. Therefore, we need a user interaction. 

Another challenge is to get the intervals for the speedometer right as it needs some signals in a specific interval. Since we don't know these intervals for sure, it's more of a try-and-error process. Those package intervals are specified by the manufacturer, in this case Volkswagen. We have no option to get the required data for those package intervals, so we need to guess them as good as we can.

Continue reading
Rate this blog entry:
3830 Hits 0 Comments

Bluetooth connected to Android

The App receives the data from the simulator via Bluetooth sent by the Arduino uno. In the code snippet below, it is explained how the App respectively the Bluetooth adapter pairs with the adapter in the smartphone. If the smartphone's Bluetooth adapter is disabled, the phone shows the option to turn on the adapter in order to pair it with the adapter sending the data from the driving simulator(method turnOnBluetooth(...)). The findHC05Device(...) is used to really pair the two adapters in order to get the communication running. To inform the User about the actions, there are Toasts showing several messages in both error cases and successful cases.

 public void turnOnBluetooth(View v) {
        if (!BA.isEnabled()) {
            Intent turnOn = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
            startActivityForResult(turnOn, 0);
            Toast.makeText(getApplicationContext(), "Aktiviere Bluetooth", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(getApplicationContext(), "Bluetooth bereits aktiviert", Toast.LENGTH_SHORT).show();
        if (BA.isEnabled()) {

    public void findHC05Device(View v) {
        pairedDevices = BA.getBondedDevices();
        if (!pairedDevices.isEmpty()) {
            for (BluetoothDevice bt : pairedDevices) {
                if (bt.getAddress().equalsIgnoreCase("98:D3:31:F5:12:1E")) {
                    myDevice = bt;
                    Toast.makeText(getApplicationContext(), "HC-05 verbunden", Toast.LENGTH_SHORT).show();
                    try {
                    } catch (IOException e) {
                        Toast.makeText(getApplicationContext(), "Arduino nicht gefunden", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(getApplicationContext(), "HC-05 nicht verbunden", Toast.LENGTH_SHORT).show();

The following screenshot shows an example of a message within the app.

app message

The Screenshot shows a dialog where the user can either accept or decline the activation of the Bluetooth adapter. As the adapter is necessary for the app to work properly, it is highly recommended to accept the activation of the Bluetooth adapter. The toast on the lower end of the image shows that the Bluetooth adapter will be activated as the user pressed accept on the dialog. (The Dialog will dispose after pressing accept or decline, it is visible here for demonstration)

Continue reading
Rate this blog entry:
3521 Hits 0 Comments

The App

The App

The SimDashApp receives all necessary data via the Bluetooth adapter (Blog post 5). The App has two "modes": The live mode and the statistics mode. The live mode displayes the live data recieved from the driving simulator. The live mode shows the speed, the rpm of the engine, light status and turning signal status. So while the driving session is in progress you can monitor the session in the app in live mode.

The statistics mode saves the data for speed and rpm in a local storage. After a driving session you can press the button to trigger the statistic generation. The statistic shows max. speed & rpm, average speed & rpm and a graph where all data points are visible so you can see the values of the whole session.

The statistics data are available as long as the app is not closed and deleted from the RAM, since the data are only held temporary within the app.


The Screenshot shows the example screens from the live mode (left side) and the statistics mode (right side).


(The data in the statistics view are test data)


Continue reading
Rate this blog entry:
3574 Hits 0 Comments