Go Down

Topic: Arduino Lightsaber (Read 407743 times) previous topic - next topic

Protonerd

how's the brightness? heat? seams like 3500ma in the space where normally one LED lives is,..  cozy. tgtbt.
So far no issues, but it sits on a sizable heat sink. As far as the max current is concerned, you probably never ever want to turn on all the LEDS at the same time with max current, anyway the brightness gain at half current and full is not that big.

I only have sporadic problems with the red die, I have a single protected 3.7V 18650 and occasionally my red config with blue FoC leads to a kind of reset, I assume from the protection circuitry, although the current of the red is rated 700mA (out of my head)? Blue and Green based configs do not experience this and the White one I do not use at all.

jshaw

For those of you using clash and swing sensors (not accellerometers), what orientation do you use? Do you use multiple swing sensors? 

In my head, there should be one swing sensor that is vertical, and the clash sensor should be horizontal, facing perpendicular to the user. 

billpealer

#572
Jan 26, 2016, 09:23 pm Last Edit: Jan 27, 2016, 05:21 am by billpealer
For those of you using clash and swing sensors (not accellerometers), what orientation do you use? Do you use multiple swing sensors? 
I found that 2 sensors in a cross and both 45 deg off of the horizontal and vertical axis (tipped forward 45 deg) works best.  when perfect vertical,.. the swing wont trigger till the saber is almost 180 degrees flat.  and a sensor perfectly horizontal, is too hard for the roller ball to rest at a state, so you may be holding the saber perfectly up and down, but the swing sound is going ape $h!t. this will give you triggers on swings, rolls, positions and guard change, and spins.


I also did it like that to keep space tight. they are epoxied together. and then hot glued to the mass of parts in the hilt nerve center.

i have them in parallel on one pin. putting them on 2 pins did very little for sensitivity and accuracy. i use debounce switch code,.. so the roller ball can't fidget for less than 50 ms, and every swing command has a 200 ms delay.

billpealer

#573
Jan 26, 2016, 09:59 pm Last Edit: Jan 27, 2016, 04:15 pm by billpealer
Diagram for  1 CR123A batt No LED driver, no PWM, no regulators,. and blue or Green 3W LEDs.  SW-200 swing sensors.  Just a reminder, back in December, this was almost the exact set up being recommended by Jake for first time builds. He was into PWM color mixing/fading.   In all honestly.  FoC is probably cooler when using it.  For show, blade growth and recessions is neat.  when dueling it is ornate at best.  but for marketability, blade emission seems to be pretty important.

Kdot

Long time reader, first time poster.

First off want to give a huge thank you to JakeSoft and billpealer, I started reading about all this when i think JakeSoft first posted in thecustomersabersshop. Been reading a lot and finally am getting started. I am using 5V Arduino Mini and 5V WT588D-16p. I have so far it coded to turn on and make turn on sound with a second of hum, and turn off with power down sound, with a momentary switch.

The part im having issues with is getting the Hum to repeat, or even play afterwards.

I can make startup loop with

WT588D_Send_Command(0); //Play sound 0
WT588D_Send_Command(0xF2); //Repeat sound


however if i add anything it doesnt play, nor does the repeat work for said sound.

Not sure what i am doing wrong. it is in the Loop section, using Jakesoft's recommended setup for the button using If, Else, and While.

jshaw

Long time reader, first time poster.

First off want to give a huge thank you to JakeSoft and billpealer, I started reading about all this when i think JakeSoft first posted in thecustomersabersshop. Been reading a lot and finally am getting started. I am using 5V Arduino Mini and 5V WT588D-16p. I have so far it coded to turn on and make turn on sound with a second of hum, and turn off with power down sound, with a momentary switch.

The part im having issues with is getting the Hum to repeat, or even play afterwards.

I can make startup loop with

WT588D_Send_Command(0); //Play sound 0
WT588D_Send_Command(0xF2); //Repeat sound


however if i add anything it doesnt play, nor does the repeat work for said sound.

Not sure what i am doing wrong. it is in the Loop section, using Jakesoft's recommended setup for the button using If, Else, and While.
Difficult to diagnose code without seeing it, but my guess would be an include in the wrong spot.

JakeSoft

Long time reader, first time poster.

The part im having issues with is getting the Hum to repeat, or even play afterwards.

I can make startup loop with

WT588D_Send_Command(0); //Play sound 0
WT588D_Send_Command(0xF2); //Repeat sound


however if i add anything it doesnt play, nor does the repeat work for said sound.

Not sure what i am doing wrong. it is in the Loop section, using Jakesoft's recommended setup for the button using If, Else, and While.
Hi, Kdot. Welcome to the party!

Try putting some short delays in between your WT588D_Send_Command() calls. Also, you can make the hum sounds repeat for "free" but adding extra hum sounds to the end of your ignition sound. A.K.A. "The lazy Pealer method"  (J/K, Bill!)  :)   :smiley-yell: It won't repeat forever if you do it that way, but if you add enough of them it'll go on long enough for practical purposes until you trigger as swing or a clash or turn it off.

Good luck. Keep us posted on your progress.

Kdot

Difficult to diagnose code without seeing it, but my guess would be an include in the wrong spot.

Thanks jshaw, I was figuring I was but tried all kind of spots with deifferent results. Haha thus the post. This is all very new to me but so far it has been successful challenge.

Kdot

Hi, Kdot. Welcome to the party!

Try putting some short delays in between your WT588D_Send_Command() calls. Also, you can make the hum sounds repeat for "free" but adding extra hum sounds to the end of your ignition sound. A.K.A. "The lazy Pealer method"  (J/K, Bill!)  :)   :smiley-yell: It won't repeat forever if you do it that way, but if you add enough of them it'll go on long enough for practical purposes until you trigger as swing or a clash or turn it off.

Good luck. Keep us posted on your progress.
Thanks for the welcome! Been great following everyone's progress.

I'll add a few hums at the end of sound on that part is working great.

I tried adding a delay equal to the time of start up sound and added hum, right after start up command.

Maybe wasn't long enough or maybe I'm reading the flow incorrectly.

Either way I'll get that section of code posted for further evaluation.


Protonerd

adding extra hum sounds to the end of your ignition sound. A.K.A. "The lazy Pealer method"  (J/K, Bill!)  :)   :smiley-yell: It won't repeat forever if you do it that way, but if you add enough of them it'll go on long enough for practical purposes until you trigger as swing or a clash or turn it off.
Haha, you can add my stamp there also. I'm using the same trick with the DFPlayer, cheers from the club of lazy humming-birds. It could be done cleaner, but this method is so much easier and quite robust!

billpealer

#580
Jan 28, 2016, 03:49 pm Last Edit: Jan 28, 2016, 07:29 pm by billpealer
Also, you can make the hum sounds repeat for "free" but adding extra hum sounds to the end of your ignition sound. A.K.A. "The lazy Pealer method"  (J/K, Bill!)  :)   :smiley-yell: It won't repeat forever if you do it that way, but if you add enough of them it'll go on long enough for practical purposes until you trigger as swing or a clash or turn it off.

Good luck. Keep us posted on your progress.
pfffff! i see how it is. i thought it was a brilliant! i would like to know how is the code that turns the on_sound on, then plays the hum sound,- is Different from the swing or clash tiggers, that play those sounds, then go back to hum.  and are we talking sw-200 swings,  or ADLX swings?  i just got my ADL's in too, i am excited to see what this things are about.

I use If/Else with Boolean for on, and off sounds.  Yes,  i don't have hum triggers at all in my saber, but i did try it.  I couldn't get hum to loop with the hex code. only play once. i don't know if I tried separating it with some delay tho...  and my swings and clashes are standard switch code,.. from,..  here.
https://www.arduino.cc/en/tutorial/switch
 i don't use the int = state.  just the if/else with the debounce time saved.  My variant of this code is posted here. it works pretty ok. i am not smart enough to make more complex code.

Kdot

#581
Jan 28, 2016, 03:59 pm Last Edit: Jan 28, 2016, 05:23 pm by Kdot
Here is the part of the code where i thought i should use the Hum Repeat Hex code:

void loop()

{

 if (digitalRead(button) == LOW) //button is pressed
 {
   if (saber_is_on) //Saber is on, so turn it off
   {
     WT588D_Send_Command(0x00); //off sound
     digitalWrite(LED, LOW);

     saber_is_on = false;
   }
   else //Saber is off, so turn it on
   {
    WT588D_Send_Command(0x02); //on sound
    digitalWrite(LED, HIGH);
 delay(4162); //Time is equal to start up sound plus one loop of hum
WT588D_Send_Command(0x01); //Hum Sound
WT588D_Send_Command(0xF2); // Repeat Previous Sound

     saber_is_on = true;
   }




This would just loop the Hum Sound and skip the Start sound.


I also tried after the on/off if statements, outside the void loop, and setting up it's own if statement as well as 'do' but no luck. Im not sure what is wrong, but 100% sure something is lol

billpealer

#582
Jan 28, 2016, 05:27 pm Last Edit: Jan 28, 2016, 05:38 pm by billpealer
revisions.


void loop()

{

if (digitalRead(button) == LOW) //button is pressed
{
  if (saber_is_on) //Saber is on, so turn it off
  {
    WT588D_Send_Command(0x00); //off sound
     delay(400);     // ADDED
    digitalWrite(LED, LOW);

    saber_is_on = false;
  }
  else //Saber is off, so turn it on
  {
   delay(80);  // don't ask just try it.  I have found waking up the WT, it needs a second to boot.
   WT588D_Send_Command(0x02); //on sound
    delay(10);
   digitalWrite(LED, HIGH);
delay(this needs to be JUST the time of the "on sound" if you plan to trigger a hum manually. not the total time with integrated hum); //capice?
WT588D_Send_Command(0x01); //Hum Sound
delay(5);  // gives the WT time to play the above command, and be ready to receive the next
WT588D_Send_Command(0xF2); // Repeat Previous Sound

    saber_is_on = true;
   }
 }
}

Kdot

Just got home and going to give this a shot! This looks way more natural.

Im going to try and then report back! Thanks billpealer!

billpealer

Just got home and going to give this a shot! This looks way more natural.

Im going to try and then report back! Thanks billpealer!
hit refresh, made a revision.

Go Up