Cockpit for rFactor with Arduino

Hello girls & guys. It is my very first time here, and my very first ever electronic project, so greetings to all.

I’d like to show to all who enjoys racing sims (and the rest :D) how to build a home made cockpit data board for a racing simulator for PC. In this case i talk about rFactor which is a good simulator (The project could be usefull with other racing sims too. The sim might only have a plugin sending the same data in the same order to Arduino).

The project is now WIP. What it is done at the moment? Just Arduino controlling seven 7segments displays (3 for Speed + 1 for Gear + 3 for Fuel).

The system consists in one plugin for rFactor collecting info and sending each data as a byte (char). Each byte will be showed only in one display all the time, this one display is only for showing the hundred of the speed number (vg. 3 in 301 Km/h). Acorging to this, because of we have 7 displays, the plugin will be always sending 7 bytes data once per frame (3-bytes for Speed + 1-byte for Gear + 3-bytes for Fuel).

To control this amount of 7 segments displays, we would need 7-bits to control each display (7-bits x 7-displays = 49 outputs in arduino). Due to this, we need to make all of them sharing the same data bus (7-bits) to turn on/off each segment of the display. Then we would need to turn on only one display at a time, exactly the one that needs to show the digit sent through the 7-bits data bus. That means we need also some bits to select which display is showing what digit, that is 3-bits of selection that make us able to create 8 turns, allthough we only need 7 turns (one for each display).

As i told you, the project is still WIP, and i have planned to add a row of leds to show the revs of the engine, and an LCD display with a button to cyclicaly swap a lot of data, such as race position, lap time, tyres and oil and water temps, etc, etc.

I’ll try to upload a video later on, if anyone is interested in the idea…

Thanks for reading.

unsigned int i = 0;    // Counter
unsigned int DB0 = 2;    // Controls G segment and DB0
unsigned int DB1 = 3;    // Controls F segment and DB1
unsigned int DB2 = 4;    // Controls A segment and DB2
unsigned int DB3 = 5;    // Controls B segment and DB3
unsigned int DB4 = 6;    // Controls E segment and DB4
unsigned int DB5 = 7;    // Controls D segment and DB5
unsigned int DB6 = 8;    // Controls C segment and DB6
unsigned int DB7 = 9;    // Controls DB7
unsigned int E = 10;   // Controls LCD's enable (S4 selection bit)
unsigned int A = 11;   // Controls S0 selection bit
unsigned int B = 12;   // Controls S1 selection bit
unsigned int C = 13;   // Controls S2 selection bit
unsigned digit = 0;
int display = 5;
int n_displays = 7;
char digitRecord[] = {'8','8','8','N','F','8','8'};      // Init

void setup()
{
  beginSerial(9600);
  for(i=2; i<=13; i++)
    pinMode(i, OUTPUT); 
}

void loop()
{
      // If still remaining bytes on the serial port... 
  if(serialAvailable() > 0)
  {
        // Reading the next available byte of the serial
    digitRecord[display] = serialRead();

        // Increment the display selector for the next reading
    display = (display +1) % n_displays;
  }
  
      // If theres no bytes available at the serial port, displays still showing their own digit.
  for(i=0; i<n_displays; i++)
  {
    if(i==4 && digitRecord[i]==' ')
      put7sgmnt(i,'F');
    else
      put7sgmnt(i, digitRecord[i]);
    if(i < n_displays - 1)
      delayMicroseconds(20);
  }

}

How topical, I just finnished a very similar project. My wife is a deaf ed teacher and needed a deaf baby monitor. so I used this idea (ardiuno feeding a transistor feeding a relay) along with a microphone input. Thanks!

Hi eighth,

I'm very interrested in your project. I recently bought a freduino with the same thoughts in mind. I still need to learn a lot (everything ::)) about programming, but seeing someone whit the same interrest gives me hope :).

Any updates on this project?

Anyone know the diagram for how to setup the 7 segment display for this code?