Main > Driving & Racing Cabinets

Adding Race Leader lights - advice needed

<< < (12/14) > >>

jorgenjl2:
For those interested, on Discord there has been updates to latest output blaster fork to get Outrun2 race leader lights working which I confirmed does work (after upgrading to latest Teknoparrot version and enabling output checkbox in TP after copying output blaster needed dll to the lower level game folder). They are also working on FnF Supercars (they have the memory region now) and possibly Mario Kart. Crusn Blast has a code snippet about race leader so not sure if that already works or will need to be created. So some great progress is being made!

jorgenjl2:
I have been meaning to write a step by step of how to do this without soldering. This is not the best description but at least it can help someone. I still need to get on one of my cabs and copy up the full Arduino code. The previous Arduino code was for lighting up a single led but for my steps below, it lights up a full ws2812b strip when in first place.


No soldering needed at all. Code is mostly ready to go except you may need to change the number of leds or what led to start the lights at (since some of the leds are outside of the marquee and I don’t want them to light up). Using an arduino with pre soldered connectors, wires that connect directly to the arduino, and using a barrel connector that has screw terminals also helps make this solderless.


1) Unwind the whole ws2812b led strip (since we want the end of the strip wound up the most on the inside)
If you look at the strip, in between each led has an arrow pointing a single direction. This arrow should point up away from the bottom of the cable. In other words, the arrows will end up pointing from the Arduino toward the marquee end (data flows from Arduino toward the end of the led strip or from “RA in RAce leadER to the “ER” at the end of the leader word)
2) Insert a (male) wire into the bottom of the cable into the black piece so one wire goes into the hole where the white cable is and insert another (male) wire where the green cable is and then add on a female to female adapter at the end of both of those (so it can then plug into the Arduino).
3) Put the cable you added that continues the white cable and plug this into the gnd on the Arduino 
4) Put the cable you added that continues the green cable and plug this into D3 on the Arduino
5) Strip the ends of the white and red wires that dangle out of the end of the led strip
6) Put the white striped wire into the negative side of the barrel connector and insert the red wire into the positive side of the barrel connector (screw terminals)
7) Count out 40 leds (or a different number if desired) from the led strip cutting half way beteeen the copper pads after the 40th.
8) Connect a mini usb cable to the Arduino and plug this into your pc
9) Plug in the electrical outlet (connected to the barrel cable that has the red and white wires in it).
10) Download Arduino Ide, start it up, on top menu go to tools >  board > change to Arduino nano
11) Go to tools > port > change com port to your com port for the usb you just plugged in. (If unsure, unplug the usb and see which com number goes away in the menu and which one comes back after plugging back in). Note If you get an error about port conflict when uploading or later on in future steps, right click mamehooker (assuming you already installed it before step below) in your bottom right tray icon and close. Mamehooker takes over your com port.
12) Paste in the code below (code to be uploaded soon hopefully)
13) Click the checkbox near top left to compile and then click the right arrow icon to the right of that to load the program (sketch) onto the Arduino
14) In the ide, Go to tools > serial monitor > type in “3,1,x” without the quotes and hit enter. And then type in 3,1,x again and hit enter key . It should light up. If it does not, review the steps and verify you are on the correct com port in the Arduino ide and the Arduino sketch was uploaded to the Arduino. Also try turning the barrel connector slightly (one time I had to twist it slightly for some reason)

15) Download mamehooker by going to here (http://dragonking.arcadecontrols.com/static.php?page=aboutmamehooker) and hit control-f and find “mamehooker” and there is a download link on the right side of the web page
16) Install it (i installed to c:\mamehooker\*) and then right click mamehooker.exe and choose run as admin (MUST DO THIS FIRST ONCE! Ignore errors if any!)
AFTER YOU HAVE RUN AS ADMIN ONCE, go to bottom right system tray in windows and right click and close mamehooker and ignore any errors if any (first time run as admin is necessary for permissions).
17) Now open up mamehooker.exe again from bottom right Windows system tray WITHOUT running as admin option (from now on no admin needed as long as ran once)
Click options and allow auto find of parameters.
18) Go to your Mame folder that you have Mame.exe installed in and find the Mame.ini file (IF YOU HAVE <game>.ini files named as the game, you have to do change those ini files. as well) and update the ini so the line that says “output” is set to “windows”.
19) Open up Mame and open up a game that has outputs like sfrush and let mamehooker find the outputs. It should auto create a sfrush ini file
Change the mamehooker sfrush.ini to look like below (need to upload this as example as well but earlier posts may have it). I will also attach other mamehooker ini settings that I have.
20) Change the number 4 (4?) in these mamehooker ini files to the com port your Arduino took.
If desired, change the 3,1,x to start with another number (2,1,x for green. 4,1,x for blue, etc)
21) If desired, Download the non-commercial license Arcade1Up marquee 3D print and edit in 3D print software (I use Cura) to be 35% on the height and width (I kept length the same) and 3D print it.
22) Purchase a see through RACE LEADER marquee print from ArcadeGraphix if desired
23) Purchase the black see through plexi glass from Tap Plastics here (https://www.tapplastics.com/product/plastics/cut_to_size_plastic/black_led_sheet/668?gad_source=1&gclid=Cj0KCQiAgK2qBhCHARIsAGACuzmFTLacS1j_ct4d6jj8vSLcML676miM_Vqhu0mv0N58fzFFmexLrvcaAlp4EALw_wcB ) if desired for blacked out look when not on. Size info for my particular size marquee was “Chemcast Black LED Acrylic - Black 1/8 (.118)" Thick, 1-1/2 inches Wide, 17-9/16 inches Long, Color: Black
24) Get in 1st place and Enjoy!!

If you want to add custom race leader lights to games that don’t support it out of the box, see posts above.

jorgenjl2:
Here is the race leader arduno code for anyone interested in lighting up a whole led strip instead of individual led's. Replace NUM_LEDS with however many you have on your strip (40 in my example) and this assumes pin 3 for data. I will be creating two more race leader lights so hopefully I can take pics of the process.



--- Code: ---#include <FastLED.h>

// Configuration
#define NUM_LEDS 40          // Set the number of LEDs in the strip
#define DATA_PIN 3           // Set the data pin connected to the LED strip
#define COLOR_ORDER GRB      // Set the color order of the strip
#define LED_TYPE WS2812B     // Set the LED strip type
#define BRIGHTNESS 150       // Set the brightness level (0-255)
#define FRAMES_PER_SECOND  120
unsigned long lastGlitterUpdate = 0;
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
CRGB leds[NUM_LEDS];

enum State {
  STATE_OFF,
  STATE_GREEN,
  STATE_BLUE,
  STATE_RED,
  STATE_RAINBOW,
  STATE_JUGGLE_GREEN,
  STATE_GREENWITHGLITTER
};

State currentState = STATE_OFF;
typedef void (*UpdateFunction)();
UpdateFunction updateFunc = nullptr;

void setup() {
  delay(3000); // 3 second delay for recovery
  FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  FastLED.setBrightness(BRIGHTNESS);
  Serial.begin(9600);
  Serial.setTimeout(100); //Setting this prevents the juggleGreen pattern from waiting 2 seconds to start dancing the lights
}

void juggleGreen() {
  // eight colored dots, weaving in and out of sync with each other
  fadeToBlackBy(leds, NUM_LEDS, 20);
  uint8_t dothue = 0;
  for (int i = 0; i < 8; i++) {
    leds[beatsin16(i + 7, 0, NUM_LEDS - 1)] |= CRGB(0, 255, 0);
    dothue += 32;
  }
  FastLED.show();
  FastLED.delay(30);
}

void updateGreen() {
  fill_solid(leds, NUM_LEDS, CRGB::Green);
  FastLED.show();
}

void updateBlue() {
  fill_solid(leds, NUM_LEDS, CRGB::Blue);
  FastLED.show();
}

void updateRed() {
  fill_solid(leds, NUM_LEDS, CRGB::Red);
  FastLED.show();
}

void updateRainbow() {
  fill_rainbow(leds, NUM_LEDS, gHue, 7);
  FastLED.show();
}

void addGlitter( fract8 chanceOfGlitter)
{
  if( random8() < chanceOfGlitter) {
    leds[ random16(NUM_LEDS) ] += CRGB(255, 255, 255); // Full intensity white
  }
}

void greenWithGlitter()
{
  // built-in FastLED green, plus some random sparkly glitter
  fill_solid(leds, NUM_LEDS, CRGB::Green);
  unsigned long currentTime = millis();
  if (currentTime - lastGlitterUpdate >= 50) { // 50 milliseconds interval between glitter updates
    addGlitter(80);
    lastGlitterUpdate = currentTime;
  }
  FastLED.show();
}





void setUpdateFunction() {
  switch (currentState) {
    case STATE_OFF:
      updateFunc = nullptr;
      break;
    case STATE_GREEN:
      updateFunc = updateGreen;
      break;
    case STATE_BLUE:
      updateFunc = updateBlue;
      break;
    case STATE_RED:
      updateFunc = updateRed;
      break;
    case STATE_RAINBOW:
      updateFunc = updateRainbow;
      break;
    case STATE_JUGGLE_GREEN:
      updateFunc = juggleGreen;
      break;
    case STATE_GREENWITHGLITTER:
      updateFunc = greenWithGlitter;
      break;
  }
}

void loop() {
  if (Serial.available() > 0) {
    String input = Serial.readStringUntil('x');
    int pin = input.substring(0, 1).toInt();
    int value = input.substring(1, 2).toInt();

    switch (pin) {
      case 6:
        currentState = value == HIGH ? STATE_GREEN : STATE_OFF;
        break;
      case 5:
        currentState = value == HIGH ? STATE_BLUE : STATE_OFF;
        break;
      case 4:
        currentState = value == HIGH ? STATE_RED : STATE_OFF;
        break;
      case 3:
        currentState = value == HIGH ? STATE_RAINBOW : STATE_OFF;
        break;
      case 2:
        currentState = value == HIGH ? STATE_JUGGLE_GREEN : STATE_OFF;
        break;
       case 1:
        currentState = value == HIGH ? STATE_GREENWITHGLITTER : STATE_OFF;
        break;
    }

    setUpdateFunction();
  }

  if (updateFunc != nullptr) {
    updateFunc();
  } else {
    FastLED.clear();
    FastLED.show();
  }

  gHue++; // Increment the hue value for some animations
}

--- End code ---

buttersoft:
jorgenjl2, any chance you still have those scripts for M2emu from above? I think i've overwritten mine now with sailorsat's newer ones, but the outputs no longer change state. And the github baritono linked is 404'd :(

I'm back at the state of seeing the outputs, but nothing is changing state...


--- Quote from: baritonomarchetto on April 17, 2023, 01:13:15 am ---I think you guys should copy these lua scripts in M2 "scripts" folder
https://github.com/njz3/vJoyIOFeederWithFFB/tree/master/gameassets/nebula_m2_1.1/scripts

--- End quote ---

jorgenjl2:
Yeah I should have those lua scripts. My racing cabinets don’t have internet so I will have to hook up a usb thumb drive and get it to you. So all you think you need is the scripts within the lua folder for m2emulator? I am assuming the outoutblaster files are all still out there so you should be good with those.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version