Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Ben Schwartz
Published © GPL3+

Arduino-Powered E-Skateboard Lighting

Using Teensy (small Arduino) to power NeoPixels off of an electric skateboard battery.

BeginnerFull instructions provided1 hour5,263
Arduino-Powered E-Skateboard Lighting

Things used in this project

Hardware components

Buck Converter
×1
Arduino UNO
Arduino UNO
×1
USB-A to B Cable
USB-A to B Cable
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1
XT60 Connectors & Heat Shrink
×1
Male/Male Jumper Wires
×1
Teensy USB 3.2 Development Board
Teensy USB 3.2 Development Board
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino Web Editor
Arduino Web Editor

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Custom parts and enclosures

Teensy 3.2 Enclosure

Enclosure for Teensy 3.2

Schematics

Teensy 3.2 to Neopixel Wiring

Teensy 3.2 to Neopixel Wiring

Code

Neopixel Control

Arduino
Use to make different patterns and change colors of Neopixels
#include <Adafruit_NeoPixel.h> //Make sure to include the Adafruit library in order to enable controlling of the Neopixels
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN            12 //This is where the data line of your Neopixels will connect to. It can be any number pin really, I just chose 12.

#define NUMPIXELS      21 //This is where we determine the number of pixels. I am only using 21 for each strip on the actual skateboard, so that's what I chose.
#define STRING_LENGTH0   21 //If you want to be able to control individual pixels in a "moving" string of neopixels, making different stringlengths from the maximum down to 1 is important.
#define STRING_LENGTH   20
#define STRING_LENGTH2   19
#define STRING_LENGTH3   18
#define STRING_LENGTH4   17
#define STRING_LENGTH5   16
#define STRING_LENGTH6   15
#define STRING_LENGTH7   14
#define STRING_LENGTH8   13
#define STRING_LENGTH9  12
#define STRING_LENGTH10  10
#define STRING_LENGTH11  9
#define STRING_LENGTH12  8
#define STRING_LENGTH13  7
#define STRING_LENGTH14  6
#define STRING_LENGTH15  5
#define STRING_LENGTH16  4
#define STRING_LENGTH17  3
#define STRING_LENGTH18  2
#define STRING_LENGTH19  1

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 5000/100; //100 = 1 second, and this will control how "fast" your string of Neopixels "moves"


void setup() {

  pixels.begin();
}

void loop() {

  int i=0;
  while(true) {

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i-STRING_LENGTH, pixels.Color(255,0,0));    
    pixels.setPixelColor(i-STRING_LENGTH2, pixels.Color(240,0,0));  
    pixels.setPixelColor(i-STRING_LENGTH3, pixels.Color(250,110,0));   
    pixels.setPixelColor(i-STRING_LENGTH4, pixels.Color(255,165,0));
    pixels.setPixelColor(i-STRING_LENGTH5, pixels.Color(255,190,0));
    pixels.setPixelColor(i-STRING_LENGTH6, pixels.Color(255,220,0));
    pixels.setPixelColor(i-STRING_LENGTH7, pixels.Color(255,255,0));
    pixels.setPixelColor(i-STRING_LENGTH8, pixels.Color(150,210,0));
    pixels.setPixelColor(i-STRING_LENGTH9, pixels.Color(90,170,0));
    pixels.setPixelColor(i-STRING_LENGTH10, pixels.Color(0,128,0));
    pixels.setPixelColor(i-STRING_LENGTH11, pixels.Color(0,70,90));
    pixels.setPixelColor(i-STRING_LENGTH12, pixels.Color(0,30,175));
    pixels.setPixelColor(i-STRING_LENGTH13, pixels.Color(0,0,255));
    pixels.setPixelColor(i-STRING_LENGTH14, pixels.Color(25,0,200));
    pixels.setPixelColor(i-STRING_LENGTH15, pixels.Color(50,0,170));
    pixels.setPixelColor(i-STRING_LENGTH16, pixels.Color(75,0,120));
    pixels.setPixelColor(i-STRING_LENGTH17, pixels.Color(130,40,160));
    pixels.setPixelColor(i-STRING_LENGTH18, pixels.Color(190,85,100));
    pixels.setPixelColor(i-STRING_LENGTH19, pixels.Color(238,20,20));
    

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); 
    i = (i+1) % (NUMPIXELS + STRING_LENGTH);


  }
   
}

Credits

Ben Schwartz

Ben Schwartz

1 project • 2 followers
Thanks to Alex Glow.

Comments