Go Down

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

DJWing79

Hey Billpealer, can you post your finished code when you get the chance? I'd really like to see it, to see if there are things I can modify with my future boards.

billpealer

Hey Billpealer, can you post your finished code when you get the chance? I'd really like to see it, to see if there are things I can modify with my future boards.
https://www.youtube.com/watch?v=yKps0fm1Wo0

Yo DJ,
my code is unfinished, but working. It also will not work with the Accelerometer.,


What exactly are you looking to solve or answer? 

shh!! my code is actually 100% represented in this thread, with Jakesoft's posts, Illuis's, Sugarbombs, and my own.  it just combines it all. it is all here

I use a standard bool condition to turn on the MOSFET, and turn on/off the blade sound.  my entire button/pin configuration, and line diagram for hardware is also already posted.

then i use the Arduino "Switch" (debounce) tutorial code to run my analog swing and clash sensors.  tweaking the delay times a bit.

and then  finally the one line serial code at the end.

that's it.  no kidding. No .h libraries, or fancy statements.

DJWing79

I am not sure if it's my arduino uno going on the fritz or what, but I had the one-line serial mode audio working one minute, now its not. weird. I am going to try to get rid of the BUSY and wanted to know how you did it in your sketch. Do you have a power up and power down sound before the hum? (couldn't hear audio, my speakers were on fritz). I am having issues with double-fonting on the swing sound from my accelerometer and am going to try applying the debounce method to it.

darkside

hey jakesoft and billpealer i am rereading this thread and taking notes as i do. came across your reply from early this month thanks for the info and i shall put it to good use. but i am doing rather the same setup as jakesoft till i get a better understanding of it all. one thing that now has me perplexed is do i need something else to program the accelerometer or not? any way itching to get going on it all but waiting on the rest of the parts i need. it also looks like i am going to have to get my bread board from radioshack, the one i ordered is going to be almost a month. also been looking at both of your videos on utube. seen some others but not as well as yours. i have a 100 more ???? but will ask as i need to. oh billpealer one more thing... be glad you have a son to support you in your endeavor. all i have is my folks.

darkside

also i have about 7.5" to play with in the hilt i constructed. which i think i have accomplished by using a a 3aaa batterie holder from a tactical light that no longer works. 3x 1.5v should be enough to power it all. 

darkside

watching a Z movie (zombie) and thought if only they had some lightsabers!

billpealer

#171
Dec 11, 2015, 05:56 am Last Edit: Dec 11, 2015, 06:02 am by billpealer
I am not sure if it's my arduino uno going on the fritz or what, but I had the one-line serial mode audio working one minute, now its not. weird. I am going to try to get rid of the BUSY and wanted to know how you did it in your sketch. Do you have a power up and power down sound before the hum? (couldn't hear audio, my speakers were on fritz). I am having issues with double-fonting on the swing sound from my accelerometer and am going to try applying the debounce method to it.
my power up sound has hum WITH IT.  i can't stress the ease of this method.  in the WT Waytronic sound uploader,  when you make the Hex address say  00 for off sound, and 01 for on sound,..  just add 4 or 5 copies of your hum after the on sound.  same for the clash and swing.  if every noise that has to trigger whilst on- after that sound resolves should also be followed by hum,.  skip the code and make those sounds actually PLAY the hum.  are you following?
in the WT588d uploader app,..  you of course need to open/upload all your sounds to it, and load them,.  but when you make your,. wtf is it called,. PLAYLISTS,.. when you make those,.  dont make a hum playlist,..  just add the hum to ALL your playlists,.  except the off sound,..  that is just one sound file.

I don't have a play hum sound command in the arduino.  it is ALL in the WT sound module.

if it worked in the arduino once and not again.... i would check physical connections.  and ypu should maybe not use the UNo, and do your testing ON the device you plan to use,.   i use nanos with usb for super easy changes and stuff.

billpealer


billpealer

#173
Dec 11, 2015, 06:21 am Last Edit: Dec 21, 2015, 04:04 pm by billpealer
spent an hour doing some real testing tonight with singe CR123A lithium 3.7v batts, and triple AAAs (alkaline and NIMH)

2 phone calls to my best bud electrical engineer and genius,..  YOU DONT NEED AND SHOULDN'T USE A RESISTOR FOR 3W LEDS if the V+ of the BATT IS LESS THAN 10% OVER THE VF of the LED.  There is a 6 page thread on custom saber shop of people who can;t figure out why their 1 ohm 5 watt resistors are only yielding 450ma.  so of course the custom saber guys want to sell the buck pucks.

the reason for only 400-500ma when using a resistor,..  The internal resistance of the battery is more than enough to drop the V by 10%.   MY MAN PJ,  WAS RIGHT.

4V fully charged CR123A,...  with 1 ohm 2W resistor  3.25v and 450ma.  even though that resistor on all the LED calcs should allow the LED to pull 3.4v and 750ma. 

4V fully charged CR123A,... NO RESISTOR...  3.33v and 700ma.  i'll be damned,. that is just about perfect for a blue luxeon star.

now  my pal went on to sing the praises of induction based buck step down converters because they produce cleaner power,. say 2 3.7v CR123A = 7.4 (closer to 8)  then stepped down to 3.4v. and anywhere tween 500 and 1000ma.  the ones i use give me about 620ma from 2 cr123a's.  it is my preferred set up, but wow,. one CR123A is 1/2 the space. 

DJWing79

Billpeeler, what I mean is can you give us an example of your power-on code?

darkside


darkside

also if anybody would like to try the 3aaa batterie holder i found them on am azon for under 5 bucks and there are 2 colours black or white.

billpealer

Billpeeler, what I mean is can you give us an example of your power-on code?
i told you.  it is all in here.  Post 91,  see jake's comments.   with the exception of some delay timing tweaks,. that is my code.


not sure if thats a joke or not.
really?  not sure?,..  then i have failed at being funny, like my father before me.

jshaw

The battery conversation is really interesting to me, and I've had a gut feel that cell phone style Li-On batteries are the way to go in sabers since I started reading forums.  I got in my RB/B/CW Tri-Rebel in yesterday and have the two blue LEDs on w/ the white for FoC, and running them from a 3.3V Arduino Pro Mini hooked up to a 3.7V Li-On battery, they are bright! I haven't pulled out the tools to measure their voltage and amperage, but my intuition says they are about where I want them to be.  Now if only my Graflex blade holder would show up...

For people looking for more lightsaber arduino code, these two links have some useful code, although they use different sound modules from what this thread discusses:

https://github.com/alextwin007/LightSaber
http://www.fx-sabers.com/forum/index.php?topic=22838.0

billpealer

This will get you started:
http://arduino.cc/en/Tutorial/Fade

Programming-wise, fading these high-powered LEDs is no more complicated than that.
i am not understanding how this PWM modulation to an LED directly will also translate to the MOSFET and LED setup.

the mosfet is ON or Off. 

Go Up