Brent Chapman
Published © LGPL

Star Tree Topper

Trinket-powered 3D-printed star tree topper featuring LEDs flashing in fun patterns in a glow-in-the-dark PLA body.

IntermediateShowcase (no instructions)12 hours223
Star Tree Topper

Things used in this project

Hardware components

Adafruit Trinket - Mini Microcontroller - 3.3V Logic - MicroUSB
×1
Adafruit Diffused Green 10mm LED
×2
Adafruit Diffused Blue 10mm LED
×1
Adafruit Diffused Green 10mm LED
×2
Resistor 100 ohm
Resistor 100 ohm
×4
Adafruit Lithium Ion Polymer Battery - 3.7v 500mAh
×1

Software apps and online services

Tinkercad
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Custom parts and enclosures

Star Topper Front

Star Topper Back

Schematics

Custom protoboard

Code

LED Patterns

Arduino
Patterns for the flashing LEDs
 /*
Star Topper
by Brent
*/

int led = 0; // LED 1 position
int led1 = 1; // LED 2 position
int led2 = 2; // LED 3 position
int led3 = 3; // LED 4 position
int led4 = 4; // LED 5 position
int count = 0; // Will use while loop for stepping through the animations
int factor = 200; // For use with the speed up and slow down trace effect

// the setup routine runs on reset:
void setup() {
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);
 pinMode(led1, OUTPUT);
 pinMode(led2, OUTPUT);
 pinMode(led3, OUTPUT);
 pinMode(led4, OUTPUT);
}

// the whole loop runs forever:
void loop() {
 while(count < 10) {
 digitalWrite(led, HIGH); 
 delay(100);
 digitalWrite(led, LOW);
 delay(100);
 digitalWrite(led1, HIGH); 
 delay(100);
 digitalWrite(led1, LOW);
 delay(100);
 digitalWrite(led2, HIGH); 
 delay(100);
 digitalWrite(led2, LOW);
 delay(100);
 digitalWrite(led3, HIGH); 
 delay(100);
 digitalWrite(led3, LOW);
 delay(100);
 digitalWrite(led4, HIGH); 
 delay(100);
 digitalWrite(led4, LOW);
 delay(100);
 count++;
 }
 while(count < 20) {
 digitalWrite(led4, HIGH); 
 delay(100);
 digitalWrite(led4, LOW);
 delay(100);
 digitalWrite(led3, HIGH); 
 delay(100);
 digitalWrite(led3, LOW);
 delay(100);
 digitalWrite(led2, HIGH); 
 delay(100);
 digitalWrite(led2, LOW);
 delay(100);
 digitalWrite(led1, HIGH); 
 delay(100);
 digitalWrite(led1, LOW);
 delay(100);
 digitalWrite(led, HIGH); 
 delay(100);
 digitalWrite(led, LOW);
 delay(100);
 count++;
 }
 while(count < 30) {
 digitalWrite(led, HIGH); 
 delay(100);
 digitalWrite(led, LOW);
 delay(100);
 digitalWrite(led2, HIGH); 
 delay(100);
 digitalWrite(led2, LOW);
 delay(100);
 digitalWrite(led4, HIGH); 
 delay(100);
 digitalWrite(led4, LOW);
 delay(100);
 digitalWrite(led1, HIGH); 
 delay(100);
 digitalWrite(led1, LOW);
 delay(100);
 digitalWrite(led3, HIGH); 
 delay(100);
 digitalWrite(led3, LOW);
 delay(100);
 count++;
 }
 while(count < 40) {
 digitalWrite(led, HIGH); 
 delay(100);
 digitalWrite(led1, HIGH); 
 delay(100);
 digitalWrite(led2, HIGH); 
 delay(100);
 digitalWrite(led3, HIGH); 
 delay(100);
 digitalWrite(led4, HIGH); 
 delay(100);
 digitalWrite(led4, LOW);
 delay(100);
 digitalWrite(led3, LOW);
 delay(100);
 digitalWrite(led2, LOW);
 delay(100);
 digitalWrite(led1, LOW);
 delay(100);
 digitalWrite(led, LOW);
 delay(100);
 count++;
 }
 while(count < 50) {
 digitalWrite(led4, HIGH); 
 delay(100);
 digitalWrite(led3, HIGH); 
 delay(100);
 digitalWrite(led2, HIGH); 
 delay(100);
 digitalWrite(led1, HIGH); 
 delay(100);
 digitalWrite(led, HIGH); 
 delay(100);
 digitalWrite(led, LOW);
 delay(100);
 digitalWrite(led1, LOW);
 delay(100);
 digitalWrite(led2, LOW);
 delay(100);
 digitalWrite(led3, LOW);
 delay(100);
 digitalWrite(led4, LOW);
 delay(100);
 count++;
 }
 while(count < 67) {
 digitalWrite(led, HIGH); 
 delay(factor);
 digitalWrite(led1, HIGH); 
 delay(factor);
 digitalWrite(led2, HIGH); 
 delay(factor);
 digitalWrite(led3, HIGH); 
 delay(factor);
 digitalWrite(led4, HIGH); 
 delay(factor);
 digitalWrite(led, LOW);
 delay(factor);
 digitalWrite(led1, LOW);
 delay(factor);
 digitalWrite(led2, LOW);
 delay(factor);
 digitalWrite(led3, LOW);
 delay(factor);
 digitalWrite(led4, LOW);
 delay(factor);
 count++;
 factor -= 10;
 }
 while(count < 80) {
 digitalWrite(led, HIGH); 
 delay(factor);
 digitalWrite(led1, HIGH); 
 delay(factor);
 digitalWrite(led2, HIGH); 
 delay(factor);
 digitalWrite(led3, HIGH); 
 delay(factor);
 digitalWrite(led4, HIGH); 
 delay(factor);
 digitalWrite(led, LOW);
 delay(factor);
 digitalWrite(led1, LOW);
 delay(factor);
 digitalWrite(led2, LOW);
 delay(factor);
 digitalWrite(led3, LOW);
 delay(factor);
 digitalWrite(led4, LOW);
 delay(factor);
 count++;
 }
 while(count < 97) {
 digitalWrite(led4, HIGH); 
 delay(factor);
 digitalWrite(led3, HIGH); 
 delay(factor);
 digitalWrite(led2, HIGH); 
 delay(factor);
 digitalWrite(led1, HIGH); 
 delay(factor);
 digitalWrite(led, HIGH); 
 delay(factor);
 digitalWrite(led4, LOW);
 delay(factor);
 digitalWrite(led3, LOW);
 delay(factor);
 digitalWrite(led2, LOW);
 delay(factor);
 digitalWrite(led1, LOW);
 delay(factor);
 digitalWrite(led, LOW);
 delay(factor);
 count++;
 factor += 10;
 }
 while(count < 100) {
 digitalWrite(led4, HIGH); 
 digitalWrite(led3, HIGH); 
 digitalWrite(led2, HIGH); 
 digitalWrite(led1, HIGH); 
 digitalWrite(led, HIGH); 
 delay(200);
 digitalWrite(led4, LOW);
 digitalWrite(led3, LOW);
 digitalWrite(led2, LOW);
 digitalWrite(led1, LOW);
 digitalWrite(led, LOW);
 delay(200);
 count++;
 }
 factor = 200;
 count = 0;
}

Credits

Brent Chapman

Brent Chapman

1 project • 0 followers
Infosec professional with a woodworking shop, CNC machine, 3D printer and electronics bench.

Comments