Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Stephen Harrison
Published © CC BY

Death Star Status Indicator

Show the status of your Death Star with this Death Star indicator.

IntermediateFull instructions provided2 hours983
Death Star Status Indicator

Things used in this project

Hardware components

Photon
Particle Photon
×1
Adafruit NeoPixel Ring 16 x 5050
×2
Death Star Mood Lamp
×1
M3 Machine Screw
×2
NXP BSS138
×1
Resistor 1K (1206)
×1
Resistor 620R (1206)
×1
Capacitor 1000uF 16V Through Hole
×1
Capacitor 1uF (0805)
×1
Terminal Block - 2 Pin
×1
Molex - 3 Pin
×1
Molex - 3 Pin - Receptacle
×1
Molex crimp
×3

Software apps and online services

IFTTT - Particle Channel
Tinamous.com
Particle.io

Story

Read more

Custom parts and enclosures

Inner structure mount for NeoPixels and ThingyStick PCB

Print on 3D printer. Attach NeoPixels and PCB.

Base washer

Base washer to provide support for bolt to hold inner structure

Schematics

ThingyStick - NeoPixel

PCB for Photon NeoPixel driver.

ThingyStick - NeoPixel driver schematic

V1.00 schematic. This version needs the FETs (Q1,Q2) replaced with proper level shifting to ensure correct timing.

ThingyStick - NeoPixel driver PCB

Schematic PDF

ThingySticks NeoPixel Stick Schematic as .pdf

PCB All Layers - PDF

PCB All Layers - PDF

ThingySticks NeoPixel Stick PCB - All Layers as .pdf

PCB Top Layer - PDF

PCB Bottom Layer - PDF

Code

Photon Code

Arduino
Paste into Build.Particle.io, add reference to the NeoPixel library and flash to the Photon.
// This #include statement was automatically added by the Particle IDE.
#include "neopixel/neopixel.h"

#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel circle = Adafruit_NeoPixel(32, D3, PIXEL_TYPE);

// Particle functions
int setAlert(String command);
int setClear(String command);
int rainbow(String command);
int setLedsOff(String command);

bool showRainbow = false;
bool alertTop = false;
bool alertBottom = false;
bool ledsOff = false;

void setup()
{
  circle.begin();
  circle.show();
  
  Particle.function("setAlert", setAlert);
  Particle.function("setClear", setClear);
  Particle.function("rainbow", rainbow);
  Particle.function("setLedsOff", setLedsOff);
  Particle.publish("Status", "Deathstart online. V1.1.0");
 }

void loop()
{
  //rainbow(10);
  if (!ledsOff) {
      if (alertTop) {
          setTop(255,0,0);
      } else {
          setTop(0,255,0);
      }
      
      if (alertBottom) {
          setBottom(255,0,0);
      } else {
          setBottom(0,255,0);
      }
      
      if (showRainbow) {
          rainbow(50);
      }
  } else {
      setTop(0,0,0);
      setBottom(0,0,0);
  }
  
  delay(1000);
}

void setTop(int r, int g, int b) {
    for(int i=16; i<circle.numPixels(); i++) {
      circle.setPixelColor(i,r,g,b);
    }
    circle.show();
}

void setBottom(int r, int g, int b) {
    for(int i=0; i<16; i++) {
      circle.setPixelColor(i, r,g,b);
    }
    circle.show();
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<circle.numPixels(); i++) {
      circle.setPixelColor(i, Wheel((i+j) & 255));
    }
    
    circle.show();
    delay(wait);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return circle.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return circle.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return circle.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

////////////////////////////////////////////////////////////////////////
// Particle functions
////////////////////////////////////////////////////////////////////////
int setAlert(String command) {
    showRainbow = false;
    
    if (command == "Top") {
         alertTop = true;
         return 1;
    } else if (command == "Bottom") {
        alertBottom = true;
        return 2;
    } else {
        alertTop = true;
        alertBottom = true;
        return 3;
    }
    
    return 0;
}

int setClear(String command) {
    showRainbow = false;
    
    if (command == "Top") {
        alertTop = false;
        return 1;
    } else if (command == "Bottom") {
        alertBottom = false;
        return 2;
    } else {
        alertTop = false;
        alertBottom = false;
        return 3;
    }
    
    return 0;
}

int rainbow(String command) {
    showRainbow = true;
    return 1;
}

int setLedsOff(String command) {
    showRainbow = false;
    ledsOff = true;
    return 1;
}

Inner Structure OpenSCAD file

SCAD
Load into OpenSCAD and edit as needed.
neopixelInner = 31.8; // 31.6mm
neopixelOuter = 45;

difference() {
    union() {

        // NeoPixel mount
        cylinder(d=neopixelInner, h=14);

        translate([0,0,5]) {
            cylinder(d=neopixelOuter, h=4);
        }

        // Connection cylinder
        translate([0,0,14]) {
            cylinder(d=16, h=80);
        }

        // mount for the photon board
        translate([-6.5,3,14]) {
            cube ([13, 5,70]);
        }
    }
    union() {

        // hole for the photon mount
        translate([0,9,91-22]) {
            rotate([90,0,0]) {
                #cylinder(d=2.6, h=10, $fn=20);
            }
        }
        
        // Hole to hold the structure
        translate([0,0,85]) {
            #cylinder(d=2.6, h=10, $fn=20);
        }
    }
}

Washer OpenSCAD

SCAD
$fn=80;


difference() {
    union() {

        // NeoPixel mount
        cylinder(d=30, h=8);
    }
    union() {
        cylinder(d=3.5, h=4);
        translate([0,0,4]) {
            cylinder(d=7, h=5);
        }
    }
}

Credits

Stephen Harrison
18 projects • 51 followers
Founder of Tinamous.com, software developer, hardware tinkerer, dyslexic. @TinamousSteve
Thanks to Adafruit.

Comments