DIY iRacing lights

Create your own ambilight system for iRacing

Following a suggestion made by the fellow iRacer Chad Smith, I decided to build some sort of "Ambilight" system, which power some LED's behind my monitor when the vehicle is under track lights (for night racing). Since the iRacing API doesn't output such "car under lights" variable, I had to come up with another strategy. The SDK does have a variable with the percentage of the lap that is completed, so I decided to manually create a file which has the light intensity information for every 0.1% of the track, totalizing 1000 lighting information for an entire lap.

I coded a software that would make this task easier. You simply start running around the track and use the numpad keys from 0 to 9 to set the light intensity (0 meaning the LEDs are off and 9 that they are with total brightness) at the current vehicle position. It will automatically interpolate between those values, so you have a nice fade. After capturing that data from an entire lap, you simply save the file, which is a raw text file with 1000 lines, each one with the brightness level at a particular track position.

iRacing Lights - C# client software

To use the information you captured, simply click the "Load lights file..." button and point to the IRL file which has the lighting information for a particular track. If you have the sim opened, it will automatically detect your current car position (based on the LapDistPct variable) and power up the leds at the right intensity, based on the information stored inside the lights file. You can see the result below. The video actually didn't captured the correct intensity of the LEDs at the background. It's a lot brighter than it seems.

Again I used my good and old arduino for the entire project. The C# application I coded send brightness information to the Arduino through the serial port (USB actually) and the Arduino is responsible for getting that information and powering up the LEDs using PWM. You might need to change the Arduino serial port in the C# code, as it might differ from one computer to another. The firmware is basically the same I used in my iRacing Wind project. Simply upload the code below to your board and you should be ready to go.

const int outpin = 9;

void setup() {
  Serial.begin(9600);
  pinMode(outpin, OUTPUT);
}

void loop() {
  if (Serial.available()) {
    int inByte = Serial.read();
    analogWrite(outpin, inByte);
  }
}

Here is the schematic on a protoboard. 4 LEDs (there are different colors in this schematic so you can see that are actually 4 LEDs, but in the real thing, I used 4 white ones), 2 resistors (15 and 2.2 kohms) and 1 2N2222 transistor. Cheap and easy to build. If you want more LEDs, just add them in parallel with the current ones and change the 15 ohm resistor to a lower value. You can use this link to calculate the resistor value (http://www.hebeiltd.com.cn/?p=zz.led.resistor.calculator).

iRacing Lights - Schematic

Below is the download link for the client software (includes source code and executable). Code was written in Visual C# 2010, so you’ll need .NET Framework for it to work properly. I'm also providing a link to the Sebring light file I did, so you don't have to waste time creating your own again

The contents of this project are distributed as “donationware”. If you find them useful, please consider doing a small donation.

DOWNLOAD: http://fergonez.net/files/iRacingLights.rar

DOWNLOAD: http://fergonez.net/files/sebring.irl