LED Cylon Scooter
2022-04-15 | By bekathwia
License: Attribution Non-commercial
It was easy to add a chasing LED animation to the grille of my 80s Honda Elite scooter. Now it looks like something out of Knight Rider or Battlestar Galactica.
Supplies for this project:
- WS2812b LED strip
- Trinket microcontroller
- Silicone adhesive
- Multimeter
- Eye protection
- Soldering iron and solder
- Wire strippers
- Flush cutters
- Helping third hand tool
- Silicone-coated stranded wire
- SPST switch
To keep up with what I’m working on, follow me on YouTube, Instagram, Twitter, Pinterest, and subscribe to my newsletter.
The strip is adhered to the inside of the grille using silicone adhesive, and the Trinket's power and ground connections are routed to the scooters power. There's a toggle switch on the power wire, mounted under the dashboard to easily turn the system on and off.
I used Phil B.'s rock-solid larson scanner code for Arduino, adjusting the number of pixels to match my strip:
// Larson Scanner by Phil Burgess:
// https://learn.adafruit.com/larson-scanner-shades?view=all
#include <Adafruit_NeoPixel.h>
#define N_LEDS 31
#define PIN 4
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRBW + NEO_KHZ800);
void setup() {
strip.begin();
}
int pos = 0, dir = 1; // Position, direction of "eye"
void loop() {
int j;
// Draw 5 pixels centered on pos. setPixelColor() will clip any
// pixels off the ends of the strip, we don't need to watch for that.
strip.setPixelColor(pos - 2, 0x100000); // Dark red
strip.setPixelColor(pos - 1, 0x800000); // Medium red
strip.setPixelColor(pos , 0xFF3000); // Center pixel is brightest
strip.setPixelColor(pos + 1, 0x800000); // Medium red
strip.setPixelColor(pos + 2, 0x100000); // Dark red
strip.show();
delay(30);
// Rather than being sneaky and erasing just the tail pixel,
// it's easier to erase it all and draw a new one next time.
for(j=-2; j<= 2; j++) strip.setPixelColor(pos+j, 0);
// Bounce off ends of strip
pos += dir;
if(pos < 0) {
pos = 1;
dir = -dir;
} else if(pos >= strip.numPixels()) {
pos = strip.numPixels() - 2;
dir = -dir;
}
}
To read more about this project, head over to my website. To build your own, check out the following Digi-Key supplies:
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum