Arduino Lightsaber

Ohh bam found this, somewhere in Step 15 I believe it shows the commands
for switch triggering PWM color changes. Please note, its the last step, so understanding
what is before it would help your comprehension!!!

Beginner Arduino Primer

I have already picked out the colors I want from playing around with this site:

RGB Color Codes Chart

Nice DFPlayer Mini MP3-TF-16P tutorial

Arduino - Test DFPlayer Mini MP3 Module

Note he also he has a remote phone control colors primer too.

Battery replacement in V1 Predates TIE Chassis concept.

billpealer: Battery replacement in V1 Predates TIE Chassis concept.

https://youtu.be/eZC2iCyDKdg

Selling it, Bill? Looks like a how-to for an end user.

Im having issues with controlling the playback of sounds on the WT588D. Is there a code solution that would allow a sound to play and keep playing as long as a button was HIGH but stopped that sound as soon as the button went LOW? (or vise versa). I guess what i really need to know is how to trigger a sound from outside the main loop.

currently my AUX button (the one for the ‘lockup’) constantly restarts the sound over and over.
im running the WT in one-line serial mode. Do i need to have the WTs BUSY pin wired to make that work?

here is the code im using for the button.

const int WT588D_SDA = 9; //Module pin “P03” or pin # 10
const int AUX_BUTTON = 1;
const int BLADE_LED_AUX = 5; // led for flashes

int aux = 0; // variable for reading the pushbutton status

void setup() {
Serial.begin(9600);
// initialize the LED pin as an output:
pinMode(BLADE_LED_AUX, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(AUX_BUTTON, INPUT_PULLUP);
pinMode(WT588D_SDA, OUTPUT);
digitalWrite(WT588D_SDA, HIGH);
}

void loop() {
// read the state of the pushbutton value:
aux = digitalRead(AUX_BUTTON);

// check if the pushbutton is pressed.
// if it is, the state of the button is LOW:
if (aux == LOW) {
// turn LED on:
digitalWrite(BLADE_LED_AUX, HIGH);
WT588D_SendAudio (0x07);
Serial.println(“LED_ON”);
} else {
// turn LED off:
digitalWrite(BLADE_LED_AUX, LOW);
Serial.println (“LED_OFF”);
}
}

void WT588D_SendAudio(byte addr){

digitalWrite(WT588D_SDA, LOW);
delay(5);
for(int i = 0; i < 8; i++) {
digitalWrite(WT588D_SDA, HIGH);
if bitRead(addr,i) {
delayMicroseconds(600);
digitalWrite(WT588D_SDA, LOW);
delayMicroseconds(200);
}
else {
delayMicroseconds(200);
digitalWrite(WT588D_SDA, LOW);
delayMicroseconds(600);
}
}
digitalWrite(WT588D_SDA, HIGH);
delay(10);

}

Anybody have suggestions?

auxbuttontest.ino.ino (1.39 KB)

JakeSoft: Selling it, Bill? Looks like a how-to for an end user.

nope. not selling it. syntax error. I sold it. if you love it, let it go. After I made my first TCSS with a Hasbro sound board, i discovered this thread days later. So i sold that saber. It was on ebay for 17 hours before being picked up. Now the goal was to sell the first couple.. to break even on the main 2 that i keep for myself. The real difficulty was to get the V1 to a point were it was durable, reliable, and sexy enough for sale. took a couple tear downs, re-soldering, re epoxying. But i got it. A major hurdle was figuring out how to take it apart and put it back together with out twisting the wires to oblivion. it finally occurred to me,. start with the blade holder, and work down. perfect. I did the same for my vintage BMX's. Refurb a couple.. sell em. pay for the good ones. Hobbyists often say things like "it's an expensive hobby, you get what you pay for." Or "It's a Hobby, no one ever said it would be cheap." I say,.. you gotta invest to make money. Do it right and you'll never have to pay a cent for a hobby again. or pay waaaaaay less than most. Helps to be a bit of a MacGyver. My next set will be a semi matching sith / jedi dueling pair. then no more selling. Just my Brass super saber. anyone have a chunk of brass tube with an ID of 1.5"?

My next obsession will most likely be a light sensing optic with relay, to toggle tween my grid tied solar panels and my battery back up. Right now it is on a 220v Jacuzzi timer, and if it was light based instead of time based, it would be more efficient.

grey3Dx: Im having issues with controlling the playback of sounds on the WT588D. Is there a code solution that would allow a sound to play and keep playing as long as a button was HIGH but stopped that sound as soon as the button went LOW? (or vise versa). I guess what i really need to know is how to trigger a sound from outside the main loop.

currently my AUX button (the one for the 'lockup') constantly restarts the sound over and over. im running the WT in one-line serial mode. Do i need to have the WTs BUSY pin wired to make that work?

Anybody have suggestions?

i would change the code to use a bool (love that Jake). and push the button for Send_Sound_Command followed b a loop command,..

second button push for turn off.

The only reason i rec that, is because i know how to do it, and know that it would work. not because it is better.

Hey Jakesoft, have you ever tried using buckpucks with an arduino for your lightsaber? I am thinking about going to the 7.4V battery so I can power the DFPlayer and didn't want to fry my leds

DJWing79: Hey Jakesoft, have you ever tried using buckpucks with an arduino for your lightsaber? I am thinking about going to the 7.4V battery so I can power the DFPlayer and didn't want to fry my leds

Nope, never tried it. I always thought they were too expensive for what they are, but I'd think you are more likely to fry your LEDs using direct drive with a FET the way I do it than you would with a buck-puck that will limit current on it's own.

I have a 700 ma buckpuck that I am going to test this weekend. it has a pin for control, which I believe goes to the arduino pin so it's a regulator and fet....I think....

DJWing79: I have a 700 ma buckpuck that I am going to test this weekend. it has a pin for control, which I believe goes to the arduino pin so it's a regulator and fet....I think....

The higher-end Plecter Lab boards also have a current regulator for the main LED drive, but it's all integrated on their quite small boards, so I guess current regulation can be done with a smaller form factor than a buckpack, but alas I do not know how this feature on them boards work... I'm now going into the direction of using a single 3.7V supply and try to supply the Arduino board with a DC-DC pushing up the voltage from 3.7V to 5V.

As to the DFPlayer, I still did not give up to make it work from 3.7V battery, but I need a couple of days more to try it out. But in the meantime, please do try the buckpuck, it's one more piece of HW this community evaluates and that enriches the work of us all!

DJWing79: I have a 700 ma buckpuck that I am going to test this weekend. it has a pin for control, which I believe goes to the arduino pin so it's a regulator and fet....I think....

i don't think it works like that. be carefull. the default way this thing works is a Vin = Vout. as the cut sheet states AND TCSS explains, 7v in would drive 1 Luxeon 3.4v LED at 700ma. more Vin would bring it up. 7.4 ,.. 8.2v. most fully charged liths push 4.1 or 4.2v when the charger cuts out. that would be 8.4v. i think that would make the buck push 5v to the LED at 700ma. you may not fry the LED off the bat, but it will die sooner than it should. i think some buckpucks have PWM control. make sure you got that one. Some have analog (potentiometer) some have digital control for strobe, and on/off. i think by trade it is called "PWM dimming". Google "PWM dimming Luxdrive" . you know,... or not. i often need to bench test, because reading has proven just wrong. hence driving a blue luxeon from a single lith with NO RESISTOR whatsoever. and it looks fine, works perfect. no where on the googles did it say that was a thing. but it is.

billpealer: i don't think it works like that. be carefull. the default way this thing works is a Vin = Vout. as the cut sheet states AND TCSS explains, 7v in would drive 1 Luxeon 3.4v LED at 700ma. more Vin would bring it up. 7.4 ,.. 8.2v. most fully charged liths push 4.1 or 4.2v when the charger cuts out. that would be 8.4v. i think that would make the buck push 5v to the LED at 700ma. you may not fry the LED off the bat, but it will die sooner than it should. i think some buckpucks have PWM control. make sure you got that one. Some have analog (potentiometer) some have digital control for strobe, and on/off. i think by trade it is called "PWM dimming". Google "PWM dimming Luxdrive" . you know,... or not. i often need to bench test, because reading has proven just wrong. hence driving a blue luxeon from a single lith with NO RESISTOR whatsoever. and it looks fine, works perfect. no where on the googles did it say that was a thing. but it is.

He might be OK insofar as he won't cook anything. I seem to remember from an electronics course I took some years ago that it's not voltage that fries things, it's current. If the buck puck is limiting current to be within spec of the LED then the input voltage doesn't really matter as long as he is keeping it within the spec of what the buck puck can handle.

If the buck-puck says it can take 5V to 12V and will regulate current to 700ma, then you should be able to supply anything in that range and it'll still put out exactly 700ma and not fry the LED.

JakeSoft: He might be OK insofar as he won't cook anything. I seem to remember from an electronics course I took some years ago that it's not voltage that fries things, it's current. If the buck puck is limiting current to be within spec of the LED then the input voltage doesn't really matter as long as he is keeping it within the spec of what the buck puck can handle. If the buck-puck says it can take 5V to 12V and will regulate current to 700ma, then you should be able to supply anything in that range and it'll still put out exactly 700ma and not fry the LED.

Tho i must admit i have no class to fall back on... (i'll just softball that one in) I think it's BOTH man. Power... ie. heat,.. 100 watts is 100watts no matter if its the V or A that gets you there.

Pretty sure Watts will fry it. which is why LEDs are rated in watts. 3.4v and 900ma LED is a 3W LED. 5.1v and 900ma -a 5W LED (they make em) 3.4v and 700ma is under powered for a Blue Rebel, by a tad,.. 5+v and 700ma is 3.6 Watts,.. yeah it may not fry it,. but it will almost surely reduce its life cycle, and maybe even REDUCE its lumens due to temp. more temp = more resistance. more resistance = less current drawn. less current = less lumens.. viscous cycle. I think diodes fry on watts,.. BUT still need the min voltage to traverse the diode (i think). so a 3w blue rebel 2.5v and 10 amp,.. will not fry it. And i may be wrong. there is prolly more than one "type" of damage. 3v and 2 amp will,. or soon will. or will cut the life by half,.. Anyone willing to cook an LED to find out?

i for one like to ruin stuff just to know what the real deal is. anyone want to donate an LED? for example.. i know 3.65v and 750ma is darn bright on the Blue Rebel, and had it going to 5 min with no damage to report. but i could not get PWM control with said LED buck driver. i got one coming in the mail tho! 3.65v and .75A is well under the 3W rating of the blue rebel.

Hello fellow builders,

I have been following this thread with great interest and decided to equip my homebuild saber with sound (finaly).
Received parts yesterday so i can start building…

My question to JakeSoft, have you ever posted your your completed arduino code (with 335 swing sensor)?

I saw a video where with a specific model of buck-puck ( 3023-D-E-1000) you can drive an LED at 1000 ma and use the PWM pin from arduino connected to its control pin (on the buck) to dim the LED up and down. I need to find my second 3.7v battery to test...will let you know. btw, the blade test on the 3D printed holder worked! It was just the holder and a small handle piece, but with 100% infill around the threads (and a little before and after to absorb shock) and 35% infill for the rest of the unit, it held up to many many hard hits..i'd post pics but the problem I had was I made the diameter of where the blade goes in too loose so I had a little bit of a wobble and I forgot to grease the threads so I can't unscrew it now...dang it's tight! Once I have the electronics dimensions set, I will know how big to make my sled and then from there how big my minimums need to be for the saber and then will print out a true test saber and will take lots of pics and maybe a video for you guys. Simplify3D for the win....just make sure you turn off retraction....found that out the hard way.

wailer: Hello fellow builders,

I have been following this thread with great interest and decided to equip my homebuild saber with sound (finaly). Received parts yesterday so i can start building...

My question to JakeSoft, have you ever posted your your completed arduino code (with 335 swing sensor)?

LOL. spoiler alert.

DJWing79: I saw a video where with a specific model of buck-puck ( 3023-D-E-1000) you can drive an LED at 1000 ma and use the PWM pin from arduino connected to its control pin (on the buck) to dim the LED up and down. I need to find my second 3.7v battery to test...will let you know.

word. thanks. pwm will surely drop the vf. if that is the same model I read on. pwm 100% = full off 0 volts. make sure you don't think it's the opposite like a MOSFET.

wailer: Hello fellow builders,

I have been following this thread with great interest and decided to equip my homebuild saber with sound (finaly). Received parts yesterday so i can start building...

My question to JakeSoft, have you ever posted your your completed arduino code (with 335 swing sensor)?

I prefer to teach people how to fish.

JakeSoft: I prefer to teach people how to fish.

all fainess. this is a gallery thread. you never had to do anything after you dropped the mic. all the stuff you got going on with your led color mixing, menus, and audio is insane. I almost went all in and tried the mkIII clone. then I thought... Obiwan never changed colors, all clash is yellow or white flash in the films and sound is not tunable on these mystical weapons . good enough for me. and my expectations got managed just right.

still waiting for you (anyone) to teach me what the hell the WT int i++ code means. my arduino book says it is some progressing increment of some sort. maybe or can you at least translate it to English?. is the 8 arbitrary? etc... does it run just once? I am thinking it does. just whats in the loop runs over and over. right? or is every Wtsendcommand() running that bit? can the arduino really send data in micro seconds?

Dutch proverb: Better steal something that is good than create something that is bad. ;)

My local fish shop sells better fish than i could ever catch...