Go Down

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

billpealer

#630
Feb 04, 2016, 03:02 pm Last Edit: Feb 04, 2016, 03:03 pm by billpealer
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.

JakeSoft

#631
Feb 04, 2016, 06:13 pm Last Edit: Feb 04, 2016, 06:16 pm by JakeSoft
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.

billpealer

#632
Feb 04, 2016, 07:53 pm Last Edit: Feb 04, 2016, 09:12 pm by billpealer
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.

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)?

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. 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.

billpealer

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.

billpealer

#636
Feb 05, 2016, 12:53 am Last Edit: Feb 05, 2016, 02:17 am by billpealer
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.

JakeSoft

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.

billpealer

#638
Feb 05, 2016, 02:16 am Last Edit: Feb 05, 2016, 03:19 am by billpealer
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?

wailer

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...

wailer

One more thing....

If ObiWan would not have given annakin's lightsaber to Luke, would Luke have become a Jedi or not...

Nobody can refuse a good lightsaber...

wailer

#641
Feb 05, 2016, 09:04 am Last Edit: Feb 05, 2016, 10:23 am by wailer
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?
For (i = 0; i < 8; i++){
}

I is a variable so the arduino replaces it with the number it has on the moment it passes in the code.

I starts with 0 and i++ adds 1 (to i) every time the  the loop passes until it reaches 8 then it ends or starts over again.
So if i reaches 8 you could put i back to 0 to run another loop or else the loop will end.
So the i used in the code changes every time the loop passes (first loop 0 second 1 next 2....)

The 8 is arbitrary if the loop has to run 8 times it could be any number....

In every arduino (or any other software) code there is a loop if not it would run the code once and then stop working

And "int" tells the arduino its a number.

https://www.arduino.cc/en/Reference/For

Protonerd

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.
Completely right.
I would only add, that most current control circuitry actually varies the voltage to make sure the current is constant. Reason is, it's easy to play with voltage. Usually then there is a shunt resistance to sense the current (convert the current to voltage again), and based on that sensed current (which is a voltage, lol), adjust the voltage to ensure the current is stable.

wailer

#643
Feb 05, 2016, 02:27 pm Last Edit: Feb 05, 2016, 02:55 pm by wailer
Here is some basic test code for you, Canobi. It'll test all the I/O except for the accelerometer inputs. I couldn't think of an easy way to do that except maybe putting out the raw read values via serial.

This code will ramp up all 6 possible LEDs to full power and then ramp them down one at a time. See code for the order they go in, but it's more or less right around the pins on the Arduino in ascending order.

Then, once all the LEDs have been tested, it'll go into "button test mode". You can press the Activation switch, Aux switch, or bang the clash sensor to play three different sounds on the WT. Just program your WT588D in one-line serial mode to have three different sounds at 0x00, 0x01, and 0x02 so you'll know if the right sound is playing when you hit the switches.

All while this is happening, the main LED light will light up or go out to indicate the status of the BUSY signal from the WT588D. If you hear sound, but the light does not change state then probably something wrong with the busy signal on the WT.

Code: [Select]

/*
 * Pins_Canobi.h : Defines pinout for Canobi's 3-channel PCB.
 *
 *  Created on: Jan 8, 2016
 *      Author: JakeSoft
 */

#ifndef PINS_CANOBI_H_
#define PINS_CANOBI_H_

//General I/O Pins
#define CLASH_PIN 2 //Clash sensor interrupt pin
#define LED_RED_PIN 3 //PWM output for RED LED
#define LED_GREEN_PIN 5 //PWM output for GREEN LED
#define LED_BLUE_PIN 6 //PWM output for BLUE LED
#define ACTIVATE_PIN 7 //Activation switch
#define AUX_PIN 8 //Aux switch
#define LED_FOC_PIN 9 //Flash-on-clash LED (not implemented by JakeSoft SW)
#define ACCENT1_PIN 10 //Accent LED
#define ACCENT2_PIN 11 //Secondary Accent LED (not implemented by JakeSoft SW)

//Serial pins for WT588d Sound board
#define WT588D_BUSY 12 //Module pin "LED/BUSY"
#define WT588D_SDA 13 //Module pin for DATA

//Accelerometer Pins
#define AXDL335_X_PIN A0 //X axis
#define AXDL335_Y_PIN A1 //Y axis
#define AXDL335_Z_PIN A2 //Z axis
#define AXDL335_VCC_PIN A3 //Accel power (not used by Canobi's PCB)
#define AXDL335_GND_PIN A4 //Accel ground (not used by Canobi's PCB)

#endif /* PINS_CANOBI_H_ */

 

Code: [Select]

/*
 * SaberTest.ino : Tests saber I/O
 *
 *  Created on: Jan 19, 2016
 *      Author: JakeSoft
 */
 
#include "Pins_Canobi.h"

//Routine to send WT588D one-line serial commands
void WT588D_Send1(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);
}

//Ramp up the LED then ramp it down
void TestLED(int PinNumber)
{
  //Ramp up the LED
  for(int LedPower = 0; LedPower < 255; LedPower++)
  {
    analogWrite(PinNumber, LedPower);
    delay(10);
  }
 
  //Ramp down the LED
  for(int LedPower = 255; LedPower > 0; LedPower--)
  {
    analogWrite(PinNumber, LedPower);
    delay(10);
  }
 
  //Ensure the the LED is fully off
  digitalWrite(PinNumber, LOW);
}

void setup()
{
  pinMode(LED_RED_PIN, OUTPUT);
  pinMode(LED_GREEN_PIN, OUTPUT);
  pinMode(LED_BLUE_PIN, OUTPUT);
  pinMode(LED_FOC_PIN, OUTPUT);
  pinMode(ACCENT1_PIN, OUTPUT);
  pinMode(ACCENT2_PIN, OUTPUT);
 
  pinMode(CLASH_PIN, INPUT);
  pinMode(ACTIVATE_PIN, INPUT);
  pinMode(AUX_PIN, INPUT);
 
  pinMode(WT588D_BUSY, INPUT);
  pinMode(WT588D_SDA, OUTPUT);
 
  pinMode(AXDL335_X_PIN, INPUT);
  pinMode(AXDL335_Y_PIN, INPUT);
  pinMode(AXDL335_Z_PIN, INPUT);
 
  //Set pull-up resistors for switches
  digitalWrite(CLASH_PIN, HIGH);
  digitalWrite(AUX_PIN, HIGH);
  digitalWrite(ACTIVATE_PIN, HIGH);
 
  //Run LED tests
  TestLED(LED_RED_PIN);
  TestLED(LED_GREEN_PIN);
  TestLED(LED_BLUE_PIN);
  TestLED(LED_FOC_PIN);
  TestLED(ACCENT1_PIN);
  TestLED(ACCENT2_PIN);

}

void loop()
{
  if(LOW == digitalRead(CLASH_PIN))
  {
    //Play a sound
    WT588D_Send1(0x00);
   
    delay(100);
    //Wait for user to let off the button
    while(LOW == digitalRead(CLASH_PIN)) {}
   
  }
 
  if(LOW == digitalRead(AUX_PIN))
  {
    //Play a sound
    WT588D_Send1(0x01);

    delay(100);   
    //Wait for user to let off the button
    while(LOW == digitalRead(AUX_PIN)) {}
  }
 
  if(LOW == digitalRead(ACTIVATE_PIN))
  {
    //Play a sound
    WT588D_Send1(0x02);
   
     delay(100);
    //Wait for user to let off the button
    while(LOW == digitalRead(ACTIVATE_PIN)) {}
  }
 
  //Use the primary blade LED to indicate the status of the BUSY pin
  if(HIGH == digitalRead(WT588D_BUSY))
  {
    //Dimmly light the primary blade LED
    analogWrite(LED_RED_PIN, 64);
  }
  else
  {
    //Turn the primary blade LED off
    digitalWrite(LED_RED_PIN, LOW);
  }

}

Gone fishing and i think i caught something, dont know if it's sprat or a bluefin tuna...
I'll see when i gut it...

Just kidding, i just needed some code to get me started and this looks fine to me.

billpealer

Gone fishing and i think i caught something, dont know if it's sprat or a bluefin tuna...
I'll see when i gut it...

Just kidding, i just needed some code to get me started and this looks fine to me.
it will not help you with the ADXL

Go Up