Trinket NeoPixel LED Longboard
2017-07-31 | By Adafruit Industries
License: See Original Project 3D Printing
Courtesy of Adafruit
Guide by Ruiz Brothers
Overview
Upgrade your ride with NeoPixel LEDs. In this project we're upgrading a longboard with more neopixels, making a very bright and safe summer night ride!
In this project, we're going to use the Trinket micro-controller to power 100 NeoPixel LEDs with a Powerboost 500C and a 2500mAh lithium polymer battery.
Parts
- 2 NeoPixel Ring 16x
- 1 NeoPixel LED Strip 30 - 1m
- 1 Powerboost 500C
- 1 Trinket 5V
- 1 2500mAh Lithium ion Polymer Battery
- 1 Slide Switch
Tools & Supplies
- Soldering Iron
- Solder Wire
- Wire Wrap
- Male/Male Jumper Cables
- Female/Female Jumper Cables
- JST Extension Cable
- #6-32 x 1/2' machine flat Phillips screws
- #6-32 x 3/4' machine flat Phillips screws
- #4 x 3/8' machine flat Phillips screws
- Screwdriver Set
- Shrink Tubing
- Flat Pliers
- Wire Strippers
- Panavise Jr.
- Third Helping Hand
Prerequisite Guides
3D Printing
Download the parts for this project on Thingiverse or Autodesk 123D Design. The original solids are available for customization so you can tweak the parts to fit your ride. The parts will print on any FDM 3D printer with a build area of 100mm x 100mm x 100mm.
PLA Material
We recommend printing the parts in PLA filament using your preferred slicing software with the recommended settings below.
Support Material
The trinket-box.stl part has geometry that requires support material in order to print properly. We recommend using a pair of flat pliers for removing the support material.
Removal Technique
Use the pliers to get a good hold on the support material. Pinch it tightly, twist, and pull it out to easily remove the support material as one whole chunk as oppose to bit by bit.
Circuit Diagram
Follow the illustration above and to reference how all the components are connected. The diagram isn't to scale and doesn't display how the circuit show actually looks like. The actual circuit is much more condensed and has rather lengthy wiring!
Below is a list of the components pin outs.
- Powerboost 500C to Trinket
- Male JST to Female JST
- Powerboost 500C to Switch
- EN, GND
- Trinket 5V to NeoPixel Strip
- GND to GND, BAT to 5V, #0 to DIN
- NeoPixel Strip to NeoPixel Ring
- GND to GND, 5V to 5V, DO to IN
- Battery to Powerboost 500C
- Male JST to Female JST
Software
Configure Trinket for Arduino
Install the proper modifications and libraries to your installation of Arduino to configure the Trinket.
Uploading Code to Trinket with Arduino
Copy and paste the code below into a new sketch in Arduino. Select Trinket 5V 8Mhz board from the Tools menu. Plug in a USB cable from the trinket to your computer. Make sure your programmer is set to USBtinyISP before you upload the code to the Trinket. Hit the upload code while the red LEDs are blinking on the Trinket.
#include <Adafruit_NeoPixel.h>
#define PIN 0
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(54, PIN);
uint8_t mode = 1, // Current animation effect
offset = 0; // Position of spinny eyes
uint32_t color = 0x00ff96; // Start red
uint32_t prevTime;
void setup() {
pixels.begin();
pixels.setBrightness(50); // 1/3 brightness
prevTime = millis();
}
void loop() {
uint8_t i;
uint32_t t;
switch(mode) {
case 0: // Random sparks - just one LED on at a time!
i = random(20);
pixels.setPixelColor(i, color);
pixels.show();
delay(10);
pixels.setPixelColor(i, 0);
break;
case 1: // Spinny wheels (8 LEDs on at a time)
for(i=0; i<54; i++) {
uint32_t c = 0;
if(((offset + i) & 7) < 4) c = color; // 4 pixels on...
pixels.setPixelColor( i, c); // First eye
pixels.setPixelColor(31-i, c); // Second eye (flipped)
}
pixels.show();
offset++;
delay(90);
break;
}
t = millis();
if((t - prevTime) > 8000) { // Every 8 seconds...
mode++; // Next mode
if(mode > 1) { // End of modes?
mode = 1; // Start modes over
color >>= 0 ; // Next color R->G->B
if(!color) color = 0x00ff96; // Reset to red
}
for(i=0; i<54; i++) pixels.setPixelColor(i, 0);
prevTime = t;
}
}
Customization
Some values to look for when adapting the sketch to your project are the number of pixels. Searching for "54" and replacing that value with whatever number of pixels are used your project is a good start. The color is conveniently formatted in HEX, "00ff96" makes a teal color. The duration of the animation can be changed by adjusting the delay "90" which is in measured in milliseconds.
Components
Trinket 5V
The Trinket 5V micro-controller runs code that will animate the NeoPixel Strips and NeoPixel Rings. The Trinket has enough memory to power about 100 NeoPixels. To power the Trinket, we'll use a lithium polymer battery. Most of our lithium polymer batters have JST connectors. The Trinket doesn't have a JST connector on board, so we'll have to solder one on!
Tin Trinket
Secure the trinket upside down to a Panavise Jr. or third helping hand. This helps you tremendously while soldering! Add solder to the +Postive and -Negative pads on the back of the Trinket, right below the USB port.
Trinket JST Connector
Measure a JST extension cable to about double the length of the Trinket and cut the cable. Use wire strippers to strip the ends of wires with the female JST connector. Solder the positive and negative wires to the bottom of the trinket where the positive and negative pads are tinned with solder.
Prep Trinket + Jumper Cables
Add a bit of solder to the GND, BAT, and #0 Pins on the Trinket. Grab three female jumper cables and snip off one of the ends. Use wire strippers to expose the tip of the wires.
Solder Jumpers to Trinket
Solder the three jumper cables to the #0, GND, +BAT pins on the Trinket.
PowerBoost 500C
The power boost 500C will provide enough current to power the NeoPixel strips and rings. We can get about 100 NeoPixel LEDs to animate properly at full brightness. The Powerboost 500C also has an on-board lipoly charger so you can recharge a lithium polymer battery over USB.
PowerBoost 500C JST
Grab the other half of the JST extension cable with the male connector and strip the negative and positive wires. Solder the wires to the +positive and -negative pins on the Powerboost 500C.
Slide Switch Wires
Measure and cut 3 strips of stranded wires to about 30mm in length. Expose the ends of the wires using wire strippers.
Solder Wires to Slide Switch
Secure the slide switch to the Panavise Jr. Use a third helping hand to hold one of the wires up against one of the terminals. Once the wire and the terminal are secured and touching, add the soldering iron to the terminal, and solder it while they're both in place.
Shrink Tube Slide Switch
Seal off the soldered connections by slipping on some pieces of heat shrink tubing. Just add heat to shrink!
Install Slide Switch
Bundle the 3 wires and thread them through the slide switch opening in the enclosure (trinket-box.stl). Carefully fit the slide switch through the opening and snap it into place.
Secure Slide Switch
Add some E600 to the top and sides of the slide switch to permanently secure it to the enclosure.
Solder Slide Switch Wiring to PowerBoost
With the slide switch installed to the enclosure, strip the other end of the 3 wires, and solder them into the PowerBoost 500C following pins.
EN, GND, VBAT
NeoPixel Strips
Use a Panavise Jr. to secure the end of the NeoPixel strip with the arrow pointing out towards the right. Snip off the end if wires are soldered on. Tin the three pads with solder.
Solder Jumpers to NeoPixel Strip
Grab 3 male jumper cables and snip off one of the ends of each. Strip the wires and solder them onto the GND, DIN, and 5V pins of the strip.
Tin NeoPixel Rings
Secure the 16x NeoPixel ring in place with a Panavise. Tin the 4 pins, GND, DIN, DOUT, and PWR.
First NeoPixel Ring
Cut six strands of wire wrap and strip the ends. Solder one wire to each of the 4 pins on the NeoPixel Ring. GND and PWR pins will need two wires soldered to them.
Thread First NeoPixel Wiring
Group the GND, DOUT, and PWR wires together and carefully thread them through the hole in the left eye of the neoring-holder.stl part.
NeoPixel Input Wiring
The remaining wires should be GND, PWR, and DIN. These three need to be threaded through the slit on the back of the neoring-holder.stl part.
Fit NeoPixel Ring Wiring
Carefully tuck the wiring to the inside of the cavity on the neoring-holder.stl part.
Install First NeoPixel Ring
Gently insert the NeoPixel Ring into the cavity without kinking the wiring. Press it down into place once the wires are tucked inside the neoring-holder.stl part.
Second NeoPixel Ring
Position the second NeoPixel ring over the neoring-holder.stl upside down and thread the three wires into the Ground, 5V, and Data Input pins.
Solder Second NeoPixel Ring
Leave a bit of slack for each wire and cut to shorten them. Use a third helping hand to secure the NeoPixel ring in place while you solder the wires to the GND, 5V, and DI pins.
Chained NeoPixel Rings
The NeoPixel Rings should have a really tight fit in the neoring-holder.stl part. If you ever need to remove the rings from the housing, you totally can! Use a flat head screwdriver, knife, or blade to lift up the PCB from out the housing.
Install Second NeoPixel Ring
Just like the first ring, gently tuck the wiring inside the holder, and carefully snap the ring into place.
No Kinks!
Make sure you don't kink any of the wires, it's very thin wiring that's easy to damage. Use a paperclip or similar to tuck any excess wires inside the cavity.
Installed NeoPixel Rings
The NeoPixel rings are now installed into the housing. Looks like a pair of glasses, doesn't it?
NeoPixel Ring Adapter
Grab the neoring-adapter.stl part and thread the three wires from the neopixel ring through the center of the hole.
Thread Wires through Adapter
Line up the two holes on the neoring-adapter.stl part with the neoring-holder.stl part and make sure they're touching on the flat sides.
Install Adapter to Ring Holder
Join together the parts and line up the two mounting holes.
Secure Adapter to Ring Holder
While holding the two parts together, insert screws, and fasten them to join them together. Use 2 #4 3/8' flat Phillips screws.
Prep Jumper Cables for NeoPixel Rings
Grab three female jumper cables and remove one end of the clip holder with a thin tool like an xacto knife or flat screw driver. Repeat for the 3 wires.
Tin Jumper Cables
Add a bit of solder to the inside of the exposed female jumper cable. Slip on the covers that were removed from the female jumper cables onto the three wires of the NeoPixel Ring.
Solder Wire Wrap to Jumper Cables
The three wires from the NeoPixel ring will be soldered to these jumper cables. Heat up the jumper cable that has a bit of solder and insert the wire wrap into the exposed female jumper cable while it's heated up.
Seal Wire Connections
Slide each of the plastic covers back onto the jumper cables and make sure they clip back into place.
NeoPixel Rings w/ Jumpers
The pair of NeoPixel rings are now ready to be wired. The next page walks through the wiring.
Test Circuits
Before finalizing the assembly, it's a good idea to test the components to ensure the circuit is working before we close it up.
Test Trinket
Plug in a JST male connection from a charged Lithium Polymer battery to the female JST connector that was soldered on the Trinket. If the LED power on, that means it works and is ready for NeoPixel power!
Test PowerBoost + Switch
Connect the battery to the JST connector on the Powerboost 500C. Flip the slide switch and see if it the blue LED powers on.
Test NeoPixel Strip
Grab the NeoPixel Strip and Trinket. Ensure you have code loaded onto the Trinket. Connect the 3 male jumpers from the NeoPixel strip to the female jumpers on the Trinket. GND to GND, PWR to +Bat and DIN to #0. Power the Trinket on with USB or battery and check to see if the LED's power on.
Test NeoPixel Rings
Connect the 3 female jumper cables of the neopixel ring to the 3 male jumper cables on the Trinket. GND to GND and PWR to +Bat and DIN to #0. Power the Trinket on with USB or battery and check to see if the LED's power on.
Assembly
Mount Powerboost 500C to Enclosure
Position the Powerboost over the trinket-cover.stl part and line up the end of the USB port with the mounting holes that line up with the ones on the power boost. Insert 2 #4 3/8' flat Phillips screws and fasten them into place.
Mount Trinket to Enclosure
Position the Trinket over the trinket-cover.stl part and align up the end of the USB with the mounting holes that align up with ones on the trinket. Insert 2 #4 3/8' Phillips screws and fasten them into place.
Mounted Trinket + PowerBoost 500C
The Trinket and Powerboost 500C are securely mounted to the trinket-cover.stl part. Now they won't move around while skating!
Install Battery into Enclosure
Grab the 2500mAh lithium polymer battery and position inside the trinket-box.stl part at an angle with one end going into the opposite end of the slide switch. It should have some wiggle room.
Connect Battery to PowerBoost 500C
Plug in the male JST connector from the 2500mAh lithium polymer battery to the female JST connector on the PowerBoost 500C.
Connect PowerBoost 500C to Trinket
Plug in the male JST connector from the PowerBoost 500C to the female JST connector on the Trinket.
Expose Trinket Output Jumpers
Move the three female jumper cables from the trinket to the slit and hole of the enclosure.
Closing Enclosure
With the Battery placed inside the enclosure and the components mount to the cover, join the cover and enclosure. Carefully tuck the wiring inside the enclosure.
PowerBoost 500C USB
Check to ensure the micro USB port is aligned up to the port opening in the enclosure.
Trinket USB
Check that the mini USB port is lined up with the port opening in the enclosure.
Mount Cover to Enclosure
Place the cover over the enclosure and line up the mounting holes that are located on the four corners. Use 4 #6 1/2' Phillips screws to secure the trinket-cover.stl part to the trinket-box.stl part.
Install Sliding Lock Mount to Board
Attach the slide-lock-mount.stl part to the bottom of your board with either E6000 adhesives or double-sided foam tape.
Install Sliding Lock Clip to Enclosure
Insert 2 #6 1/2' flat Phillips screws into the slide-lock-clip.stl part. Fasten the screws until the thread is flush with the bottom. Position the part over to the top of the enclosure and line up the screws with the holes on the enclosure. Fasten the screws until the two part are secured.
Sliding Lock
To mount the enclosure to the sliding lock, position the clip into the mount and pinch the two legs together and push the part through. To remove the enclosure, pinch the two legs together and pull the part out. A lot like a belt clip or GoPro mount, right?
Mount NeoPixel Strips to Board
Two options for mounting the NeoPixel strips to the bottom of the board. Vertically or horizontally. The vertical(tall) position allows the light to spread further across while the horizontal(flat) position illuminates the bottom of the board.
Secure NeoPixel Strip Wiring
Neatly bundle up the access wiring from the strip.
Install Ring Mount to Trucks
Position the neoring-holder.stl to the neoring-mount.stl and line up the mount holes. Mount the neoring-mount.stl part to the front of the trucks by inserting the part with the opening facing the side of the trucks. The two fixtures with the holes should face the front of the trucks.
Secure Ring Mount to Trucks
Use a #6-32 3/4' Phillips screw to secure the neoring-mount.stl to the trucks.
Install Ring Holder to Truck Mount
Position the neoring-adapter.stl part and to the neoring-mount.stl part. Join the two parts with the mounting holes together.
Secure Ring Holder to Truck Mount
Insert a #6-32 3/4' flat Phillips machine screw and fasten it together to secure the neoring-holder.stl to neoring-mount.stl parts.
Add Diffusers
Install the NeoPixel Ring diffusers, neoring-cap-a.stl and neoring-cap-a.stl onto the neoring-holder.stl part.
Secure NeoPixel Ring Wiring
Group up the excess jumper cables and secure them down to the edge of the truck risers. For a more permeant method, apply E6000 adhesive or hot glue. Black electrical tape is only temporally.
Connect Jumpers To Trinket
With the enclosure locked to the mount, connect the male jumper cables from the strip input to the female jumper cables on the trinket.
- Trinket 5V to NeoPixel Strip
- GND to GND
- BAT to 5V
- #0 to DI
Connect Strip + Ring Jumpers
With the ring holder mounted to the trucks, connect the female jumpers from the NeoPixel Ring to the male jumper cables coming from the output of the NeoPixel Strip.
- NeoPixel Strip to NeoPixel Ring
- GND to GND
- 5V to 5V
- DOUT to DIN
NeoPixel Ring Headlights
The NeoPixel Rings are installed to the trucks and ready for a nightly skate session!
NeoPixel Power!
Slide the switch on and light up your nightly skate session!
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum