Harry Vader's fully armed and operational Elder Light Saber Wand 3d model
3dmdb logo
GrabCAD
Harry Vader's fully armed and operational Elder Light Saber Wand

Harry Vader's fully armed and operational Elder Light Saber Wand

by GrabCAD
Last crawled date: 1 year, 11 months ago
This is an iteration of a previous design that is printed with hollow parts to allow the installation of electronics. There is a 9 volt battery, power switch, keyboard key switch (Cherry brand), dual red/blue LED, and an Arduino Pro Mini (5VDC) tucked inside. I posted a video on YouTube on how to safely operate the wand/saber without casting spells on yourself or lopping off your own arm. (see below)

Update : added files for a roomier handle with a threaded pommel - a sturdier seal and more room for the electronic doohickeys.

Attributions :
Adriano Cazzarotto : RGB LED : https://grabcad.com/library/led-rgb-5mm-1

Pamir : Arduino Pro Mini : https://grabcad.com/library/arduino-pro-mini-1

Oliver Darvas : 9 Volt Battery : https://grabcad.com/library/9-volt-battery-2

Kevin Yu : Cherry Switch : https://grabcad.com/library/cherry-mx-switches-mx-1

Mini Switch resized from a McMaster Carr item.

B.O.M. :

Power switch : http://www.microcenter.com/product/465454/miniature-snap-in-nylon-illuminated-rocker---red-switch

Arduino Pro Mini (5VDC logic) : http://www.microcenter.com/product/486546/arduino-pro-mini-board

Dual LED : http://www.microcenter.com/product/390134/led---dual-color-5mm-super-fresh-red-super-blue-3-pack

Cherry switch : https://www.amazon.com/gp/product/B077TK5DL9/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

Keycaps (not exact match) : https://www.amazon.com/gp/product/B077C287J2/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

9 Volt Battery Leads : http://www.microcenter.com/product/497120/9v-battery-clip

Super-Duper Glue : https://www.amazon.com/Bob-Smith-Industries-BSI-157H-Insta-Set/dp/B0166FFCHS/ref=sr_1_1_sspa?s=industrial&ie=UTF8&qid=1535459641&sr=1-1-spons&keywords=bob+smith+industries&psc=1

You'll also need one 10K pull down resistor for the push button input on the Pro Mini, and two 1K resistors for the LEDs.

Assembly and Programming :

Started assembly by gluing in the dual LED into the 'silencer' part (prewired with 1K resistors in line with positive leads). Fed the wires through the barrel and glued the barrel to the silencer. Glued the Cherry switch into the trigger part (prewired) and then glued the barrel to the trigger assembly. The little power switch in the handle just snaps in (prewired) and the handle is then glued to the trigger. All the electronics are then wired together and stuffed into the handle (after programming the arduino). The pommel is a snap in fit to finish.


Update : added a new version of the handle and pommel with threads. This handle allows more room for the electronics (yay!).

Update : added code for 3-color LED wand with 6 modes. This program cycles through the six modes each time you press the cherry switch, and the light show is always active - no timeout. I found out that the mini regards high and low states as opposite the voltage being applied to the inputs, which is irritating, but it's not a show-stopper so I left the code as-is. As a result, the wand will wake up in mode 1 instead of mode 0 - no biggie, but there it is.

Update : added basic schematic for 3-color LED version. Note that the 3-color LED has positive 5VDC as the common lead, unlike the dual color LED. You'll have to confirm the polarities on whatever LEDs that you use.

The following arduino code has two flavors - one for a dual-color LED and one for a 3-color LED. Use only one or the other - the code is clearly separated between the two.

Arduino Pro Mini Program for dual-color LED:

//harryVader.ino
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 9; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
const int blueLed = 6;
const int redLed = 5;
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
int buttonCount = 0;
int x = 0;
int buttonPressed = 0;
int buttonOff = 0;
int loopCount0 = 0;
int loopCount1 = 0;
int loopCount2 = 0;
int loopCount3 = 0;




// Setup function runs once when you press reset or power the board
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(ledPin, OUTPUT);
pinMode(blueLed, OUTPUT);
pinMode(redLed, OUTPUT);
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}



// MAIN LOOP function runs over and over again forever

void loop()
{
// read the state of the pushbutton value:

buttonState = digitalRead(buttonPin);
digitalWrite(ledPin,buttonState);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if ((buttonState == LOW) and (buttonPressed == 0))
{
buttonPressed = 1;
buttonOff = 0;
//buttonCount = buttonCounter(x);
buttonCount++;
if (buttonCount > 3)
{
buttonCount = 0;
Serial.println("Button counter reset!");
}

//Set loopCounters
if (buttonCount == 0)
{
loopCount0 = 255;
loopCount1 = 0;
loopCount2 = 0;
loopCount3 = 0;
}
if (buttonCount == 1)
{
loopCount0 = 0;
loopCount1 = 40;
loopCount2 = 0;
loopCount3 = 0;
}
if (buttonCount == 2)
{
loopCount0 = 0;
loopCount1 = 0;
loopCount2 = 20;
loopCount3 = 0;
}
if (buttonCount == 3)
{
loopCount0 = 0;
loopCount1 = 0;
loopCount2 = 0;
loopCount3 = 60;
}
Serial.println("Button pressed...");
Serial.print("number of button pushes: ");
Serial.println(buttonCount);
delay(60);

}

//Set button-OFF flag when button is released

if ((buttonState == HIGH) and (buttonOff == 0))
{
buttonPressed = 0;
buttonOff = 1;
Serial.println("Button is OFF...");
delay(60);
}

//Reset Loop Counters
if (buttonCount != 0)
{
loopCount0 = 0;
}
if (buttonCount != 1)
{
loopCount1 = 0;
}
if (buttonCount != 2)
{
loopCount2 = 0;
}
if (buttonCount != 3)
{
loopCount3 = 0;
}

//Mode Zero
if (loopCount0 > 0)
{
analogWrite(blueLed, loopCount0);
analogWrite(redLed, (255-loopCount0));
delay(70); // wait for a second
//analogWrite(blueLed, (255-loopCount0));
//analogWrite(redLed, loopCount0);
//delay(10);
loopCount0 = (loopCount0-5);
if (loopCount0 != 0)
{
Serial.print(loopCount0);
Serial.print(" ");
}
else
{
Serial.println(loopCount0);
}
}

//Mode One
if (loopCount1 > 0)
{
digitalWrite(blueLed, HIGH);
digitalWrite(redLed, LOW);
delay(18); // wait for a second
digitalWrite(blueLed, LOW);
digitalWrite(redLed, HIGH);
delay(18);
--loopCount1;
if (loopCount1 != 0)
{
Serial.print(loopCount1);
Serial.print(" ");
}
else
{
Serial.println(loopCount1);
}
}

//Mode Two
if (loopCount2 > 0)
{
digitalWrite(blueLed, HIGH);
digitalWrite(redLed, LOW);
delay(100); // wait for a second
digitalWrite(blueLed, LOW);
digitalWrite(redLed, HIGH);
delay(100);
--loopCount2;
if (loopCount2 != 0)
{
Serial.print(loopCount2);
Serial.print(" ");
}
else
{
Serial.println(loopCount2);
}
}

//Mode Three
if (loopCount3 > 0)
{
digitalWrite(blueLed, HIGH);
digitalWrite(redLed, HIGH);
delay(10); // wait for a second
digitalWrite(blueLed, LOW);
digitalWrite(redLed, LOW);
delay(20);
--loopCount3;
if (loopCount3 != 0)
{
Serial.print(loopCount3);
Serial.print(" ");
}
else
{
Serial.println(loopCount3);
}
}


//Turn OFF LEDs if all loopCounters are zeroed

if ((loopCount1 == 0) and (loopCount2 == 0) and (loopCount3 == 0))
{
//digitalWrite(ledPin, LOW);
digitalWrite(redLed, LOW);
digitalWrite(blueLed, LOW);
//delay(30);
}
// end main loop
}



-----------------------------------------------

















Program for 3-color 6-mode wand :

//darthPotter_01.ino
// constants won't change. They're used here to set pin numbers:
const int ledPin = 13; // the number of the LED pin
const int buttonPin = 3; // the number of the pushbutton pin
const int redLed = 11;
const int greenLed = 10;
const int blueLed = 9;
// variables will change:
int x = 0;
int redBrightness = 0; // how bright the red LED is
int greenBrightness = 0; // how bright the green LED is
int blueBrightness = 0; // how bright the blue LED is
int fadeAmount = 3; // how many points to fade the LED by
int buttonState = 0; // variable for reading the pushbutton status
int buttonCount = 0;
int buttonPressed = 0;
int buttonOff = 0;
int loopCount = 0;

//modeLocks are for one-shot code
int modeLock0 = 0;
int modeLock1 = 0;
int modeLock2 = 0;
int modeLock3 = 0;
int modeLock4 = 0;
int modeLock5 = 0;

// Setup function runs once when you press reset or power the board
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(ledPin, OUTPUT);
pinMode(blueLed, OUTPUT);
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);

pinMode(buttonPin, INPUT);

analogWrite(redLed, 255);
analogWrite(blueLed, 255);
analogWrite(greenLed, 255);

Serial.begin(9600);
delay(1500);
}



// MAIN LOOP function runs over and over again forever

void loop(){

// read the state of the pushbutton value:

buttonState = digitalRead(buttonPin);
// output to on board led
digitalWrite(ledPin,buttonState);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if ((buttonState == LOW) and (buttonPressed == 0))
{
buttonPressed = 1;
buttonOff = 0;
buttonCount++;
loopCount=0;
Serial.println(buttonCount);
if (buttonCount > 5)
{
buttonCount = 0;
Serial.println("Button counter reset!");
}
Serial.println("Button pressed...");
Serial.print("number of button pushes: ");
Serial.println(buttonCount);
delay(60);
}
//Set button-OFF flag when button is released

if ((buttonState == HIGH) and (buttonOff == 0))
{
buttonPressed = 0;
buttonOff = 1;
Serial.println("Button is OFF...");
delay(60);
}

//begin mode 0
//all lights on - zero is full ON
if (buttonCount == 0 && modeLock0 == 0){

//unlock mode 5
if (modeLock5==1){
modeLock5=0;
}

if (redBrightness>0){
redBrightness=0;
}
if (greenBrightness>0){
greenBrightness=0;
}
if (blueBrightness>0){
blueBrightness=0;
}
analogWrite(redLed, redBrightness);
analogWrite(greenLed, greenBrightness);
analogWrite(blueLed, blueBrightness);
modeLock0 = 1;
//delay(60);
}

// begin mode 1

if (buttonCount == 1){

//unlock mode 0
if (modeLock0==1){
modeLock0 = 0;
}
//initialize mode 1
if (modeLock1 == 0){
loopCount = 0;
fadeAmount = 5;
redBrightness = 0;
greenBrightness = 0;
blueBrightness = 0;
modeLock1 = 1;

}
// set the brightness of redLed
analogWrite(redLed, redBrightness);
//Serial.print(redBrightness);

// change the brightness for next time through the loop:
redBrightness = redBrightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (redBrightness <= 0 || redBrightness >= 255) {
fadeAmount = -fadeAmount;
}

if (redBrightness == 80) {
analogWrite(blueLed, 120);
}
else{
analogWrite(blueLed, 255);
}

if (redBrightness == 180) {
analogWrite(blueLed, 160);
}
else{
analogWrite(blueLed, 255);
}

if (redBrightness == 230) {
analogWrite(greenLed, 120);
}
else{
analogWrite(greenLed, 255);
}
if (redBrightness == 60) {
analogWrite(greenLed, 160);
}
else{
analogWrite(greenLed, 255);
}
// wait for 20 milliseconds to see the dimming effect
delay(20);

}
// end mode 1

// begin mode 2

if (buttonCount == 2){

//unlock mode 1
if (modeLock1 == 1){
modeLock1 = 0;
}
//initialize mode 2
if (modeLock2 == 0){
loopCount = 0;
fadeAmount = 5;
redBrightness = 0;
greenBrightness = 0;
blueBrightness = 0;
modeLock2 = 1;

}

// set the brightness of greenLed
analogWrite(greenLed, greenBrightness);
//Serial.print(redBrightness);

// change the brightness for next time through the loop:
greenBrightness = greenBrightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (greenBrightness <= 0 || greenBrightness >= 255) {
fadeAmount = -fadeAmount;
}

if (greenBrightness == 80) {
analogWrite(blueLed, 120);
}
else{
analogWrite(blueLed, 255);
}

if (greenBrightness == 180) {
analogWrite(blueLed, 160);
}
else{
analogWrite(blueLed, 255);
}

if (greenBrightness == 230) {
analogWrite(redLed, 125);
}
else{
analogWrite(redLed, 255);
}
if (greenBrightness == 60) {
analogWrite(redLed, 165);
}
else{
analogWrite(redLed, 255);
}
// wait for 20 milliseconds to see the dimming effect
delay(20);

}
// end mode 2

// begin mode 3

if (buttonCount == 3){

//unlock mode 2
if (modeLock2 == 1){
modeLock2 = 0;
}
//initialize mode 3
if (modeLock3 == 0){
loopCount = 0;
fadeAmount = 5;
redBrightness = 0;
greenBrightness = 0;
blueBrightness = 0;
modeLock3 = 1;

}

// set the brightness of blueLed
analogWrite(blueLed, blueBrightness);

// change the brightness for next time through the loop:
blueBrightness = blueBrightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (blueBrightness <= 0 || blueBrightness >= 255) {
fadeAmount = -fadeAmount;
}

if (blueBrightness == 80) {
analogWrite(redLed, 120);
}
else{
analogWrite(redLed, 255);
}

if (blueBrightness == 180) {
analogWrite(redLed, 160);
}
else{
analogWrite(redLed, 255);
}

if (blueBrightness == 230) {
analogWrite(greenLed, 125);
}
else{
analogWrite(greenLed, 255);
}
if (blueBrightness == 60) {
analogWrite(greenLed, 165);
}
else{
analogWrite(greenLed, 255);
}
// wait for 20 milliseconds to see the dimming effect
delay(20);

}
// end mode 3

// begin mode 4 ramp up and down with overlap

if (buttonCount == 4){


//unlock mode 3
if (modeLock3 == 1){
modeLock3 = 0;
}

//initialize mode 4
if (modeLock4 == 0){
loopCount = 0;
fadeAmount = 5;
redBrightness = 0;
greenBrightness = 0;
blueBrightness = 255;
modeLock4 = 1;

}

loopCount++;
if (loopCount>=307){
loopCount=0;
}

//ramp red up
if (loopCount < 52){
if (redBrightness < 255){
redBrightness = redBrightness + fadeAmount;
}
analogWrite(redLed, redBrightness);
}

//ramp blue down
if (loopCount > 51 && loopCount < 103){
if (blueBrightness>=fadeAmount){
blueBrightness = blueBrightness - fadeAmount;
}
analogWrite(blueLed, blueBrightness);
}

//ramp green up
if (loopCount > 102 && loopCount < 154){
if (greenBrightness<255){
greenBrightness = greenBrightness + fadeAmount;
}
analogWrite(greenLed, greenBrightness);
}

//ramp red down
if (loopCount > 153 && loopCount < 205){
if (redBrightness>=fadeAmount){
redBrightness = redBrightness - fadeAmount;
}
analogWrite(redLed, redBrightness);
}

//ramp blue up
if (loopCount > 203 && loopCount < 256){
if (blueBrightness<255){
blueBrightness = blueBrightness + fadeAmount;
}
analogWrite(blueLed, blueBrightness);
}

//ramp green down
if (loopCount > 254 && loopCount < 307){
if (greenBrightness>=fadeAmount){
greenBrightness = greenBrightness - fadeAmount;
}
analogWrite(greenLed, greenBrightness);
}


delay(20);

}
// end mode 4

// begin mode 5 flash fast in sequence

if (buttonCount == 5){

//unlock mode 4
if (modeLock4 == 1){
modeLock4 = 0;
}

loopCount++;
if (loopCount >= 30){
loopCount = 0;
}

//turn red on
if (loopCount < 15){
analogWrite(redLed, 255);
}
else{
analogWrite(redLed, 0);
}

//turn green on
if (loopCount > 9 && loopCount < 25){
analogWrite(greenLed, 255);
}
else{
analogWrite(greenLed, 0);
}

//turn blue on
if (loopCount > 19 || loopCount < 5){
analogWrite(blueLed, 255);
}
else{
analogWrite(blueLed, 0);
}
delay(5);

}
// end mode 5


}

// end main loop

Tags