Skip to content

ArminJo/OpenledRace

Repository files navigation

Extended version of the OpenledRace version "Basic for PCB Rome Edition. 2 Player, without Boxes Track".

Open Led Race logo

Badge License: GPLv3     Badge Version     Badge Commits since latest     Badge Build Status     Badge Hit Counter

Also available as OpenLedRace example in the NeoPatterns library.

If you find this library useful, please give it a star.

🌎 Google Translate


If you find this program useful, please give it a star.

Extensions to standard version

  • Input from MPU6050 Accelerometer.
  • Classes for Car, Bridge, Ramp and Loop with natural gravity.
  • Light effects by NeoPattern library.
  • Tone generation without dropouts by use of hardware timer output.
  • 2004 LCD for instructions and leap counter.
  • Input feedback by an 8 pixel Neopixel bar.
  • Winner melody by PlayRTTTL library.
  • Compensation for blocked millis() timer during draw.
  • Checks for RAM availability.
  • Overlapping of cars is handled by using addPixelColor() for drawing.
  • Development mode, where Gravity, Friction and Drag can be set by potentiometers.

Principle of operation

With every button press or every acceleration of the dumbbells you add a fixed amount of energy to the "car".
This energy is used to increase speed.

Formula is: Speed = sqrt((OldSpeed * OldSpeed) + AdditionalEnergy)

On the other hand, energy is consumed by friction and drag.
Gravity also increases or decreases the car as in real life.

Formula is: NewSpeed = Speed + Gravity + Friction + (Speed * Drag)


Pictures

Old version New version
Accelerometer version from MakerFaire 2022 Accelerometer version from MakerFaire 2022
At the Cologne public library MINTköln-Festival 2025 At the Cologne public library MINTköln-Festival 2021
OpenLedRace at the Cologne public library MINTköln-Festival 2021 OpenLedRace at the Cologne public library MINTköln-Festival 2025

Size

The version using a 5 m IP30 - 60 pixel per meter strip with ramp and loop reqires an area of 145 cm x 80 cm plus 20 cm space for breadboard etc.
The base of the ramp is 83 cm, the height is 23.5 cm. The slope is 45 degree and therefore the top of the ramp is 83 cm - (2 * 23.5 cm) = 36 cm.
The diameter of the loop is 26 cm.


YouTube Videos

At the Hannover MakerFaire 2022 At the Cologne public library MINTköln-Festival 2021
OpenLedRace at the Hannover MakerFaire 2022 OpenLedRace in action 2021
At the Cologne public library MINTköln-Festival 2025
OpenLedRace in action 2025

Arduino plotter output

Arduino plotter output

In this output, both accelerators were initially moving, then only the first, and finally the second alone. AccelLP is the low-pass value of Accel.
In the middle, there is a steep decrease in speed at the same input level. This is because the car has reached the ramp and must now overcome gravity.
At the end, you can see negative speed. This is because the car was on the ramp when the input stopped and gravity moved it backwards down the ramp.


Compile with the Arduino IDE

Download and extract the repository. In the Arduino IDE open the sketch with File -> Open... and select the OpenledRace folder.
You need to install Adafruit NeoPixel library under "Tools -> Manage Libraries..." or "Ctrl+Shift+I" -> use "neoPixel" as filter string.
You also need to install NeoPatterns and PlayRtttl library under "Tools -> Manage Libraries..." or "Ctrl+Shift+I"

BOM

Required

  • Breadboard
  • Jumper wire
  • Pin header to connect cables to breadboard
  • Arduino Nano
  • WS2812 strip 5m 60 IP30 - 60 pixel per meter
  • 10 kOhm resistor for WS2812 strip data input
  • 2 push buttons 16 mm + 2x2 meter flexible 2-wire cable
  • 2 Handlebar ends with foam grips to mount the push buttons
  • 2004 LCD with serial I2C interface adapter
  • Speaker > 32 Ω
  • 4.7 µF capacitor for speaker
  • Power supply - e.g. a 18650 battery + holder
  • "Reset / Start Game" Pushbutton
  • 1 kΩ potentiometer for speaker volume control

Optional

  • 2 8xWS2812 bars + 2 10kOhm resistors for optical feedback of input strength
  • 2 GY-521 MPU6050 accelerometer Breakout boards (+ 2 Blink LEDs)
  • 2 Dumbbells, each 1 kg
  • 2x2 meter 4-Wire cable (+ 2x2 10 kOhm I2C pullup resistors) to connect the accelerometers
  • 3 pieces 4 pole magnetic pogo pin connectors

For development

  • 3 100k potentiometers for setting of Gravity, Friction and Drag.

Pin layout is defined here

Breadboard overview Accelerometer connection
BreadboardOverview Accelerometer connection
Breadboard top view Breadboard front view
Breadboard top view Breadboard front view

Links:

About

OpenLedRace version with accelerator or button inputs, track animations and winner melody

Resources

License

Stars

Watchers

Forks