Skip to content
1d game for Raspberry Pi and DotStar LED strip
JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

LED Run Pi

A simple 1d game for Raspberry Pi, using a DotStar LED strip as display. Guide a small worm to the other end of the LED strip by matching its color with the color of oncoming worms, going in the opposite direction.

Project status

Basic gameplay in place. Needs a lot of polishing and some good refactoring. :-)

Needed software and hardware

  • Raspberry Pi
  • HC-SR04 ultrasonic sensor
  • DotStar LED Strip
  • Node.js v6 (see compatibility node below)

Installing and Running

Developed on a Raspberry Pi 3, Model B

./ && npm install && ./

Run Tests

npm test

Connecting the peripherials

DotStar LED strip

Via a level-shifter, connect the DotStar DAT to Pi GPIO 10 and the DotStar CLK to Pi GPIO 11.

For details, see The Adafruit instruction.

Note, you need to hook up a quite beefy power brick to power the LED strip, at least 10A will be needed to handle the power draw of a lot of pixels firing at the same time. I ended up ordering a 5V, 15A brick. Should cover most scenarios.

Enable SPI on the Pi3

In /boot/config.txt, uncommend the dtparam line to enable spi, like so:

# Uncomment some or all of these to enable the optional hardware interfaces

Ultrasonic sensor

Hook up the senor ECHO pin to Pi GPIO17 and sensor TRIGGER pin to Pi GPIO04.

If those are not free, use other pins and set the corresponding pin numbers in ./config/GPIO-pins.js.

Compatibility Note - Why such old Node.js (v8)?

The library used to interface with the ultrasonic sensor (HC-SR04) uses a depricated API and was not functioning properly with the latest Node.js for me.


  1. Write game engine, (DONE)
  2. Connect HC-SR04 ultrasonic sensor (PoC working outside this repo)
  3. Buy DotStar LED Strip (DONE Black friday hooray!)
  4. Connect DotStar LED Strip (DONE)
  5. Write display logic to render game to DotStar strip (DONE)
  6. Compose levels (DONE minimal)
  7. Clean code and build robust case
  8. Tweak difficulty
  9. Done!
You can’t perform that action at this time.