Help with Race car/ Derby Racing Game with Addressable LEDs

This is the game I want to recreate. The game is played as follows: There is a 4 ft tall by 7 ft wide wall board that is black vinyl covered except for 16 rows of cutout horses/cars (think Cricut) that extend across the board with 28 segments (car cutouts). One segment is the start, one is the finish and the 25 in the middle are for the race.
horse-race-trailer-4-600x448
horse-race-trailer-6-600x448
I believe I can do this with Nanos for each horse, a set of addressable RGB LEDs, break beams (for the pinball side).
Here's my questions:

  • Can a Arduino Nano light the strip across the board in groups of three LEDs behind the horse/car as it moves from left to right?
    Can it also handle the break beam switches to act as a counter for every time the ball (rubber ball or pinball, crosses it's path and advances the LEDs to the next cut out.
    Each time the beam is interrupted, the next segment lights up until the car/horse/puppy etcetera reaches the end, at which point the overall winner flashes?

The problem is that using one Nano for each player, (and there's 16 players), can shut off the other "racers" Nanos to end the race?

I was thinking of using the Adafruit Grand Central M4 Express featuring the SAMD51
Product ID: 4064
for all of the light strips and a break beam for each player all tied into the same board because it has enough digital pins to do it but then, I haven't a clue how to code it and I'm struggling with determining how much power I'll need.
I was thinking the Nanos are easy for each individual player instead of everyone on the same board, but it can't connect with the other racers as they start or cross the finish line.

I need help, any help and if someone could help with coding either version, that would be a godsend. Which is the better way to do this?

I am building this to be my retirement job. I need a way to support myself because social security won't be enough to pay the bills. This will be my lifesaver so to speak. Any help would be greatly appreciated. I have a year to build this before I leave my job and I'm not so proud as to ask for a hand to help me support myself. Thanks,
Mike

This is a complicated project. Break it into sections. Power distribution will be critical, of course, and you should keep it as simple as possible. What are all the voltages you will be working with? There's 5V, obviously for the Arduino(s) and I guess you were looking at Adafruit Neopixels? They typically run off 5V as well.

??? Why would you use one Nano per player? I'm not understanding a lot of what you are trying to do.

You have to really break this down into every component you are considering. I don't know what a Cricut is except a device my wife had for scrapbooking to make stickers or something like that. So you are going to really have to break this down. I don't mind offering some help along the way, but I don't even know what action/device/input moves the horses down the track.

As for power distribution, for projects like these, I usually go for a computer power supply unit converted for general use. It gives you lots of options and is quite easy to convert, plus it's low cost. Only thing is, I only do this for personal projects and there may be a question of liability with using a hacked PSU depending on who you're selling to? Decide for yourself, here's a guide
https://www.dimensionengineering.com/appnotes/atxguide/atxguide.htm
EDIT: so are you making one of these to run yourself at a carnival?

1 Like

Oh I see:

https://hanfordsentinel.com/lifestyles/nostalgic-carnival-game-makes-one-final-appearance/article_f1a2a497-669e-51c7-86eb-bce1393bd6e1.html



You need a display board with 16*28=448 lights, and 16 pinball machines with about 5 inputs. Are you refurbishing the hardware? Or building new?

I think I'd break it down as one display board with the addressable leds, and then each pinball machine as a separate device that sends a signal or two to the display.

1 Like

Building new. That is the very game I used to play when I was a kid with my mom when we went to the fair every year. This is exactly what I want to do except with more modern electronics. That one had old relays, ceramic insulators, and fabric-covered wiring from what looked like the 30's and 40's. The article says it was built in 1970 but that thing had really old parts in the back. It put off so much heat -playing was challenging but it had waiting lines every time we tried to play. LOL Please help me figure out how to build this.

The Nano was a thought because I don't know which is the better solution. I built a simple one a few years ago to try and figure it out, but I didn't have a lot of luck. Honestly, if I could do it on that Metro board, I think it would work, but I've never built something like this, with that board, and my coding isn't that great.
How it breaks down. Here's an explanation of what is happening:
The ball passes a series of beam breakers, signaling the LEDs to light at a particular place. When they reach the end of the row of lights, the race ends, and all of the horses stop until the game is reset for the next race.

The different sections:
Beam-breakers. As you can see in the next reply's photo, there are a number of chutes the ball passes through. This is what I will be making so I'll skip the wood working part. I can do all of these easily in my shop. There are 4 chutes with two counters and the center one has three counters. I think those are limit switches in the picture. Every time the switch is hit by the ball (or passes through the beam), the LED's will light at the next light, shut off the previous light, and advance until it reaches the end of the strip, where light number 50 tells the system, "stop because I'm the winner.
I'll need a board (the Metro) a slew of addressable LED strips (16 at least), and 11 of the beam breaker switches or limit switches for each play board.
Does this help?
You are right, the Cricut is for making stickers. I have a large vinyl cutter for 24" vinyl.
I need to code all of them, and while coding a single strip isn't that hard, 16 of them is and then having them do other things like stop the game and reset is beyond my knowledge.

I'm making it for myself. I forgot that a CPU PS units can supply 5V. Those are about 80 dollars for a decent one.

1 Like


This is something similar, except it has mechanical camels in the back instead. This uses a roll-a-ball concept versus my pinball version. Either works well and the mechanical one looks intimidating. It's probably stepper motors and the like but more than I want to try. The lights version I believe I can do at 65 years old. I teach 6th grade middle school history. Building this would be a great way to de escalate after a day with 120+ kids too.

Well, a Nano with addressable leds looks capable:

// Derby Race game Nano feasibiity per
// https://forum.arduino.cc/t/help-with-race-car-derby-racing-game-with-addressable-leds/1248176/10
// https://wokwi.com/projects/395283077096057857

#include <FastLED.h>

const size_t numSections = 16;
const size_t ledsPerSection = 27;
const size_t ledCount = numSections * ledsPerSection;
const uint8_t ledPin = 2;
const byte InPins[numSections] = {3, 4, 5, 6, 7, 8, 10, 11, 12, 13, A0, A1, A2, A3, A4, A5};
byte lastPinState[numSections] = {};
uint32_t lastPinMs[numSections] = {};
byte position[numSections] = {};
const int ACTIVE = LOW;
uint32_t now = 0;

// hat tip https://forum.arduino.cc/t/multiple-animation-zones-on-1-pixel-strip-with-fastled/1073391/16
CRGB leds[ledCount];
// See https://fastled.io/docs/class_c_pixel_view.html
CPixelView<CRGB> sections[numSections] = {
  CPixelView<CRGB>(leds, 0 * ledsPerSection, 1 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 1 * ledsPerSection, 2 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 2 * ledsPerSection, 3 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 3 * ledsPerSection, 4 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 4 * ledsPerSection, 5 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 5 * ledsPerSection, 6 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 6 * ledsPerSection, 7 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 7 * ledsPerSection, 8 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 8 * ledsPerSection, 9 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 9 * ledsPerSection, 10 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 10 * ledsPerSection, 11 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 11 * ledsPerSection, 12 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 12 * ledsPerSection, 13 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 13 * ledsPerSection, 14 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 14 * ledsPerSection, 15 * ledsPerSection - 1),
  CPixelView<CRGB>(leds, 15 * ledsPerSection, 16 * ledsPerSection - 1)
};

void setup() {
  Serial.begin(115200);
  FastLED.addLeds<WS2812B, ledPin, GRB>(leds, ledCount);

  lampTest();
  randomRainbowTest();

  for (auto &pin : InPins ) {
    pinMode(pin, INPUT_PULLUP);
  }

  Serial.println("Ding!");
}

void loop() {
  now = millis();

  scanButtons();

  //swapColors();
}


void scanButtons(void) {
  for (int ii = 0; ii < numSections; ++ii) {
    int buttonState = digitalRead(InPins[ii]);
    if (buttonState != lastPinState[ii] && now - lastPinMs[ii] > 100) {
      lastPinState[ii] = buttonState;
      lastPinMs[ii] = now;
      Serial.print(ii); Serial.print(" ");
      if (buttonState == ACTIVE) {
        sections[ii][position[ii]] = CRGB::Black;
        ++position[ii];
        if (position[ii] > ledsPerSection - 1) { // winner
          Serial.print("Winner!");
          position[ii] = ledsPerSection - 1;
        }
        sections[ii][position[ii]] = CRGB::CRGB::Yellow;
        FastLED.show();
      }
    }
  }
}

void swapColors(void) {
  static uint32_t last = 0;
  static int flip = 1;
  if (millis() - last < 1000) return;
  last = millis();
  for (int idx = 0; idx < ledCount; ++idx) {
    leds[idx] = (idx + flip) & 0b1 ? CRGB(74, 126, 54) : CRGB::Coral ;
  }
  flip = flip > 0 ? 0 : 1;
  Serial.print(".");
  FastLED.show();
}

void lampTest(void) {
  // test leds
  Serial.println("test all the leds in leds()");
  for (int idx = 0; idx < ledCount; ++idx) {
    leds[idx] = idx & 0b1 ? CRGB::Aqua : CRGB::Coral ;
  }
  FastLED.show();
  delay(2000);
}
void randomRainbowTest(void) {
  Serial.println("test each strand in sections[]");
  for (int ii ; ii < numSections; ++ii) {
    Serial.print("View:");
    Serial.print(ii);
    Serial.print(" size:");
    Serial.print(sections[ii].size());
    Serial.println();
    randomSeed(random() + analogRead(A7) + micros());
    sections[ii].fill_rainbow(random(255), 3);
    FastLED.show();
    delay(500);
  }
  delay(5000);
}

But if you need more & varied inputs per pinball & chute, it might be good to separate it into the display and pinball machines.

Hat-tip to 2 effects on one strip 1 pin - #15 by gfvalvo and Multiple animation zones on 1 pixel strip with FastLED - #16 by gfvalvo for CPixelView hints.

2 Likes

Yes. I agree. The best approach is to make two and once I have those figured out, then make the rest and update the code. Did you look at the Metro board?


This has a lot of digital pins for the lights and chute sensors. Here's the details for the board
" This board is like a freight train, with its 120MHz Cortex M4 with floating point support. Your code will zig and zag and zoom, and with a bunch of extra peripherals for support, this will for sure be your favorite new chipset.

The Grand Central is the first SAMD board that has enough pins to make it in the form of the Arduino Mega - with a massive number of pins, tons of analog inputs, dual DAC output, 8 MBytes of QSPI flash, SD card socket, and a NeoPixel.

To start off our ATSAMD51 journey we are going large with the Mega shape and pinout you know and love. The front half has the same shape and pinout as our Metro's, so it is compatible with all our shields. It's got analog pins where you expect, and SPI/UART/I2C hardware support in the same spot as the Metro 328 and M0. But! It's powered with an ATSAMD51P20:

  • Cortex M4 core running at 120 MHz
  • Floating point support with Cortex M4 DSP instructions
  • 1MB flash, 256 KB RAM
  • 32-bit, 3.3V logic and power
  • 70 GPIO pins in total
  • Dual 1 MSPS DAC (A0 and A1)
  • Dual 1 MSPS ADC (15 analog pins)
  • 8 x hardware SERCOM (can be I2C, SPI or UART)
  • 22 x PWM outputs
  • Stereo I2S input/output with MCK pin
  • 12-bit Parallel capture controller (for camera/video in)
  • Built in crypto engines with AES (256 bit), true RNG, Pubkey controller

Pretty good start right? So we put this chip on a PCB with all these nice extras:

  • Power the Grand Central with 6-12V polarity protected DC or the micro USB connector to any 5V USB source. The 2.1mm DC jack has an on/off switch next to it so you can turn off your setup easily. The board will automagically switch between USB and DC.
  • Grand Central has 62 GPIO pins, 16 of which are analog in, and two of which is a true analog out. There's a hardware SPI port, hardware I2C port and hardware UART. 5 more SERCOMs are available for extra I2C/SPI/UARTs.
  • Logic level is 3.3V
  • Native USB, there's no need for a hardware USB to Serial converter as the Metro M4 has built in USB support. When used to act like a serial device, the USB interface can be used by any computer to listen/send data to the METRO, and can also be used to launch and update code via the bootloader. It can also act like an HID keyboard or mouse.
  • Four indicator LEDs and one NeoPixel, on the front edge of the PCB, for easy debugging. One green power LED, two RX/TX LEDs for data being sent over USB, and a red LED connected. Next to the reset button there is an RGB NeoPixel that can be used for any purpose.
  • 8 MB QSPI Flash storage chip is included on board. You can use the SPI Flash storage like a very tiny hard drive. When used in Circuit Python, the 8 MB flash acts as storage for all your scripts, libraries and files. When used in Arduino, you can read/write files to it, like a little datalogger or SD card, and then with our helper program, access the files over USB.
  • Micro SD Card slot - removable storage of any size, connected to an SPI SERCOM (SDIO is not supported)
  • Easy reprogramming, comes pre-loaded with the UF2 bootloader, which looks like a USB storage key. Simply drag firmware on to program, no special tools or drivers needed! It can be used to load up CircuitPython or Arduino IDE (it is bossa v1.8 compatible)

Note: The Grand Central M4 may come with a black or purple PCB.

We have a working Arduino board support package, with lots of stuff working, but our primary target for this board is CircuitPython - with 120 MHz, and 256KB of RAM CircuitPython runs really well on this chip!"

It certainly can handle everything. What do you think?

Sure it will handle it. Since a nano can handle all the leds and inputs you’ve described, any more capable device would be able to do at least as well.

I think you ought to figure out more about the architecture of your problem: how many inputs and outputs do you need and what signals they demand.

I’m not advocating for the nano, just that it seems feasible that a controller with 16 inputs and 1 output could do everything the old system did. Everything else is gravy.

I agree. That Metro board combined with an LED amplifier will work . The amplifier, if I'm understanding it correctly, lets me connect 8 light strips to one pin. I'm going to use a computer power supply from an old computer. I'll use a multimeter to check the voltage. Instead of the beam breakers, I may copper tape to create a switch when the ball rolls over it. The switch will work as a counter advancing the LEDs along the track. It's a cheap and simple solution saving a lot of money.

The reason for choosing the bigger board is speed, it has a lot of RAM for the MP3 sound start and finish files, and a card reader. With all of the beam breakers or limit switches, having the extra pins will make it much easier to connect those too. Plus I can add more players if I want to without starting over.

The Nano won't be able to do that. The pinball board in the picture has 11 switches. All are for two movements except the center, which has three. I think I can reduce that number of switches to five for the five chutes if I can code them to count as one, two, three, two, one (five chutes) each time the switch is triggered.

I don't know enough about coding to do that part but it seems like it should be possible.

Do you know if buying single, larger ARGB LEDs is possible? The lights need to be behind the horse/car, not in between the blacked-out area. A strip will have a lot of wasted lights in between unless I want to cut them and reconnect and even then the small lights won't be bright enough to see in shaded daylight, in the shade of a trailer - at least I don't think they will.

The code above connects 16 strips to one pin.

I was thinking you could wire the pinball buttons all in parallel and deliver one signal to the main display controller. A couple of the pinball pics had multiple buttons in the faster chutes/lanes. Those would take care of the multiple steps per lane mechanically and work with the code above.

Or that you could put a small board in each pinball machine and use it to translate the local buttons into a series of pulses on a single wire to be delivered to the main display controller.

Really, the controller/controllers is the easiest part of the project. At 16 lanes, and 1sec/ball, processing ~50 button/sec or 20ms/step (20000us/step) is very slow compared to the cheapest controllers.

You can handle the MP3s with a DFMini card and the MP3 playback won't interact with the light timing or vice versa.

Adafruit sells a number of addressable LEDs in different brightnesses and forms. There might be a strip that would be good to design around, you could even buy longer standard strips and light up every other or every 3rd like. But if you go much bigger than 500 LED, you might run out of memory on the smaller controllers.

Reliable buttons/ball sensors might be tough. Here's some examples of different sorts of sensors: https://homepinballrepair.com/pinball-switches-fixing-adjusting/

Planning and building the mechanical bits will be hardest part.

Here's code to translate a 5-lane (weighted 1-2-3-2-1) pinball machine into single pulse train to feed into a main display controller:

Design more of the mechanical setup and source your components. 16 x 3m of 30LED/m of addressable strips from Adafruit would cost nearly $1000. I haven't a guess for how much it would cost to build the 16 small pinball machines.

Will do, thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.