Arduino Forum

Community => Exhibition / Gallery => Topic started by: Protonerd on Nov 24, 2015, 04:29 pm

Title: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 24, 2015, 04:29 pm
Hi fellow Arduino developers!

After nearly a year of planning, designing, coding and a lot of research in different Arduino related forums I finally finished the first fully working prototype of an Arduino saber for LED string blades.

First of all I would like to thank this great community here for the invaluable support and help in all facets of the development from hardware design through benchmarking to software coding, greatly appreciated! Without the insight you provided this project could not have happened! But it did!
Special thanks to JakeSoft who developed the first Arduino saber for his motivation and hints throughout the development process.

Some words to LED string sabers: if you remember the Star Wars films, you might recall how lightsabers extend when activated and retract when switched off. To better simulate this effect, blades can be build with multiple segments of LED strings, which can be individually controlled by the circuitry. Such lightsaber replicas differ from the so called high power LED implementation, in which the blade is lighted up from below by a single or multiple high power LED dies situated in the hilt of the lightsaber replica.
I started this project after a couple of years gearing up, modifying and building together prop lightsabers. From the beginning I felt attracted to LED string sabers, and looking at the available electronics on the market, I concluded that in certain respects I can do it better. I also set an ambitious goal: implement all features available to high-end lightsaber circuits, with some improvements in the finetuning of the LED segment drives.

The harware can be seen on the following pic (I will create a schemtics and a better description later on):
(http://s1035.photobucket.com/user/Kunci1/media/kicsi00008_zpsjuflnrs0.jpg.html)


*** videos are download friendly, a higher resolution version I will upload shortly ***

Please see a video of the "end result":
https://youtu.be/Ha7ZNmRhLBs
(http://i1035.photobucket.com/albums/a432/Kunci1/kicsi_AS2demo_zpsh0aymbsg.mp4)

Here is a short video demo of the breadboard version:
https://youtu.be/gtMFf8ygSzE
(http://i1035.photobucket.com/albums/a432/Kunci1/kicsi_werkfilm_zpsuiyobnx0.mp4)

Cheers: ProtoNerd (Andras)

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Nov 25, 2015, 12:22 am
I love it! Well done!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: marco_c on Nov 25, 2015, 02:05 am
Very impressive. Are you planning on putting together something to show others how to do this?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 25, 2015, 08:58 am
Yes, definitely I will draw a circuit schematics, I just need to find a suitable programm to do that. Is there a tool use commonly use in the Arduino community to share circuit drawings?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: CrossRoads on Nov 25, 2015, 09:25 am
www.expresspcb.com, download the schematic capture tool.
Others might use fritzing.org, but it makes miserable schematics.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: marco_c on Nov 25, 2015, 11:40 am
EAGLE CAD is another, but a bit of a pain to learn to use. I also would suggest avoiding Fritzing except for the simplest things.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 25, 2015, 04:01 pm
Thanks Crossroads for the suggestion, I downloaded ExpressPCB and made the circuit diagram (not polished yet, but shows everything what is important):
(http://s1035.photobucket.com/user/Kunci1/media/AS2_LEDstringSaberArduino_zpsxitdxh9o.png.html)

I will add a more detailed description to the modules and why I choose them tomorrow once I got some sleep :)
Edit: I also updated the original post to have the pics and videos visible as thumbnails.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Nov 26, 2015, 09:42 am
A spectacular job.

I'm also making a lightsaber with Arduino ( 80x 5mm green leds, WT5001M02-28P U-disk audio, ultrafire 3,7v 6000mAh x2 batteries)
I have seen the circuit and have a question:
The LEDs are separated by segments which are activated with Arduino through a mosfet transistor...
But... when a part of string is activated.. it's  reciving 7,4V?
Is not necessary to use a regulator or resistance to prevent damage?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 26, 2015, 01:32 pm
Hi chivotenkai,

Good luck for your project, it's a worthy one!
As to your question: for that there is a technique to serially connect LED's. That means: I have currently 2 LED string blades, one red and one blue. The blue LED's have 3.4V typ threshold, if you connect 2 in series, you can have 6.8V across them. Actually what I did was to put 2 sets of 5 parallel connected LEDs in series. Advantage: no need for resistances to bring down your voltage, nor for a voltage regulator. The small difference of 0.6V can be managed by the LED's, but you can also adjust the MOS transistor drive to remove the surplus voltage from the LEDs. With the red blade it's even a 3x5 so called serial III. class setup. Big advantage is also that your current consumption will be halved -> longer active time of the saber.

Regarding the WT5001, I also tried that (I will write about it later, that took the longest time to evaluate 3 different mp3 moduls), but I never managed to have a gapless playback, which is essential for realistic saber sounds. The 3rd module I tried was the same used by Jakesoft (WT588D), well I also did not have any luck with that, but he did, so at least it's proven to be able to do that.
I can only suggest to keep the DFPlayer in mind for later...

May I know which batteries you found? 6000mAh capa is tremendous! I also want them...provided they are not too big. In my Arduino saber, or more specifically in the hilt I put in the module I found only enough room for 2x10440, which have only a meagre 350mAh.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Nov 26, 2015, 04:07 pm
WOW
thath idea its great!

I had created the strings 5 strings of 16 leds... so im only need to divide and conect series the string ((8+8) x 5)
consumption only 1A for the leds.
im waiting for the other materials (audio card and arduino nano)   
I planned to use dc regulators + NPN transistors but  with your scheme , I will manage to save space .

The batteries are a liitle big: ULTRAFIRE 18650 6000MAH LI-ON 3,7V.  66 x 18 mm...
i going to make a hilt similar the luke's saber of episode 6 so i can "hide" that problem.
My idea its to create a video tutorial when i complete the saber.
Even... I have to say again : Thank you for sharing this information
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: tanakabuki on Nov 27, 2015, 01:17 am
First of all, congratulations !! long time ago, I want to build a sound card for my lightsaber, but was very difficult to me, but, thanks to your tutotrial, like Jakesoft, I have an idea now.
The Question that I want to make to you is wath players have used.
because here in Argentina, it is difficult to get some components ..
Here I get Arduino nano and the accelerometer, MPU6050 ..
but i can not find the player, with that name, DF Player? is ok?
Thanks in advance!!
Gabriel
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 27, 2015, 11:35 am
Hi Gabriel,

This is the sound module MP3-TF-16P aka. DFPlayer Mini I selected after quite a long phase of benchmarking (as you see there has been quite a lenghty discussion about it on the Arduino forum):

http://forum.arduino.cc/index.php?topic=241021.0
http://www.dfrobot.com/image/data/DFR0299/DFPlayer%20Mini%20Manul.pdf

I got mine from a local company but I guess it also gets supplied from Asia, so you could try searching the web. Or you might also look at the sound module JakeSoft used (WT588D).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Nov 27, 2015, 10:31 pm
I read the spec sheet for this sound module. 3W amplifier?! Is that right? Holy cow, that's louder than a Nano Bicotti!

Did you use an 8 ohm speaker? I read the PDF you linked, but the documentation doesn't say what the expected load is for the speaker.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 27, 2015, 10:52 pm
In fact it's louder than any other lightsaber electronics I have (and I have some high ends) :) up to the point that for just playing with it you will have the urge to pull down the volume to around 2/3 (code 20 from 32).

So far I tried both 8Ohm/2W (TCSS bass Speaker) and a locally sourced 4Ohm/3W, I cannot hear the difference (am I going deef?), so it can deal with both loads.

BTW, I watched again your MKII Video, especally the part with the configuration. Wow, now that I made mine, the sheer programming elegance you brought in into your saber just astonishes me...I see who is the software expert, software-wise my implementation is like a stone age club in comparison. Did you use the EEPROM to save the setting?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: tanakabuki on Nov 28, 2015, 01:22 am
Thanks Protonerd for your answer...the idea is build something with component found here...(in the bestcase scenario..ja..)
by the way, i wanna know, if i use an arduino mp3 modulo...like Wtv020, do you think it is not work?
Sorry, but i am  nooby in arduino, and i am still learning, and i dont understand why, only 2 or 3 player ( the MP3-TF-16P,or the WT588D can be work..
GReats!! and thanks!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Nov 28, 2015, 03:12 pm
BTW, I watched again your MKII Video, especally the part with the configuration.
Wow, now that I made mine, the sheer programming elegance you brought in into your saber just astonishes me...I see who is the software expert, software-wise my implementation is like a stone age club in comparison. Did you use the EEPROM to save the setting?
Thanks for the compliment, although I think I may have overdone it. The project has become so big that I moved to developing it in Eclipse because it was too hard to manage in the basic Arduino IDE. Also I think I've pushed the RAM limit of the Pro Mini with the features I'm trying to add in for the Mk. IV system. If I change something trivial, it causes what looks like memory corruption issues or outright crashes. I'm going to have to go back and do a lot of optimizing some of the not-so-elegant portions of the code before I can add anything else, or move to a chip with more RAM.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 28, 2015, 10:59 pm
Hihi, cool, you know how hard it was for me to find out why even changing the most unermarkable piece of code caused a totally unexpected behaviour from the saber at a totally different location... it took weeks before it occured to me that probably the system ran out of memory for the dynamic variables. So now I know that in the current state anything I add have to be preceeded by optimizing something else. So Memory IS a great problem with the small boards and only experience is going to tell you that!

@tanakabuki: I do not want to discourage you to use other mp3 players, on the contrary by all means please try them and tell us your findings! This is how I also started and I needed to spend quite a time to go through 3 different mp3 players before I put down my coin beside the mp3-tn-16p. Now with JakeSoft's solution we have currently 2 proven mp3 modules and I would love to see more diversity here. And one more thing: the more people searching for certain features the higher the chance that a commercial solution will de developed for it.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Dec 01, 2015, 10:38 am
Thanks for the recommendation for the LED circuit.
I'm still waiting for the MOSFET , Arduino and sound module .
but I'm done "led string" (1 cable for V+ and five for mosfet-gnd)

Still not add the  light diffuser but I have already tried the brightness with 7.4V
It goes great


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 01, 2015, 02:35 pm
Wow, impressive brightness. I take you used green LED's (from the background color, because the string is so bright the camera shows only a glowing white). Greens are anyway the brightest of all LED colors.

How do you lock the LED segments in place? Do you use a stiffener? Or wrap them all in foil/shrink tube?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Dec 04, 2015, 01:33 pm
sorry for answer late...

In the image... only the leds appear in the image.

for the creation of the string i used a similar metod of "Hampton's Hand-Crafted Lightsabers" channel.

But i change a little for make your circuit. I turn led for connect serial: if a string have 16 leds (8+8) in the middle for make the serial conection i solder de V- of the 8º Led to the V+ of the 9º Led.

Next, I Cut the V- of the 9º Led and i use that new space to solder the cable... that cable its directly going to the mosfet. Repeat the process in all strings. If you make 5 strings you have:

5 cables for V-
1 "special" for V+... I use only a cable but i cut it many times for using less space.... conecting the V+ when it have the 7.4V with the next string
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: kkwapnioski on Dec 06, 2015, 04:48 am
 i would like to know how you achieved gapless playback with the DFPlayer mini? I am trying to create a similar build and I am having trouble with gaps when transitioning from a swing or clash back to idle hum.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 07, 2015, 11:27 am
Hi,

Generally speaking the DFPlayer can transit from one sound file to another without any discernable gap. That is already a big advantage which many other MP3 players do not have!

Gapless playback you can do the 1. professional hard way or the 2. practical easy way.

1.: you have to keep track how long each track is and make sure in your code that you start the next sound just a bit earlier. Most high-end commercial saber electronics do it like that.

2.: while 1 is possible but hard to program, I choose another way. I simply extended the hum and copied the him to all other sound files. For a full sound font it takes about 5 minutes of work, well worth the effort. Since the hum will not stop aftter a few hundred ms, you have plenty of time to start a new sound.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: kkwapnioski on Dec 10, 2015, 07:03 am
So its definitely easier to add the hum to each sound bite, thanks for the pro tip. Next question, do you play the files from the root of the sd card, mp3 folder, or numbered folders? I think I'm getting playback gaps when trying play files from the folders, but its pretty close if not gapless when playing from the root. Did you notice anything similar? Also I'm wondering if file format makes in difference. I'm currently using wav files but now I'm curious if mp3 would make any difference in the folders.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Dec 11, 2015, 07:12 pm
Good news.
Now I have all electronic materials.
Here is my progress
https://youtu.be/V6yZFv4wBsM (https://youtu.be/V6yZFv4wBsM)

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: integra386 on Dec 12, 2015, 12:56 pm
Hello everyone .... first of all congratulations for your projects.

Even I'm starting to build a lightsaber following your instructions ... but I have a little doubt.

Having never run so many LEDs together ... I would understand if it is better to place the load resistors for LEDs, or not.

The leds I bought, are the Straw Hat 5mm red (1,8-2,2v and about 30ma ... http://www.ebay.it/itm/STRAWHAT-STRAW-HAT-180gradi-100-LED-ROSSI-5000mcd-5mm-/180649038439?hash=item2a0f859267:m:m8Oli3L3bnU9JmGN3osb1VA).

Wanting to create a series-parallel LED string consists of 6 groups of 8+8 leds ... My calculations say that I need 6 resistors 18R 1w.

They are so necessary, given the low value ???

I have seen some schemes around, and often these resistors are not mentioned.

Attaching any two schemes ... do you think is correct?

Thanks so much
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Dec 13, 2015, 09:10 pm
integra386.. i dont know but... you are making a blade with 96 leds?

Protonerd can you post the code you used for acelerometer?
i make the sound work (blade on and off sound) but with the acelerometer... T.T
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: integra386 on Dec 13, 2015, 10:46 pm
Chivontekai ... Yes ... 96 leds
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 14, 2015, 02:06 pm
integra386, good luck!

As to the 96 leds, why not, I also have integrated 6x3x5=90 in my red blade and 6x2x8=96 in my blue blade.

As to the resistors or not: for a red blade with serial II. technic (2 LEDs in series), you need the resistors, otherwise you will have a very narrow band to control your transistors -> effects will be less spectacular. Not to mention that not all small transistors can tolerate the power dissipated over them.
Better is to use a serial III. setup, then you do not need the resistors. 2.2V*3=6.6V, you only need to dissipate max. 8.2V-6.6V=1.6V over the MOSFET. If you insist on the serial II., then you need the resistors.

BTW, looking at your schematics, please do not forget the pull-down resistors from transistor gate to GND, otherwise you will have floating gate and you cannot control switch on/off (all LEDs will always be somehow in a random on state).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: integra386 on Dec 14, 2015, 04:35 pm
Protonerd thanks for the reply .... then I will make from 96 to 90 LED ... 6 x ( 3 x 5 ) .

I updated again the scheme ... now should be correct .


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 15, 2015, 03:15 pm
Thumbs up!

How do you intend to interlink the LEDs?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: integra386 on Dec 15, 2015, 04:34 pm
I will use the Makoto's tecnique but I will use a small jig to bend the LED's leads, created with 3D printer.



Add ...











Meanwhile I got the DFPlayer and I started to " play" with the sounds.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 19, 2015, 10:27 pm
@integra386: I dig your jig, awesome, you are really in for a professional lightsaber!
I used the same arm buddies method to link the LED's, mostly using household utensils instead of a jig, see my old thread here:
http://forums.thecustomsabershop.com/showthread.php?16889-My-first-LED-string-blade-a-progress-diary

@chivotenkai: I like the video, good start for an ignition/retraction.
As for the accelerometer, I use a very easy scheme. Simply read out in every loop turn the raw values for acceleration and gyro:

accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

Then I take the absolute value of the accelero values, take the largest one and using simple "if"statements compare it to some defined threshold.

if ((abs(ax) > 1000 or abs(ay) > 1000 or (az) > 1000)) {}
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 20, 2015, 10:54 pm
Update: I set out to explore new ways to make the saber look even more "alive". In the course of this the first modification I made was to connect the SPK- and SPK+ to one input of the Arduino each. Then in the software in each cycle the code samples the sound being played and adjusts the LED drives according to the rythm.

Looks great and saves a lot of code, because I can leave it up to the music to control the flicker instead of writing an own flicker algorithm (which also looks great, but why bother...I'm a lazy guy!)

Here is the result. Please look at the wall, that will mirror the flicker much better than the blade, which is simply too bright for the camera.

https://youtu.be/z3Sy9JCvs-Q
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: integra386 on Dec 21, 2015, 09:54 am
I tested the scheme led to 6 x (3 x 5) ... however, I need resistors (about 10 ohm) ... the light is inconsistent and leds become very hot.
I tried it with a resistance test and it's all ok.

Only real problem ... I miscalculated ... for a sword of about 90cm ... I'll need more LEDs ... 126 in all!

6 x (3 x 7) ... may the force be with me ... but above all ... the patience!

To not have as many cables inside the blade, I ordered from SMD resistors 2w (same size as 1w ... but more is better) that i'ss weld directly on the LED, so I'll keep only one positive cable.

Why not create a public folder and add the materials that we produce or find interesting, such as circuit diagrams and PCB, Arduino codes, sounds font, bill of materials and their suppliers, CAD drawings?

Github? Dropbox?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Dec 21, 2015, 10:32 am
@tanakabuki: I do not want to discourage you to use other mp3 players, on the contrary by all means please try them and tell us your findings! This is how I also started and I needed to spend quite a time to go through 3 different mp3 players before I put down my coin beside the mp3-tn-16p. Now with JakeSoft's solution we have currently 2 proven mp3 modules and I would love to see more diversity here. And one more thing: the more people searching for certain features the higher the chance that a commercial solution will de developed for it.
Sometimes i feel modules like the one you mention there spoil the making of such projects a bit XD.
It's incredible to see what that tiny & cheap module can do. I also made my own arduino based lightsaber (but with a maple mini with the arduino IDE on it), and so far handled the sound myself (the maple mini has enough flash to store the 3 sounds i currently have :) ), which i loved as a challenge :). Seeing such modules feels like such a cheat if you use them, but i ordered one anyway just to play around with it :D.
I'm probably also going to have a go at writing my own software for reading wav files from an SD card and sending the bits to a DAC, but i'll never be able to match everything that little dfplayer has >_<. One thing i might try though which you can't do with such a module is making subtle changes to the samplerate of you audio as response to swinging of the saber. Adding a bit of an extra doppler effect to the audio :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 22, 2015, 09:30 am
If you come up with a solution to read the SD card with the Arduino, let me know, I'm also interested. Best would be a working example of sharing the SD-card between audio module and Arduino, storing the sound files and some configuration settings on the same media.

As to cheating: no. I do not see it the same way. I work in the semicon industry and I know from experience: with novadays technology all that can be implemented on silicon on a tiny module which does not eat up any mentionable room on the PCB is worth it (even on this small module the biggest part is the SD-card and the audio amp which you need anyway) ! Hardware is cheap but if you set out to load it on the Arduino, you will soon end up with no memory. So I want my Arduino to be the command center and distribute the task to dedicated modules on the PCB. Some controllers even have dedicated embedded mp3 player, idea is the same. Do it in HW and save on SW.

The story is different if you want to have special effects like doppler/pitch change etc. Then go for the Arduino solution and let us know :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Dec 22, 2015, 10:45 am
As to cheating: no. I do not see it the same way. I work in the semicon industry and I know from experience: with novadays technology all that can be implemented on silicon on a tiny module which does not eat up any mentionable room on the PCB is worth it (even on this small module the biggest part is the SD-card and the audio amp which you need anyway) ! Hardware is cheap but if you set out to load it on the Arduino, you will soon end up with no memory. So I want my Arduino to be the command center and distribute the task to dedicated modules on the PCB. Some controllers even have dedicated embedded mp3 player, idea is the same. Do it in HW and save on SW.
It's indeed not really cheating, but it just removes the challenge from making the things a bit ^^
Personally, i only feel comfortable using such all in one solution ic's once i've solved the problem myself once the hard way :) (or died trying XD). Maybe it's also because i'm a programmer by trade, and writing a bit more complicated software for the arduino is part of the fun/challenge for me (i'm finally starting to learn some proper C++, i'm a C# developer). If it's just some modules with some simple communication towards them... that just takes away the entire challenge XD.
On my saber, the only library i used (on a maple mini) was one that gave me a very precise delay(down to nearly individual clock cycles), allowing me to easily drive the ws2812 ledstring without needing a library ^^. there are tons of libraries out there for driving such leds, but it's just too much fun to write my own code :p. And a challenge to be driving such timing sensitive ledstrings, and at the same time be playing audio on the same microcontroller :D.
I love a bit of a programming challenge :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 22, 2015, 12:34 pm
@racemaniac: :) I see your angle and I find it a noble challenge to have everything coming out from the same uC. For me as a HW-guy the main fun is to put together the modules to a functioning whole and then have good libraries to see the fruits of my development right away (being an engineer I'm lazy and inpatient). I actually was thinking about playing 2 sounds at the same time, one coming from the MP3 module and one from the uC, on the same speaker (disclaimer: I did not do a feasibility study yet...), so if you have a working prototype share with us!!! I'm interested.

@integra386: I was not aware you used 3mm LED's. Actually in mine LED string blades I've always put 5mm LED's. I think that if you keep them apart a bit more, you do not need to many and on top of that it might even turn out to be brighter. Somehow I have the bad feeling that putting very bright LED's with a narrow emission angle head to tail actually has the emitted light absorbed by the next LED and therefore a waste...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: integra386 on Dec 22, 2015, 05:52 pm

I am using LED 5mm , but kind of Straw Hat .
They are lower than the standards , but with a beam of 120 ° , much wider , less concentrated .
This is why I have preferred over the standard , since in a lightsaber light is emitted sideways .
In theory I should scatter less light .

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Dec 28, 2015, 01:38 pm
Hello there !

I'm so glad to have found your video Andras !
Your saber is awesome. You made a wonderfull job !

So much you decided me to build my own.
I've ordered the boards and some leds :


I plan to make a two string led blade : the main string will be green and the secondary string led will be red and should be trigger as a FoC/blaster hit.

That's the main idea. I need to make some test to see if the secondary string won't produce too much shadow when not lit up. If this is the case it will made a good second blade :P

Thank you !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 28, 2015, 09:57 pm
Hello there!

I'm glad you like the idea and I'm happy to greet one more Arduino lightsaber developer.

As to the dual led string blade, I tried it and I found it was not worth the effort. The shadowing is indeed really an issue, but more importantly it will make the anyway very complicated design a hell to put together, not to mention maintenance. If you want to have different color on blaster hit and/or clash, maybe you can experiment with dual die LEDs (those which have 3 legs and 2 emitters, like red/orange or even red/green if you can find any. Still, I find that with a clever adjustments of LED drive and timing you can trm your lightsaber to produce superb effects with a single color string.

If you have a working prototype, please do post the pics! Good luck and MTFBWY!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Dec 28, 2015, 11:46 pm
It's indeed not really cheating, but it just removes the challenge from making the things a bit ^^
Personally, i only feel comfortable using such all in one solution ic's once i've solved the problem myself once the hard way :) (or died trying XD). Maybe it's also because i'm a programmer by trade, and writing a bit more complicated software for the arduino is part of the fun/challenge for me (i'm finally starting to learn some proper C++, i'm a C# developer). If it's just some modules with some simple communication towards them... that just takes away the entire challenge XD.
On my saber, the only library i used (on a maple mini) was one that gave me a very precise delay(down to nearly individual clock cycles), allowing me to easily drive the ws2812 ledstring without needing a library ^^. there are tons of libraries out there for driving such leds, but it's just too much fun to write my own code :p. And a challenge to be driving such timing sensitive ledstrings, and at the same time be playing audio on the same microcontroller :D.
I love a bit of a programming challenge :).
That's funny because part of the reason I set out to build my own sound board was that it seemed too easy to just buy a commercial sound board. You are taking that thinking to a whole other level.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Dec 29, 2015, 06:22 pm
Well then, I'll think that I'll stick to a "basic" design without colored FoC.

Not to mention this is my very first lightsaber project and that I'm quite clueless in electronics.
I'm better at coding :P

I also thought at making a multicolor blade using multiple RGB leds and adding a MCP23017 chip to extend I/O channels. This way it would be possible to manage color changes.

But just thinking at all the work assembling the leds , it scared the crap out of me and I've no idea what kind of plug to use (it would require 19 pins)

Maybe for a future project.

I'm still waiting my orders but I will share photos of my project ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Dec 29, 2015, 10:59 pm
Well then, I'll think that I'll stick to a "basic" design without colored FoC.

Not to mention this is my very first lightsaber project and that I'm quite clueless in electronics.
I'm better at coding :P

I also thought at making a multicolor blade using multiple RGB leds and adding a MCP23017 chip to extend I/O channels. This way it would be possible to manage color changes.

But just thinking at all the work assembling the leds , it scared the crap out of me and I've no idea what kind of plug to use (it would require 19 pins)

Maybe for a future project.

I'm still waiting my orders but I will share photos of my project ;)
If you want more colors, give the WS2812 ledstrings a try, that's how i made my rgb lightsaber (http://forum.arduino.cc/index.php?topic=366701.0)
it's 2 ledstrings of 60leds per meter back to back (they cost me 20€ for 4m of ledstring, so 10€ of ledstring for a blade :)), and some diffusing material around it. And they give awesome individual led control, making for a very nice light up sequence (and once i get around to a next version, i might do some subtle brightness variations in it to make the blade a bit more alive :) ).
If you're more of a coder, and less of an electronics guy, they are ideal :). They come as a string, and you can power them directly from a 3.7V lithium battery (with protection circuit ofcourse :p).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: ryang on Dec 30, 2015, 03:42 am
Great choice in parts!! ;)

How are you doing clash detection with the 6DOF?  Was going to have a crack at it when my next lot of gear arrived, but if you've already been there/done that! :D
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 30, 2015, 09:55 pm
Enlighten us please, what is a 6DOF?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: ryang on Dec 31, 2015, 03:41 am
Enlighten us please, what is a 6DOF?
The MPU6050 is a 6DOF. ;)

http://www.dfrobot.com/index.php?route=product/product&product_id=880#.VoSVgfl95hE

I'll move the discussion to this post to keep the other one more related to their setup.  Mine is a hybrid, but is using the same audio & sensors, so it seems better suited here.

My acceleration calcs are just working off raw values as well (getMotion6()) then just plays with the values a bit.

I'll grab the code I'm using later on, it's NYE here today so no time after work! :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MegaCorsair on Dec 31, 2015, 11:30 pm
Hi, Do you Gonna upload the Code and schemtics for arduino and Mp3 Files for this Soon? Im Making a Blade and I have the 3 Modules :D Just I Dont Know how to make it Work together  :'(
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Jan 02, 2016, 08:47 pm
Since the 15th, I had completed electronic ... but when I was to assemble all in the grip ..
the audio module .. was broken ( i dont know the reason)

so I am waiting for me to get the new module .
However since I have almost finished hilt.



Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jan 03, 2016, 01:04 pm
Sweeeeet Chivotenkai !
Sorry to read that a part of your assembly got damaged :(

I'm personnaly in the process of assembling my green led string segments (seriallell II type) . I've done 4 segment so far (but ruined half a segment by being to hard when bending led pins :P).
I have a question regarding building the blade :
How do you fasten the segments between each other to get a quite stiff led string?

Still waiting for my arduinos components to be delivered.

Ohh and by the way : Happy new year to everyone !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Jan 03, 2016, 02:56 pm
Since the 15th, I had completed electronic ... but when I was to assemble all in the grip ..
the audio module .. was broken ( i dont know the reason)

so I am waiting for me to get the new module .
However since I have almost finished hilt.
Nice, how did you make the hilt?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Jan 03, 2016, 03:50 pm
neskweek  , my metod is similar of this video (but if you want to make the ignition effect you must make a little change)

https://www.youtube.com/watch?v=_tw0pD8LPtw

racemaniac, for the hilt i used a Pvc pipe 32 mm  and i used a tool to cut an a pipe accesory to make the rings.... when the saber is completed, i want to make a fast tutorial
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Jan 06, 2016, 07:34 pm
Hi all and thanks for all the valuable info this thread holds, all those videos were enough to push me to try it for myself despite having lost a lot of my electronic knowledge.

I'm currently waiting for materials, and doing some research in circuit and Arduino programming, you can check my progress here (warning: very preliminar solution):

https://123d.circuits.io/circuits/1423510-test-arduino

As you can see running the circuit simulation, when turning on the saber (pushing button), there are some milliseconds where all the voltage is applied only to one or two segments of LEDs, which causes these to be displayed in a state of 'burned'.

Is there any solution to this problem?

Perhaps the time in this oversaturated state is short enought to cause any problem?

One second thing I can observe is that switching off the saber seems to have two steps, dimming leds in one first step and switching all off finally, I don't know if it can be a problem with 123d.circuits.io simulation or a Mosfet incorrect operation.

Thanks and may the force be with you.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: ryang on Jan 07, 2016, 10:23 am
Here's my code so far, warts and all - so to speak.

http://pastebin.com/jYR235h3

I've just received another shipment of parts, so I'm going to tinker with the gyro code a heap more to try and get some clash detection out of it..
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 07, 2016, 06:13 pm
Sweeeeet Chivotenkai !
Sorry to read that a part of your assembly got damaged :(

I'm personnaly in the process of assembling my green led string segments (seriallell II type) . I've done 4 segment so far (but ruined half a segment by being to hard when bending led pins :P).
I have a question regarding building the blade :
How do you fasten the segments between each other to get a quite stiff led string?

Still waiting for my arduinos components to be delivered.

Ohh and by the way : Happy new year to everyone !
You can look here for a build log of a LED string saber:
http://forums.thecustomsabershop.com/showthread.php?16889-My-first-LED-string-blade-a-progress-diary

Only thing I would change is that the shrink tube should be used only to fasten the segments at the segment boundary for an inch or so. Putting the whole blade into the shrink tube makes it impossible to maintain and that is something you have to do on a regular basis.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jan 09, 2016, 11:56 am
Thanks for the fasten tips.

I'll finally go with the method found here :
http://www.fx-sabers.com/forum/index.php?topic=40348.msg540966#msg540966

I'll then wrap the whole string with some cellophane.

I'll post a photo of the full fisrt string (the green one) when I'll complete it.

Right now I only have half a string cause I burned some leds during my tests (stupid short cuts). I have ordered some more.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Jan 09, 2016, 04:37 pm
Here's my code so far, warts and all - so to speak.

http://pastebin.com/jYR235h3

I've just received another shipment of parts, so I'm going to tinker with the gyro code a heap more to try and get some clash detection out of it..
Nice :)
And i'm also starting to receive my new part from china, my fingers are starting to itch to start working on v2 of my saber XD.
I can already start discovering my i2c DAC to see how my next iteration of doing all the sound myself rather than the mp3 module will work :p.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MegaCorsair on Jan 10, 2016, 12:16 am
Here's my code so far, warts and all - so to speak.

http://pastebin.com/jYR235h3

I've just received another shipment of parts, so I'm going to tinker with the gyro code a heap more to try and get some clash detection out of it..
This is the code for the MPU6050 + DfPlayer + Minipro? How Will be connected correctly?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jan 16, 2016, 12:00 pm
First led strip done !

OFF :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160116_114332_zpsomcryrjy.jpg.html)


ON:
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/5c0eeea4-1b61-48fe-bb38-dc7554f5b112_zpsxywu0y8p.jpg.html)

Tested with a lux meter app on my android phone around 5400 lux, last night.

The mounting and soldering are not quite academic but that do the trick and the string is quite stiff by only enterlacing wires trought the led pins.
Next steps are :
- DIN soldering (still waiting for the connector)
- wrap it in diffusor material (polyurethane foam made for flooring isolation)
- put it in the blade and make a nice picture :)

Still waiting the Arduino Nano board to be delivered :(
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 18, 2016, 11:07 am
Looks awesome, good luck with the build! Did you put the whole string into a shrink tube, do I see it right?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jan 18, 2016, 04:22 pm
Nope, there's no shrink tube.

Only the wires holds everything in place.

Here is a close up of the upper part:
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160118_161429_zpsnulu116b.jpg.html)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 18, 2016, 09:58 pm
Since there is a growing demand to know how to use the MPU6050, instead of sending PM to fellow lightsaber builders, I give you here some hints how I use it in my lightsaber. If you integrate this code into your code, it's gonna work.

First of all what modules to include and global vars to be declared:
Code: [Select]
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"
// or the next one, should be equivalent
//#include "MPU6050.h"
#include <stdlib.h>
#include <SoftwareSerial.h>


// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
  #include "Wire.h"
#endif


MPU6050 accelgyro;
// calibrated acc/gyro values
int16_t ax_zero, ay_zero, az_zero;
int16_t gx_zero, gy_zero, gz_zero;
// acc/gyro values of the previous cycle
int16_t ax_prev, ay_prev, az_prev;
int16_t gx_prev, gy_prev, gz_prev;
// MPU control/status vars
bool dmpReady = false;  // set true if DMP init was successful
uint8_t mpuIntStatus;   // holds actual interrupt status byte from MPU
uint8_t devStatus;      // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize;    // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount;     // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer
volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high

// uncomment "OUTPUT_READABLE_ACCELGYRO" if you want to see a tab-separated
// list of the accel X/Y/Z and then gyro X/Y/Z values in decimal. Easy to read,
// not so easy to parse, and slow(er) over UART.
#define OUTPUT_READABLE_ACCELGYRO


Then in the void setup():
Code: [Select]
// initialize device
  Serial.println("Initializing I2C devices...");
  accelgyro.initialize();

  // verify connection
  Serial.println("Testing device connections...");
  Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

  // load and configure the DMP
  Serial.println(F("Initializing DMP..."));
  devStatus = accelgyro.dmpInitialize();
 
    // make sure it worked (returns 0 if so)
    if (devStatus == 0) {
        // turn on the DMP, now that it's ready
        Serial.println(F("Enabling DMP..."));
        accelgyro.setDMPEnabled(true);



        // set our DMP Ready flag so the main loop() function knows it's okay to use it
        Serial.println(F("DMP ready! Waiting for first interrupt..."));
        dmpReady = true;

        // get expected DMP packet size for later comparison
        //packetSize = accelgyro.dmpGetFIFOPacketSize();
    } else {
        // ERROR!
        // 1 = initial memory load failed
        // 2 = DMP configuration updates failed
        // (if it's going to break, usually the code will be 1)
        Serial.print(F("DMP Initialization failed (code "));
        Serial.print(devStatus);
        Serial.println(F(")"));
    }



Here in the setup you can also experiment with some of the advanced options (use at your own risk, this section of the code is not fully verified).

Code: [Select]
  // motion engine configuration

  accelgyro.setFullScaleGyroRange(0); //0-250deg/s | 1-500deg/s | 2-1000deg/s | 3-2000deg/s
  accelgyro.setFullScaleAccelRange(1); //0-2g | 1-4g | 2-8g | 3-16g

 
  // INT_PIN_CFG register
  // in the working code of MPU6050_DMP all bits of the INT_PIN_CFG are false (0)
  accelgyro.setInterruptMode(false); // INT_PIN_CFG register INT_LEVEL (0-active high, 1-active low)
  accelgyro.setInterruptDrive(false); // INT_PIN_CFG register INT_OPEN (0-push/pull, 1-open drain)
  accelgyro.setInterruptLatch(false); // INT_PIN_CFG register LATCH_INT_EN (0 - emits 50us pulse upon trigger, 1-pin is held until int is cleared)
  accelgyro.setInterruptLatchClear(false); // INT_PIN_CFG register INT_RD_CLEAR (0-clear int only on reading int status reg, 1-any read clears int)
  accelgyro.setFSyncInterruptLevel(false);
  accelgyro.setFSyncInterruptEnabled(false);
  accelgyro.setI2CBypassEnabled(false);

 
// set up interrupt sources
  accelgyro.setIntFreefallEnabled(false);
  accelgyro.setIntMotionEnabled(true);
  accelgyro.setIntZeroMotionEnabled(false);
  accelgyro.setIntFIFOBufferOverflowEnabled(false);
  accelgyro.setIntI2CMasterEnabled(false);
  accelgyro.setIntDataReadyEnabled(false);

  accelgyro.setIntMotionEnabled(true); // INT_ENABLE register enable interrupt source  motion detection
  accelgyro.setMotionDetectionThreshold(10); // 1mg/LSB
  accelgyro.setMotionDetectionDuration(2); // number of consecutive samples above threshold to trigger int
  mpuIntStatus = accelgyro.getIntStatus();


Then finally in each loop (only MPU related code included, all the rest removed):
Code: [Select]
int16_t ax, ay, az;
  int16_t gx, gy, gz;
  int16_t accgyro_temp[6];



    else { // motion engine actions
      accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
      accgyro_temp[0]=ax;
      accgyro_temp[1]=ay;
      accgyro_temp[2]=az;
      accgyro_temp[3]=gx;
      accgyro_temp[4]=gy;
      accgyro_temp[5]=gz;
     
      ax = ax- ax_prev;
      ay = ay- ay_prev;
      az = az- az_prev;
      gx = gx- gx_prev;
      gy = gy- gy_prev;
      gz = gz- gz_prev;
     
      ax_prev=accgyro_temp[0];
      ay_prev=accgyro_temp[1];
      az_prev=accgyro_temp[2];
      gx_prev=accgyro_temp[3];
      gy_prev=accgyro_temp[4];
      gz_prev=accgyro_temp[5];
     

      // ************************* blade movement detection ************************************
      if ((abs(ax) > 1000 or abs(ay) > 1000 or (az) > 1000)) { is there any movement to trigger motion detection

        if ((abs(ax) > 4000 or abs(ay) > 4000 or (az) > 4000)) { // threshold for Clash (values depend on Acceleration Range used!!!)
          if (SupressCounter >= 3) {
            if (verboseprint) {Serial.println("Clash") ;}
            Sound_PlayClash(SoundFontIdx);
          }
        }
        else {
          if (SupressCounter >= 30) {
            if (verboseprint) {Serial.println("Swing");}
            Sound_PlaySwing(SoundFontIdx);
           
          }
        }
      }
      else {
        if (verboseprint) {Serial.println(F("\nNo activity, continue hum"));}
      }
      // ************************* blade movement detection ends************************************
   



I hope it helps. Good luck with coding and experimenting.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: ryang on Jan 18, 2016, 11:00 pm
Since there is a growing demand to know how to use the MPU6050, instead of sending PM to fellow lightsaber builders, I give you here some hints how I use it in my lightsaber. If you integrate this code into your code, it's gonna work.
Holy hell man, great work!!  Quite a bit more detailed than mine! :)

How is the clash detection working out?  Usable?

Also, I came to the realisation the other day that the way I've mounted the gyro, the Z-access is actually going to be useful for thrust detection - and possibly only that..
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MegaCorsair on Jan 19, 2016, 02:09 am
There's a Scheme Connection for the 4 codes?

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 21, 2016, 06:02 pm
I decided it was time to move to the next level of Arduino based LED-string saber electronics, integrating everything discussed in this thread on one single PCB. I dubbed my future board:

DIYino

for 2 reasons:
- it's meant for DIY projects (obviously), but with this board my intention is to provide the possibility to build either LED-string sabers or sabers with high-power LED's. On top of that, since the board provides sound, light control (and motion detection), it can be used for a multitude of other projects as well (I plan an E11 blaster electronics as well, to stay with the SW theme).
- the Y also stays for the MP3 chipset YX5200-24SS

Here is the schematics I came up with after many weeks of research. It basically implements the same as my Arduino-based module:
- an Arduino-Nano-clone circuit
- a motion detection engine using the MPU-6050
- and the circuitry of the DFPLayer mini
- a MOSFET attached to each PWM-capable pin of the Atmega328P-AU (6pcs) to drive up to 6 strings or high-power LED's

(http://s1035.photobucket.com/user/Kunci1/media/DIYino_v1.0_LayoutSubmit_zpsdgiuq1ta.jpg.html)

I try to attach a PDF of the schematics, feedbacks and checks are warmly welcome, I'm now planning on starting the layouting and ordering the parts for the sample builds.

Target is to have a module size ~20mmx70mm, including mini-USB and SD card socket. So far the plans :)

Cheers!

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: CrossRoads on Jan 21, 2016, 06:20 pm
Suggestion: add more caps.
Atmega328: 0.1uf for each pin of VCC and AVCC - 3 total. I only see 1.
Ft232: Same, add more 0.1uF
UA78M05: "All characteristics are measured with a 0.33-μF capacitor across the input and a 0.1-μF capacitor across the output." I don't see any caps.
IC5: Same, add a 0.1F. will help with hum issues also.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: ryang on Jan 22, 2016, 01:15 am
I decided it was time to move to the next level of Arduino based LED-string saber electronics, integrating everything discussed in this thread on one single PCB. I dubbed my future board:

DIYino
Love it!! Bring it on!! :D
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jan 22, 2016, 02:09 am
I decided it was time to move to the next level of Arduino based LED-string saber electronics, integrating everything discussed in this thread on one single PCB. I dubbed my future board:

DIYino


OMG. I've created a monster.  ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 22, 2016, 04:26 pm
Suggestion: add more caps.
Atmega328: 0.1uf for each pin of VCC and AVCC - 3 total. I only see 1.
Ft232: Same, add more 0.1uF
UA78M05: "All characteristics are measured with a 0.33-μF capacitor across the input and a 0.1-μF capacitor across the output." I don't see any caps.
IC5: Same, add a 0.1F. will help with hum issues also.

Wow CrossRoads, actually I've been fervently hoping that you would chip in! Thanks a lot for the advice, I will make the updates.

Actually I based the Arduino part on the schematics found on the Arduino page:
https://www.arduino.cc/en/uploads/Main/ArduinoNano30Schematic.pdf
and realized just recently, that other than the link suggest this is the Nano v2.

I found an updated schematics for v3 on GitHub, and now I see that the v2 had some mistakes (actually I found one, the FTDI IC's Test pin must be connected to GND if unused, which is on the v3 schematics but not on the v2 on the Arduino site) and other external component values.
https://github.com/NashMicro/NashDuino/blob/master/Nano/ArduinoNano3_0schematic.pdf

I added suggested 100nF caps to UA78M05 and the IC5 audio amp, one on the VCC/VCCIO of the FTDI, as well as the 2 caps for LDO. As for the Atmega328 I opted to stay with the current caps, I fear that it will be the sheer number of external components that will dominate the board and dictate the size.

We discussed the topic of bootloader burning the other day. Currently I'm reluctant to plan in an ICSP header, due to limited space on the board and the fact that everyone removes them once it fulfilled its purpose. Instead I will try to use the same SPI pins from the sides, I hope it will work.

Schematics in PDF replaced.


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: CrossRoads on Jan 22, 2016, 04:33 pm
Can also use a press-in-place adapter to bootload and then program the 328p:

http://www.hobbyking.com/hobbyking/store/__64417__Atmel_Atmega_Socket_Firmware_Flashing_Tool_AR_Warehouse_.html?strSearch=atmega (http://www.hobbyking.com/hobbyking/store/__64417__Atmel_Atmega_Socket_Firmware_Flashing_Tool_AR_Warehouse_.html?strSearch=atmega)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jan 23, 2016, 01:15 am
Ok, quick question about your clash and swing detect, ProtoNerd

what is SuppressCounter?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 23, 2016, 10:26 pm
Can also use a press-in-place adapter to bootload and then program the 328p:

http://www.hobbyking.com/hobbyking/store/__64417__Atmel_Atmega_Socket_Firmware_Flashing_Tool_AR_Warehouse_.html?strSearch=atmega (http://www.hobbyking.com/hobbyking/store/__64417__Atmel_Atmega_Socket_Firmware_Flashing_Tool_AR_Warehouse_.html?strSearch=atmega)
Is it specified how much keepout area I have to observe around the Atmega to have a proper contact with this press-in-place adapter? I could ask the layouter to cater for this.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 25, 2016, 05:24 pm
I made a sketch of how the placement on the PCB and the pin-out are going to look like. Any comments are welcome!!!

At this stage I know that the width of the PCB shall be between 20mm and 23mm (so a bit under 1"), approximately the same as the DFPlayer, which also have a standard pin header connectors (8 contact holes 0.1" apart).
The length is not fixed yet, it depends on the layout. There are 2 scenarios:
- pad/pin limited size: if the pins on the sides are too many and make the PCB much longer, then I will put only the most needed signals on the side, all the other pre-assigned signals (i.e. those which have a connection on the board, like the A4/A5 to the MPU or D8 to the YX5200-24SS) will be placed somewhere on the PCB, still accessible, but only on a need-to basis.
- if the placement/layout determines the size, I will try to put as many of the signals on the side rows as possible.

With regards to the pin assignment, I tried to follow the standard Arduino stile, with the MPU and DFPlayer related signals grouped at the bottom of the PCB.

Regarding the 2 big sockets (USB and micro-SD), the will be at the bottom of the PCB on the two sides respectively. I hope that is possible to mount that way.

(http://s1035.photobucket.com/user/Kunci1/media/DIYino_placement_v1_zpsvjuz00kw.jpg.html)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jan 25, 2016, 06:09 pm
I made a sketch of how the placement on the PCB and the pin-out are going to look like. Any comments are welcome!!!

At this stage I know that the width of the PCB shall be between 20mm and 23mm (so a bit under 1"), approximately the same as the DFPlayer, which also have a standard pin header connectors (8 contact holes 0.1" apart).
The length is not fixed yet, it depends on the layout. There are 2 scenarios:
- pad/pin limited size: if the pins on the sides are too many and make the PCB much longer, then I will put only the most needed signals on the side, all the other pre-assigned signals (i.e. those which have a connection on the board, like the A4/A5 to the MPU or D8 to the YX5200-24SS) will be placed somewhere on the PCB, still accessible, but only on a need-to basis.
- if the placement/layout determines the size, I will try to put as many of the signals on the side rows as possible.

With regards to the pin assignment, I tried to follow the standard Arduino stile, with the MPU and DFPlayer related signals grouped at the bottom of the PCB.

Regarding the 2 big sockets (USB and micro-SD), the will be at the bottom of the PCB on the two sides respectively. I hope that is possible to mount that way.

(http://s1035.photobucket.com/user/Kunci1/media/DIYino_placement_v1_zpsvjuz00kw.jpg.html)
Q1) What is your target power source? 3.7V? 6V? 7.4V?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 26, 2016, 10:38 am
Q1) What is your target power source? 3.7V? 6V? 7.4V?

I leave it up to the user. I use them currently mainly with 7.4V (2x3.7V) setup, but a single 3.7V cell setup is also feasible, provided that the 5V is maintained, which could be done with a small boost.

I plan to play around with 3.7V supply wo/boost, but that needs a different external connection and I do not want to commit this option as of yet.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 26, 2016, 09:28 pm
Ok, quick question about your clash and swing detect, ProtoNerd

what is SuppressCounter?
With this variable I want to define the minimum time which must elapse between 2 swings. At the moment it counts the number of loops but I plan to change it to be based really on elapsed time, since the loop times are varying strongly and I keep optimizing the code to make a single loop as short as possible. Unless this loop count is less than a set threshold, no new swing can be triggered.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MegaCorsair on Jan 28, 2016, 02:35 am
You can post the code you use with the Nano V3 with the Mpu6050 and DfPlayer?
It would be a great example to follow and create variations
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Jan 28, 2016, 10:41 am
Signed up for an account just because this project is so awesome! What kind of MOSFET transistors are you using? Would these be acceptable?

http://www.amazon.com/gp/product/B011NANC9Q?psc=1&redirect=true&ref_=ox_sc_act_title_6&smid=AU6PGFJBQPQ80
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 28, 2016, 02:16 pm
Signed up for an account just because this project is so awesome! What kind of MOSFET transistors are you using? Would these be acceptable?

http://www.amazon.com/gp/product/B011NANC9Q?psc=1&redirect=true&ref_=ox_sc_act_title_6&smid=AU6PGFJBQPQ80
Yop, I use the same ones. My planned DIYino board will also boast them.
But caution, they are indeed tiny. While you can solder them on your own, it's a bit of a challenge.
BTW, you can try to leave out the pull-down resistances, JakeSoft's builds do not use them and if you take care about keeping the PWM signals to low in case the saber is off and cutting power to the board when not used, you can do without.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Jan 28, 2016, 06:55 pm
I was wondering about that. The red LEDs I'm using have a forward voltage of about 1.8 to 2.0 volts. They're in a class III seriallel setup with a 7.4 volt battery source meaning that each sub-segment will have ~2.49V across it, which is slightly over the forward voltage. Is that extra 0.5V something to worry about? And does keeping the PWM signals low just amount to setting analogWrite(pinNumber, 0), or is it more complicated?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: CrossRoads on Jan 28, 2016, 07:08 pm
You need current limiting resistor to dissipate the extra voltage.
7.4V is the low end of the battery voltage, it will be as high as 8.4V when fully charged.
Thus a resistor value of:
(8.4V - (3 x 1.8V ))/.02A = 150ohm
is called for.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Jan 28, 2016, 07:44 pm
Would it be apt to add that resistor at the circled location?

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 29, 2016, 10:27 am
You need current limiting resistor to dissipate the extra voltage.
7.4V is the low end of the battery voltage, it will be as high as 8.4V when fully charged.
Thus a resistor value of:
(8.4V - (3 x 1.8V ))/.02A = 150ohm
is called for.

@772pilot: CrossRoads' answer is the completely right and is for sure the most secure way to ensure no overvoltage/current comes to your LEDs. It's also true that a fully charged 3.7V battery can have a voltage up to 4.2 -> 2 of them up to 8.4

However usually I choose to rely on the MOSFET to act as said resistor by playing around the PWM to the gate. The channel of the MOSFET can be thought as a voltage controlled resistor, so what I did was implement a ramp and measure the LED segment voltage with a multimeter (or one of the analog inputs) and note down which is the highest PWM value applied to the gate which still ensures the LEDs are not overdriven. You can then use the constraint function to limit the PWM value with in your analogWrite function.

[read this section at your own risk]: all that said, I usually allow the LEDs to be overdriven slightly. 0.5V will not harm them in my personal experience.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Jan 30, 2016, 01:16 am
@772pilot: CrossRoads' answer is the completely right and is for sure the most secure way to ensure no overvoltage/current comes to your LEDs. It's also true that a fully charged 3.7V battery can have a voltage up to 4.2 -> 2 of them up to 8.4

However usually I choose to rely on the MOSFET to act as said resistor by playing around the PWM to the gate. The channel of the MOSFET can be thought as a voltage controlled resistor, so what I did was implement a ramp and measure the LED segment voltage with a multimeter (or one of the analog inputs) and note down which is the highest PWM value applied to the gate which still ensures the LEDs are not overdriven. You can then use the constraint function to limit the PWM value with in your analogWrite function.

[read this section at your own risk]: all that said, I usually allow the LEDs to be overdriven slightly. 0.5V will not harm them in my personal experience.
Both seem like pretty easy solutions, thanks!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jan 30, 2016, 01:31 am
@772pilot: CrossRoads' answer is the completely right and is for sure the most secure way to ensure no overvoltage/current comes to your LEDs. It's also true that a fully charged 3.7V battery can have a voltage up to 4.2 -> 2 of them up to 8.4

However usually I choose to rely on the MOSFET to act as said resistor by playing around the PWM to the gate. The channel of the MOSFET can be thought as a voltage controlled resistor, so what I did was implement a ramp and measure the LED segment voltage with a multimeter (or one of the analog inputs) and note down which is the highest PWM value applied to the gate which still ensures the LEDs are not overdriven. You can then use the constraint function to limit the PWM value with in your analogWrite function.

[read this section at your own risk]: all that said, I usually allow the LEDs to be overdriven slightly. 0.5V will not harm them in my personal experience.
I've long wondered if I could get away with this for my in-hilt LED (non string blade) setup. Now I want to run some experiments to try throttling PWM instead of adding resistor to each LED. It would also allow me to briefly over-drive the LEDs for dramatic effect on a clash event. Hmm... seems my work is never done; always something new to learn and try!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: chivotenkai on Jan 30, 2016, 06:29 pm
https://www.youtube.com/watch?v=sgeXLru1uqI&feature=youtu.be (https://www.youtube.com/watch?v=sgeXLru1uqI&feature=youtu.be)

After waiting a long time, I have received audio module.
I decided not to use the accelerometer for certain reasons ....
I still have to add support for batteries (I have not received it yet), so the sword in the video is connected to a power supply
I hope you like the result
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 30, 2016, 10:52 pm
https://www.youtube.com/watch?v=sgeXLru1uqI&feature=youtu.be (https://www.youtube.com/watch?v=sgeXLru1uqI&feature=youtu.be)

After waiting a long time, I have received audio module.
I decided not to use the accelerometer for certain reasons ....
I still have to add support for batteries (I have not received it yet), so the sword in the video is connected to a power supply
I hope you like the result
Amazing brightness, chivotenkai! And I love the ignition/retraction, feels like a real lightsaber! Keep posting your progress, it's gonna be a formidable lightsaber once finished.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 01, 2016, 12:11 am
I am excited to use the DFPlayer, but I have hit a snag with my first test....namely, it won't play anything. If I have it with 1K resistors on TX or RX or both, nothing...if I have 470 ohm on TX or RX or both, nothing...without any resistor I get a strange feedback/hum sound...but...only when there is nothing plugged into it's power...weird...when Power is plugged in and it is hooked up as the diagrams say...I get nothing...I am posting a video to show....any thoughts?

https://www.dropbox.com/s/gbzmzfsmis2dnd6/IMG_2741.MOV?dl=0

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: ryang on Feb 01, 2016, 09:53 am
I am excited to use the DFPlayer, but I have hit a snag with my first test....namely, it won't play anything. If I have it with 1K resistors on TX or RX or both, nothing...if I have 470 ohm on TX or RX or both, nothing...without any resistor I get a strange feedback/hum sound...but...only when there is nothing plugged into it's power...weird...when Power is plugged in and it is hooked up as the diagrams say...I get nothing...I am posting a video to show....any thoughts?
It could be anything... :/
- Is the SDcard formatted correctly?  Files named as required? In the correct folder?
- Have you maybe swapped the TX/RX?  Swap them anyway! Just to be safe.. lol
- Are you initialising it correctly? Including the libs?
- Are you supplying the right voltage? Ground? Is the speaker connected??

All I can think of right now...

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 01, 2016, 02:17 pm
I've long wondered if I could get away with this for my in-hilt LED (non string blade) setup. Now I want to run some experiments to try throttling PWM instead of adding resistor to each LED. It would also allow me to briefly over-drive the LEDs for dramatic effect on a clash event. Hmm... seems my work is never done; always something new to learn and try!
I'm glad I can give people some new ideas to try out. Actually this idea is what started me off on this path the first place. Here is my first trial with a video from the TCSS forum:

http://forums.thecustomsabershop.com/showthread.php?16699-Smooth-color-mixing-saber-with-NB-v1-0

I imitate PWM in this build with a voltage divider connected to the gate of the MOSFETs. Same principle as the PWM. It works great as long as you battery max voltage is close to the max voltage of your LEDs (for instance 3.7V for Green and Blue) or you have some other means to limit the current (like the constraint function in C). Crucial for it to work is a proper selection of MOSFET with respect to threshold voltage and gate-source transfer curve. For an n-channel type the earlier it begins to conduct the best and the more flat the transfer curve the better, because you have a wider range to smootly adjust the current through the LED. You also have to consider the max power dissipation of the selected MOSFET if it's used to burn power like a resistor (i.e. in case of the transistors I use they are rated for max 0.8W dissipation. If I want to have 2V on a red LED using a 3.7V battery, the transistor needs to dissipate 1.7V, if at 2V the red LED is running at 700mA, that gives 1.19W, already too much. Well, this is only a theoretical calculation, as a red at 2V will have less current, 700mA is for most of them the max current at Vmax, take it just as a guideline.)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 01, 2016, 06:45 pm
Hey RyanG, thanks for you response....some answers to your questions.



- Is the SDcard formatted correctly?
                   FAT32, reformatted this morning (didn't quick format either) 
Files named as required?
                   file to test is called   001.mp3 (have also tested with 0001.mp3 and got same results)
In the correct folder?
                    inside folder called mp3 (also did it inside a folder called 001 inside mp3, and still failed)
- Have you maybe swapped the TX/RX? 
                    Yup, have tried that both with and without the resistors...funny thing, with resistors                               
                    there is no noise whatsoever, without resistors and without power I get buzz
- Are you initialising it correctly?
                     I have the library included from this link
                     http://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299
                     it compiles fine
Including the libs?
                      see above reply
- Are you supplying the right voltage?
                       I have tried to run it off the 5V coming from the Arduino as in the schematic from the
                       Wiki, as well as the 3.3V. I have also had it run directly off a 3.7V li-ion battery 
                        which is what I will use in my saber, and nothing
Ground?
                       Yup, it's grounded
Is the speaker connected??
                        yes, otherwise I wouldn't hear the buzzing

All I can think of right now...
                        Any other ideas would be appreciated. I have also e-mailed the manufacturer. On a
                        weird note, when I have it plugged into the 3.7V and the 3.3V nothing lights up
                        either, but when I have it on 5V I get a steady(but dim) red light on the unit. I have
                        seen videos of people testing these things and they get a white/blue light but only
                        when its playing. Also, I have tested two separate units.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 01, 2016, 11:43 pm
Any other ideas would be appreciated. I have also e-mailed the manufacturer. On a
                        weird note, when I have it plugged into the 3.7V and the 3.3V nothing lights up
                        either, but when I have it on 5V I get a steady(but dim) red light on the unit. I have
                        seen videos of people testing these things and they get a white/blue light but only
                        when its playing. Also, I have tested two separate units.
Let's see what possibly can go wrong. The most important questions have been already asked by riang, so I go to the next stage:
- please try with .wav files. I recall the DFPlayer can play also .mp3, but I always use it with .wav files. Any decent audio converter can do the conversion. If you have a Plecter Lab board, you can use files from a sound font.
- do not create any folder. Just dump everything in the root. While the module is supposed to support folders, I never tried it. Let's get it working first, then you can try the folders once the module is alive (but then I count on you sharing the code dealing with the folders! - deal?) Files names do not matter.
- supplying the module: actually it needs really 5V on Vcc, although the module is a 3.3V module. The module has in fact an 3.3V LDO which regulates the input 5V to 3.3V and supplied the whole thing with it (except the audio amp, which is supplied directly from 5V). Therefore 3.3V or even 3.7V would not be enough. I watched your video, I get the same static if the supply gets too low (~3.4V on Vcc and downwards).
- the DFPlayer modules I own have only a single LED which lights up only if playing a sound, it's connected to the busy signal.

Then download this code, which I use to test the module. Very simple, just plays all files on the SD-card in sequence and starts all over again.

Code: [Select]

// DFPlayer Demo
#include "I2Cdev.h"
#include <stdlib.h>
#include "Wire.h"
// to recognise the inclusion of this library...???
#include <SoftwareSerial.h> // interestingly the DFPlayer lib refuses
#include "DFPlayer_Mini_Mp3.h"
SoftwareSerial mp3player(7, 8); // RX, TX

char buffer[4];
int received;

void WaitMP3Busy() {
    while (digitalRead(16) == LOW) {}
    
}


void setup() {
  // put your setup code here, to run once:
    Serial.begin(9600);
    received = 0;
    buffer[received] = '\0';
    Serial.println("Start DFPlayer Demo...");

    // configure pins and set the data rate for the SoftwareSerial port
    // these 2 pins will be used to communicate with the DFPlayer
    pinMode(7,INPUT); //SS_RX
    pinMode(8,OUTPUT); //SS_TX
    mp3player.begin(9600);  
    mp3_set_serial (mp3player); //set softwareSerial for DFPlayer-mini mp3 module
    mp3_set_device(1); //playback from SD card
    mp3_set_volume (15);
  
}

void loop() {
  // put your main code here, to run repeatedly:

int i;

for (i = 0; i < 89; ++i)
  {
    Serial.print("Playing track: ");
    Serial.print("\t");
    Serial.println(i);
      mp3_play_physical(i);
      delay(1000);
      //WaitMP3Busy();
   }
  
}
[code]
[/code]
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 02, 2016, 12:56 am
I will try that when I get home. here's the thing...I planned to use the 3.7v 18650 3400mah from TCSS. But it looks like I will have to go to the 7.4V and then....?

Like this maybe?

7.4v -> VCC pin on Arduino
5V from Arduino -> DFPlayer

will that work? or will I need a 5V regulator...I ask because this will kill my LEDs at 7.4V, so I'd need to drive them down majorly.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 02, 2016, 07:08 am
@ Protonerd

SUCCESS! that did it!....but now the problem, I have to run the 7.4V battery...do you know if the 3.3V OUT of the Arduino will provide enough amps for a cree led?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 02, 2016, 03:08 pm
 :) I'm glad!

As to the supply question: the 3.3V of the Arduino is supplied from an LDO embedded in the FT232RL (the USB chip). It can supply 50mA only...enought for the MPU6050 for instance, but for the LEDs way too weak.

Same is the case with the 5V LDO of the Arduino Nano or similar, it can source max 500mA. And this 5V LDO will only work if it gets greater than 5V!!!

According to this, you have the following options (and I really encourage you to experiment, that would be a great help!).
1. you supply the VIN pin (mind, not the VCC, at least the Nano does not have an Vcc) with anything greater than 5V. Takes a lot of room in the hilt, you can practically forget the 18650... but then you would have to either use serial techniques with your LEDs or use resistors to burn the excess voltage.
2. you use a single 18650, supply the LEDs directly with it and use a small DC-DC to pump up the voltage from 3.7V to 5V for the Arduino board (I currently experiment with these 2 types:
http://www.ebay.de/itm/331649725186?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
http://www.ebay.de/itm/121142828799?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
). These modules are not huge, you can even piggy-back them on the SD-card holder (they will hang down a bit).
3. now comes the tricky but exciting part. Actually 3.7V is enough for the Arduino. Only thing is, you need to connect the 3.7V to the 5V and not to the VIN pin. Effectively this will bypass the LDO, so the board will get the 3.7V directly. Tried, it works. Interestingly enough, this voltage is enough for the FT232RL's 3.3V LDO to supply the MPU6050 (which also has an own LDO on board). The only part of the circuitry which I could not bring to work is the DFPlayer mini. But alas I did not try all possibilities. The DFPlayer wants to have 5V on the VCC pin, which is in turn taken by the LDO of the chipset on the module to tone it down to 3.3V. Dificulty is, that if you apply 3.7V to the VCC pin instead of 5V, the LDO will output something like 3.1V and I get out static noise most of the time. But it could be, that if you connect the 3.7V directly to the 3.3V output (not on the pinout, but could be accessed with some soldering skill), there is a chance that the whole thing will work from a 3.7V supply. Of course it's not without some danger: the 3.7V batteries can reach as high as 4.2V and I do not know how the DFPlayer designed for 3.3V reacts on 4.2V... there might be smoke involved.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 02, 2016, 03:36 pm
Ok, so I'm going to try this one

http://www.ebay.com/itm/DC-DC-Boost-Converter-Step-Up-Module-1-5V-to-5V-500mA-Power-Module-New-S3-/381340232628

but here's a second issue...I had to // your IC2DEV from your code but I know you use it for your MPU. Can you tell me exactly where you got that library? I tried searching and there are tons and when I tried to add them with your sketch I kept getting errors where it couldn't find certain other libraries that it was referencing
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 02, 2016, 03:59 pm
Hello there

I managed to make directory structures work with the DFPlayer.
I'll post how in a few days/week.

I also managed to use its "advert" system. But I did'nt kept this option since the DFPlayer is way to slow to trigger it.

Since Protonerd kindly offered us the electronic schematics, I plan to share the full code I made but I'm still working on it, mainly on  sound timing.

No offence Protonerd, but I'm starting to think that the DFPlayer is not the best solution for sound playing ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 02, 2016, 04:32 pm
I made an update to the DIYino placement (see attachment), I reworked the pinout a bit and added an alternative placement for the SD-card holder.



The peripheral pinout signals will be compatible with the 0.1" pin connector type like other Arduino boards.
The yellow signals are secondary ones, they will get the smaller plated thru-hole and will be distributed over the layout as the layouter sees fit, not to interfere with the primary goal of smallest possible PCB size. But in case they are needed on the primary pinout, I reserved 2 signals (spare tbd) where they can be mapped to.

Tomorrow I will get a first placement from the vendor :) I will keep you updated.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 03, 2016, 02:46 am
Do you guys think this would work for pulling the 7.4V down for the LEDs to not melt?

http://www.luxdrive.com/content/3021-BuckPuck.pdf

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 03, 2016, 10:31 am
Do you guys think this would work for pulling the 7.4V down for the LEDs to not melt?

http://www.luxdrive.com/content/3021-BuckPuck.pdf


From the description it looks it would actually work. Only thing I'm not sure about is how to implement flicker/shimmer effects. And it's quite big for one single LED. For color change you would need multiple ones.

What is your target? RGB with HP-LEDs or LED-string?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 03, 2016, 03:24 pm
HP LED, RGB...I'm designing my saber on my 3D printer and I think I have the right balance of infill-to-durability (I whacked it several times hard with the blade in and it held strong!), so i am also designing a sled the electronics will ride on....I may go with the DC-DC Boost, but if these work, I can attach them to the underside of the sled and run the wiring to my LED's...currently it looks like my sled needs to be 98mm long for the PCB I was designing to fit. If these work as a resistor/mosfet gate...the Negative lead coming from Arduino on a PWM pin should still cause it to flicker.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 05, 2016, 01:35 pm
Hello there

I managed to make directory structures work with the DFPlayer.
I'll post how in a few days/week.

I also managed to use its "advert" system. But I did'nt kept this option since the DFPlayer is way to slow to trigger it.

Since Protonerd kindly offered us the electronic schematics, I plan to share the full code I made but I'm still working on it, mainly on  sound timing.

No offence Protonerd, but I'm starting to think that the DFPlayer is not the best solution for sound playing ;)
Your contribution is much appreciated! I'm also curious about the directory handling and the advert, although latter is not really needed, as gapless playback can be done also without.

And no offence meant. We can only come to the best solution if we constantly keep a lookout for new things and keep challenging what we have.

Currently the DFPlayer fulfills all my expectations to a sound module, cheap, smallest under all competing modules, can do gapless playback, easy to program and has the most powerful output amp.
If I think about what I would still like to have, then the following features pop up in my mind intuitively:
- combined access on the SD-card, i.e. that not only the DFPlayer but the Arduino also has access and can store there for instance config parameters.
- ditch SD-card for an U-disk/Flash/whatever, which can be seen as an USB drive from a host computer (actually the chipset supports that, it just needs to be tried out on the bench, because there is no spin-offs like for the WT588D based boards)
- connected to the previous item, of course using the same USB as for programming the Atmega
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 05, 2016, 03:40 pm
Hey Protonerd, can you tell me exactly where you got your IC2DEV library for your sketch? I keep trying to upload the one you posted but have the // that line on include IC2DEV because each time I try to install an IC2DEV library it says I am missing files.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 06, 2016, 05:37 am
Ok, so I tested the buckpuck and found that it works, BUT, you have to digitalWrite your LED to HIGH in order to turn it off, instead of low. The pulsing works, am using model 3023-D-E-700, but you can use the 1000 if you want.

I am having an issue with looping my hum audio...I don't want to use delay, but if I try to use millis to allow for it to play the sound for a set length of time before repeating, it doesn't loop.

Proto, how do you handle this?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 06, 2016, 03:59 pm
I know - because I use version tracking for my SW development and I strongly recommend for other also to use such a tool (i.e. TortoiseSVN) - that I only had to modify the DFPlayer lib. Somehow it had trouble recognising the SoftwareSerial library and I added one new function for looping a sound file. Maybe this latter is what you are looking for. Look for the function mp3_loop_play.

For completeness' sake I zipped (7zip) all the libs I use (see attachs), most of them I got from GitHub (thanks for that amazing community!!! without them such projects could not exist!).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 07, 2016, 06:29 am
Ok, weird thing, the mp3_play_physical command works but the numbering is based on the order the files are copied over onto the SD Card, whereas the mp3_play command just doesn't work...I am getting a strange click from repeating the hum, but it might be he audio file itself, so will modify and test.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 08, 2016, 11:18 am
The actual lib DFRobot is providing is incomplete, not developper-friendly, and flawd for some functions.
Add to that a datasheet also incomplete and containing some false info, and that will explain your problems.

With my project (which ils close to completion) I'll provide an all new lib for DFPlayer based on SoftwareSerial communication (forget about busy pin ans replace it by TX pin).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 10, 2016, 02:22 pm
The actual lib DFRobot is providing is incomplete, not developper-friendly, and flawd for some functions.
Add to that a datasheet also incomplete and containing some false info, and that will explain your problems.

With my project (which ils close to completion) I'll provide an all new lib for DFPlayer based on SoftwareSerial communication (forget about busy pin ans replace it by TX pin).
neskweek, that would be great indeed!!! I'm glad this community is growing and actively contribute now to the development! I for sure volunteer to test your improved DFPlayer lib, there is still unused potential in this module not yet utilized. I would also love to see a demonstration of your project !!!
Cheers!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 11, 2016, 04:23 pm
My PCB development for the DIYino board enters now the final stage, layout is nearly finished, last checks are running.

To give you a feeling about the component placement and routing, here are the pics from component and back-sides:

(http://s1035.photobucket.com/user/Kunci1/media/ComponentSide_zpseqhqytmi.png.html)
(http://s1035.photobucket.com/user/Kunci1/media/BacktSide_zpskg4gm3ik.png.html)

I was quite happy to learn that it was possible to place both the USB port and the SD-card holder on the bottom part of the PCB beneath/above each other. This way both the USB and the card can be accessed in-hilt, while the drive transistors are located all on the top part for easier wiring of the LEDs.

The current size of the PCB is width 22mm x length 60mm (0.8661" x 2.3622"), same width as the DFPlayer, length is slighly shorter than a 18650 battery, this should make chassis design easier.

I'm still waiting for the FTDI chips, otherwise all components already came in.

In the first run I will have ~10 boards, round about half of them with Atmegas already having the Arduino bootloader for faster verification. I'm so excited :)

Does anyone have experience about pro's and con's of ceramic vs. elko(tantalum) caps? This is the last thing I need to feed-back to the layouter for the 1uF and 10uF caps.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Feb 11, 2016, 08:13 pm
My PCB development for the DIYino board enters now the final stage, layout is nearly finished, last checks are running.

Wow, really exiting to see!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 11, 2016, 11:38 pm
Hey Fellows !

I'm really please and proud to finally announce the release of LightSaberOS (https://github.com/neskweek/LightSaberOS).

LightSaberOS

Device currently supported :

I would be glad to see other modules added. If you're interested to make your device compatible, please contact me.

What it does :





How it works :

In standby mode (idle) :


In Action Mode :


In config Mode :


If you want to add a soundfont, create a new folder (named 004 for instance), put your soundfiles in it (don't put gaps in numbering files) and take a look at SoundFont.h file


License:
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ (http://creativecommons.org/licenses/by-nc-sa/4.0/).

Notes :

NOOOO MP3, NOOOO WMA !!! Only WAVs !!! : when encoding a sound to those format (MP3 and WMA) the encoder will automaticly put a silence at start. WE DON'T WANT GAPS !!!  

With soundfiles with hum extension (you edited a swing file and paste a hum sound repeated for some time), if you put 2 min of hum after your swing sound, if you don't move your saber for 2 min (higly unprobable in real situation) you'll notice a little gap in hum sound at that moment : You've just switch on a pure hum soundfile.

Don't put gaps in soundfile numbering ex.:001_Boot.wav,002.wav, 0010_Swing1.wav... The "folder play" command of the DFPlayer will see them as 001, 002, 003... That will generate unpredictable behaviour.

You can't put more than 255 folders numbered folder on your SDCard, including O1 (which contains config mode sounds)

You can't put more than 255 files in a folder on your SDCard.

You won't be able to have more than 65535 sound file on the wole SDCard (including config sounds).

Don't put names after folder number (ex.: 001_Config or 002_Sith). Your folder won't be detected (tested :( )

Since I've developped it on a breadboard, clash and swings settings may need some more tweaking. Still hopping that will not be the case  :P. I've developped those wanting to obtain "real life" saber feel.

Beware  the amount of debug settings you uncoment: they add significant amount of data to the compile.


Wirings :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/AS2_LEDstringSaberArduino_NeskweekRevised_zpsu5k0ljck.png.html)


Quick Tour video (https://youtu.be/mc8scn_qyFM)
Quick Demo of the new motion detection system (V1.0 RC5) (https://www.youtube.com/watch?v=wY8BSSEyYLY)

For more info consult README.md file on github. (https://github.com/neskweek/LightSaberOS/blob/master/README.md)



I hope you'll like it.

Don't hesitate to reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) (I've made a lot of test but... hey !), or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new).

[EDIT]
LSOS have greatly evolved since this announce.
For up to date infos please visit github.

[EDIT2 - 18/03/2016]
PLEASE ! Report your issues on github to keep this thread readable.
I won't answer your questions, or look at your problem HERE anymore !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 12, 2016, 02:48 am
that is excellent! can I send you my code for changing colors with a RGB LED and see if you can integrate that?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 12, 2016, 06:06 am
Yes, please !
Send it !  I will integrate it
Make sure it works before send it to me, since I don't have your hardware to test it


I posted the wiring schematics I used in my precedent post.
[EDIT 15/02/2016 ] Removed since LSOS v1.0 RC3
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: ryang on Feb 12, 2016, 06:16 am
I'm really please and proud to finally announce the release of LightSaberOS V1.0 RC1 (https://github.com/neskweek/LightSaberOS).
:O

That's an impressive amount of work in a bloody short amount of time!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 12, 2016, 10:33 am
Hey Fellows !

I'm really please and proud to finally announce the release of LightSaberOS V1.0 RC1 (https://github.com/neskweek/LightSaberOS).


Hi neskweek,

That is an impressive work you have done!!! It seems now we have our much needed software pro for this project! I'm especially grateful, because now I can focus more on the hardware implementation of my DIYino, knowing that we have for it professional code support!

BTW, can you check if there is any hard-to-fix incompatibility between your breadboard implementation and the proposed DIYino board schematics? You mentioned you've made some changes to the wiring but a quick glance will not reveal them. I would pretty much prefer a library compatible with the hardware I'm designing.

Other question: does you DFPlayer lib make use of the Tx pin of the DFPlayer? On the DIYino board currently I wire only the Rx to the Atmega, but if your lib makes extensive use of the Tx, I'm willing to cater for that (with the current schematics it's of course possible to hand wire, because Tx access is granted, but I strive to make the board as easy-to-use as possible with only a min amount of soldering necessary).

Final statement: simply GREAT! Let us know if you update the lib, then I will also run a trial. Once my hardware project is closed and boards available, I will use the extra time to see if I can propose to add any additional useful function.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 12, 2016, 02:02 pm
Thank you guys  ^_^

BTW, can you check if there is any hard-to-fix incompatibility between your breadboard implementation and the proposed DIYino board schematics? You mentioned you've made some changes to the wiring but a quick glance will not reveal them. I would pretty much prefer a library compatible with the hardware I'm designing.
Concerning the change I made on pin connexion :
Added :
A0 Connected to DFPlayer SPK+
A1 Connected to DFPlayer SPK-
(based on one of your previous post)
DFPlayer TX  on D12


Removed  :
DFPlayer Busy pin (to my eyes this pin only serve one purpose: light an external led on a device to show activity)

Modded :
Main button   on  D9     instead of   D12
Lockupbutton on  D10   instead of   D4
ledstring S3   on  D5     instead of   D6
ledstring S4   on  D6     instead of   D9
ledstring S5   on  D7     instead of   D10
ledstring S6   on  D8     instead of   D11
DFPlayer RX   on  D13   instead of   D8

But pin can be customized in the code (I plan to add #define at the start of the code to ease modification.)

[EDIT]
Not true since LSOS v1.0 RC3


For what I saw, If the chips are the same as the module we use there should'nt be any reason it wouldn't work with your DIYino. But I have to precise that I'm totaly clueless regarding electronics. I will  still have a closer look, in case I see something.

Anyway I didn't pay much attention to its design since I was focused on my code for the last two weeks, but now I did get a look at it, and I'm definitly interested by your future device:
Now that I finished the hardest part  of coding I was thinking about how I would integrate my breadboard to a hilt .... And how it would react to stress... (You'll see what I mean when you'll see my breadboard on video... that I've still got to make)

Your device embark MOSFET for ledstrings too ?
If so, you can count me on the order list.
Meaning that if  LightSaberOS doesn't work out of the box on it, I will fix it.

Other question: does you DFPlayer lib make use of the Tx pin of the DFPlayer?
Yes it does, extensivly. It use the full query/answer serial system of the DFPlayer.
You will want to wire the DFPlayer TX pin to the Atmega.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 12, 2016, 03:36 pm
Oh, I know it works, I had paid a guy on Freelancer to do it. It uses the Onebutton sketch, but you can take that out. It saves the RGB info to the EEPROM for both main blade color and clash. I have tested it and it works, just some quick notes so it's easier to see

updateLED1 is the main blade color
updateLED2 is the clash color

I am only using the RGB and not the White on some modules, so it's not wired for White.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 12, 2016, 04:21 pm
I got the code and took a look at it.
Finally, I should be able to basic test it with my leds.

I'll still add some code for white LED. Others may want to wire it.

Is it ok if I put colour changing option inside the config mode ?

I plan to add a soundfont preset color option (save a color preset for each soundfont) and let you boot with the last color chosen.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 12, 2016, 07:05 pm
Yes please add it to the config menu...that'd be epic! Let me know when your code is complete and I will download and test. Btw...protonerd...is your board simply a pcb or does it also have the resistors and mosfets soldered in? Those buck pucks work great btw...when designing a pcb for myself I left a 3pin connection for each led so it'd match the buck (positive, negative, control)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 13, 2016, 12:25 am
Yes please add it to the config menu...that'd be epic! Let me know when your code is complete and I will download and test. Btw...protonerd...is your board simply a pcb or does it also have the resistors and mosfets soldered in? Those buck pucks work great btw...when designing a pcb for myself I left a 3pin connection for each led so it'd match the buck (positive, negative, control)
The DIYino PCB will come with all ICs and components mounted, yes, including 6 MOSFETs and all passives.
Which means no need for a buck puck, that will be taken care by the transistors. You can drive LED string blades with it, using all 6 low side switches or use 4 of them for RGBW (or 3 for RGB). I designed the board to be as generic as possible to suit a wide range of different flavors. To avoid confusion: the Atmega, the MPU6050 and the chipset of the DFPlayer are also mounted on the PCB. So theoretically no need to add anything. But more after I get my hands on them and test them.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Feb 13, 2016, 02:36 am
Modded :
Main button   on  D9     instead of   D12
Lockupbutton on  D10   instead of   D4
ledstring S3   on  D5     instead of   D6
ledstring S4   on  D6     instead of   D9
ledstring S5   on  D7     instead of   D10
ledstring S6   on  D8     instead of   D11
DFPlayer RX   on  D13   instead of   D8

But pin can be customized in the code (I plan to add #define at the start of the code to ease modification.)

One feature I like from Protonerd design is using PWM to drive leds (I'm using it in my saber). I'm an Arduino newie but I think some of the pins you are using are not PWN capable on Arduino Nano.

Regarding the Protonerd DIYino PCB, I'm including a new feature in my design to allow for a constant blade brightness across all battery life, I plan to use an analog pin to do a battery power meassurement on bootup and adjust PWM values accordingly to compensate low battery condition. What do you think about including this feature in the design?

I will have a look at neskweek code and try to help as much as possible.

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 13, 2016, 07:09 am
Question....will the DIYino have built-in voltage regulator similar to the buckpuck or will I still have to put resistors on my LED's so the 7.4v doesn't fry them?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 13, 2016, 08:52 am
Question....will the DIYino have built-in voltage regulator similar to the buckpuck or will I still have to put resistors on my LED's so the 7.4v doesn't fry them?
He answered yes to that one two post above ;)

I have integrated the RGB led code but not fully tested it yet: I found a "bug" in my buttons handling functions.(it impacts ledstrings and RGBs : button debounce delay seems to fluctuate too much so the program miss some buttons call)

I think I'm going to rewrite that part too using OneButton Lib
I did'nt saw that lib prior to my developpment and it handles buttons in a much better way than my code do (more interrupts !). I just hope it won't add too much size to compile.

But I don't thinkl I'll have time to work on it today :P
You can still test it (have a look at RGB fork branch in git [EDIT 2016/02/14]commited to 1.0 RC2 and fully functionnal[/EDIT]) but be aware that clash and blaster shot calls might not work properly. Going to action Mode after modifyed some parameters in Config Mode might be broken too (you can still reset the Arduino after leaving config mode to test that it retains your parameters correctly)

@Thelmos
You're probably right regarding PWM pins :P. Didn't saw that too. That would explain why some led flickers correctly and some other don't (I thought it was my old breadboard that was involved)
I'll try to revert my wiring to original schematics
Thanks
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Feb 13, 2016, 01:13 pm
Regarding the Protonerd DIYino PCB, I'm including a new feature in my design to allow for a constant blade brightness across all battery life, I plan to use an analog pin to do a battery power meassurement on bootup and adjust PWM values accordingly to compensate low battery condition. What do you think about including this feature in the design?

That's the way I pretend to measure battery voltage and increment PWM values as it drains, mosfet preserves battery life when measurement is not needed (I think it is enough to read the voltage at  bootup, battery should not drop a lot during one saber use):




Code: [Select]

float readVcc() {
  //Turn on voltage divider
  digitalWrite(PIN_VOLTIMETER_SWITCH, HIGH);
  delay(50);
  //Read voltage
  float volts = (analogRead(PIN_VOLTIMETER_INPUT)*2*5)/1023.0;
  //Turn off voltage divider
  digitalWrite(PIN_VOLTIMETER_SWITCH, LOW);

  return volts;
}


You can see it in action and get full code here (voltages are printed in serial monitor):

https://123d.circuits.io/circuits/1505709-arduino-vin-measurement (https://123d.circuits.io/circuits/1505709-arduino-vin-measurement)


Hope it helps.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 13, 2016, 03:38 pm
I guess I didn't understand Proto's answer, so is there voltage regulator or no? will I need resistors on my LED's?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Feb 13, 2016, 11:14 pm
I guess I didn't understand Proto's answer, so is there voltage regulator or no? will I need resistors on my LED's?
As for Protonerd's design, you don't need resistors, just use transistors in PWM arduino pins to drive leds, adjust signal pulse so leds don get burned.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 14, 2016, 03:18 am
LightSaber V1.0 RC2 is out ;)

Changes:

- RGB Led (Luxeon styled) support
- Button triggers ported to OneButton library. It is more efficient and adds more trigger => we can add even more functions... Arduino Nano space will become a problem tho.
- Added ledstring/RGB blaster effect ( randomly shut down one segment for a
short amount of time / change color on RGB)
- Added some more sounds to config Mode
- Added boot sounds of soundfont when selecting them in config mode. (still buggy)
- changed powerOff trigger => via long press on Main button (less risk of shut it down by accident)
- Code cleaning


RGB branch produces a big hex file.
Actually it takes litterally all the capacity of the Arduino Nano. I had to hunt for some bytes to make it work with the INFO mode on. In the future, if we add functionality with new buttons trigger it will require to run with INFO mode off. Unless we give the code a diet.

To activate RGB support comment  :
#define LEDSTRINGS
and change ledpins (#define)  to match your project.

[EDIT 18/03/2016]
Please reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) , or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new) on GitHub. I won't address problems in this thread !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 14, 2016, 03:31 am
I honestly don't know what a transistor does so here's my concern. The arduino puts out something like 50-150 ma of juice per pin which makes for a dim led. That's why I had to use mosfets and resistors to power the led from the battery and mosfets to control them. How much juice will the pins put out for the led to consume?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: CrossRoads on Feb 14, 2016, 05:42 am
An IO pin is only good for 20-25mA of current. Not 50-150mA.
If you are controlling a MOSFET, it needs very little current to switch from on/off or off/on. The input capacitance of the gate must be overcome, so there is a brief surge of current needed to charge or discharge that capacitance. After that, mere uAs of current are needed to hold the on/off state.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 14, 2016, 08:15 am
Ok, so here's my concern then...does the DIYino control the amount of amperage going to the LED? or do I still need a buckpuck or resistor? if I hook up 7.4v without either and the DIYino doesn't regulate it, then poof goes the LED.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: RemBok on Feb 14, 2016, 09:39 pm
Hi there,

First of all: great thread! Also started collecting the necessary parts. Right now i'm planning to go make two ledstring sabers, a blue one and a green one.
But I soon found out that it's not that easy for me to find some Si2304DS MOSFET's, since this MOSFET currently outdated according to some online shops. Since i'm a total noob regarding MOSFET's, i was wondering if it's also acceptable to use the Si2304BDS.
As far as I can see the only the most notalbe difference between them is the Drain-Source On-Resistance, 117 mOhms for the Si2304DS versus 70 mOhms for the Si2304BDS.

More detailed comparison can be found here:
http://www.vishay.com/docs/73284/73284.pdf
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 14, 2016, 09:51 pm
LSOS v1.0 RC3 is out :




There will be a rc4 tomorow: I plan to enhance blaster/clash effect on RGB device

[EDIT 18/03/2016]
Please reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) , or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new) on GitHub. I won't address problems in this thread !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 15, 2016, 08:53 am
LSOS v1.0 RC4 is out

Changes :


If someone knows how to surcharge/capture ISR(PCINT0_vect) from softwareSerial to try to capture the *_END_PLAY signals from the DFPlayer please tell me ;) That may allow us to have full gapless sound playing.
Any other solution you may find is also welcome ;)
The principle: the sooner we get any *_END_PLAY signal the sooner we can launch a play command sound.

Unless you find something else (bug or functionnality) and since the code is now in its stable form, I may pause developpment with this version(unless I came up with a new solution for the "problem" above).
I will concentrate on soldering my ledstrings again :I have soldered them with a common anode and, for our project, it needs a common cathode :P

Nope ... Not yet...


[EDIT 18/03/2016]
Please reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) , or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new) on GitHub. I won't address problems in this thread !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 15, 2016, 10:55 am
First of all, what neskweek put together is EPIC!!! Although my original code for my first build has all the functions of the LSOS, your code is sooooo much more clean!!! Huge thumbs up!

Ok, so here's my concern then...does the DIYino control the amount of amperage going to the LED? or do I still need a buckpuck or resistor? if I hook up 7.4v without either and the DIYino doesn't regulate it, then poof goes the LED.
The DIYino will have a 5V LDO for the logic chips, but for driving the LED's, you still have to carefully select and adapt your voltage source to your LED forward voltage. You can use PWM control of the transistors, but with that there is a limitation how much power you can take away. The transitors are rated at 0.8W dissipation, i.e. roughly speaking at 1A current (usual for max current of for instance Cree Blue and Green HP-LEDs), you can safely burn 0.8V. Which means 7.4V-0.8V=6.4V, still way too much for single LEDs. You can of course decide to risk burning more over the transistors, but there is a common sense limit to that as well.

So to sum it up: with transistors and PWM theoretically you do not need any resistors or buckpucks, but in reality it depends. This kind of dilemma exists since the "dawn" of lightsaber prop building. Most of the useful batteries have 3.7V. Now 3.7V is perfect for the LED's (for green, white and blue you do not need any means of dissipation, for red a transistor can take care of that), BUT it might be too low for the logic and some say that the audio output will be less loud (something I cannot confirm really). So to overcome this people tend to include 2 of these batteries, which brings them up to between 7.4V-8.2V. Now yon can connect this voltage to Arduino boards or the upcoming DIYino, because they regulate the input voltage down to 5V, it will be seen still  by the LEDs. BUT it's a huge waste of already scarce power to connect single LEDs to double the Vf, because you just convert half of your power consumed to heat. Nice in certain climates to have a heated hilt, but still a waste.

Answer/Solution?
1. Well, if you are going to build a LED string blade, you can use the serial techniques to buidl up strings having a Vf close to 7.4V, so you need to burn only a small portion of the power over the transistors.
2. If you have a sinlge LED or RGB(W), I advice to use 3.7V battery and either try to run the logic from that low voltage (I still have to see if the DIYino can do that, my breadboard design have difficulties, but I was so far not able to track it down which component has the difficulty)
3. or use a DC/DC boost to supply the logic with 5V, while the LEDs still get the 3.7V, good enough for the transistors to PWM safeguard the LEDs.
4. Or if you are going for 7.4V with sub-3.7V LEDs, use resistors or a puckpuck, disadvantage is the above mentioned power loss and the aweful room it takes in the hilt.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: GUNB on Feb 15, 2016, 01:15 pm
sorry for my bad english....@ neskweek  an example for your library DFPLAYER? this module is doing me crazy...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 15, 2016, 02:00 pm
That's the way I pretend to measure battery voltage and increment PWM values as it drains, mosfet preserves battery life when measurement is not needed (I think it is enough to read the voltage at  bootup, battery should not drop a lot during one saber use):

https://123d.circuits.io/circuits/1505709-arduino-vin-measurement (https://123d.circuits.io/circuits/1505709-arduino-vin-measurement)


Hope it helps.
Thelmos, this is indeed a excellent idea! Actually I also tried this a long time ago to monitor the voltage, I used 2x1MOhm resistors to divide the 7.4V to half, but I never though about actually using this for anything else than maybe a warning light to charge the battery (like a PLI), but later dropped the idea mainly because my tiny double 10440 batteries discharged very dependably in 20 mins...

But this regulation of the current never occurred to me. I think this would be a valuable addition to the LSOS! If the community can find a way to power the electronics from a 3.7V supply (or anything up to 5V), then even the voltage divider would not be necessary. If another Analog Input would be connected to the LED cathode, then even the voltage across the LED could be measured and/or calibrated to stay within specification voltage range.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 15, 2016, 05:14 pm
@Protonerd
Thank you again.
Still in my source there's not your blade effects you shown in your video when you use the AncientSaber soundfont ;)
I might add it with other ones, and I'll add the same system  made wth color: the possibility to assign a blade effect to a soundfont.
@GUMB
Basic example :
Code: [Select]
#include "DFPlayer_SoftwareSerial.h"

#define DFPLAYER_DEBUG
#define DFPLAYER_HEAVY_DEBUG

DFPlayer mp3;

// setup code here, to run once:
void setup() {
 // Serial line for debug
 Serial.begin(115200);
 // Initialize DFPlayer Serial line
 mp3.setSerial(7, 8);
 // Set Volume
 mp3.setVolume(15);
} // setup

// main code here, to run repeatedly:
void loop() {

 //Have a folder called "001" containing a file "001.wav"
 mp3.playTrackFromDir(1, 1);
 delay(500);

 // You can implement other code in here or just wait a while
 delay(10);
} // loop



Concerning capturing  ISR(PCINT0_vect) from SoftwareSerial, I manage to do it (I copied Software Serial source, pasted it in DFPlayer library and moded it )
But the result isn't much better than what we have right now.

The only two solutions left are :
- to be able to manipulate intern chip pointer for next sound file. (the more I test the less I think its possible)
- use hum extended soundfiles.

I'll still add it to v1.0 RC5, I may have another idea to obtain full gapless sound support, hoping it'll fit in Nano RAM.

Concerning current regulation: I'll add it to the code but won't be able to test it.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 15, 2016, 11:23 pm
LightSaber OS Demo video (https://youtu.be/mc8scn_qyFM)
please be indulgent with my spoken english :p
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: billpealer on Feb 16, 2016, 12:34 am
First of all, what neskweek put together is EPIC!!! Although my original code for my first build has all the functions of the LSOS, your code is sooooo much more clean!!! Huge thumbs up!
where is the link to DL it?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 16, 2016, 09:56 am
The DL link is Page 8 of this topic, or in the video description from my precedent post.

I didn't upload 1.0 RC5 yet because I finally decided to move hum relaunch detection to an interruption based system.

Another problem I need to address : the hex file produced is getting really heavy.

By the way if other developpers want to participate, you're more than welcome !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 16, 2016, 05:27 pm
@Protonerd
Thank you again.
Still in my source there's not your blade effects you shown in your video when you use the AncientSaber soundfont ;)
I might add it with other ones, and I'll add the same system  made wth color: the possibility to assign a blade effect to a soundfont.

Actually those effects look great, but in terms of implementation I used a very crude way, namely to put the sequence in an array. This weights heavy of course on the hex size, so I was forced to remove these complicated effects, but I want to bring them by providing simple effect functions like brightness ramp-up/down, oscillating etc. In this way such effects can be put together like lego bricks. But first thing is the hardware debug...

As to the hex size, I'm a bit afraid that our project simply overstretches the Nano's RAM, but I still could not quite put my hands on the root cause, simply because I'm not a software expert
- it could be the amount of global variables used
- it could be the amount of libraries used (maybe those libraries shall be shortened to a bare minimum to support the LSOS?)
- of the number and/or type of the variables

That's why I'm so happy to have people on board for software development :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on Feb 16, 2016, 08:40 pm
Hi there,
Congratulations on your impressive work, I am an initiate of this but I recently found this if you can be helpful for coding the LEDs and sound. It works really well and fast:

http://www.whitearmor.net/forum/topic/19322-arduino-a-cheap-board-for-e11-blaster-effects/


You can neskweek publish the electronic scheme used? Thank you
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 16, 2016, 10:09 pm
Ok, quick question about your wiring....what do you mean wiring the speakers to the analog pins? Is that needed for non-DIYino? I am looking to do my own mockup for right now and use the buckpuck for power, can i still run the speaker wires directly off the DFPlayer?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 17, 2016, 05:13 am
Hey guys!

Just wanted to pop in and say that this is an awesome project so far. I've been following for a while and have most of my parts on the way. I also wanted to ask one question: I don't have the same arduino you guys are working with, but I do have an A-Star 32U4 on my breadboard right now. Looking at the diagrams you have posted here, it seems like it would have all of the pins I would need to make this work including the SDA, SCL, 5v, and 3v3 pins. Is there anything else it would be missing that an arduino would? I'll probably be getting an arduino nano clone anyway, but I'd like to give it a shot with this board. Thanks again, guys for all of the info!

Jes
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 17, 2016, 08:41 am
Ok, quick question about your wiring....what do you mean wiring the speakers to the analog pins? Is that needed for non-DIYino? I am looking to do my own mockup for right now and use the buckpuck for power, can i still run the speaker wires directly off the DFPlayer?
Wiring the speaker outputs/terminals to analog inputs is just a nice feature, but it's not essential. What it does is easy: with the analog inputs you measure the voltage on both terminals of the speaker, this information can be used to for instance control the LED fluctuations, so the light will change synchronous to the beat of the sound file. Nice effect, I show it in one of my videos, you can look it up. Makes the saber look alive :) not to mention the saving in code, because you can simply leave it up to the sound to make adjustments to the PWM instead of writing complicated flicker algorithms.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Feb 17, 2016, 07:19 pm
Wow, neskweek, you just saved me a ton of work on my saber project! I'm going to see if I can use SoftPWM to add pseudo-PWM functionality to the remaining free pins. Need more lights for my Kylo Ren crossguards!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 17, 2016, 07:51 pm
nes, can you weigh in on your code? do I need the speakers wired to the analog pins for non-DIYino?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 17, 2016, 11:47 pm
nes, can you weigh in on your code? do I need the speakers wired to the analog pins for non-DIYino?
If you want to have flicker effect Protonerd has explained in his last post: yes. It also works with RGBs :)
I think it's a really great feature : it really enhance the visual effect of the saber.
I consider it as a "must have"!

And by the way
Wiring the speaker outputs/terminals to analog inputs is just a nice feature, but it's not essential. What it does is easy: with the analog inputs you measure the voltage on both terminals of the speaker, this information can be used to for instance control the LED fluctuations, so the light will change synchronous to the beat of the sound file. Nice effect, I show it in one of my videos, you can look it up. Makes the saber look alive :) not to mention the saving in code, because you can simply leave it up to the sound to make adjustments to the PWM instead of writing complicated flicker algorithms.
I'm doing this in my code since initial release. I plugged them on A0 and A1 (can be change via parameter).
When I look to DIYno schematics I don't see anything of that. Have you planned to plug them in?


Wow, neskweek, you just saved me a ton of work on my saber project! I'm going to see if I can use SoftPWM to add pseudo-PWM functionality to the remaining free pins. Need more lights for my Kylo Ren crossguards!
You're welcome ;) I would be glad to add your modifications to a future release.
That would be also usefull if someone wants to add a FoC ledstring.

But you should wait a little before starting to modify LSOS :
I'm going to release v1.0 RC5 soon. It still needs further testing.
I've made HUUUUUGE improvements since the video.  I'm quite proud of the result !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 18, 2016, 05:40 am
@DJWing & Prtotnerd

Hey guys, I'm having the same issues DJWing was having back on pages 6 & 7, nothing is playing at all, and sometimes I get buzzing. I've tried all suggestions here and nothing so far. I've tried with both a pololu a-star board and an official arduino uno without any success. SD card formatted, switched TX and RX, dumped files in the root of the card, and tried Protonerd's testing sketch. Any other clues? Thanks a bunch!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 18, 2016, 07:21 am
@DJWing & Prtotnerd

Hey guys, I'm having the same issues DJWing was having back on pages 6 & 7, nothing is playing at all, and sometimes I get buzzing. I've tried all suggestions here and nothing so far. I've tried with both a pololu a-star board and an official arduino uno without any success. SD card formatted, switched TX and RX, dumped files in the root of the card, and tried Protonerd's testing sketch. Any other clues? Thanks a bunch!
I had also the same problem when starting using this bloody module. It looks like a bad module initialisation.
How do you do it ?

If you want to basic test your DFPlayer module : put some soundfiles on your sdCard, make some current go throught DFplayer's IO1 pin for a short time (simulate a button press). It should play .

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Feb 18, 2016, 07:54 am
But you should wait a little before starting to modify LSOS :
I'm going to release v1.0 RC5 soon. It still needs further testing.
I've made HUUUUUGE improvements since the video.  I'm quite proud of the result !
Exciting news :) What kind of improvements can we look forward to?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 18, 2016, 10:08 am
I experimented a bit with a few DC/DC converters of type boost (i.e. Vout>=Vin) to see how they perform. I wanted to see:
- if there is any which is small and can supply the Arduino board with 5V while the battery is in the range of 3-4.2V (3.7V type battery)
- if I find a DC/DC which can replace a 18650 type 3.7V battery for LED string sabers

All 3 I bought from ebay, they have the following bird's view specs:

1. Vout: 5V@0.5A
http://www.ebay.de/itm/121142828799?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

2. Vout: 5-28V@2A
http://www.ebay.de/itm/331649725186?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

3. 4Vout: 4-35V@3A
http://www.ebay.de/itm/251687632376?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

You can see the sizes of the individual DC/DC's on the next 2 pics:

(http://s1035.photobucket.com/user/Kunci1/media/IMG_20160215_192625701_zpswwhzhes4.jpg.html)
(http://s1035.photobucket.com/user/Kunci1/media/IMG_20160215_192607857_HDR_zpsan6fnhxy.jpg.html)

Nr#1 I used to supply my breadboard DIYino setup and it worked. True, I did not have the LED(string) to connect, but I'm anyway not supplying that with the DC/DC. These part have a slightly higher Vout than 5V (I tried 5 pcs, all of them had a voltage around 5.2V), but for 5V logic this is not a problem. Please note that the (+) output of the DC/DC has to be connected to the 5V of the Arduino instead of the Vin. Reason is, we want to bypass the 5V LDO of the Arduino.

Nr#2 I used with another of my sabers waiting for maintenance on my bench. It uses a commercial board, but in terms of circuitry very similar to the DIYino (i.e. it has an 5V LDO to supply the logic while the LEDs are supplied directly from the battery). Reason I wanted to have a DC/DC is fairly simple: in the hilt I had 2x3.7V batteries, with a capacity of 700mAh, which is enough for about 20 mins. My calculation was, that if I reduce the voltage to 3.7V, but get in a 18650 with 3200mAh, due to the DC/DC I loose half of the capacity, but I still end up with roughly 1500mAh (including the efficiency coefficient of the DC/DC), which is double the operating time of one charging.
You can see a brief video here:
(http://i1035.photobucket.com/albums/a432/Kunci1/VID_20160215_211658012_zpslnypjzop.mp4)
Due to the fact that the rated max current output of the Nr#2 is 2A, and the 90+ LEDs consume more than that, you can see that upon switch on the voltage will drop from 7.4V to ~6V. So with this DC/DC I have a nice, smooth operation, but all the LED's are operated at their nom voltage condition, so dramatic "power surges" with flashes of light are not possible, the power supply goes into a kind of limitation. But the concept works :)
To increase the voltage headroom, I bought the big DC/DC's rated for 3A.

Nr#3: not much to tell about these, they simply do not do what I expected. I soldered them in in place of the Nr#2 to the same circuit, but the voltage immediately collapsed to ~5V, with huge fluctuations (the LEDs kept switching on/off), and after a few secs the board reseted itself and booted again, probably due to undervoltage. I tried all 3, so it's not just an unlucky draw. So 3A module is rubbish.

Facit: the smallest Nr#1 is a good solution to supply the logic only, if you intent to use a single 3.7V battery but want 5V to properly supply your logic. Nr#2 could be used if you do not exceed 2A in your setup including all the LEDs, but need higher voltage due to LEDs in series.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 18, 2016, 10:30 am
Exciting news :) What kind of improvements can we look forward to?
It's a surprise ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 18, 2016, 10:56 am
If you want to have flicker effect Protonerd has explained in his last post: yes. It also works with RGBs :)
I think it's a really great feature : it really enhance the visual effect of the saber.
I consider it as a "must have"!

And by the way I'm doing this in my code since initial release. I plugged them on A0 and A1 (can be change via parameter).
When I look to DIYno schematics I don't see anything of that. Have you planned to plug them in?

On the DIYino board this feature is not in. I carefully weighted which connection should be hard-wired and which can be done by the user. Crucial connections like the Rx/TX to the MP3 chip or the SDA/SCL to the MPU6050 are wired on the board (actually in the initial design they had 0Ohm bridges, in case users would have wanted to redirect them, but I dumped that idea on 2nd though). The speaker output to analog input connection has to be wired externally, for that I included the Arduino-like pin connectors running down on both sides of the board. So a connection like proposed by neskweek is easy. I agree that this feature is a "must-have", but in terms of hardware design I rated it as a soft-"must-have". Nevertheless I happy that you like this feature, if fine-tuned it indeed gives a enhanced visual.

To the topic of the MP3 player buzzing, did you check the voltages? As I mentioned earlier, my trial module does it if the supply voltage is too low.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 18, 2016, 04:48 pm
I had also the same problem when starting using this bloody module. It looks like a bad module initialisation.
How do you do it ?

If you want to basic test your DFPlayer module : put some soundfiles on your sdCard, make some current go throught DFplayer's IO1 pin for a short time (simulate a button press). It should play .


Well that worked! Jumping the IO1 pin made the module play, which is further than I've gotten before. So you're right, I don't think my board is communicating with the player. I'll keep digging into some code to find the answer.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Feb 18, 2016, 09:52 pm
You can see a brief video here:
(http://i1035.photobucket.com/albums/a432/Kunci1/VID_20160215_211658012_zpslnypjzop.mp4)
Due to the fact that the rated max current output of the Nr#2 is 2A, and the 90+ LEDs consume more than that, you can see that upon switch on the voltage will drop from 7.4V to ~6V. So with this DC/DC I have a nice, smooth operation, but all the LED's are operated at their nom voltage condition, so dramatic "power surges" with flashes of light are not possible, the power supply goes into a kind of limitation. But the concept works :)
Wait, you've got a prototype PCB built already?! Jeepers creepers! You're not wasting any time!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 18, 2016, 10:12 pm
LightSaberOS 1.0 RC5 is out 

Changes :


Known Bug :



Quick Demo of the new motion detection system (https://www.youtube.com/watch?v=wY8BSSEyYLY)
Time to have some rest on coding.
;)

[EDIT 18/03/2016]
Please reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) , or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new) on GitHub. I won't address problems in this thread !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 19, 2016, 09:02 am
Wait, you've got a prototype PCB built already?! Jeepers creepers! You're not wasting any time!
In fact today the PCBs should be out, but still unassembled. But the board I have on the video is a CF LS 6.5, this saber was heavily utilized by the kids and needed maintenance. Because I anyway had to take it apart I though I can also do some experimenting.

For the prototype I guess I still need some time, I guess I will have them physically on my bench in around 3 weeks.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 19, 2016, 10:03 am
Wow, neskweek, you just saved me a ton of work on my saber project! I'm going to see if I can use SoftPWM to add pseudo-PWM functionality to the remaining free pins. Need more lights for my Kylo Ren crossguards!
I was thinking :
Why don't you just wire your 1st crossguards segments in parallell with 1st stringleds segment, 2nd with 2nd, etc...?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 19, 2016, 02:18 pm
I was thinking :
Why don't you just wire your 1st crossguards segments in parallell with 1st stringleds segment, 2nd with 2nd, etc...?
Or use 5 segments for your primary blade and 1 segment for the cross-guard. Then you are able to light them up in a same dramatic fashion as in the film, with a certain delay after the main blade. You can easily tweak a power-up sound file in Audacity to imitate a secondary firing of the side blades.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: BinaryDomain on Feb 19, 2016, 08:58 pm
Great job neskweek, you gonna publish the Fritzing connection diagram of all the components?
It will be more easy to connect and test everything (I Have the MPU, DFPlayer and the Nano :D)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Feb 19, 2016, 09:25 pm
Or use 5 segments for your primary blade and 1 segment for the cross-guard. Then you are able to light them up in a same dramatic fashion as in the film, with a certain delay after the main blade. You can easily tweak a power-up sound file in Audacity to imitate a secondary firing of the side blades.
That's exactly what I plan on doing, but I'd still like to have 6 segments in the main blade. I'm modifying LightsaberOS to flicker each independent segment randomly like Kylo Ren's and I'd like to have as much variation as possible.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 19, 2016, 09:37 pm
Great job neskweek, you gonna publish the Fritzing connection diagram of all the components?
It will be more easy to connect and test everything (I Have the MPU, DFPlayer and the Nano :D)
I've just done it. Look Page 8 or on the README.md on git

There's not so much differences from Protonerd original one (they are in blue, except BUSY pin connection that I removed)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 19, 2016, 09:54 pm
That's exactly what I plan on doing, but I'd still like to have 6 segments in the main blade. I'm modifying LightsaberOS to flicker each independent segment randomly like Kylo Ren's and I'd like to have as much variation as possible.
Look at https://www.youtube.com/watch?v=PD9YwP0hcR4
starting from position 2:22 :)

This how it's gonna look like.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Feb 20, 2016, 12:34 am
Look at https://www.youtube.com/watch?v=PD9YwP0hcR4
starting from position 2:22 :)

This how it's gonna look like.
Where do you think I got the inspiration from? ;)
I've been meaning to ask you, when each of the segments is flickering like that, is there a visible transition from one segment to the next?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 20, 2016, 08:38 am
Where do you think I got the inspiration from? ;)
I've been meaning to ask you, when each of the segments is flickering like that, is there a visible transition from one segment to the next?
No, it happens way too fast for your eyes to resolve.

Combined with the technique of sampling the music - which neskweek already implemented in his LSOS - this effect will be even more spectacular I guess, make a video and share!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Feb 20, 2016, 09:15 am
No, it happens way too fast for your eyes to resolve.

Combined with the technique of sampling the music - which neskweek already implemented in his LSOS - this effect will be even more spectacular I guess, make a video and share!
Oops, I should've phrased my question better. I meant can you see where one segment starts and another ends when they flicker, or is there a smooth diffusion of the light between segments?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 20, 2016, 03:35 pm
If you make it smooth between segment you'll end up with some sort of pulsing surge effect.That could ne nice but I don't think this is what you want.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 20, 2016, 10:12 pm
Oops, I should've phrased my question better. I meant can you see where one segment starts and another ends when they flicker, or is there a smooth diffusion of the light between segments?
OK, now I get your meaning. It's all about the physical diffusing of your LED string blade. If you do it right, you end up with a smooth diffusion, therefore you will not see under normal circumstances the individual string boundaries (under normal circumstances I mean when interactions happen fairly fast, i.e. you do not want to switch on/off your segments at a snail's pace). No need to worry about it, just make your blade right :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 20, 2016, 10:31 pm
LightSaberOS 1.0 RC5 is out 
I could hardly wait to finally set up everything to try LSOS on my breadboard, and as I expected it took only around 15 mins to be able to compile and download the code. I also saw your video about the swing detection, judging from the video this is by far the best swing detection I've seen for far (including high-end commercial saber electronics). But field testing with a saber is still pending ;)

First impressions:
- easy to set up

- I love OneButton. I was not aware of this library and struggled a lot to come up with something from scratch, but this is better by far. I really have to invest time to read through how it works, it's exciting.

- I'm impressed about the config handling, plain simple as that! Very elegant, especially with all those custom artificial voices announcing the selected config mode. BTW, how did you generate the menu announcement sounds? I would love to create my owns. This would be a nice tweak to be able to customize the speaches from the saber (like "As you wish, Master!" in a Sith sound font).

- uploading the content of the SD-card............ OMG!!!!!!!!!!!!!!!!!!!! I saw it working for the high-ends, but I never thought is possible it can be like copy-and-paste... Sir, that's an accomplishment in itself. Gone are the days I had to copy the files one by one, and no remorse.

- I had not much time trying the real saber features, switch on/off works, as well as blaster deflect and lock-up.

- I had problems with swings though, I lowered the threshold to 800, after some trials not yielding any swing, with the lower setting I got some odd swings, but not reproducibly. Maybe the problem is on my side... I also switched on all debug features, but as forecasted by you (and this reflects also my experience on this field) too much code quickly ends up in a crash. I could not produce any clash. I checked my MPU, it works, also LSOS debug serial prints show alterations of the acc/gyro values.

I planned to upload the code to my debug saber, but I lost in cram-fu, so I'm sentenced to resolder some nasty parts of it... I'm half a mind to dismantle my Hasbro MR Obi-Wan and relocate my DIYino prototype into it, it just has so much more room than the SaberForge one I use currenly.

[/quote]
Known Bug :


;)
[/quote]

It rings some bells, I need to consult my version tracking. I faintly recall I solves similar issues by introducing a delay, it might be about the DFPlayer still processing code and not ready.



All in all, BIG THUMBS UP!!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 20, 2016, 11:39 pm
Glad you liked it :)
BTW, how did you generate the menu announcement sounds? I would love to create my owns. This would be a nice tweak to be able to customize the speaches from the saber (like "As you wish, Master!" in a Sith sound font).
I did use this text to speech engine : http://www.fromtexttospeech.com/ (http://www.fromtexttospeech.com/)

- I had problems with swings though, I lowered the threshold to 800, after some trials not yielding any swing, with the lower setting I got some odd swings, but not reproducibly. Maybe the problem is on my side... I also switched on all debug features, but as forecasted by you (and this reflects also my experience on this field) too much code quickly ends up in a crash. I could not produce any clash. I checked my MPU, it works, also LSOS debug serial prints show alterations of the acc/gyro values.
(Excuse me for asking if you did but) Did you calibrate your MPU device ? (http://www.i2cdevlib.com/forums/topic/96-arduino-sketch-to-automatically-calculate-mpu6050-offsets/)
With the script included in this link it doesn't take a lot of time

Another thing:
On my breadbord MPU Z-axis is parallell to the blade axis and now that you make me think on this, it may not be a standard way of mounting it: MPU Y-axis should be parallell to blade axis
You may need to replace "quaternion.z" with  "quaternion.y" (and vice versa) and "aaWorld.z" with "aaWorld.y" in main loop .

I'll add a parameter for this in future version.


clash on the other hand is not axis-dependant
I finetuned clash on my breadboard but it might not be the best values for a hilt with saber.
This detection part is quite tricky to handle.

Quote
I also switched on all debug features, but as forecasted by you (and this reflects also my experience on this field) too much code quickly ends up in a crash. I could not produce any clash. I checked my MPU, it works, also LSOS debug serial prints show alterations of the acc/gyro values.
Yeah that's a problem.

I did make them modular tho.
You can turn on Swing debug alone or Clash debug alone but both at the same time won't work:( (to much output)
Heavy debug are quite unreadable... I'm not sure they are still usefull.
 


It rings some bells, I need to consult my version tracking. I faintly recall I solves similar issues by introducing a delay, it might be about the DFPlayer still processing code and not ready.
That would be nice. I spend some hours tracking this down without success.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 21, 2016, 01:18 am
Just getting all of my ducks in a row here... I've downloaded LSOS and installed the libraries, but when I go to compile I get:

Lightsaber:738: error: 'confParseValue' was not declared in this scope

    confParseValue(storage.volume, 0, 30, 1);

I'm guessing that I don't have something installed correctly. I Googled the "LinkedList" and "OneButton" libraries and installed them, but I'm not 100% that they were the correct ones. Can anyone point me in the right direction? Thanks!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 21, 2016, 01:31 am
Hey Nes....I am wanting to use a Adafruit Pro Trinket 3V, and was wondering if you could guide me on something?

This unit can't use pin 2 or pin 7

It uses pin 3 for its interrupt....heres the other problem..the code is just a smidge too big...

Sketch uses 29,750 bytes (103%) of program storage space. Maximum is 28,672 bytes.


I am not using LEDStrings, just RGB, what can I safely dump from the code to trim it down? And where in the code would I change the Interrupt pin from 2 to 3?

I am super excited to get this tested and working!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 21, 2016, 09:12 am
Just getting all of my ducks in a row here... I've downloaded LSOS and installed the libraries, but when I go to compile I get:

Lightsaber:738: error: 'confParseValue' was not declared in this scope

    confParseValue(storage.volume, 0, 30, 1);

I'm guessing that I don't have something installed correctly. I Googled the "LinkedList" and "OneButton" libraries and installed them, but I'm not 100% that they were the correct ones. Can anyone point me in the right direction? Thanks!
Wow... weird...
Check you've got the latest files from LSOS git and that you didn't accidentaly add some disrupting character :P.

I'm going to release a little update soon, I'll add the library I did use inside, just in case, but I don't think,it's related.



Hey Nes....I am wanting to use a Adafruit Pro Trinket 3V, and was wondering if you could guide me on something?

This unit can't use pin 2 or pin 7

It uses pin 3 for its interrupt....heres the other problem..the code is just a smidge too big...
just adjust pin parameters at the start of the code

Sketch uses 29,750 bytes (103%) of program storage space. Maximum is 28,672 bytes.

I am not using LEDStrings, just RGB, what can I safely dump from the code to trim it down? And where in the code would I change the Interrupt pin from 2 to 3?

I am super excited to get this tested and working!
Code: [Select]
#ifdef LEDSTRINGS
....
#endif

Those instructions already exclude blocks they contains from compile. They don't get inside hex files.

comment :
Code: [Select]
#define LS_INFO
That will produce an 27866 bytes hex file. But you won't have any serial output.


There's another problem I see: your device is 12Mhz not 16Mhz... I really don't know how it will handle MPU6050 I2CDEV communication.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 21, 2016, 10:05 am
LSOS 1.0 RC6 is out



[EDIT 18/03/2016]
Please reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) , or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new) on GitHub. I won't address problems in this thread !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Feb 21, 2016, 03:20 pm
Just wanted to make sure about something...if I change the attachinterrupt from 0 to 1, that will correctly change it to pin 3, right?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on Feb 21, 2016, 04:31 pm
Hi there
You can get a link to a SI12304DS MOSFET or equivalent , valid for this project at international stores ? thanks
It is the only missing component for asking me .
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 21, 2016, 06:23 pm
Wow... weird...
Check you've got the latest files from LSOS git and that you didn't accidentaly add some disrupting character :P.

I'm going to release a little update soon, I'll add the library I did use inside, just in case, but I don't think,it's related.
Downloaded all new files, wiped my libraries folder, and replaced with the included packages. Still getting the same error. It has to be something local. I'll try it on another system today and report back. Thanks for the help, and thanks for putting in the effort to make something awesome. You guys rock! =]

p.s. the RC6 sketch still says RC5. Not a big deal, just thought I'd let you know =]
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 21, 2016, 10:03 pm
p.s. the RC6 sketch still says RC5. Not a big deal, just thought I'd let you know =]
Thank you I corrected it

I'm a bit pieced off right now ... I burnt a led segment of my red blade... again ...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 21, 2016, 10:34 pm
Okay, I've got to be doing something wrong. I've tried compiling this on a different machine with a fresh install, and I get the same error. Let me run down what I'm doing so that you guys can point out what is probably a stupid mistake on my part, lol. Here we go:

The lightsaber OS .zip file is extracted to MyDocuments/Arduino/Lightsaber.

The contents of the Libraries folder from the .zip is copied to the libraries folder at MyDocuments/Arduino/libraries.

EEPROMEx-9.1.zip, LinkedList-master.zip, and OneButton-master.zip are extracted there as well.

The I2Cdev and MPU6050 folders are extracted from the i2cdevlib-master.zip to the same folder.

The Lightsaber.ino file is opened with the Arduino IDE 1.6.7.

I hit the Compile button and get the error.

Suggestions? Thanks, guys
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 22, 2016, 07:12 am
Jes,
I changed the way I did embark librairies on github.
Can you re-download LSOS again and try to compile it again ?

I did made my Arduino IDE compile tests with v1.6.5 (due to compatibility requirements for Arduino Eclipse)

Also try before compiling to go to menu "Sketch->Include Libraries->Manage Libraries" to make sure they get recognized by Arduino IDE.

If it doesn't work again, can you please post full error message in private msg?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 22, 2016, 05:26 pm
Thank you I corrected it

I'm a bit pieced off right now ... I burnt a led segment of my red blade... again ...
I can totally symphatize, I've also got my share  of burnt/deattached/broken/justdimmerthantherest LEDs along the way. LED string sabers are for those committed to film accurate lightsaber feel, with lot of passion and patience.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on Feb 22, 2016, 06:35 pm
Okay, I've got to be doing something wrong. I've tried compiling this on a different machine with a fresh install, and I get the same error. Let me run down what I'm doing so that you guys can point out what is probably a stupid mistake on my part, lol. Here we go:

The lightsaber OS .zip file is extracted to MyDocuments/Arduino/Lightsaber.

The contents of the Libraries folder from the .zip is copied to the libraries folder at MyDocuments/Arduino/libraries.

EEPROMEx-9.1.zip, LinkedList-master.zip, and OneButton-master.zip are extracted there as well.

The I2Cdev and MPU6050 folders are extracted from the i2cdevlib-master.zip to the same folder.

The Lightsaber.ino file is opened with the Arduino IDE 1.6.7.

I hit the Compile button and get the error.

Suggestions? Thanks, guys
I happened the same, the problem is the version of arduino, uninstall 1.6.7 and install the 1.6.5
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 22, 2016, 07:42 pm
I happened the same, the problem is the version of arduino, uninstall 1.6.7 and install the 1.6.5
Wonderfull ! Great to see you found the problem.
I'll added that as a requirement into README.md.
Thank you !
I can totally symphatize, I've also got my share  of burnt/deattached/broken/justdimmerthantherest LEDs along the way. LED string sabers are for those committed to film accurate lightsaber feel, with lot of passion and patience.
Yes... You've got to be motivated ;)
Especially with the red ones. Those are really unforgiving.
(Note for later: DO USE your multimeter and don't rush it !!!)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on Feb 22, 2016, 08:03 pm
Ok

There are some mosfet easier to find that the mosfet SI12304DS ?
Wonderfull ! Great to see you found the problem.
I'll added that as a requirement into README.md.
Thank you !Yes... You've got to be motivated ;)
Especially with the red ones. Those are really unforgiving.
(Note for later: DO USE your multimeter and don't rush it !!!)
Ok I'm glad

There are some mosfet easier to find that the mosfet SI12304DS ?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 22, 2016, 08:07 pm
I saw your previous messages but I'm really not the best person to answer :P

The only thing I can tell is what I use are those : STP36NF06 but I really don't know if they optimaly suit this project.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 22, 2016, 08:19 pm
Ok

There are some mosfet easier to find that the mosfet SI12304DS ?
Ok I'm glad

There are some mosfet easier to find that the mosfet SI12304DS ?
You need an n-channel mosfet with  a Vgs between 1.5V and 3V. It shall be able to carry at least 2A, Rdson should be lower than say 100mOhms.

If you plan a breadboard I suggest to use a package which lends itself to being inserted into the breadboard slots like the TO-220. For the one going into the saber you can take a DIYino board if you are willing to wait. It has everything on a tiny board and believe me, every square mm/inch counts in a hilt.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: CrossRoads on Feb 22, 2016, 08:55 pm
This one is not bad
http://www.digikey.com/product-detail/en/AOD476/785-1112-1-ND/1856055 (http://www.digikey.com/product-detail/en/AOD476/785-1112-1-ND/1856055)
Comparable parts with legs, do a search for Vgs @ 2.5V parts
http://www.digikey.com/product-search/en/discrete-semiconductor-products/fets-single/1376381?k=aoi (http://"http://www.digikey.com/product-search/en/discrete-semiconductor-products/fets-single/1376381?k=aoi")
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 22, 2016, 09:27 pm
Arduino IDE 1.6.7: uninstalled
Arduino IDE 1.6.5: installed
Compilation: SUCCESS!!

Thanks guys for all of the help... I thought I was losing my mind =] Karma all around!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: destructables on Feb 22, 2016, 11:31 pm
I'm dying to get this to work as I've got the 6050, but I've also got a WT588d instead of the soundboard you're using in the LsOS (it just came in the mail actually). I'm terrified to piecemeal all this together at this point, because I've done so little programming/electrical work. I'm still waiting on my RGBw LED (Got an awesome little Cree XML star type with all 4 leds in the center; should be able to recycle my ultrasaber lens, heatsink, and housing) but I'm trying to figure out which MOSFETs to get, how to get everything balanced out.. how to even do the proper fade between colors I'm wanting.

...Man, I'm not gonna lie.. it's absolutely daunting to look at. (JakeSoft's stuff uses the wt588D but with an ADXL, and this uses the MPU-6050, but with a different soundboard... so confusing) But I've gotten all these parts and I'm just gonna have to get over that anxiety and just try. But any suggestions that you guys could give me on the remaining parts I need to get or how to hook these things up together, it would be amazing.

Here's what all I've got so far:

Pro Micro
wt588D-16p
MPU-6050
18020p (clash sensor.. just in case)

I've got a ton of resistors as well.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Feb 23, 2016, 02:24 am
Here's what all I've got so far:

Pro Micro
wt588D-16p
MPU-6050
18020p (clash sensor.. just in case)

I've got a ton of resistors as well.
I hope you got a programmer for the WT588D also.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: destructables on Feb 23, 2016, 05:50 am
I hope you got a programmer for the WT588D also.
...of course not. Trying to decide if I should buy the other one and see if anyone here wants to buy a spare 16p.. Or buy the programmer for just in case I get the bug to make more.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on Feb 23, 2016, 11:53 am
I bought this :

http://www.ebay.es/itm/151415089133?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Transistor IRF540 Mosfet 28A 100V 150W TO-220

it is valid?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: GUNB on Feb 23, 2016, 12:30 pm
with the library Wire Arduino implements the i2c communication on a4 a5 wire ports enables the internal pull up so the logical level rises to 5v creating incompatibilities with devices that have a logic high less than 5v .
to restore compatibility you must edit the file twi.c library wire:

line 75

// Activate internal pullups for twi .
digitalWrite ( SDA , 1 ) ;
digitalWrite ( SCL , 1 ) ;

comment like this:

// Activate internal pullups for twi .
// DigitalWrite ( SDA , 1 ) ;
// DigitalWrite ( SCL , 1 ) ;

launched the wire library

#include<Wire.h>
void setup()
{
Wire.begin();
}
void loop()
{
}

measured voltage should be 0V .
Thus you can feed MPU6050 with 5V and also use a mino pro 5v instead of a nano

sorry for English..
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 23, 2016, 06:42 pm
I bought this :

http://www.ebay.es/itm/151415089133?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Transistor IRF540 Mosfet 28A 100V 150W TO-220

it is valid?
IMHO is OK to use. But only for first breadboad, like neskweek's. Have a look at his board in his videos, very clean setup.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Feb 24, 2016, 05:45 am
Protonerd, what kind of LEDs did you purchase for your strings? I'm looking for red ones that have a 45 degree viewing angle, but I'm not sure what the best mcd rating should be. I purchased 4000mcd straw hat LEDs that have a 120 degree viewing angle, but they're not bright at all...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 24, 2016, 11:55 am
Hey guys !
I thought it might interrest you:

I've contacted the company which make YX5200-24SS chip to know if they have any new documentation, since all I found on the net is incorrect or incomplete.
Here is their answer:
 YX5200-24SS instruction manual v1.7 (https://drive.google.com/file/d/0B3FqB9nvAU0FX21QUXlHMFU3MjY0alNDb2VrTEFSWmppWEpR/view?usp=docslist_api)

What ? You don't understand chinese ?

Me neither, but with some translator, the info it brings to light is much more closer from what I've found from my tests and I see some other functions I didn't tested yet.

To finish: don't bother with NORFLASH/FLASH write handling. The people who answer me told me that it's not supported by our device.

[EDIT]
Unfortunately, there's nothing much that will help to make gapless sound :(
[EDIT2]
I've tried to manage sound via precise timings but it's not better. Looking at the datasheet the problem may come, as I thought earlier, from SDCard access time. Each time you launch a play command, dfplayer stops the previous track (stupid) search the new one on the SD, ans play it when found. It's short but long enough for the ear to catch.
As a consequence I stop my quest for gapless playing with this module.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 24, 2016, 03:25 pm
You could have asked me as well for the manual. Although it seems you managed to "coerce" it out of them where I completely failed. I've got the same spec from the distributor company's representative lady, but that only after I placed an order for the chips. Maybe the mistake was I told them i was going to design it in?

But all credits to Google's translator, it really makes a good job of translating Chineese to English.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 24, 2016, 10:32 pm
Protonerd, what kind of LEDs did you purchase for your strings? I'm looking for red ones that have a 45 degree viewing angle, but I'm not sure what the best mcd rating should be. I purchased 4000mcd straw hat LEDs that have a 120 degree viewing angle, but they're not bright at all...
For my red LED string blade I used these ones:
https://www.led-tech.de/de/Leuchtdioden/5mm-LEDs/Superbright-LED-LT-360_1_4.html

With 4000mcd they are crazy bright on their own, and you are going to chain up close to 100 of them. To be honest, since quite a portion of the light will be absorbed, you can take LED's with less mcd rating (but gut feeling tells me >1000mcd they shall be bright enough).
If you look at the viewing angle, the really bright ones have a narrow angle, 20 degree or below. That is the tradeoff. On the net you can find methods how to scatter the light better (like sanding the dome, or cutting it off), but I'm not convinced it's worth the effort.

While I cannot judge your red you bought, the reds I have kill your eyes if you are crazy enough to look at into the light directly. And do not forget: it will be not one led, but a whole dozen.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 24, 2016, 11:04 pm
Finally I managed to fix my prototype saber and uploaded neskweeks' LSOS V1.0RC6.
My main intention was to test his swing detection, which was quite promising (what an understatement) based on the video posted.

As a reference I picked one of my other sabers with a commercial (and suberb!) sound board, that is the red one I start the video with.

Just after recording the video I recognized that I recently swapped my 3W speaker for a smaller and less loud one and the saber is barely audible at the distance (and the background noise of the street), so let me summarize what you might not hear:
the swing detection works awesome! I even risk the statement, that it's the best, most life-like swing detection I experienced so far.
Commercial saber cores work - based on when they fire a swing - on a simple grading of the acceleration. You can see from the video, that the red saber makes swing sounds even if the hilt is vehemently trusted back and fort. But large gestures are not always recognized.
With the LSOS swing detection there is no trigger on small but forceful gestures, and slow or weak, but wide gestures will also not trigger it (as a comparison, the Hasbro sabers have ball Switches which react on angles, no matter the acceleration). In the contrary wide and forceful gestures, i.e. real swings are always recognized, even in a chain i.e. if the saber is swirled.

BTW, you can also see lock-up, bolt deflect. Next time I try to record inside and/or maybe look for another speaker (I choose this one not to wake up the family).

https://youtu.be/B0tCsAFyovs
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 25, 2016, 06:25 pm
Hey guys,

   I got LSOS installed and running on my breadboard and while there are gaps in the audio, I still think it's fantastic work! So thanks =] This may be a silly questing/suggestion, but would the arduino itself be able to play the hum file while the DFPlayer handles all of the other sounds? Or what if we used two DFPlayer modules? I know it may be overkill, but would that work?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 25, 2016, 11:17 pm
[EDIT]
Unfortunately, there's nothing much that will help to make gapless sound :(
[EDIT2]
I've tried to manage sound via precise timings but it's not better. Looking at the datasheet the problem may come, as I thought earlier, from SDCard access time. Each time you launch a play command, dfplayer stops the previous track (stupid) search the new one on the SD, ans play it when found. It's short but long enough for the ear to catch.
As a consequence I stop my quest for gapless playing with this module.
OK guys, now calm down and let's concentrate on the facts:

Fact #1: Gapless playback means by definition, that a sound module is able to switch from playing one sound file to another without any audible gap in-between. And the DFPlayer/YX5200-24SS can do that, look at the very first video I introduced my Arduino saber with.

Fact #2: what neskweek refers to as non-gapless is simply the inability to start a new sound gaplessly after the previous already stopped playing. But this is not different for any other sound board/chip. You always have an access time and our ears are good. Let's call it launch-on-stop, not to mix it up with gapless playback.

The key to gapless chaining of sound files is to start the new sound while the previous one is still being played. And the DFPlayer can do that excellently. If the length of each sound file would be stored in the EEPROM, the Arduino could be programmed to start the new sound an access and command time earier as the previous finishes. There you go. This method is used by the high-end saber boards AFAIK. Their sound module also cannot do launch-on-stop per se.

But as this method is complicated, both JakeSoft and me choose instead to do it in a much simpler but totally effective way: simply append a length of hum sound to each of the sound files. There you go, perfect gapless transition from one sound to the other, with Audacity 5 mins of effort.

Neskweek, I can totally understand your frustration, you as a software pro might prefer a more elegant, "software way" to implement the transitions. But there are just so many other cool things which the LSOS already improved and so many ideas yet to come, I suggest to drop this quest for a software-enabled launch-on-stop. I'm preatty sure that with your skills you could come up with a solution, but frankly speaking, IMHO it's not worth the effort.

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 25, 2016, 11:22 pm
[edit] Protonerd answered faster ;) [/edit]

While 2 DFPlayer would be the perfect solution for "lasy" file deposit on the SD Card , it's not the only one.

If you edit your soundfiles to add a hum loop at their end, depending on this hum loop length you may never notice a gap.

Look at the README.md, there is a link of an example of "hum extended" soundfont.

Protonerd came up with this solution and its the most practical, cheapest and straightforward one.
And hey, we left you some job to do ;)

[edit]
Concerning that "gapless sound" thing, the only reason I was pursuing this was to really be able to "lasy" deposit any soundfonts, and the lightsaber do the rest. But as I said I dried all the solution I could think off so I won't be able to make it better than it is now, with this hardware anyway.
[/edit]


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


By the way thank you for your comments. Not only it's rewarding that you like LSOS, but the true reward is that it's actually working good on your devices ;)

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


I have a question for the electronics Gurus of this thread. Would it be possible to plug two speaker on the DFPlayer without a powerloss effect ?

I was thinking of pluging an additional bass speaker but only if it doesn't impact the noise production of the first one.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 26, 2016, 03:41 am
Awesome! Thanks for the input, guys =]

Neskweek, I went to your Git page to download the hum extension archive, but it returned a 404. I'm pretty affluent in Audacity, but I may not totally understand adding in the hum. Would one of you guys mind posting a screenshot of one of the edited files in Audacity? That'll help a bunch. Also, I noticed in your readme that I may need to swap out the soundfont.h file to work with these?

Edit: Never mind, I read through the readme again, and now I understand how to edit them. Lol, derp
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 26, 2016, 08:55 am
I made another video, this time it's loud. Enjoy!
BTW, anyone knows how to link a youtube video which will be shown either as a thumbnail or as a clickable link?

LSOS Demo - Swings (https://youtu.be/tU3GZzV9I6E)

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 26, 2016, 09:37 am
Great video! Thank you.

I noticed your DIYino saber didn't produced hums sound tho (and your face as you noticed it too )...
I think I know why : the OPERATING_DELAY of DFPlayer.h is not long enough. What this does is : when a command is sent to DFPlayer sometimes it goes to fast and the DFPlayer does not have enough time to process the command.
From my latest test he program needs to wait at least 150ms after a command has been sent

I'm actually working on this and already have great results. I want to remove all delay function call from the sketch. So hopefully it will be fixed soon ;)
[EDIT]
I want to remove all delay() calls because this function is not interruptible. As LSOS use 2 interruption system for sure, it would be best to get rid of those delay()
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Feb 26, 2016, 03:48 pm
So I've been playing around with this on my breadboard some more and even after adding the hum extensions, I would get quite a bit of delay when switching from one sound to the next. Then I remembered something you said in your earlier post about how the DFPlayer will have to stop the current track, read the SD card, and play the next track when it's found. I have been using some off brand SD card this whole time for testing and thought I'd throw the sound fonts on to a Sandisk SD and see if there was any difference, and to my surprise it made a HUGE difference! I haven't tested the difference in read speed between the cards yet, but this may be something you could add in to your readme.

I've downloaded a bunch of free sound fonts and will be adding the hum extensions to them. I'll post links to them once they are done, crediting the original author of course =]
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: stinky1 on Feb 27, 2016, 09:55 pm
 

Nice video on how they did it
Star Wars Featurette: The Birth of the Lightsaber (https://www.youtube.com/watch?v=RIefj6dOhnM)

Star Wars - All Lightsaber Duels 1080p by NexGen  (https://www.youtube.com/watch?v=OzK6K0-9RwM)

At 46:00 is a slow swing that perhaps you can include in lower settings of accelerometer.
In some thread Sebastian said all you need to do is lower the threshold settings,  or add another
lower set.  So that would be 3 swing sound settings,  slow as in 46:00,  medium,  and short fast one that leads to clash.  With respective accelerometer motion setting trigger vectors, low med high.
You can get the sounds here as well.

Star Wars The Original Trilogy (Theatrical Cut) Unaltered 720p EN-MULTI-SUB x264-[MULVAcoded]


Sébastien CAPOU 6 days ago
   Hello there ! thanks for your comment I published schematics on github, take a look at README.md I just added the possibility to chose from a set of colors you specified (v1.0 RC6).

Thanks Sebastian,  I was thinking about the z axis and there could be a twist sound,  and bam you did it!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 28, 2016, 01:42 am
v1.0 RC7 is out

Changes :


Please note that , again,hex file size is getting criticaly high, and both for ledstrings and RGB.
Adding some more functions is going to become tough.


[EDIT 8:51am]
Sorry for those who already downloaded this version, I just made an update on github :
I forgot to package some modifications, so I corrected that.
Ahhhhh... Late night updates ....

[EDIT 18/03/2016]
Please reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) , or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new) on GitHub. I won't address problems in this thread !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 29, 2016, 12:57 pm
First of all, I want to congratulate and thank you for the great job you did with the LightSaberOS!  8)
 
Device currently supported :
- DFPlayer Mini
I used MP3-FLASH-16P instead (can be found on eBay (http://www.ebay.com/sch/i.html?_from=R40&_trksid=p2060353.m570.l1313.TR0.TRC0.H0.X64M+bit+MP3+Voice+Module+Serial.TRS0&_nkw=64M+bit+MP3+Voice+Module+Serial&_sacat=0)). It is basically a DFPlayer with a built-in memory, what seems more reliable that the external SD card, since the card can pop out if you swing it around and hit too much with it.

BTW, why did you use DFPlayerSerial instead of the standard SoftwareSerial package, since SoftwareSerial was replaced with the DFPlayerSerial since version 1.0? I noticed that the binary compiles into somewhat smaller code when using the DFPlayerSerial, but I don't know what is the exact difference between the two.

Also, I managed to compile the code with Arduino IDE 1.6.7! I first removed my existing 1.6.7 and replaced it with 1.6.5 - to find the 1.6.5 not working because of some obscure internal compiler error. Then I upgraded back to 1.6.7. I managed to compile it after adding the following line somewhere above the void setup() method (btw, that's why it is good to separate H files from the actual implementation code). ;)
Code: [Select]
inline void confParseValue(uint16_t variable, uint16_t min, uint16_t max, short int multiplier);
There were a lot of cast warnings, but the code got compiled!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Feb 29, 2016, 08:49 pm
Hello JonnieZG

DFPlayerSerial is nothing more than a personal fork of SoftwareSerial.

As for seperate H files, yes your right ;)=

I already was thinking of ventilating many functions in separate H files.
It's just the code has grew up very fast and my main concern was to make it work ;)

This ventilation may also reduce hex file size.

Code warnings mainly come from libraries used :P
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 01, 2016, 10:11 pm

The DIYino board takes shape  ;D

(http://s1035.photobucket.com/user/Kunci1/media/DSCN0502_zpsgfg9yebw.jpg.html)

The first batch of PCBs are manufactured, pending component mounting.

I'm sooooooooo excited! Just wanted to share!

Oh, as a bonus track, I've inserted a basic API of the NEOPIXEL LED strings into the LSOS framework, here is the first demo with a lot of explanation, but most importantly visuals.
https://youtu.be/lyk8riXgIzM
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 01, 2016, 11:38 pm
The DIYino board takes shape  ;D

(http://s1035.photobucket.com/user/Kunci1/media/DSCN0502_zpsgfg9yebw.jpg.html)

The first batch of PCBs are manufactured, pending component mounting.

I'm sooooooooo excited! Just wanted to share!

Oh, as a bonus track, I've inserted a basic API of the NEOPIXEL LED strings into the LSOS framework, here is the first demo with a lot of explanation, but most importantly visuals.
https://youtu.be/lyk8riXgIzM
You really shouldn't post stuff like this. It reinforces stereo types. You know, the one about the high quality of German engineering?  :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 02, 2016, 01:09 am
I already knew this kind of LEDs would end up producing really great blades.
As I already told you I did thought of making my blade with those. The power consumption did stop me tho.
But man... This is so sexy ... Not talking about the time it saves when it comes to building a led string.
That's really hard to resist to go online  to buy some of those.

Just a technical question: how did you assemble them in your blade :
Did you put 2 stips back to back ?
Mounted 3 strips in pyramids ?

Concerning power consumption I half joked about the possibility to use this kind of design (http://www.saberforum.com/index.php?PHPSESSID=ac2vsn1stpbmo7qlc9utmf42c1&topic=7930.msg126290#msg126290) but an Ezra kind of hilt could embark more powercells too and could support such a blade. Even a solid crossguard containing battery cell could be considered.

[EDIT]
Concerning LSOS, as a teaser, FULL GAPLESS sound is on it's way ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 02, 2016, 02:12 pm
Removed SDCard.7z from github since Novastar message on Protonerd last video.
I'll provide  at least one custom one, free of charge, and under common creative license with next release.
Off course it will repel next release date even more.

If some of you want to participate :
How to create your own lightsaber sounds (https://www.youtube.com/watch?v=Q_6VITJT0-w) (you won't find that on sabersmith's forum since it threaten thier business, believe me, I did search some time ago)
Link to freensound library (https://www.freesound.org/search/?q=hum&page=1) Where you'll find maybe the same base sounds they did use ;) but they do not have griefs not to tell this and get paid for it.

Yeah... That really pieced me off ! Greedy peoples ...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 02, 2016, 03:42 pm
Removed SDCard.7z from github since Novastar message on Protonerd last video.
I'll provide  at least one custom one, free of charge, and under common creative license with next release.
Off course it will repel next release date even more.

If some of you want to participate :
How to create your own lightsaber sounds (https://www.youtube.com/watch?v=Q_6VITJT0-w) (you won't find that on sabersmith's forum since it threaten thier business, believe me, I did search some time ago)
Link to freensound library (https://www.freesound.org/search/?q=hum&page=1) Where you'll find maybe the same base sounds they did use ;) but they do not have griefs not to tell this and get paid for it.

Yeah... That really pieced me off ! Greedy peoples ...
Well, look at this way: what we are doing is drawing attention from the incumbent players. Take it as a compliment.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: dannyc09 on Mar 02, 2016, 06:43 pm
You guys rock! :o

I've been looking for a way to build a string blade from an Arduino and you guys have really inspired me.

Parts on order!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 02, 2016, 09:36 pm
If some of you want to participate :
How to create your own lightsaber sounds (https://www.youtube.com/watch?v=Q_6VITJT0-w) (you won't find that on sabersmith's forum since it threaten thier business, believe me, I did search some time ago)

Haha, this is soooooo cool. Never had though that those guys back in the 70's and 80's used such low costs and totally innovative, mindboggingly simple methods to produce these sounds! Damn, I should have kept those old TV sets!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 03, 2016, 12:56 am
Neskweek, I'm trying to modify LSOS so that each random ignition sound has a specific LED lighting sequence. What would you say is the best way to pass the random value from Soundfont.h into Lightsaber.ino? I plan to use a simple switch case to determine which sequence to use.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 03, 2016, 09:31 am
Haha, this is soooooo cool. Never had though that those guys back in the 70's and 80's used such low costs and totally innovative, mindboggingly simple methods to produce these sounds! Damn, I should have kept those old TV sets!
TV sets are not the only device to produce nice hums that can be use to our needs. Fridges are another exemple. There's a lot of interresting base sounds in the freesound library (and I didn't finish o browse it).

Neskweek, I'm trying to modify LSOS so that each random ignition sound has a specific LED lighting sequence. What would you say is the best way to pass the random value from Soundfont.h into Lightsaber.ino? I plan to use a simple switch case to determine which sequence to use.
In RC7 I added a first shot of new ignition effects. But their triggers are a parameter the user set in config mode.
In LightOn/LightOff functions, If you change
Code: [Select]
switch (storage.soundStringPreset[storage.soundFont][0|1])
 by
Code: [Select]
switch (soundfont.getBoot())
 that should do what you want to achieve
;)
Then you may want to comment PowerOn and PowerOff effect config options to get back some hex file size.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: GUNB on Mar 04, 2016, 08:02 pm
@ neskweek

when verify sketch:

Arduino:1.6.5 (Windows 8.1),

Lightsaber:184: error: expected unqualified-id before 'else'


anyway tnx for yopur great job

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 04, 2016, 10:04 pm
In LightOn/LightOff functions, If you change
switch (storage.soundStringPreset[storage.soundFont][0|1])
 by
switch (soundfont.getBoot())
 that should do what you want to achieve
;)
Perfect, thank you!

@ neskweek

when verify sketch:

Arduino:1.6.5 (Windows 8.1),

Lightsaber:184: error: expected unqualified-id before 'else'


anyway tnx for yopur great job


Add this line of code before void setup()
Code: [Select]
inline void confParseValue(uint16_t variable, uint16_t min, uint16_t max, short int multiplier);
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 04, 2016, 11:00 pm
I would like to have your opinion about how to set up color management. With tranditional LED string blades this is not an issue, since there is only a single color, but when designing a high-power RGB(W) LED saber like that of Jakesoft, or using RGB neopixels, color mixing becomes possible. The question is, what would be the most optimal handling, keeping it simple for users to that people can adapt the code to suit their own style.

In my opinion the supporting data structure should be as simple as possible.
I discussed it with neskweek in some emails, and finally proposed to move the discussion back to the thread again.
I gave this topic some thoughts. Color setting is done via PWM, in each case (either through the MOSFETs or through the PWM registers of the neopixel. So far we deal only with 8-bit PWM control. This leads me to the logical conclusion, that the simplest and best way to code the color components is simply by storing the PWM value for each color, a number between 0...255.
This way the same struct could be used for RGB LED and neopixel. Actually traditional LED string blades could also benefit, obviously they will use only a single value, the one which corresponds to the color of the blade.
I.e. we need a struct, array or whatnot which coudl keep 3 (RGB) or 4 (RGBW) 8-bit values. Then for the actions like swing, clash, lockup, blaster etc. similar variables could be used, telling the controller how to change the color when that particular action is triggered.
An additional element could then store the range of brightness modification that action uses when dealing with the audio feedback (now I'm getting too obscure, but what I mean is simple: you have a base hum color, say (R=100, G=50, B=0), giving you a slightly orange blade. In case of clash you want to emphasize the yellow, so you define a clash mix of (R=90, G=100, B=0).  Swing would add just a tiny little tint change, say (R=100, G=60, B=0). In addition you specify, that for clash you want 2 times as vivid sound cotrol, so if the sound would add +5PWM, you add +10. This is the additional value, a sound control verbosity parameter)

Just my ideas...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 05, 2016, 12:02 am
I totally agree to the fact the datastructure must be kept as small as possible.
The current form of datastructure is :

LEDSTRINGS :
use only one parameter : uint8_t brightness

RGB:
color parameter : uint8_t currentColor[4] which stores R(0) G(1) B(2) and a colorID(3)
it also use uint8_t brightness
there is 4 more parameters inside storage structure:
uint8_t mainColor;
uint8_t clashColor;
uint8_t soundFontColorPreset[SOUNDFONT_QUANTITY + 2][2];
Each of those 4 parameters stores a colorID


I also fell for the neopixel: I just ordered a 2x 1m 144/m pack.


I just thought of something more.
15 days ago I watched  Sabertalk 8 on Spacewindu youtube channel and during this program they talked about the possibility to push saber sound to another device via Bluetooth.
That's quite an interresting idea. But not an easy one to achieve for several reasons.
But if we want to just have sound to a bigger external speaker, I just thought that a FM Radio emitter would make just as good without difficulties. So I also ordered a tiny module to add to my future hilts.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 05, 2016, 01:48 am
I would like to have your opinion about how to set up color management. With tranditional LED string blades this is not an issue, since there is only a single color, but when designing a high-power RGB(W) LED saber like that of Jakesoft, or using RGB neopixels, color mixing becomes possible. The question is, what would be the most optimal handling, keeping it simple for users to that people can adapt the code to suit their own style.
I've actually been working on a universal saber architecture that would enable a common interface for all blades regardless of implementation details. This is a pretty common concept for those familiar with object oriented design. I'll hopefully have something up-worthy in a few days.

For example: To do a power-up sequence, the base class defines something like:

Code: [Select]

class BladeInterface
{
public:
  bool Powerup() = 0;

  //A bunch of other common functions
};


Then, in a derived class would implement a specific power-up sequence for that type of blade.

For string blade:
Code: [Select]

class StringBlade : public BladeInterface
{
public:
 bool Powerup()
 {
   //Do a sequence to power up a string blade
 }


For a single-LED blade
Code: [Select]

class SingleLedBlade : public BladeInterface
{
public:
 bool Powerup()
 {
   //Do a sequence to power up a single LED (ramp it, blink it, whatever you want)
 }


Then in the core logic of the lightsaber, do something like
Code: [Select]

//Create a single LED blade
BladeInterface* MyBlade = new SingleLedBlade();

Or
Code: [Select]

BladeInterface* MyBlade = new StringBlade();


Then, when you want to power up the blade, all you have to do is
Code: [Select]

MyBlade->Powerup(); //Core logic doesn't care about details of powering on the blade!


I ran some tests last night. The trick is finding a balance between providing enough features and keeping it simple enough that you don't have a ton of methods to cause confusion.

There is a difference between being a programmer and being a software architect. For small projects typically programming is good enough. As the scope of this thing keeps growing to encompass an ever increasing variety of hardware, it seems that an architect or architects is/are becoming increasingly necessary for coherence.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Mar 05, 2016, 04:03 am
Just a technical question: how did you assemble them in your blade :
Did you put 2 stips back to back ?
Mounted 3 strips in pyramids ?

I second this question. After seeing Proto's awesome video, it got me looking at the neopixels also, but I'm not sure how much I would need. Any insight?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: GUNB on Mar 05, 2016, 08:25 am
Perfect, thank you!
Add this line of code before void setup()
Code: [Select]
inline void confParseValue(uint16_t variable, uint16_t min, uint16_t max, short int multiplier);
same error
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 05, 2016, 08:59 am
GUNB polease post full error message in private message. The parts you send on forum is not enough to determine problem cause.

I've actually been working on a universal saber architecture that would enable a common interface for all blades regardless of implementation details. This is a pretty common concept for those familiar with object oriented design. I'll hopefully have something up-worthy in a few days.
Looking forward to this

That's what I said to Protonerd in a previous mail exhange:
I wanted LSOS to be more generic and allow for several hardware implementation, but in it's current form it fails to do so.
Especially when it comes to sound and motion detection. But without having at least some working code from other hardware, it just can't be done.
There is a difference between being a programmer and being a software architect. For small projects typically programming is good enough. As the scope of this thing keeps growing to encompass an ever increasing variety of hardware, it seems that an architect or architects is/are becoming increasingly necessary for coherence.
To start architectutering correctly, good foundations are needed.
In that regard, blade management interface won't be much of a challenge since there's not 1000 ways to do it.
In LSOS, it's not in object form right now (but I planned to do so, if it doesn't impact hex file size) but it is already in a generic form.

Concerning sound and motion that's an all different story.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 05, 2016, 02:40 pm
Looking forward to this

That's what I said to Protonerd in a previous mail exhange:
I wanted LSOS to be more generic and allow for several hardware implementation, but in it's current form it fails to do so.
Especially when it comes to sound and motion detection. But without having at least some working code from other hardware, it just can't be done.To start architectutering correctly, good foundations are needed.
In that regard, blade management interface won't be much of a challenge since there's not 1000 ways to do it.
In LSOS, it's not in object form right now (but I planned to do so, if it doesn't impact hex file size) but it is already in a generic form.

Concerning sound and motion that's an all different story.
My Mk. IV software is 100% object oriented but not it's not generic. (The Mk. III was not OO, so that was a major effort to convert it.) Having done that exercise has given me something at least to draw from and abstract it out into some interface or base classes. I decided to start with the blade because it seems like it would be the easiest to do as a proof of concept. Motion shouldn't be too hard, I've got some ideas about that. The sound is probably going to be the hardest, so I'm saving that for last.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 05, 2016, 11:28 pm
Anyway I do agree that's totaly the way to go to enhance "easyness" of coding.

But for my part it won't be until LSOS has a stable code base, which is still not the case. A lot of modification is still going on.

I also said that I would ventilate functions to other h files, but I won't: from my latest experiments it produce hex size overhead we can't afford anymore.


Does anybody has idea/comments/desires concerning color management system (RGB/NEOPIXEL only)?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 06, 2016, 03:44 am
I also said that I would ventilate functions to other h files, but I won't: from my latest experiments it produce hex size overhead we can't afford anymore.
That's weird. Maybe you've got to let the linker to a little work. Declare your functions in .h files and put their full definition in .cpp files. Otherwise, the code may be repeated every time you include the .h file and bloat your hex file size. Sorry if you already know that, I'm just putting it out there in case you don't.

Also, investigate if there is bloat in the libraries that you are using. Over in my thread where we use ADXL335s for motion detection and WT588Ds for sound we aren't having this kind of problem. That may be a product of not needing external libraries for the ADXL335 and only a single small function is needed to operate the WT588D. My Mk. IV software in it's current state seems to have similar capabilities to your LightsaberOS but compiles to 25900 bytes. It's totally OO and is greatly modular consisting of ~30 files. You should be able to break up your code across multiple files without incurring a size penalty unless there is something funky about this compiler that I'm not understanding.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 06, 2016, 10:55 am
I didn't put their implementation in cpp files, so actually that might be the cause, thank you.

I also inlined them.
So far, it has surprised me, but I did have better results, in term of size, with inlined functions.
Compiler optimisation might have discard it tho.

I'll do some more experiment then. Thanks again

[edit]
pfff !!! My bad I used enormous datastructure for functions parameters when there was no need.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 06, 2016, 10:13 pm
Looking forward to this

That's what I said to Protonerd in a previous mail exhange:
I wanted LSOS to be more generic and allow for several hardware implementation, but in it's current form it fails to do so.
Especially when it comes to sound and motion detection. But without having at least some working code from other hardware, it just can't be done.To start architectutering correctly, good foundations are needed.
In that regard, blade management interface won't be much of a challenge since there's not 1000 ways to do it.
In LSOS, it's not in object form right now (but I planned to do so, if it doesn't impact hex file size) but it is already in a generic form.

Concerning sound and motion that's an all different story.
I think that the few of us actively participating in the two lightsaber threads pretty much came up with all the features a lightsaber could possibly have. We as a community could be proud of that!

Now when it comes to a generic ligthsaber software architecture, I wish it would be easy to understand and very generic, like a skeleton code. The core functionalities have to be there for sure, and what these are we could make a brainstorming about, however I would make it in a way which encourages people out there to custom-program the details and share their ideas. Let me bring an example: how to power on a saber. The core functionality here is to have a properly working finite-state-machine with config, action mode, etc. , with a place for power on. Functions have to be there for button handling and sound management has to be working perfectly. But I would leave it up to the user to program her/his own lightshow, be it for high power LED, LED-strings or neopixels. Other example could be to pimp the saber, for instance with illuminated swicthes. I would not include any pre-programmed method, 'cause I think if the code is well readable and understandable, inserting an digitalwrite() function  into the code at the right place should be a feat which could be expected from anyone who has serioously in mind embarking on a similar quest we did.

As to color management: I still would like an easy interface, which codes the colors in PWM values form 0 to 255. I'm strongly convinced that this would work the best. As a baseline a struct could be used with 6 PWM values, one for each PWM capable outputs of the used Arduino boards.Then maybe (and I have to confess a lack of C programming experience) somehow pointers could be used to link RGB, maybe a W or even all 6 (for a LED string with 6 segments) to alias names, so that instead of pin5 a name like RED could be used.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 07, 2016, 02:23 am
I think that the few of us actively participating in the two lightsaber threads pretty much came up with all the features a lightsaber could possibly have. We as a community could be proud of that!

Now when it comes to a generic ligthsaber software architecture, I wish it would be easy to understand and very generic, like a skeleton code.

...
I agree that you can't compensate for every possible corner case that somebody might dream up. Generic is the way to go for mass appeal. Anybody wanting something super unusual should be prepared to write their own custom core logic.

Here's what I've got so far for the blade interface. I intend to implement a few examples and provide unit test code so that people can test their custom blades outside the context of a full lightsaber project. Eventually, I want to make this part of a library that can be released under GPL for all to use. For now, this is still WIP and therefor subject to change, but I'm just posting it to share ideas.

The basic concept to to treat every LED as a "channel". In the simplest case, a single LED, the blade would support one channel. In the most complicated case, NeoPixel, it would support a ton of channels. In any case, they can all be set individually using the interface provided. For a traditional RGB 3-up LED saber, it would be 3 channels, mix by setting channels 0 through 2. I think you get the idea.

Code: [Select]

/*
* IBladeManager.h
*
*  Created on: Mar 1, 2016
*      Author: JakeSoft
*/

#ifndef UNIVERSALSABER_IBLADEMANAGER_H_
#define UNIVERSALSABER_IBLADEMANAGER_H_

/**
* Used to describe features of a blade. This can be  used
* to inform control logic about what the blade can do and avoid
* invalid or useless calls to subclass methods of IBladeManager.
*/
struct BladeMetadata
{
//Number of channels supported
int Channels;
//Number of flicker effects
int Flickers;
};

/**
* This interface class provides a framework for  management of the LEDs that
* illuminate the main blade. The abstract concept is that each LED is a
* channel. Each channel can be individually controlled. Convenience functions
* for common operations are also provided.
*/
class IBladeManager {
public:

/**
* Initialize and prepare to run. Implement things that should happen
* on startup such as setting I/O pins.
*/
virtual void Init() = 0;

/**
* Power on the blade. Subclasses should implement a power-up sequence.
* The sequence can be blocking or non-blocking. Callers should loop until
* this method returns TRUE indicating that the power up sequence is complete.
*
* Args:
* aRampTime - Time (in milliseconds) from full off to full on.
*
* Returns:
* TRUE when complete, FALSE otherwise.
*/
virtual bool PowerUp(int aRampTime) = 0;

/**
* Ramp down blade power to off. Subclasses should implement a
* power-down sequence. Callers should loop until this method
* returns TRUE indicating that the power up sequence is complete.
*
* Args:
*  aRampTime - Time (in milliseconds) from full on to full off.
* Returns:
* TRUE when complete, FALSE otherwise.
*/
    virtual bool PowerDown(int aRampTime) = 0;

/**
* Set the PWM values directly for the LED(s). This is intended to
* allow for a target to be set on a specific output channel but
* no I/O is performed. To perform the I/O and see the effect of
* the level adjustment, the PerformIO() method should be called
* right after the call to this method. For color mixing, multiple
* calls may be made to this method to set individual channels then
* a single call to PerformIO() will apply the effect.
*
* Args:
*  aLevel - Level to use (0 to 255 for PWM)
*  aChannel - Which channel to set
*/
virtual void SetChannel(unsigned char aLevel, int aChannel) = 0;

/**
* Sets flicker/shimmer special effect type. The intention is that this
* function be non-blocking and be called cyclicly to apply the desired
* effect. Use this to apply flicker patterns or whatever else you want.
*
* Args:
*  aType - Flicker effect to apply.
*/
virtual void ApplyFlicker(int aType) = 0;

/**
* Instantly Sets the output pins per output level variables. If the
* levels are set to non-zero values, then this has the effect of
* turning on the LEDs for the blade. To set the levels manually,
* the SetChannel() method should be used.
*/
virtual void PerformIO() = 0;

/**
* Instantly turns the blade off. Should set all power levels to zero and
* perform any I/O necessary to turn off the blade fully. This is a
* convenience function shortcut for setting all levels to zero and calling
* PerformIO().
*/
virtual void Off() = 0;

/**
* Instantly turns the blade on without any powerup effects. Assumes that
* channels have been set by SetChannel() function.
*/
virtual void On() = 0;

/**
* Return a structure describing the capabilities of this blade. This is
* useful for giving the caller information such as how many flicker patterns
* are supported.
*
* Returns:
*  A description of capabilities.
*/
   virtual BladeMetadata GetFeatures() = 0;

};

#endif /* UNIVERSALSABER_IBLADEMANAGER_H_ */


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 07, 2016, 11:01 pm
Nice !
I'll surely convert my code to use your interface at some point.

I'm struggling to finish RC8 first. 
The code is complete. It works perfectly under Eclipse but Arduino IDE don't want to compile it (just tested - crappy IDE !) so I have to debug this and it should be ready to go.

[edit]
Found... This IDE  really have a problem with functions declaration order.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: dannyc09 on Mar 09, 2016, 06:48 pm
Got my LEDs today so can start playing with the string build.  Also received the nano, so card module and acceleratometer board
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 10, 2016, 05:13 pm
HP LED, RGB...I'm designing my saber on my 3D printer and I think I have the right balance of infill-to-durability (I whacked it several times hard with the blade in and it held strong!), so i am also designing a sled the electronics will ride on....I may go with the DC-DC Boost, but if these work, I can attach them to the underside of the sled and run the wiring to my LED's...currently it looks like my sled needs to be 98mm long for the PCB I was designing to fit. If these work as a resistor/mosfet gate...the Negative lead coming from Arduino on a PWM pin should still cause it to flicker.
Hi DJWing79,

I'm coming back to this old post, it looks we have everything now together for the lightsaber project, multiple hardware flavors, expert software architects, two different PCB solutions (fully integrated and rider board style), the thing we miss so far is someone to make 3D printable sledge/chassis designs and share with the community. As it seems you can do 3D designs on a 3D printer, would you be willing to jump in?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 10, 2016, 05:22 pm
I've had a couple of issues with this, but think I have found a solution. I just printed my latest version and will have to clean it up tonight and do the treatment.

Basically it comes down to making sure the walls are thick enough and that you have something to help fill in the open space inside the hilt. I've taken to lining the inside with epoxy to strengthen it. it worked on my last test with my son and we were hitting it at normal strengths, but it broke where the hilt was thinnest inside and I hadn't epoxy'd so will be able to test probably on Saturday and will post the STL file if it works.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 11, 2016, 01:24 am
Hello everyone

I am please to announce that LSOS V1.0 has been released

The code has reached a quite stable structure now, so it doesn't deserve to wear the Release Candidate title anymore.
From now on a standard versionning number will be applyed.

Before listing changes I have another annouce :

I already know this version may not compile with Arduino IDE, depending on modules you enable, and I won't fix it.
I know it's linked to function declaration order.
But I'm really tired to spend hours, each time I add a function, playing musical chairs with those to determine how to fix it.
A decent IDE shouldn't do that !!

Face it, this project has already gone to big for this IDE.

While there is a bunch of great alternatives I will only support Arduino Eclipse (http://eclipse.baeyens.it/index.shtml)! You're totally free to use any other IDE, but you'll be on your own for config/debugging
I (personnaly) won't support Arduino IDE anymore ! If kind people wants to, you're welcome !

Higher ends IDE will ease reading/modifying/compiling with this project, believe me.
Do yourself a favor.



Changes:


I have to make a whole new readme file for this version, a lot of modification have been done to the code.
I'll post this new documentation on github in the next few days.

Have fun !

[EDIT 18/03/2016]
Please reports bugs (https://github.com/neskweek/LightSaberOS/issues/new) , or suggest new functionallity (https://github.com/neskweek/LightSaberOS/issues/new) on GitHub. I won't address problems in this thread !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: snakearthur on Mar 11, 2016, 02:32 am
woooow!! you proyect is great!!! i like it!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 11, 2016, 03:15 pm
hey Nes,

to avoid any confusion on compatibility or which version you are using, can you post a link to where YOU got your eclipse? I see different options and want to mirror your setup.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 11, 2016, 05:03 pm
As a fast answer : I can't find the one I use anymore (that sucks I only figured out now)  ... it was V2.4_win64.2015-12-06_20-24-02.
It wasn't a nightly build.
I don't know why it has been retired.


Anyway, I already planed to add a full paragraph in the future readme revision, on Arduino Eclipse install and config.
Not that is complex, but I least you'll find everything in one place ;)

[EDIT]
First README.md update including Arduino Eclipse setup.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Mar 12, 2016, 04:17 pm
  • Low/critical Battery detection system
    • When battery goes low, a sound (and light if you're in actionMode) effect will be played to warn you
    • When battery goes critical, the saber will shut and go in deep sleep mode, if enabled or will stays dull until you change battery. Believe me : the sound alert produced for this event IS annoying. You will change your battery !



Hi neskweek, very good job, impresive development speed :)

Regarding battery level detection... have you tested if it works properly?

I have tested this type of measurements and it seems that takes VCC after Arduino voltage regulator, so you would only get a 5volts read with small variation (in my tests arround 4.9v with USB power and 5.1v with batteries).

The only method I have found to correctly measure the voltage is the other one already mentioned in this forum:

http://forum.arduino.cc/index.php?topic=361566.msg2612651#msg2612651 (http://forum.arduino.cc/index.php?topic=361566.msg2612651#msg2612651)

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 13, 2016, 01:11 pm
@Thelmos
Thank you :D

The function that reads Vcc from Arduino comes from here (http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/). This pages explian really well how it works

I just realized you used this part of code in the solution you posted some time ago. I also have to apologize:  I didn't read it right since I thought it was a Voltage Regulation solution you did post :P
I just realized it,  now that I wanted to ask you how it works (since I didn't understood in the first place :P)

Anyway I did test it, that way :

I own 2 old 18650 :


I did set voltage treshold detection for low and critical to 3.2V and 3.020V respectivly.

I powered the device with only battery (1). It runs for almost 5 min until it start firing Low battery alert. (LSOS  ask for battery voltage status every minute)
Then I powered the device with only battery (2). It started but immediatly thrown critical battery alert.

When plug on USB, readVCC always shows around 5V, since it's USB power it uses and doesn't fire any alert (unless there is USB wire failure: in this case it fires critical battery alert).

Concerning  Deep Sleep Mode, it seems to work OK, but I was totally unable to measure consumption: my AmpMeter isn't sensible enough. From what I've read on the net :


Then you might be right if one use battery that provides more than 5V it may not catch up Voltage readings. But that exceed my knowledge.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 13, 2016, 08:28 pm
Hey Nes,

I am going through your instructions but I am using adafruit's trinket pro and I don't know how to add that to eclipse, got any pointers?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 13, 2016, 09:20 pm
I hope you didn't remove Arduino IDE from your computer. If you did You'll have to reinstall it with the adafruit hardware package.

Then

In Eclipse Arduino

Windows>Preference>Arduino

Private hardware path > New

C:\Users\[YOUR USER]\AppData\Roaming\Arduino15\packages\adafruit\hardware

OK

Then right click on project name in Project explorer > Properties> Arduino

Change Board.txt file

The board list should now present you the trinket ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 13, 2016, 09:54 pm

Wow, I'm impressed by the sheer amount of activity on both lightsaber threads. Neskweek, good job, I will test the LSOS v1.0 as soon as these arrive :D

I'm already sooooo excited, they will arrive tomorrow. Front side:

(http://s1035.photobucket.com/user/Kunci1/media/DSCN0511_zpstvpl7wgr.jpg.html)

Back side:

(http://s1035.photobucket.com/user/Kunci1/media/DSCN0513_zpsl67sjnq8.jpg.html)

Keep the fingers crossed that they work first-time-right!!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Mar 13, 2016, 10:05 pm
I powered the device with only battery (1). It runs for almost 5 min until it start firing Low battery alert. (LSOS  ask for battery voltage status every minute)
Then I powered the device with only battery (2). It started but immediatly thrown critical battery alert.

The whole system runs with only one 18650? !!!

Arduino nano input voltage limits are 6-20 V, I thought that even a fully charged 18650 (4.2v) would not be able to handle it.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 13, 2016, 10:09 pm
@Thelmos
yep my "whole" breadboard  system runs with a single 18650... but I only have 8 leds plugged in. And they light dim. That was just for testing purpose.

@Protonerd

SWEEEEEEEEEEEET !!!!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Mar 13, 2016, 10:10 pm
Keep the fingers crossed that they work first-time-right!!!

The build quality seems really good, congrats!

I'm currently finishing my build, I will share some thougts in a week or so, specially regarding led strings build, MPU6050 and base code for my saber engine.



Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 13, 2016, 10:24 pm
The whole system runs with only one 18650? !!!

Arduino nano input voltage limits are 6-20 V, I thought that even a fully charged 18650 (4.2v) would not be able to handle it.

6-20V is the recommended range for the external system voltage connected to VIN pin. Reason is, that the 5V LDO between the system/battery voltage and the supply of the internal logic only works if its input voltage is greater than its output. But if you bypass the LDO - correct me neskweek if you did it differently - and connect the 18650 directly to the 5V pin, the system works. For the Atmega this voltage is enough. The MPU6050 is anyway a 3.3V device. Same applies to the YX5200, the only thing I need to check is the audio amp.

Once I have a working DIYino I will certainly check what is the lowest voltage the system still works with. A single 18650 will be able to supply all kind of saber setups (with the notable exception of neopixels, there you need at least 2 or a different type as suggested by neskweek) and with LSOS's new sleep mode feature shelf life should be extended quite a bit!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 14, 2016, 12:32 am
is the DIYino run off 3.7v or 7.4v?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 14, 2016, 12:47 am
Neskweek, I'm trying to setup LSOS v1.0 using Eclipse Arduino, but when I go to import the libraries, they don't appear in the list.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 14, 2016, 01:29 am
Wow, I'm impressed by the sheer amount of activity on both lightsaber threads. Neskweek, good job, I will test the LSOS v1.0 as soon as these arrive :D

I'm already sooooo excited, they will arrive tomorrow. Front side:

(http://s1035.photobucket.com/user/Kunci1/media/DSCN0511_zpstvpl7wgr.jpg.html)

Pretty exciting indeed!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Akavari on Mar 14, 2016, 02:36 am
Hello, I'm from Russia and very badly speak in English, and will use an online translator, I'm me, I'm sorry, if that is not clearly expressed, but the idea is to bring all the same try. I need help, I decided to put a lightsaber with sound-based Arduino Nano 3, but do not know where to start, there are already very Arduino Nano 3, a sound module WTV020 instead want to use the accelerometer sensor SW-18010- P and 200 Sw d, and not only a powerful LED, I want to use a homemade garland of 5mm LEDs. I need advice on choosing the sound module, so my I do not like where to get themselves to the sound of a lightsaber, and circuit sketch. near I is unlikely to happen, because I really do not mess with this technique.Once again I am sorry for my english.https://www.youtube.com/watch?v=m4cnBX5P3R4, if that person is present at this forum, I beg you, I throw off the sounds that you use in your project with the name
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 14, 2016, 05:06 am
I tried changing to the Trinket and here are the errors I get

failed to find core reference: arduino:arduino

failed to find variant reference: arduino:eightanaloginputs

eclipse.buildId=unknown
java.version=1.8.0_74
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -perspective it.baeyens.arduino.application.perspective
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -perspective it.baeyens.arduino.application.perspective

it.baeyens.arduino.core
Warning
Sun Mar 13 21:05:52 PDT 2016
parsing of upload recipe failed

java.lang.NullPointerException
   at it.baeyens.arduino.tools.Helpers.setTheEnvironmentVariablesPostProcessing(Helpers.java:1100)
   at it.baeyens.arduino.tools.Helpers.setTheEnvironmentVariables(Helpers.java:922)
   at it.baeyens.arduino.listeners.ConfigurationChangeListener.handleEvent(ConfigurationChangeListener.java:47)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.notifyListeners(CProjectDescriptionManager.java:2212)
   at org.eclipse.cdt.internal.core.settings.model.AbstractCProjectDescriptionStorage.fireAboutToApplyEvent(AbstractCProjectDescriptionStorage.java:284)
   at org.eclipse.cdt.internal.core.settings.model.SetCProjectDescriptionOperation.executeOperation(SetCProjectDescriptionOperation.java:66)
   at org.eclipse.cdt.internal.core.model.CModelOperation.execute(CModelOperation.java:341)
   at org.eclipse.cdt.internal.core.model.CModelOperation.run(CModelOperation.java:607)
   at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241)
   at org.eclipse.cdt.internal.core.model.CModelOperation.runOperation(CModelOperation.java:638)
   at org.eclipse.cdt.internal.core.settings.model.AbstractCProjectDescriptionStorage.setProjectDescription(AbstractCProjectDescriptionStorage.java:203)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionStorageManager.setProjectDescription(CProjectDescriptionStorageManager.java:149)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.setProjectDescription(CProjectDescriptionManager.java:885)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.setProjectDescription(CProjectDescriptionManager.java:846)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager$6.run(CProjectDescriptionManager.java:573)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager$5.run(CProjectDescriptionManager.java:523)
   at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.runAtomic(CProjectDescriptionManager.java:519)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.access$2(CProjectDescriptionManager.java:517)
   at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager$4.run(CProjectDescriptionManager.java:498)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: stinky1 on Mar 14, 2016, 07:37 am
Yeah I noticed that java 8 is not 32 bit,  I run Windows XP.   So I have to search archives for possibly working version.  So anyone who trys compile with XP need report of good  JAVA version,  as I'm sure everyone else has WIN 7 10 etc.  All differences in Operating Systems probably gave you above errors.

Or mixed up file naming assignments etc etc.....  saaaa naaaa....
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 14, 2016, 07:39 am
so should I uninstall Java and reinstall what Nes suggested?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 14, 2016, 08:47 am
@772pilot

I don't know why you have this problem or how to fix it :( .From what I understand something might have go wrong during the first start. Maybe try to remove eclipse and start install again.
But I can't guaranty it will work.

@DJWing79
From what I understand it might be the reason why Eclipse Arduino is still not officially released.
You might want to try newer nightly builds or you may try to hack C:\Program Files\eclipseArduino\arduinoPlugin\packages\arduino\hardware\avr\1.6.10 files to add your device , or wait the 1st April for Arduino Eclipse v3 release (yeah no joke here ;) )
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: GUNB on Mar 14, 2016, 06:43 pm
@neskweek

nesk is normal when comment line #define LEDSTRINGS  have 39 errors in compilation with arduino eclipse?


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 14, 2016, 06:49 pm
I've had a couple of issues with this, but think I have found a solution. I just printed my latest version and will have to clean it up tonight and do the treatment.

Basically it comes down to making sure the walls are thick enough and that you have something to help fill in the open space inside the hilt. I've taken to lining the inside with epoxy to strengthen it. it worked on my last test with my son and we were hitting it at normal strengths, but it broke where the hilt was thinnest inside and I hadn't epoxy'd so will be able to test probably on Saturday and will post the STL file if it works.
Huh, what is an STL file? Can it be printed? :)

Just now I see that you were talking about a full 3-D printed lightsaber hilt. Actually what I was looking for is more a standardized chassis, which is in the vocabulary of lightsaber enthusiasts an encasing of the electronic parts so that they do not rattle around in the saber hilt.
Looking at the DIYino design (and other designs would not be much different), this chassis would be like a cylindrical part holding:
- the battery (most commonly 1 or 2 18650 type Li-Ion batteries)
- the electronics in a way that the cables can be led to the LEDs on one side, and the speaker on the other, plus openings to be able to see the status LEDs on the board(s)
- some access openings i.e. for SD-card or USB port in our Arduino based world
- opening for in-hilt recharge port
- a cap holding the speaker, which acts as a resonant chamber

Maybe this list is not comprehensive, I just pulled it from the top of my head. Purpose is to have a tube-like encasing for the sensitive parts which can be easily dropped in/removed from the hilt. The min diameter is predefined by the parts it needs to hold, but it also should be an adaptive design to be able to scale the diameter to standard hilt diameters (like the MHS, Hasbro, SaberForge, Graflex etc. ).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 14, 2016, 08:21 pm
@neskweek

nesk is normal when comment line #define LEDSTRINGS  have 39 errors in compilation with arduino eclipse?
No absolutly not.

My mistake: after my latest test campaign I commented by mystake a line "#ifdef LEDSTRINGS" in Config.h and it ruins all LUXEON/RGB part.

I updated github with the correction ;)

Sorry

Another thing to keep in mind: sometimes eclipse have an hard time to detect a branch disabling.
close it after commented #define LEDSTRING, reopen it and no more errors will show up.

Console Tab always tell the truth ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 14, 2016, 11:16 pm
@772pilot

I don't know why you have this problem or how to fix it :( .From what I understand something might have go wrong during the first start. Maybe try to remove eclipse and start install again.
But I can't guaranty it will work.
Ha, turns out I had them in the wrong folder... that'll teach me to skim the instructions  :smiley-sweat:
I finally got it working and it's AMAZING! Top notch work there.

I did run into an interesting issue though. After initially powering the nano via USB, I tried powering it with my 7.4 Li-Ion battery from the custom saber shop and for some reason it's completely unresponsive. All I hear is a buzz coming from my speaker. On top of that, now if I power via USB, I can only power on/power off the saber once. After that, it becomes similarly unresponsive (albeit with no speaker buzz). Any ideas what might be happening? My hypothesis is possible electrical/grounding issues. I did notice a faint pop and slight burning smell when I plugged the battery in (even though it should be within the nano's voltage input limits). May try with a different unit and see if I get similar results.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 14, 2016, 11:41 pm
I have two arduino nano :

A genuine one
A cheap chinese clone.

The clone one produce the same bug you just described (only one poweron/poweroff on USB, I didn't tried on batteies).
I didn't investigate on this yet since this (my clone) board as issues: it can only be programmed via an ISP device.
It refuses to accept a new bootloader burn. (it does that since the moment I tried to reset the board using RST pin)

For the buzz, did you put a resistor on RX DFPlayer connection ?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 15, 2016, 01:04 am
So I ran a test and my hilt held up! Will test it again and take photos or a brief film.

It's a full hilt, but also has "sleds" inside for the electronics to secure them and the battery. The STL file is the 3D programming file, but can save it in other formats.

@Nes,

Can you recommend a different IDE uploader that might work instead of Eclipse? I don't want to have to a do a lot of tweaking.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 15, 2016, 01:34 am
@neskweek
Yup, I've got a 470ohm resistor on my RX connection.

I also have a nano clone (this one to be specific http://www.amazon.com/gp/product/B00UACD13Q), but I didn't start to have problems UNTIL I tried the battery. Prior to that, LSOS was working perfectly.

EDIT: Okay interesting. I rebooted my computer and reuploaded LSOS to my nano and now it's working as it should (on USB). I'm noticing that if I let it run long enough I get a critical battery alert on my serial monitor and the board powers down. I'm guessing this might have to do with my USB port sleeping. Will keep playing around.

EDIT2: Aaaand  it's unresponsive again after 1 poweron/poweroff. I have no clue what's going on anymore. I also timed the amount of time it takes for the critical battery alert to appear... doesn't seem very consistent. First trial was 58s and the second was 1m58s.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 15, 2016, 02:45 am
I'm trying to weight out promini 3.3 vs ardafruit trinket, thoughts?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 15, 2016, 02:56 am
I'm trying to weight out promini 3.3 vs ardafruit trinket, thoughts?
Pro Mini will win just about every contest except size.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 15, 2016, 03:05 am
I've been reading on how to use an accelerometer to generate pitch, yawand roll values, gah radians this stuff brings back memories. Neskweek, I've not looked at your code but I read you used quats what all do you use them for? It seems you can't get yaw data but who cares pitch and roll is all you need.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 15, 2016, 08:47 am
@772pilot
Check your USB Wire ;) If it is worn, it can be the cause of  critical alert triggering. Mine does (I quite waste it by doing all those swings:P )

@Soulbp
Quaternions are used in my code to detects a change in hilt orientation and avoid managing Gimbal lock effect in the code.
That's the base of my swing detection.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 15, 2016, 10:00 am
@Nes,

Can you recommend a different IDE uploader that might work instead of Eclipse? I don't want to have to a do a lot of tweaking.
http://playground.arduino.cc/Main/DevelopmentTools (http://playground.arduino.cc/Main/DevelopmentTools)
Atmel STudio is too hard to setup
MariaMole does not seems to support adafruit's

I tried Platform IO is promising : Build on a std Arduino Nano works.
But build on trinket 3V/8Mhz does not  seems to work either and the reason didn't hit me at first.
But Playing with Platform IO, it now does :

Adafruit Trinket 3V/8MHz CPU : ATTINY85
Arduino nano CPU : Atmega328

Don't expect LSOS to compile then. Or you'll have to disable/replace all "regsiter driven" code.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 15, 2016, 03:07 pm
[quote author=neskweek link=msg=2664084 date=1458028041

@Soulbp
Quaternions are used in my code to detects a change in hilt orientation and avoid managing Gimbal lock effect in the code.
That's the base of my swing detection.

[/quote]
That's what I suspected, that should be pretty ellegant. Do you use it at all to detect spins also?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 15, 2016, 05:16 pm
I want to but I didn't work on it yet.
Right now I just managed to trigger sound close enough from each other to give illusion it detects spins
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 15, 2016, 07:15 pm
@772pilot
Check your USB Wire ;) If it is worn, it can be the cause of  critical alert triggering. Mine does (I quite waste it by doing all those swings:P )
I actually tried a different nano and now it actually works with a battery setup (no buzzing, yay!). I guess there was a faulty component with my previous one. I still get the critical battery alert after a random amount of time, but I don't think it's because of the battery voltage being too low (it works again if I just replug the battery). Still running into the issue where I can only poweron/poweroff once though. Config menu works just fine, however.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 15, 2016, 08:47 pm
What about visual studio with arduino plugin? I can see the pro trinket (12mhz) showing but haven't had time to upload code to see if it compiles. Wondered if you'd used it before
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 16, 2016, 03:09 am
Just as a sanity check, i wired it up to my Arduino Uno and set the board, but when I upload I get the following error

Starting upload
using arduino loader
Starting reset using DTR toggle process
Toggling DTR
Continuing to use COM7
Ending reset


Launching C:\Users\Damien\Dropbox\eclipseArduino\arduinoPlugin\tools\arduino\avrdude\6.0.1-arduino5/bin/avrdude -CC:\Users\Damien\Dropbox\eclipseArduino\arduinoPlugin\tools\arduino\avrdude\6.0.1-arduino5/etc/avrdude.conf -patmega328p -carduino -PCOM7 -b115200 -D -Uflash:w:C:\Users\Damien\Documents\eclipse\LSOS/Debug_AVaRICE/LSOS.hex:i
Output:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% -0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "C:\Users\Damien\Documents\eclipse\LSOS/Debug_AVaRICE/LSOS.hex"
avrdude: can't open input file C:\Users\Damien\Documents\eclipse\LSOS/Debug_AVaRICE/LSOS.hex: No such file or directory
avrdude: read from file 'C:\Users\Damien\Documents\eclipse\LSOS/Debug_AVaRICE/LSOS.hex' failed

avrdude done.  Thank you.

6.0.1-arduino5/bin/avrdude finished
upload done
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 16, 2016, 06:38 am
Build before upload ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 16, 2016, 10:30 am
Just to give you guys a heads-up:

I received yesterday my first DIYino V1 board

and
IT WORKS!!!


No grey smoke, all voltages where they are supposed to be, code can be uploaded, motion sensor and MP3 player up and working!!!

I could jump from joy! First real Milestone is achieved.
Further verification tests are on the way.

I will send some pics when I get the time and a camera with macro.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 16, 2016, 12:20 pm
Great news !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 16, 2016, 02:01 pm
Hey Proto, how much are the DIYino boards going to run us schlubs?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: dannyc09 on Mar 16, 2016, 02:03 pm
Awesome news!  Can't wait to pick one of these up!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jshaw on Mar 16, 2016, 03:46 pm
Amazing news, Protonerd!

It's been so rad to follow these two threads and see the levels of dedication as the projects evolve from "hey look what I did" into "look what we've made".  Very exciting stuff.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 16, 2016, 04:17 pm
Just to give you guys a heads-up:

I received yesterday my first DIYino V1 board

and
IT WORKS!!!


I'll take 12!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 16, 2016, 09:38 pm
I'll take 12!
Ohhh Nooooo ! It's already out of stock :(


I just received my neopixel strings ^_^ Double sweet news day !!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 17, 2016, 12:12 am
Okay, played around some more with the config files. Turns out I forgot to specify my battery parameters... oops. That solves the critical battery alert. I also disabled deep sleep and noticed that the lightsaber stops making noise and flickering (LEDs stay on though) after a certain amount of time. Is this supposed to happen?

Still having issues with only being able to power on/ power off the saber once... I have no idea what the issue could be. Anybody have any ideas? I don't think it has to do with my nano being a clone... after all I'm able to upload the code just fine (no FTDI madness going on here, using a CH340 USB chip).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 17, 2016, 12:28 am
Ohhh Nooooo ! It's already out of stock :(
Hahaha! Typical saber-land woes.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 17, 2016, 01:05 am
Ok, new error using Eclipse


17:03:34 **** Incremental Build of configuration Release for project LSOS ****
"C:\\Users\\Damien\\Desktop\\eclipseArduino\\arduinoPlugin\\tools\\make\\make" all
'Building file: ../.ino.cpp'
'Starting C++ compile'
"/bin/avr-g++" -c -g -Os -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR     -I"C:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\cores\arduino" -I"C:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\variants\standard" -I"C:\Users\Damien\Arduino\libraries\OneButton" -I"C:\Users\Damien\Arduino\libraries\DFPlayer" -I"C:\Users\Damien\Arduino\libraries\I2Cdev" -I"C:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\libraries\Wire" -I"C:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\libraries\Wire\utility" -I"C:\Users\Damien\Arduino\libraries\MPU6050" -I"C:\Users\Damien\Arduino\libraries\LinkedList" -I"C:\Users\Damien\Arduino\libraries\EEPROMEx" -MMD -MP -MF".ino.cpp.d" -MT".ino.cpp.o" -D__IN_ECLIPSE__=1 -x c++ "../.ino.cpp"  -o  ".ino.cpp.o"   -Wall
process_begin: CreateProcess(NULL, sh.exe -c "/bin/avr-g++ -c -g -Os -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\cores\arduino -IC:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\variants\standard -IC:\Users\Damien\Arduino\libraries\OneButton -IC:\Users\Damien\Arduino\libraries\DFPlayer -IC:\Users\Damien\Arduino\libraries\I2Cdev -IC:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\libraries\Wire -IC:\Users\Damien\AppData\Roaming\Arduino15\packages\arduino\hardware\avr\1.6.5\libraries\Wire\utility -IC:\Users\Damien\Arduino\libraries\MPU6050 -IC:\Users\Damien\Arduino\libraries\LinkedList -IC:\Users\Damien\Arduino\libraries\EEPROMEx -MMD -MP -MF.ino.cpp.d -MT.ino.cpp.o -D__IN_ECLIPSE__=1 -x c++ ../.ino.cpp -o .ino.cpp.o -Wall", ...) failed.
make (e=2): The system cannot find the file specified.
subdir.mk:33: recipe for target '.ino.cpp.o' failed

make: *** [.ino.cpp.o] Error 2
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 17, 2016, 08:38 am
IC:\Users\Damien\Arduino\libraries\EEPROMEx -MMD -MP -MF.ino.cpp.d -MT.ino.cpp.o -D__IN_ECLIPSE__=1 -x c++ ../.ino.cpp -o .ino.cpp.o -Wall", ...) failed.
make (e=2): The system cannot find the file specified.
subdir.mk:33: recipe for target '.ino.cpp.o' failed
It seems you have a problem with  EEPROMEx library but I can't deduce more from this message.

@Everyone
Please notice that you can post errors concerning LSOS on github. It would be best, for this thread readability ;).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 17, 2016, 10:21 am
I'll take 12!
Is that on order? :)

Quote
Ohhh Nooooo ! It's already out of stock :(
Yeah, sort of. It's not yet in stock. I have currently 5 pieces, but I plan to make a first run of 20 more.

Yesterday I experimented with using a Nano as an AVR ISP programmer to burn the bootloader, so far with negligible suceess. OK, I have to make some explanation. For the initial run I ordered 5 pcs pre-bootloader-burnt Atmega328 chips, more expensive than regular ones, but I just rated the risk of not being able to (right away) bootload-burn them as high, and it turned out to be a prudent foresight. So I have a couple of board working due to having a bootloader (but I have to define them to the Arduino IDE as Arduino Mini...). The rest I still have to find a way to bring in the bootloader. So if anyone has experience on this field, I could use a helping (virtual) hand.

As to the problem I still do not fully grasp it (opportunity to learn avr low level programming), I always get
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03

error messages. Suspicious is that I even get them if I do not connect the DIYino to the Nano, so the problem seems to be not on the receiving side.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 17, 2016, 03:13 pm
@Nes,

so what would I need to look at in order to troubleshoot this better? I used the files from your LSOS zip and the instructions on your github. Maybe I'm using the wrong version of eclipse? Its 3.0.0 Toddler
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 17, 2016, 03:15 pm
As to the problem I still do not fully grasp it (opportunity to learn avr low level programming), I always get
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03

error messages. Suspicious is that I even get them if I do not connect the DIYino to the Nano, so the problem seems to be not on the receiving side.
I might be able to help you out with that, Proto. I've recently learned how to successfully burn the bootloader on a Pro Mini. Doing the same on your board shouldn't be any more difficult since it's the same chip. I'll send you a PM (much) later when I can look at my notes. 
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 17, 2016, 03:36 pm
I might be able to help you out with that, Proto. I've recently learned how to successfully burn the bootloader on a Pro Mini. Doing the same on your board shouldn't be any more difficult since it's the same chip. I'll send you a PM (much) later when I can look at my notes.
Muchos gracias! Appreciated! :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 17, 2016, 03:44 pm
@Nes,

So I took a look at the project and there is a red X nest to subdir.mk

when I click on Problems, I get a error I can highlight

@echo 'Building file: $<'


https://www.dropbox.com/s/lxbd7mcqcb7wxvw/Eclipse%20Error.png?dl=0
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 17, 2016, 10:38 pm
@Everyone
Please notice that you can post errors concerning LSOS on github. It would be best, for this thread readability ;).

Issue posted :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Mar 18, 2016, 12:56 pm
First off, to Jakesoft, Protonerd, Neskweek, and anyone else who's helped with this project so far:

THANK YOU!

I've been a saber enthusiast for quite some time, but haven't really dug into the details of building a truly quality one yet. One that gave me all the control I wanted.  The closest was Ultrasabers Emerald series, but once I talked to them to get prices on a guts-only purchase, I was literally only $15 away from the cost of a completed Emerald saber. Since a true Jedi builds his own, I didn't want anything off-the-shelf. The rest of the options for self-builds out there seemed like a conglomeration of mismatched, sub-par parts that don't offer real control.

That's, of course, when I remembered that this is exactly the type of project where am Arduino would shine. Ten seconds of googling later, I'm reading Jakesoft's thread about exactly that. What brilliance! Soon after that I'm discovering that Protonerd and Neskweek are joining forces to become the biggest names in Saber Construction. A customizable drop-in solution for string blades, RGB(W), single die, and even the new hotness, Neopixels? Sheer brilliance. Plus you're keeping the software open source GPL? I love you. Add to this, the talked about possibility of 3d printer files for custom chassis? I can't even express how much of a dream come true this is.

As it stands right now, I only have minimal electronics building experience, or programming experience, however, I do have one thing that will help me. I have the ability to learn. That's what I intend to do, from now until I know more about public availability of those brilliant DIYino's. That is the intent, is it not? I certainly hope so. Do you have any idea yet how much they will cost? I definitely hope I can afford to support your innovation. Depending on final cost, I could very well be interested in as many as 3 of them. One RGBW saber each for my son and I, and one on reserve for an eventual Neopixel blade.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 18, 2016, 04:45 pm
@772pilot  and @DJWing79
Thank you for having posted your problems on github.
I did reply  ;)

@772Pilot Your problem should be solved with v1.0.1 please test it and tell me (on github ;) )

@Everyone
I will tighten a previous declaration I've made :
Please post your problems on github. I won't  help you HERE anymore.
I'll also modify the releases announces on this thread to add this info.

Let's keep this thread as clean as possible :p

@AardvarkSagus
Hey welcome
Man ... I don't consider myself to be part of the biggest names in sabersmithing (yet :P). But hey... Thank you ;)

Do you have any idea yet how much they will cost?
I can't talk for Protonerd here, but I don't think they will be.
You'll just have to sell your son or your both  arms.



[EDIT]
I almost forgot ...
Look what arrived in today's mail :
http://i1073.photobucket.com/albums/w385/cest_bastien1/Lightsaber/1458318039283-1304924743_zpsbjfibw1y.jpg (http://i1073.photobucket.com/albums/w385/cest_bastien1/Lightsaber/1458318039283-1304924743_zpsbjfibw1y.jpg)

That's gonna swing !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Mar 18, 2016, 05:51 pm
@AardvarkSagus
Hey welcome
Man ... I don't consider myself to be part of the biggest names in sabersmithing (yet :P). But hey... Thank you ;)
OK. Maybe not yet, but with a bombshell like this, you're well on your way.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 18, 2016, 09:57 pm
OK. Maybe not yet, but with a bombshell like this, you're well on your way.
Fight the power! LOL.

Thanks for the thanks. :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 19, 2016, 12:02 am
Update to DIYino progress:


Heureka! I've just burned a bootloader into my first DIYino :) wow, that was my biggest fear, that this would not work. Great thanks to Jakesoft who set me on the right track.

There were 2 tweaks:
1. The Nano needs a 10uF cap between RESET and GND. But only after the ArduinoISP is downloaded to the Nano used as the programmer.
2. There was a topic with how to reset the board to be programmed. I first tried out the suggestion from Jakesoft to wire a reset button, but he mentioned to me in a PN that he is not sure of the timing, but somehow a reset must be applied. So I looket a bit more closer at the code. It redefines the reset as

Code: [Select]
#define RESET     SS

Well, since I did not know what on Earth SS could mean, I told myself, that might be a typo? Then at the beginning of the code I spotted following comment:
Code: [Select]
// pin name:    not-mega:         mega(1280 and 2560)
// slave reset: 10:               53


Hm, that got me thinking...and acting...so if there is a slave RST, it must be different from the main reset of the programmer which is anyway neutralized by the 10uF cap...so I just redefine the RESET like this:

Code: [Select]
#define RESET     10

And then it worked! Huh, I'm very tired at this late hour, probably did not get more than 5 hours of sleep during the last few days, but Í'm really relieved.

There is also a bad news, at least for the time line. I played around with the working DIYino, dowloading the LSOS from neskweek. Other than my ol' lightsaber code - whiched worked quite well - it produced random swings. OK, I knew I had to insert the rght offsets for the MPU...I remembered neskweek told me about an MPU6050_Calibration code, I downloaded it and let it run....
....and it ran, it ran....
I cancelled it. Then I plugged in my DIYino prototype (known good module), there the code worked. I became curious and loaded again my saber code, which had among others also a rudimentary MPU calibration code. It ran, but I was not happy about what I saw. The values were insane high. My code worked because at one point in the development I decided that I use only differential accelerometer values for swing.
Anyway, I fired up he datalogging and...to my surprise...not only the values were too high, but one of the axis did not budge a bit.

OK, I do not want to bother you with this tale, those honest guys over there on eBay from whom I bought my MPU's sent me obviously either totally fake devices, or even worse, stolen some production fails from Invensense batches. S***t, but I count myself lucky that I only had 5 board assembled. Slight issue is, that those guys sold me MPUs for a price of ~3$, if I buy them from trusted sites (DigiKey, Farnell etc.) they costs a proud 7-10$!!!

Anyway, let's be happy for things which succeded and a good sleep helps see things in a different light.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 19, 2016, 12:31 am
Update to DIYino progress:

OK, I do not want to bother you with this tale, those honest guys over there on eBay from whom I bought my MPU's sent me obviously either totally fake devices, or even worse, stolen some production fails from Invensense batches. S***t, but I count myself lucky that I only had 5 board assembled. Slight issue is, that those guys sold me MPUs for a price of ~3$, if I buy them from trusted sites (DigiKey, Farnell etc.) they costs a proud 7-10$!!!

Anyway, let's be happy for things which succeded and a good sleep helps see things in a different light.
I can't speak for anyone else, but I'm willing to pay an extra 5 or 10 bucks per unit to know the parts are from reputable suppliers and are good and going to last.

Your boards might not be totally useless if the accelerometer is still working on two axis. You can still detect a swing with that. If that doesn't work, you can go old school and just put some swing and clash sensors on the I/O you brought out to the edge and have the SW ignore the accelerometer. Not ideal, but then you don't have 5 boards collecting dust at least.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 19, 2016, 11:11 pm
I can't speak for anyone else, but I'm willing to pay an extra 5 or 10 bucks per unit to know the parts are from reputable suppliers and are good and going to last.

Your boards might not be totally useless if the accelerometer is still working on two axis. You can still detect a swing with that. If that doesn't work, you can go old school and just put some swing and clash sensors on the I/O you brought out to the edge and have the SW ignore the accelerometer. Not ideal, but then you don't have 5 boards collecting dust at least.
Good to hear that and I will also only purchase parts from reputable suppliers in the future, lecture is learnt. There are quite a number of high-end chips on the board, which are for sure expensive, but people in this hobby are known to give money for good quality and reliability.
The 5 boards will not dust, I will have the company which mounted the chips to swap the fake ones with original parts on the way. It's just a delay. Anyway, even with no MPU at all these boards are valuable, next project I will start will be an E11 Blaster, and there I need the full power of the DIYino, except the MPU :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 19, 2016, 11:29 pm
Here is a sneak preview of the DIYino board :)
Sneak preview of DIYino (https://www.youtube.com/watch?v=g69xRFi4PCc)

I hope you like it! More to come as I progress with the verification.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 19, 2016, 11:59 pm
I can't speak for anyone else, but I'm willing to pay an extra 5 or 10 bucks per unit to know the parts are from reputable suppliers and are good and going to last.
Late reply but I do agree with Jake 100%. Cheap unit are great but fully functionnal unit are way better :D

[edit]

Neopixel preliminary work (https://youtu.be/-wZOojL-Yok)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 21, 2016, 01:17 pm
[edit]

Neopixel preliminary work (https://youtu.be/-wZOojL-Yok)
Wowha, that looks frighteningly good! Do you want to connect all 3 stripes in triangle?

I like the fast switching between the colours! Also the multi-colour effects look great! I need to have a closer look at it at home with sound.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Mar 21, 2016, 04:16 pm
[edit]

Neopixel preliminary work (https://youtu.be/-wZOojL-Yok)
Wish. Sweet. What Neopixel density is that? 144/m? 60/m?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 21, 2016, 05:04 pm
Thank you guys
It's 144LED/m stripes
By the way if you want some of those and go for cheap ones, prepare your solder iron.
I did need to solder some misoldered ones.
And I still need to resolder the 50cm junction wich is to wide.

@Protonerd, yes I'm going to mount them on prism shaped rod


I'm preparing to go from breadboard to soldered project but this brought some questions for electronic gurus ;) :
On my breadboard I didn't put the resistors attached to the MOSFETs. :
What are they functions ? (since all seems to work without them and it kind of bothers me)
Is it possible to attach all the MOSFET to the same resistor?

Thanks again ;)


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Mar 21, 2016, 09:55 pm
What do you mean, cheap ones? The only ones I see are the ones that Adafruit sells for $60-65/m. Are they cheaper somewhere?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 21, 2016, 11:25 pm
I got mine from aliexpress
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 22, 2016, 03:31 am
I got my initial hardware except the sound module, went with the 6050 and a dfplayer on a pro mini. I'll be looking forward to try out LOS to get a feel for things before I start anything myself.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 22, 2016, 08:57 am
I'm preparing to go from breadboard to soldered project but this brought some questions for electronic gurus ;) :
On my breadboard I didn't put the resistors attached to the MOSFETs. :
What are they functions ? (since all seems to work without them and it kind of bothers me)
Is it possible to attach all the MOSFET to the same resistor?

Thanks again ;)

No need for the resistors. They are supposed to pull down the MOSFET gates thus ensuring that even if the driver is floating, you will no accidentally turn on LEDs. If you make sure in the code to drive LOW on the PWM channels if the saber is off, they can be omitted.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 22, 2016, 10:10 am
Sweet ! More room in my hilt ^_^
Thanks Protonerd

Here I share some info about an interesting diffuser solution :
http://www.luminitco.com/products/light-shaping-diffusers#rolls (http://www.luminitco.com/products/light-shaping-diffusers#rolls)

I did ask for a quotation to european retailer. Hope they'll answer...

A lot of industrial company don't even answer when asking for small quantities even when you say it's for prototyping purpose...
And after they complain about customer who provides themselves in Asia ...


Anyway from what I've seen on video, celluloid might also be an interesting solution (ping pong balls material ) as styro foam (cofee cup, hamburger packaging). But I don't have any to test.

So far with what I've got here, packaging/isolating foam  + crystal paper is a good solution, but they absorb alot of light.
Beware of packaging foam: they all seems to be the same, but actually they are not equals ! Some gives best results than others.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 22, 2016, 01:57 pm
Thank you Nes for your top-notch troubleshooting and help. But I have one question and I'm not sure if its really a bug or done by design. When I run the  DFPlayer off the 5v rail of my Uno it works, but when I run it off my 3.7v battery it won't (in fact neither will lights). Is this part of your power reading feature? I was planning on using a 3.7V design and I know the DFPlayer will work with that voltage (have had it work previously with the test code from the manufacturer). Is there a way to disable your power feature or...even better..could you make a code to differentiate between the 5v and 3v version of your unit? similar to how you can set it for led string or rgb?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 22, 2016, 03:13 pm
Oh one last thing, in config mode, clicking the colors only changes the led, I get no mixing. so it moves from red to green to blue but turns off the other colors as it does this.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 22, 2016, 06:48 pm
@ DJWing79 you should take a closer look at Config.h and at the start of LighSaber.ino ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Mar 22, 2016, 09:53 pm
I got mine from aliexpress
Awesome. I'll have to keep an eye out there. I don't see any currently.

Edit: Found them.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 23, 2016, 05:05 pm
Thank you Nes for your top-notch troubleshooting and help. But I have one question and I'm not sure if its really a bug or done by design. When I run the  DFPlayer off the 5v rail of my Uno it works, but when I run it off my 3.7v battery it won't (in fact neither will lights). Is this part of your power reading feature? I was planning on using a 3.7V design and I know the DFPlayer will work with that voltage (have had it work previously with the test code from the manufacturer). Is there a way to disable your power feature or...even better..could you make a code to differentiate between the 5v and 3v version of your unit? similar to how you can set it for led string or rgb?
I guess you connected the 3.7V to the VIN pin. That will not work. Connect it to the 5V pin. But make sure the voltage never exceeds 5V.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 24, 2016, 01:07 am
I can see I have a lot of learning to do. Neskweek you've done some great things in you code. All the ifdefs can make a guys eyes swim. =) I can see I have my work cut out for me to get up to speed.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 24, 2016, 07:11 am
Thanks
And yeah, all those ifdefs made the code hard to read, even for me.

That's why I want to port LSOS to USaberLib. It should win some readability, and some hex file size (I hope). But I won't do that until next month.

UsaberLib still needs MPU6050, and Neopixels additions.

I'm currently working on completing my blades and on a chassis design right now.
I'm tired of just playing with a breadboard :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 24, 2016, 01:43 pm
Ya I need to check out Jake stuff yet also. I really liked a number of things you did such as your supresses.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 24, 2016, 07:28 pm
Is there another place on github to comment outside of the issues section? I'm getting to place I can make solid contributions. I'm a bit rusty on my c/c++ but I can get back into the swing of things pun intended. I can stream line the swing code for sure without changing the way it works or losing functionality. Neskweek are you interested in these kinds of optimizations? Otherwise if not I won't trouble you I'll just do my own thing.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 24, 2016, 09:09 pm
Sure I am interested !
As I said when I started the project, every good will is welcome, and there's room for improvements.

I promoted you to contributor on github. You can upload code to the project if you like.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 24, 2016, 09:46 pm
I'm not sure what I did but I'm having uses with ide, project not compile because of arduino.h. killed the project reinstall, try to recreate the project and now the additional libraries are there. I may have to just delete everything and start from scratch. I'm not sure what's up very odd.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 25, 2016, 01:12 am
Soul, if you can make it work with IDE that'd be AWESOME, i'm trying to make it work on a trinket pro 3v from adafruit
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 25, 2016, 04:06 pm
Hey neskweek, if I want to increase the amount of time before a new swing sound is triggered, I can just modify SWING_SUPPRESS right?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Mar 25, 2016, 07:33 pm
yes
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 26, 2016, 05:27 am
Perfect, thank you! Also, you should add into the readme that DFPlayer only supports 16-bit audio files... I mastered my sound font at 24-bit and spent a good 30 minutes trying to get sounds to play.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 26, 2016, 07:04 pm
Soul, if you can make it work with IDE that'd be AWESOME, i'm trying to make it work on a trinket pro 3v from adafruit
I second it ! That would be a cool addition! In the meantime I will try Eclipse as well, just to see how much it really is more convenient to use.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 26, 2016, 07:15 pm
That's what I intend to do, from now until I know more about public availability of those brilliant DIYino's. That is the intent, is it not? I certainly hope so. Do you have any idea yet how much they will cost? I definitely hope I can afford to support your innovation. Depending on final cost, I could very well be interested in as many as 3 of them. One RGBW saber each for my son and I, and one on reserve for an eventual Neopixel blade.
I'm still quite engaged in verifying the DIYino as it is, so I still need to make calculations to define the pricing for the boards. But I can give you already some guides: the boards will be a bargain if compared to commercially available saber cores, with all the advantages a flexible solution offers. But they will be much more expensive compared to if you buy the major building blocks from cheap eBay sources.
Advantage is obvious: small size fitting into all saber parts, everything integrated onto one PCB, proven design and flexible programming. And the most important feature: a lot of resource available from a dedicated community, in form of code, ideas, design help, know-how etc.

I will have my first 5 boards with genuine MPU6050 parts by Tuesday, so I can test the MPU. Afterwards I can consider all major functionalities to be verified. Once that is finished I will make a run of 20 boards. If anyone is interested, drop me a PN (not binding at this stage, as price is not yet settled).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 27, 2016, 12:19 am
So I'm trying to modify LSOS to add crossguard support (ala Kylo Ren), but I'm a little stumped as to how I'm going to pull it off. Was originally going to leverage the soft pwm accent LED, but I'm not sure about how to best make it flicker randomly and implement staggered ignition. Any ideas?

Here was my thought process... move the ACCENT_LED section from standby mode to action mode and put it in a while loop to delay turning it on for n milliseconds. I'd like to vary brightness randomly (just like the flicker effect), but I'm not sure how to manipulate the duty cycles to accomplish that.

EDIT: Quick question. As it's written, is the accent led supposed to be solidly lit in action mode?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 27, 2016, 12:57 am
Okay, went back to eclipse and got everything working their.eesh, I've had no time to get everything set up on my bread board to test. I think I need a bigger bread board. As to the kylo cross guards why not just adjust the led string code or if your using a string blade just turn the last segment into the cross guards. Sure you lose a segment but it should be pretty straight forward.

I need to get me bread board together, and run the calibration script on my mpu. Then hopefully I'll be in business. Weirdly with eclipse I had to copy all the libraries into the eclipse folder and then change the directory structure so that all the files in the libraries where in numeric folders like 1.0.1... That was really weird.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 27, 2016, 01:06 am
As to the kylo cross guards why not just adjust the led string code or if your using a string blade just turn the last segment into the cross guards. Sure you lose a segment but it should be pretty straight forward.
This seems like the best idea for a string blade. If you are using a Luxeon-style blade, then the Universal Saber library already has a cross-guard blade you might be able to use. I just posted an update today.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Mar 27, 2016, 01:17 am
As to the kylo cross guards why not just adjust the led string code or if your using a string blade just turn the last segment into the cross guards. Sure you lose a segment but it should be pretty straight forward.
Each of my crossguards is an LED segment and I'd like to have them flicker independently. So if I wanted to do that, I'd lose two segments in my blade. I'd prefer to retain 6 segments in the blade, though.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Mar 27, 2016, 04:41 am
I have to say I like Jakes use of oop. I think Neskweeks saberfont lends towards that direction. 
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Apr 01, 2016, 02:56 am
Anybody have experience using this (https://github.com/per1234/PalatisSoftPWM) soft PWM library? I can't get Lightsaber.ino to build with the PalatisSoftPWM.begin(60); statement in setup(). I'm getting the following errors:
Code: [Select]
make:*** [ino.cpp.o] Error 1
Method 'begin' could not be resolved
Method 'begin' could not be resolved
missing template arguments before '.' token
recipe for target '.ino.cpp.o' failed
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 01, 2016, 12:47 pm
Anybody have experience using this (https://github.com/per1234/PalatisSoftPWM) soft PWM library? I can't get Lightsaber.ino to build with the PalatisSoftPWM.begin(60); statement in setup(). I'm getting the following errors:
Code: [Select]
make:*** [ino.cpp.o] Error 1
Method 'begin' could not be resolved
Method 'begin' could not be resolved
missing template arguments before '.' token
recipe for target '.ino.cpp.o' failed


Please report bugs and errors on GitHub and keep this thread for lightsaber electronics discussion.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Apr 01, 2016, 07:00 pm
This isn't an LSOS related issue. I'm trying to expand the number of PWM outputs available and wanted to know if anybody had an experience with the particular library I linked.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on Apr 02, 2016, 03:10 pm
This is wonderful, thank you very much , is absolutely brilliant .
Thank you NESTWEEK for sharing code and so public with us because insurance has many hours
Video....

https://www.youtube.com/watch?v=uwFoDDV1pM0
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 02, 2016, 10:40 pm
This isn't an LSOS related issue. I'm trying to expand the number of PWM outputs available and wanted to know if anybody had an experience with the particular library I linked.
All right, you are redeemed!

If you make it work, this opens up new vistas of possibilities for sure! While I think that 6 PWM channels are enough for most builds, certainly a few more could benefit unique builds like a Kylo Ren crossguard saber, where at least 2 additional channels would be a boon!

BTW, my next build will be also a Kylo Ren, using neopixels. With those stripes I do not have the problem of distributing segments (that is not to say that it has no challange, but they are somewhat different). I already found an old toy Vader lightsaber hilt for that, it will be fairly easy to add the crossguards.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Apr 03, 2016, 08:40 am
Anybody have experience using this (https://github.com/per1234/PalatisSoftPWM) soft PWM library? I can't get Lightsaber.ino to build with the PalatisSoftPWM.begin(60); statement in setup(). I'm getting the following errors:
Code: [Select]
make:*** [ino.cpp.o] Error 1
Method 'begin' could not be resolved
Method 'begin' could not be resolved
missing template arguments before '.' token
recipe for target '.ino.cpp.o' failed


Latest version of LSOS embarq soft PWM capabalities. Take a look at it ;)
No need for a full library. It can be done with a simple short function.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Apr 03, 2016, 07:16 pm
Latest version of LSOS embarq soft PWM capabalities. Take a look at it ;)
No need for a full library. It can be done with a simple short function.
Oh, this makes me excited! Before I started looking at the library, I tried adapting the accent led code and inserting in the main LED timer loop. Didn't quite have the desired effect.

EDIT: Oops, I misunderstood the message. I've been playing around with the accent led PWM functions, but I'm having trouble figuring out how I would get it to continuously flicker like the main blade LEDs when the saber is activated.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: LukeRaNcOr on Apr 04, 2016, 10:52 am
Hi Guys!

I have been following this thread from the beginning and I am all most got all the necessary chips to make this lightsaber board.

A strange question, how difficult would it be to port the code to the Atmega328's bigger brother the Atmega2560? As it has more pwm channels and I think(if i read the datasheets right) more flash/eeprom to work with? It might be an alternative to use for a Kylo ren type saber?

Keep up the awesome work you guys!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Apr 04, 2016, 03:18 pm
Hey Proto,

Will your DIYino work off of 3.7v?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 04, 2016, 06:06 pm
Hey Proto,

Will your DIYino work off of 3.7v?
It does, I demonstrated it in my latest video.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Apr 04, 2016, 09:46 pm
How close are we to a working model we can order, and how much is it going to cost us?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Apr 05, 2016, 10:05 pm
Neskweek, I've been looking at the PWM() and fadeAccent() functions. Let me know if I'm understanding this correctly: Every time the code runs through loop(), PWM() increments the tick counters and compares them to the duty cycle values, yes?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 06, 2016, 07:47 am
How close are we to a working model we can order, and how much is it going to cost us?
Working model is already existing, in fact I already sold a few of them locally. I will start a bigger run soon, about 30 boards.

I'm going to make an "official" launch in another thread in the appropriate forum branch. Starting price will be 59 EUR/board. This price is subject to change due to component prices/PCN manufacturing and mounting costs varying, but I will try to maintain this low price if possible.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Apr 07, 2016, 08:34 pm
Will instructions be included? any cool packaging? if you buy 50, you get 1 free? Am super excited
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 08, 2016, 03:02 am
We already talked a lot about motion detection, different LED flavors, audio amps and speakers, however there is still one essential part we haven't mentioned, although it adds a whole new experience to a prop lightsaber build.

If I look at lightsaber scenes in the SW films, I can feel the power surge in my hands holding that lightsaber. This feeling can be replicated very easily by vibration motors, essentially the same parts used in handheld devices (smart phones etc.) for buzzing.

http://www.precisionmicrodrives.com/vibrating-vibrator-vibration-motors

For some of my builds I used this type:
https://www.pollin.de/shop/dt/NDA2OTg2OTk-/Motoren/Gleichstrommotoren/Vibrationsmotor_LA4_432A.html

It is very small but has enough "buzz" in it to be felt. Because it needs a few 10's of mA, it should be able to be driven from digital pins (never tried though, I have to still test it).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Apr 08, 2016, 12:50 pm
Hello I didn't take much time to answer lately.
I'm currently working on puting every part in  a chassis and things doesn't go smoothly ... I already ruin a DFPlayer mini and the second one I received is faulty out of the box (SPKs pin and GND pin  shorted). And I almost fried the MPU6050 because my cheap solder iron was flatening at the tip (some pin ports did came out. I still was able to salvage it)

I first mounted the mosfets on an alluminium disc, for heat dissipation, but the back panel is linked to the gatepin of the mosfet, so when I fired it the first time, all segment fired at once, and shut at once. So I had to remove them and paste those on new plastic discs.
I also inverted segments 6 and 2 on this build, but this can be corrected in the software. That's the problem when you assemble and disassemble those several time: you augment the mistake risks. I did marked the cables with (not so) permanent markers but the ink still did go away.

So here is the reason why so many Jedi turn to the dark side :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160408_125839_zpsamiambos.jpg.html) (http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160408_125902_zps4onaqhms.jpg.html)
Please be indulgent, I know this is some ugly job here.This is my very first hilt assembly and I must confess that even if I put time on the design, I didn't thought of everything, so I did some ajustements on the fly resulting on this.
This is definitly a prototype :P
I made the chassis disc by lathing and milling, and made some slight adjustment with a dremel.
I still made those holes for the PCBs to tight. It's quite hard to pass cables. Next time I'll make a little more room. Believe me, PCBs won't go anyway.
The last disc is wearing a 7th mosfet because I wanted to try FoC capabilities. It works but I think I'll won't use it anyway:
Protonerd already warn me on this on several occasions, but since I'm stuborn I wanted to try out. But my FoC ledstring as several issues and I don't have the courage to work on it right now.
The channel you see on the upper part of the disc are made for battery holders. I want to be able to remove those 18650 for charging or replacement.
The pending cables are for switchs, and RGB accent LED, and there's one free (unless I use it for a vibrating motor ;) )

Lights and movements are working but I'm still waiting for a DFPlayer replacement, again...
This chassis have a 32mm diameter (33mm at the aluminium emitter disc, made on purpose)
and about 230mm long.



Neskweek, I've been looking at the PWM() and fadeAccent() functions. Let me know if I'm understanding this correctly: Every time the code runs through loop(), PWM() increments the tick counters and compares them to the duty cycle values, yes?
You're correct.
For your use case you might want to make a new fonction though. fadeAccent was designed to make an accent LED blink when the saber is idle.
In action mode the loop is slower, but it should be fast enough to trigger a nice fading pattern.
As for synchronzing it with the main blade, I didn't look at that but it might be possible: with this code it is impossible to make it flicker as fast as the main blade, but you should be able to trigger a flicker effect suffisant to trick your eye.


Nice idea Protonerd, concerning vibrating motor.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 09, 2016, 07:35 am
Hey neskweek, you are the first person in this Galaxy far, far away who received his DIYino board already, why not use that one for the build? Saves all that trouble you reported.   ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Apr 09, 2016, 09:35 am
I'm currently building some discs for it ;)
I didn't speak of it yet, I didn't want to brag :P

But for sure it will be waaaaaayyy more easy to solder and mount.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 09, 2016, 10:12 am
Would you care to share how exactly you make those disks? My biggest pain point is building a chassis still...

You also mentioned you plan to make a 3D chassis, will it be anytime soon? I would be grateful for someone who could make a 3D design I only had to send to a 3D print provider  ::)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Apr 09, 2016, 10:45 am
We already talked a lot about motion detection, different LED flavors, audio amps and speakers, however there is still one essential part we haven't mentioned, although it adds a whole new experience to a prop lightsaber build.

If I look at lightsaber scenes in the SW films, I can feel the power surge in my hands holding that lightsaber. This feeling can be replicated very easily by vibration motors, essentially the same parts used in handheld devices (smart phones etc.) for buzzing.

http://www.precisionmicrodrives.com/vibrating-vibrator-vibration-motors

For some of my builds I used this type:
https://www.pollin.de/shop/dt/NDA2OTg2OTk-/Motoren/Gleichstrommotoren/Vibrationsmotor_LA4_432A.html

It is very small but has enough "buzz" in it to be felt. Because it needs a few 10's of mA, it should be able to be driven from digital pins (never tried though, I have to still test it).
Oooooh, i love that idea XD
I'm so going to do that for my saber XD.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Apr 09, 2016, 01:24 pm
Would you care to share how exactly you make those disks? My biggest pain point is building a chassis still...

You also mentioned you plan to make a 3D chassis, will it be anytime soon? I would be grateful for someone who could make a 3D design I only had to send to a 3D print provider  ::)
I've put some  pictures on photobucket already but I'll made some more especially for the milling part, that I forgot to shoot last time.

For the 3D design, I still plan to do those, but after the one I'm making. They will be used as patrons to make the 3D design.

The tools I'm using right now (lathe and mill) are some old tools and they are really not precise, they do float a bit, and so it's quite hard to obtain something really neat.
However, that's just an aesthetic matter.

A 3D print will create a cleaner result, and it's the printer who works, not me :P.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 11, 2016, 04:01 pm
I finally managed to put together the ad for the DIYino board.

Next step is to assemble a manual and order the parts for the first run of 20-30 boards.

DIYino announcment (http://forum.arduino.cc/index.php?topic=393174.0)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Thelmos on Apr 11, 2016, 11:51 pm
...

If I look at lightsaber scenes in the SW films, I can feel the power surge in my hands holding that lightsaber. This feeling can be replicated very easily by vibration motors, essentially the same parts used in handheld devices (smart phones etc.) for buzzing.

http://www.precisionmicrodrives.com/vibrating-vibrator-vibration-motors

For some of my builds I used this type:
https://www.pollin.de/shop/dt/NDA2OTg2OTk-/Motoren/Gleichstrommotoren/Vibrationsmotor_LA4_432A.html

It is very small but has enough "buzz" in it to be felt. Because it needs a few 10's of mA, it should be able to be driven from digital pins (never tried though, I have to still test it).
I have some spare parts from old mobile phones including two vibration motors, I have tested one of them and it works at 5v with a current of 160mA, too high for a pin with this units :(

Do you think one of this motors would be enought for that "power surge" feeling?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 12, 2016, 11:11 am
I have some spare parts from old mobile phones including two vibration motors, I have tested one of them and it works at 5v with a current of 160mA, too high for a pin with this units :(

Do you think one of this motors would be enought for that "power surge" feeling?

More than enough! Mines draw maybe 20-40mA and that already feels like a surge. But due to the high current, you might have to use a PWM channel with a mosfet (or a plan I/O with an extra mosfet).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 13, 2016, 01:19 am
I currently make chasis disk from a sheets of acrylic and polycarb, by using a hole saw. I'm trying to work out a jig for hole patterns by using a block of wood with the pattern laid and drilled out on one end and the other opened up with a spade bit for the disks to sit in. I've had a set back in my saber itself which has caused me to take a step back from the project. I was using 1.5 sink tube to sleeve over an MHS pipe and a 1.25 sink tube. The sleeve turned out very disapointing, sink tube is too thin I think.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on Apr 13, 2016, 04:57 pm
El mio.....



un video...

http://www.youtube.com/watch?feature=player_embedded&v=b5AwZS1pB28
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: occidere on Apr 13, 2016, 06:36 pm

Hi good afternoon, and I followed the whole thread looking for a replacement for SI2304DS mosfet, because I can not find in Mexico.

Would it be functional this?

http://mexico.newark.com/international-rectifier/irlml2030trpbf/mosfet-30v-2-7a-sot-23/dp/52R2615?MER=ALT_N_L5_SemiconductorsDiscretes_None

Excuse my English and my lack of knowledge in electronics.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: 772pilot on Apr 14, 2016, 07:23 am
For your use case you might want to make a new fonction though. fadeAccent was designed to make an accent LED blink when the saber is idle.
In action mode the loop is slower, but it should be fast enough to trigger a nice fading pattern.
As for synchronzing it with the main blade, I didn't look at that but it might be possible: with this code it is impossible to make it flicker as fast as the main blade, but you should be able to trigger a flicker effect suffisant to trick your eye.
I tried playing around with this and the action loop is definitely slower. Trying to play around with function placement to increase speed. Can you clarify what ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) is used for?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Apr 14, 2016, 09:07 am
Hello

ISR is used to produce a timed low priority callback every 24ms .

It is used to apply light/color effects on the blade (blaster blocks, clash, lockups,flicker)


@Everyone
You can safely use Arduino eclipse V3. I also switched to this version.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 14, 2016, 08:14 pm
Hello

ISR is used to produce a timed low priority callback every 24ms .

It is used to apply light/color effects on the blade (blaster blocks, clash, lockups,flicker)


@Everyone
You can safely use Arduino eclipse V3. I also switched to this version.
I hope thats good news as I can't seem but to switch from one frustration to another. My time is limited that I can devote and evrytime I turn around something new crops up. So last night I hook the bread board up to the laptop compile and upload the sketch. I realize i never ran the calibration. So i try to setup the imu calibration tool and it wont compile.... I play around for a bit and cant get it. So i delete the project only to find the lightsaber sketch wont compile..... Today i had to install gcc seperately and that got me further but its now having an issue with make... This is pretty much out of the blue. So I hope v3 is some better as id almost rather use notepad and run command line which...eh im not excited about.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 14, 2016, 08:29 pm
Btw can anyone tell me if the raw pin on a pro mini is the same ss the 3.3 on the nano? I tried posting this earlier but i think the thread ate it. Im starting to wish i went with the nano instead i dont like the usb break out board with pro mini.  Live and learn.

Edit: hmmm unless the on the nano is from 3.3 v pin is the just the one from the ftdi chip which i think is the case. N/M ill just need to rereview the pin outs for the los on the nano next to the pro mini pin outs and reverify evrerything as they are slightly different.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: CrossRoads on Apr 14, 2016, 09:00 pm
RAW pin on promini is the input to the onboard regulator.

3.3V pin on nano is the 3.3V output from the FTDI chip.
(on CH430 clones, who knows).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 18, 2016, 04:40 am
As of right now I hate eclipse. One day it worked only one day. I've tried two different PCs. The Paths issues it has are odd and then the make issue. Once I regain sanity I will try again to wipe it all out and start again. V3 will not even run due to some bash error.... I'm sure Windows 10 is partly to blame somewhere. I seem to be the only one with these issues.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 19, 2016, 01:28 am
Hallelujah, I believe I have found success with eclipse Mars and installing the plugin... Seems much better.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Apr 19, 2016, 03:08 am
Hallelujah, I believe I have found success with eclipse Mars and installing the plugin... Seems much better.
If I get ambitious, I may tweak LightsaberOS so it builds in the Arduino IDE. Once Nesweek ports it to use the Universal Saber Library that I developed as he's suggested doing in the future, that may become much easier. That lib already builds with the Arduino IDE.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 19, 2016, 04:41 am
Yes, I thought about that but truth is eclipse is nice... There are just issues. Arduino Mars with MinGW and eclipse plugin v3 and arduino 1.65 was the trick. I think I'm going to switch to a nano though as now I have this worked out I don't k ow if I feel like converting the wiring diagram to work with the pro mini... I'm not sure. I was hoping to be much further along now.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Apr 19, 2016, 06:41 pm
Yes, I thought about that but truth is eclipse is nice... There are just issues. Arduino Mars with MinGW and eclipse plugin v3 and arduino 1.65 was the trick. I think I'm going to switch to a nano though as now I have this worked out I don't k ow if I feel like converting the wiring diagram to work with the pro mini... I'm not sure. I was hoping to be much further along now.
Oh, no doubt. I like Eclipse and I use it myself. For those just looking to build LightsaberOS and dump to an MCU though, it is not as straight forward to install and configure as the Arduino IDE. So, there's just that on the accessibility/approachability angle.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 20, 2016, 03:39 pm
Oh, no doubt. I like Eclipse and I use it myself. For those just looking to build LightsaberOS and dump to an MCU though, it is not as straight forward to install and configure as the Arduino IDE. So, there's just that on the accessibility/approachability angle.
I can secound that. As I'm not a SW pro, I was happy to be able to install the Arduino IDE as is. With Eclipse I did not have that luck so far, which means all those nice updates from neskweek I cannot try with my shiny new DIYino boards !!! (weeep) Anyway, I do not give up, but if the code could compile with Arduino IDE, it would be a real achievement.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 20, 2016, 08:03 pm
I can secound that. As I'm not a SW pro, I was happy to be able to install the Arduino IDE as is. With Eclipse I did not have that luck so far, which means all those nice updates from neskweek I cannot try with my shiny new DIYino boards !!! (weeep) Anyway, I do not give up, but if the code could compile with Arduino IDE, it would be a real achievement.
What issues are you having with eclipse? I'm no expert but I have learned something's now as it's been a nightmare. Once I figured some things out such as the bundle gives you less control than the plugin.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Apr 20, 2016, 09:21 pm
If I get ambitious, I may tweak LightsaberOS so it builds in the Arduino IDE. Once Nesweek ports it to use the Universal Saber Library that I developed as he's suggested doing in the future, that may become much easier. That lib already builds with the Arduino IDE.
That is still planned. The hardware building is just more difficult, pityless and time consuming that I first planned :P

Not sure anyway that once LSOS will be ported to  USaber Lib that it come back compatible with Arduino IDE.

But tweaks are welcome off course ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Apr 20, 2016, 11:20 pm
Not sure anyway that once LSOS will be ported to  USaber Lib that it come back compatible with Arduino IDE.

True, there is no guarantee, but potentially huge blocks of your code could be managed by USaber library classes (blade control, sound playback, motion detection) which themselves do/will build in the standard IDE. You'll have a much narrower scope of code to adjust for Arduiono IDE compatibility.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: pert on Apr 21, 2016, 02:11 am
UPDATE the changes in my repository have been merged into the main LightSaberOS and it is now compatible with the Arduino IDE.

If I get ambitious, I may tweak LightsaberOS so it builds in the Arduino IDE.
I did this a little while ago because I was trying to help @772pilot use my soft PWM library with LightSaberOS and I don't have Eclipse installed. To make it compile with Arduino IDE 1.6.6 and later you only need to change the filename of Lightsaber.ino to match the folder name and move(not copy!) the libraries to the libraries folder in your sketchbook folder. I just posted it on GitHub in case it might be of interest to anyone. The changes I made are shown at: https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f (https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f)
So to use it:

I changed the library include paths so that you don't need to do any extra steps to install the libraries but that's not necessary, it just makes installation easier and avoids any conflicts with previously installed libraries. I think if you're going to make an Arduino project available to the public it's only common sense to make it compatible with the Arduino IDE. I agree that this will make LightSaberOS more accessible. I don't own a light saber so I can't test this on the hardware but it does compile with Arduino IDE 1.6.6, 1.6.7, 1.6.8, and the hourly build. I haven't tested if this breaks Eclipse compatibility but I don't see any reason why it would. The Eclipse installation process would be different(more simple) since the libraries don't need to be installed.

I'm happy to add Arduino IDE install instructions to the readme and submit a pull request for this change to the LightSaberOS repository if neskweek wants me to.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Apr 21, 2016, 03:10 am
I did this a little while ago because I was trying to help @772pilot use my soft PWM library with LightSaberOS and I don't have Eclipse installed. To make it compile with Arduino IDE 1.6.6 and later you only need to change the filename of Lightsaber.ino to match the folder name and move(not copy!) the libraries to the libraries folder in your sketchbook folder. I just posted it on GitHub in case it might be of interest to anyone. The changes I made are shown at: https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f (https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f)
So to use it:
  • Download https://github.com/per1234/LightSaberOS/archive/arduino-IDE-support.zip (https://github.com/per1234/LightSaberOS/archive/arduino-IDE-support.zip)
  • Unzip LightSaberOS-arduino-IDE-support.zip
  • Rename the folder LightSaberOS-arduino-IDE-support to LightSaberOS
  • Open LightSaberOS.ino with the Arduino IDE

I changed the library include paths so that you don't need to do any extra steps to install the libraries but that's not necessary, it just makes installation easier and avoids any conflicts with previously installed libraries. I think if you're going to make an Arduino project available to the public it's only common sense to make it compatible with the Arduino IDE. I agree that this will make LightSaberOS more accessible. I don't own a light saber so I can't test this on the hardware but it does compile with Arduino IDE 1.6.6, 1.6.7, 1.6.8, and the hourly build. I haven't tested if this breaks Eclipse compatibility but I don't see any reason why it would. The Eclipse installation process would be different(more simple) since the libraries don't need to be installed.

I'm happy to add Arduino IDE install instructions to the readme and submit a pull request for this change to the LightSaberOS repository if neskweek wants me to.
Well, would you look at that? Ask and you shall receive! I continue to be impressed by the helpfulness and capabilities of the community members here on the Arduino forums. Thank you!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 21, 2016, 05:20 am
I did this a little while ago because I was trying to help @772pilot use my soft PWM library with LightSaberOS and I don't have Eclipse installed. To make it compile with Arduino IDE 1.6.6 and later you only need to change the filename of Lightsaber.ino to match the folder name and move(not copy!) the libraries to the libraries folder in your sketchbook folder. I just posted it on GitHub in case it might be of interest to anyone. The changes I made are shown at: https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f (https://github.com/per1234/LightSaberOS/commit/0a13827be9096ade53728921bb7489aebea63f7f)
Impressive, I will give it a go as soon as I get near my workbench!!! Thanks a lot, that is a great contribution, I never stop to be amazed by this community.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Apr 21, 2016, 11:06 am
Wonderfull job Pert !

I'll test your changes as soon as I can to make them go mainstream.

Changes to readme are welcome too ;)

Thank you very much
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: pert on Apr 23, 2016, 12:20 pm
UPDATE the changes in my repository have been merged into the main LightSaberOS and it is now compatible with the Arduino IDE.

It was bothering me that LightSaberOS still wouldn't compile in Arduino IDE versions previous to 1.6.6. Many users have not wanted to upgrade past 1.6.5-r5 due to some bugs and breakage caused by changes made in 1.6.6. So I made the changes required to make LightSaberOS compatible with the older versions, shown at https://github.com/neskweek/LightSaberOS/compare/master...per1234:all-Arduino-IDE-compatibility (https://github.com/neskweek/LightSaberOS/compare/master...per1234:all-Arduino-IDE-compatibility). Unfortunately Arduino IDE versions previous to 1.6.6 don't support using libraries in subfolders of the sketch folder so to use this version of LightSaberOS with the Arduino IDE:

I was able to compile with all Arduino IDE versions from 1.6.0-1.6.8 and the hourly build except for 1.6.4 which hung on compilation. This is a known issue with 1.6.4(not a LightSaberOS specific problem) and your results may vary. I didn't test Arduino IDE 1.5.x. LightSaberOS still doesn't compile with Arduino IDE 1.0.6, this could probably be fixed but I don't know how many people are still using the 1.0.x versions. As before, I haven't tested on hardware or with Eclipse.

I think it's unfortunate to lose the ability to use the libraries in place with Arduino IDE 1.6.6 and later as I had it set up in the version of LightSaberOS I posted previously. This could be worked around, for example:
Code: [Select]
#if ARDUINO > 10605
#include "Libraries/DFPlayer.h"
#else
#include <DFPlayer.h>
#endif

The downsides to this is that it will require different installation instructions depending on the IDE version.

I'm open to any feedback on these changes and am happy to submit a pull request.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 23, 2016, 11:40 pm
Any one wire this up with a pro mini? Looking at the nano wiring diagram it seems odd because when I look at an online nano pin out the seem off. I thought I had it converted over but I guess no as my IMU doesn't initialize nor dfplayer
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Apr 25, 2016, 04:39 am
Any one wire this up with a pro mini? Looking at the nano wiring diagram it seems odd because when I look at an online nano pin out the seem off. I thought I had it converted over but I guess no as my IMU doesn't initialize nor dfplayer
I haven't tried it myself, but it would be strange if it worked on a Nano but not a 5V pro mini since the pro mini is basically the Nano minus the FTDI chip for USB programming.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 25, 2016, 09:56 pm
I was able to compile with all Arduino IDE versions from 1.6.0-1.6.8 and the hourly build except for 1.6.4 which hung on compilation. This is a known issue with 1.6.4(not a LightSaberOS specific problem) and your results may vary. I didn't test Arduino IDE 1.5.x. LightSaberOS still doesn't compile with Arduino IDE 1.0.6, this could probably be fixed but I don't know how many people are still using the 1.0.x versions. As before, I haven't tested on hardware or with Eclipse.


I'm open to any feedback on these changes and am happy to submit a pull request.
Pert, I indepted to you! It even compiles on 1.6.4 which I have! Simply excellent, now finally I can use LSOS v1.0!!! I still want to use Eclipse too, but now I'm not in a hurry any more.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Apr 26, 2016, 02:54 am
Pert, I indepted to you! It even compiles on 1.6.4 which I have! Simply excellent, now finally I can use LSOS v1.0!!! I still want to use Eclipse too, but now I'm not in a hurry any more.
Yeah, if all you want to do is compile somebody else's sketch and upload it to an MCU, the Arduino IDE is the way to go for simplicity. Eclipse is just much nicer tool if you plan to write a lot of new code.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Apr 26, 2016, 03:43 pm
I haven't tried it myself, but it would be strange if it worked on a Nano but not a 5V pro mini since the pro mini is basically the Nano minus the FTDI chip for USB programming.
Yes, the issue is the pin layout is different, and there are some mildly confusing things on the github diagram such as using the USB 3.3 to power one of the chips. The nanos pin layout and promo minis is close but not exact annoyingly the pro mini a4 and a5 are inset so they are not bread board friendly for example but they are needed for the 6050.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: snyperdead on May 05, 2016, 09:18 pm
Hello every one,

i have a problem, even i posted this in the official github, but i see more movement here, and i say: more heads think better than one, no????

and here is the thing, quota from the github.

Quote
"Hello, and congratulation for this work with LSOS !!!

I have a problem, with the sound font aparently.

I'll connected every wire, with the squematic, acording to Andras Kun (aka protonert).

Aparently everything works fine, but when i start the blade, the leds flashing but the sound, stay in static and no hear any more.

i thing the problem are in with the wav sound, because, the mp3 for the config mode are played without a problem.

p.d: sorry for my bad english i hope you understand my redaction without a problem."
by the way:

For the led mosfet... that specific mosfet, i don't find in Mexico, but I suppose the IRFZ44n
would be a fine replacement, what you think about that????

Best Regards.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 06, 2016, 10:08 pm
@Snyperdead Hello  and welcome.

I didn't reply lately on github because I'm quite busy with the build of my first hilt from scratch: during this time I have no test ready unit, so I can't code/debug correctly.

For the sound the way you did copy it on your card might be to blame. Sound files must be copied in the same exact order they are when you you look at the folder. If they are not it can end up with hasardous behaviour. Look at the readme to see how to do that.


@Everyone
I thought it would end yesterday: I did have all the pieces. I did finally solder the buttons after a final test, and did give the final screwdiver turn. I then remove the kill key and .... nothing :'(.

I did several tests, resolder some connections but nothing did: in the process other connections broke inside the chassis T_T.


I save you all the long process of trial and error and give you my final conclusion :
Disc chassis are CRAP ! :

- whatever the number of soldering you need to do, once the PCBs installed you can't correct/change/fix those
- It's not rigid enough.The problem is the torsion around the axe of the chassis when you try to slide it in your blade's body.
- discs are fragile. Even by taking the best care, I broke two of them. and here comes the headache : if you want to make them tough you need to reduce the PCB holes, but you will struggle to make the cables go through (breaking some connections in the process...).

Well, to make it short, the body is ready to go but I need to make a new rigid chassis, remove all the PCB soldered, and the battery holder that I did paste T_T ... resolder,repaste... well you get it.

you can see photos on my photobucket (http://s1073.photobucket.com/user/cest_bastien1/library/Lightsaber?sort=3&page=1).
Here is what the body actually look like :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160506_214647_zpsn1xg4klj.jpg.html)
It is not finish but it would have been usable...
The pommel will be engraved too and the main alluminium cylinder will be covered by a reddish leather, engraved too.

I'll make a new rigid chassis out of a wood rod but I need to plan it first.
It add a good 2 to 3 weeks more work.
The good news (at least for Andras ;) ) is that with that kind of chassis I will be able to build a second one at the same time to mount and extensivily test the DIYino in real situation without a body.

I also have some personal matters to attend too and that require my entire attention.
This won't allow me to work on sabersmithing for at least a month , again.

To everyone who didn't got an answer on github, believe me I'm really sorry, and believe me I'm also really frustrated not to be able to work on the code.
It's way more easy and fun, for me, than hardware building.

By the way if some of you can confirm that Pert patch is working, allowing you to compile LSOS under Arduino IDE, I'll commit it to mainstream (but without being able to test it :( )
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 06, 2016, 11:08 pm
Hi neskweek,

Hey, I just dropped you a PM. Then I saw your post; once again: great looking hilt, congratulation, all the mode because you made it all out of scratch!

I can totally symphatise with the frustration, I assume all aspiring sabersmiths go through it a few times. All of us is good at certain aspects of this hobby and nobody is really a jask-of-all-trades. I enjoy making electronics work, you are a SW pro, there are others out there with no idea about voltages, currents or bytes but can do miracles with Aluminium tubes. But hey, that is our chance to learn from each other! Your trials and errors will save a lot of time for other on this forum!

I reacall I already mentioned that pert's code compiles all right on the Arduino IDE. I cannot tell if the code he took has all features of the one on GitHub though...but it compiles and works with DIYino all right.

BTW, if some of you guys out there already have completed models/full sabers, please do share them. There seems to be a growing community of Arduino lightsaber builders...which is really great!!! ... still up till now AFAIK there are still only two completed Arduino sabers: one from Jake and one from me. I'd love to admire the new ones!!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on May 07, 2016, 01:56 am
Hi neskweek,

Hey, I just dropped you a PM. Then I saw your post; once again: great looking hilt, congratulation, all the mode because you made it all out of scratch!
I totally agree with this. It's looking really good so far. Keep at it!

BTW, if some of you guys out there already have completed models/full sabers, please do share them. There seems to be a growing community of Arduino lightsaber builders...which is really great!!! ... still up till now AFAIK there are still only two completed Arduino sabers: one from Jake and one from me. I'd love to admire the new ones!!!
Yes! This! Spark 'um up and show 'um off, guys and gals!

Other folks who I think should get credit for completed sabers to date include BillPealer and DJWing79 from my thread. They were successful in implementing spin-offs of my design and posted video proof.
 
Oh, and let's not forget racemaniac with his Neopixel saber. I don't remember if it had sound, but he did have a saber in his video.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on May 07, 2016, 04:27 am
I will post a work in progress shot of my saber soon. It's roughly inspired by obi wan TPM. I've mainly been working on that as I've too little time to futs with the arduino. To much of it is time consuming and I only half 30 minutes here or there very frustrating when every time you sit down its one issue or other. However persistence is the key.

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: pert on May 07, 2016, 08:18 am
That's a sweet looking hilt neskweek! I'm glad you will have some nice hardware to run the LSOS on. You all are making me want to make one.
By the way if some of you can confirm that Pert patch is working, allowing you to compile LSOS under Arduino IDE, I'll commit it to mainstream (but without being able to test it :( )
I'm glad to see there is interest in making LightSaberOS compatible with Arduino IDE again. I see 5 options, listed from most to least invasive of the current code, with a summary of the required changes:


So does anyone have any opinions on which option is best?

I finally read the whole thread and saw that neskweek had requested that discussions of LSOS be done on the GitHub repository instead of this thread(sorry about that) so if you want I could open a WIP pull request and we could continue the discussion there but I'm not sure if all interested parties have GitHub accounts.

Once I have finalized the code changes, compatibility with Eclipse will also need to be checked.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on May 07, 2016, 02:54 pm
@Snyperdead Hello  and welcome.

I didn't reply lately on github because I'm quite busy with the build of my first hilt from scratch: during this time I have no test ready unit, so I can't code/debug correctly.

For the sound the way you did copy it on your card might be to blame. Sound files must be copied in the same exact order they are when you you look at the folder. If they are not it can end up with hasardous behaviour. Look at the readme to see how to do that.


@Everyone
I thought it would end yesterday: I did have all the pieces. I did finally solder the buttons after a final test, and did give the final screwdiver turn. I then remove the kill key and .... nothing :'(.

I did several tests, resolder some connections but nothing did: in the process other connections broke inside the chassis T_T.


I save you all the long process of trial and error and give you my final conclusion :
Disc chassis are CRAP ! :

- whatever the number of soldering you need to do, once the PCBs installed you can't correct/change/fix those
- It's not rigid enough.The problem is the torsion around the axe of the chassis when you try to slide it in your blade's body.
- discs are fragile. Even by taking the best care, I broke two of them. and here comes the headache : if you want to make them tough you need to reduce the PCB holes, but you will struggle to make the cables go through (breaking some connections in the process...).

Well, to make it short, the body is ready to go but I need to make a new rigid chassis, remove all the PCB soldered, and the battery holder that I did paste T_T ... resolder,repaste... well you get it.

you can see photos on my photobucket (http://s1073.photobucket.com/user/cest_bastien1/library/Lightsaber?sort=3&page=1).
Here is what the body actually look like :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160506_214647_zpsn1xg4klj.jpg.html)
It is not finish but it would have been usable...
The pommel will be engraved too and the main alluminium cylinder will be covered by a reddish leather, engraved too.

I'll make a new rigid chassis out of a wood rod but I need to plan it first.
It add a good 2 to 3 weeks more work.
The good news (at least for Andras ;) ) is that with that kind of chassis I will be able to build a second one at the same time to mount and extensivily test the DIYino in real situation without a body.

I also have some personal matters to attend too and that require my entire attention.
This won't allow me to work on sabersmithing for at least a month , again.

To everyone who didn't got an answer on github, believe me I'm really sorry, and believe me I'm also really frustrated not to be able to work on the code.
It's way more easy and fun, for me, than hardware building.

By the way if some of you can confirm that Pert patch is working, allowing you to compile LSOS under Arduino IDE, I'll commit it to mainstream (but without being able to test it :( )
Your saber is a very interesting design. By the looks though did you use stranded or solid wire? The pictures the wire looks rigid... If so that maybe your problems.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on May 11, 2016, 10:47 am
Hey Geeks!
First of all I want to thank all the brilliant people who contributed to this awesome project! You definitely rock, guys!

A funny coincidence led me here, and I still can't get the way it happened: I planned to build a lightsaber since last year, but I wasn't really convinced to spend a lot of money for it, like most people here I guess. The project slowly slipped out of focus, and went down in the depths of a forgotten drawer, until a few weeks ago. I fortunately got introduced to some professional Prop Makers, and was invited to a group of geeks who prepare a Star Wars Con in germany next year. PERFECT to pick up the forgotten project again!

It was clear to me that I wanted to use an Arduino as base, and I did research for two weeks to find the best setup and components, but it was a very frustrating job, so I just ordered a few parts such as an Arduino Nano, a soundchip/mp3-player and an accelerometer.
I had no clue about Arduino stuff before, but it turned out to be qite easy, at least than I've expected. The first setup was drafted, and I started coding...After a week of fiddling around how to do this and that. I ACCIDENTLY stumbled into this threat and found out:
I ALREADY BOUGHT EXACTLY ALL THE RIGHT COMPONENTS!! Moreover, my approaches to go with the code were mostly the same as LightSaberOS!

Please bear with me about the long post, but it is a glimpse of expression of the excitement I am in right now. So again, big thanks to all contributors who worked on this project, you all make dreams come true!


Of course I want to chime in and share some of my ideas in the hope to help this project becoming the most awesome one ever seen.

Here are a few thoughts I had during development BEFORE I knew this thread existed:
Swing Hum
I claim this is the hardest part regarding the most convincing sound a lightsaber prop can offer. First I thought to create the basic hum as well as the accent hum (swing hum) procedurally on the arduino board itself, with a library called MOZZI (http://sensorium.github.io/Mozzi/). Clash sounds and all other sounds are loaded/handled by the mp3 player itself.
Pros:

Cons:


Next approach was to digitize a hum sound on the fly, coming from the player and sent to the arduino. The arduino board is capable to do some basic sampling, and the sound can be pitched or distorted by the accelerometer again.
Pros:

Cons:


A slight variation of this approach was to have wavetables involved, but that would eat up space on the arduino board like nothing, and the hum file(s) need to be converted...

Current most promising idea:
If you listen to the lightsaber swing sound carefully (for hours, like I did), you maybe find out that the hum changes more in frequency depth than in pitch. The doppler effect is less prominent in the pitch than in the fullness of the sound. That makes sence, since a lightsaber doesn't travel hundreds of meters with one swing like a motorcycle or car does. the electromagnetic field of the blade is responsible for the hum, and if you ever had the chance to listen to a high voltage transformer, you might agree that the buzzing sound changes between clear and dull depending on the angle. Maybe because of this Ben Burtt used a shotgun microphone in front of a speaker.

To restrict/manipulate the fullness of any sound you can use a so called Low Frequency Pass Filter. I did a few audible tests in Audacity, changing the cutoff frequency, and it sounds PRETTY MUCH like the characteristic buzzing swing sound!
So, how to incorporate a LF Pass filter in the setup? Well, FORTUNATELY this filter can be build analog, which would keep the arduino free from additional computation: a resistor and a capacitor build the foundation. The capacitor needs to be adjustable (maybe the resistor as well), and can then be controlled by the accelerometer. See this to get an idea -> http://www.instructables.com/id/Arduino-Audio-Output/step4/Low-Pass-Filter/ (http://www.instructables.com/id/Arduino-Audio-Output/step4/Low-Pass-Filter/)
Then, all you need are some WAV files of the buzz in slightly diffrent pitches (optional), a trigger for the arduino to kick in the LFP filter between soundboard and speaker and you have a wonderfull lightsaber swing sound which you can replace anytime!

I have no idea about electronics, and if that idea is even possible. I would love to hear your thoughts on this!

Cheers, Mo
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on May 11, 2016, 03:44 pm




This is a rough work in progress, I still need to finish the emitter sleeve and tweak the base sleeve. Most work was done with a dremel, the black grip was cutouts were done with a compound miter saw. Polishing etc.. Is still needed this is just the basics. It's mostly plumbing with a couple MHS parts.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 11, 2016, 04:15 pm
*long post*
I'm going to have to see what i can use from this :)
If you read my RGB lightsaber thread, you see i'm working on something in that direction :). I'm using a slightly more powerful microcontroller than an arduino (it's a maple mini, in size comparable to an arduino micro, in power comparable to a due), and doing sound processing on it. It's still in early stages (i started with just changing the pitch, but that indeed doesn't really do it :) ).
Implementing such filters are not easy i'm afraid (maybe in hardware something is possible, but i'd also have to look into it). But atm i'm working on having multiple sounds streaming at the same time, and be able to mix them together. So if i have a sound with a lot of frequency depth, and one with little depth, maybe mixing between them both will give a similar result with far less work :) (so i can then nicely transition between having all frequencies, and only having the lower frequencies).
At least thanks for giving another good idea of how to construct sound samples for my saber :). I'm trying to get the sound to react very dynamically to the sensor, and not just have fixed swing sounds :).
Not sure if i'll be able to achieve that, but i've now got everything set up on a microcontroller to give it a try :). I can steam multiple sounds at the same time, read & process the motion sensor, and still have plenty of power left to do some mixing of those sounds :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on May 12, 2016, 10:19 am
Not sure if i'll be able to achieve that, but i've now got everything set up on a microcontroller to give it a try :). I can steam multiple sounds at the same time, read & process the motion sensor, and still have plenty of power left to do some mixing of those sounds :).
That sounds really good! Interesting! Maybe in the future I'm gonna try something similar.
For the frequencies of the hum and buzz sounds: Since I put in the efforts (and stubbon idea) to create my sounds from scratch without soundsamples, I spent two weeks just to get hum and buzz really as I wanted them to be for my lightsaber. Somewhere I read an article talking about the exact HZ frequencies used, but I couldn't manage to find it again, so I really started from scratch. Here's what I ended up with, creating the whole sounds in Audacity (free audio editing program):

Basic Hum (constant tone all the way):

Mix the first three sounds and convert the new track to stereo, split the left and right channels and move one of both slightly off. That gives this nice tin can like sound.

Swing Buzz:

Mixed down the layers and put some reverb and phaser effects on it. Finished.

That is all I can provide about the anatomy of my lightsaber sounds. If this is of any help to you, I'd be happy. Of course it is a complete different challenge to create all these frequencies and effects with hardware, but maybe this could provide at least an idea how to start. :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 12, 2016, 10:39 am
That sounds really good! Interesting! Maybe in the future I'm gonna try something similar.
For the frequencies of the hum and buzz sounds: Since I put in the efforts (and stubbon idea) to create my sounds from scratch without soundsamples, I spent two weeks just to get hum and buzz really as I wanted them to be for my lightsaber. Somewhere I read an article talking about the exact HZ frequencies used, but I couldn't manage to find it again, so I really started from scratch. Here's what I ended up with, creating the whole sounds in Audacity (free audio editing program):

Basic Hum (constant tone all the way):
  • First layer: Buzz Tone, sine wave of 90HZ with 3-4 harmonics. Gives a nice saturated buzz
  • Second Layer: Tone, square wave of 20-40Hz (cant remember anymore). Apply a ring modulator with 120Hz and sine- or sawtooth wave to it and you're almost there.
  • Third layer: Tone, sawtooth wave of 76HZ (Again, cant remember anymore, I think I used a ring modulator afterwards here as well), gives a nice optional gritty pattern.
  • Fourth layer: Pink noise for the electrical sizzle sound. Ramped up to -15dB, and cut back to give a dense yet sparkly crackle. Maybe some Low-or High Pass Filters and another ring modulator, and you have a nice electric sizzle.

Mix the first three sounds and convert the new track to stereo, split the left and right channels and move one of both slightly off. That gives this nice tin can like sound.

Swing Buzz:
  • First Layer: AFAIK I used the first two layers of the basic hum merged, with a higher pitch.
  • Second Layer (optional): some tiger roars, bear roars and motorbike engine sounds. My sound was intended to be sounding similar to Kylo Rens's saber, but bit cleaner.

Mixed down the layers and put some reverb and phaser effects on it. Finished.

That is all I can provide about the anatomy of my lightsaber sounds. If this is of any help to you, I'd be happy. Of course it is a complete different challenge to create all these frequencies and effects with hardware, but maybe this could provide at least an idea how to start. :)
I'm currently working with soundsamples i took from youtube videos with soundsamples, and to get a more texture like sample, i used paulstretch from audacity to make parts of the hum/swing samples into repeatable samples i can use for the mixing :).
But your sound anatomy is amazing XD. I'm now wondering how feasible it would be to just program a generator for those sounds, rather than to store them as actual samples :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on May 12, 2016, 10:46 am
But your sound anatomy is amazing XD. I'm now wondering how feasible it would be to just program a generator for those sounds, rather than to store them as actual samples :).
Thanks!. But it was a pain in the arse to figure it out.
The basis would always be a sine-, sawtooth- or square wave, it shouldn't be that hard to find codes for programming these.

Attached are samples for hum and buzz, the buzz swing is a rather slow accelerated swing though. Just to give an audible example of my previous post. Rename them to mp3.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 12, 2016, 01:40 pm
Thanks!. But it was a pain in the arse to figure it out.
The basis would always be a sine-, sawtooth- or square wave, it shouldn't be that hard to find codes for programming these.

Attached are samples for hum and buzz, the buzz swing is a rather slow accelerated swing though. Just to give an audible example of my previous post. Rename them to mp3.
If you ever want to implement something similar to what i'm making now, start looking into more powerful microcontrollers than an arduino uno or equivalent. I wish arduino themselves would make something arduino due equivalent but at the size of a micro/nano.
for now i'm sticking to the maple mini's (and stm32duino.com, where they have a compatible arduino framework for them), they're awesome devices, and the chinese clones are so cheap if you see what they're capable of :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on May 12, 2016, 01:50 pm
If you ever want to implement something similar to what i'm making now, start looking into more powerful microcontrollers than an arduino uno or equivalent. I wish arduino themselves would make something arduino due equivalent but at the size of a micro/nano.
for now i'm sticking to the maple mini's (and stm32duino.com, where they have a compatible arduino framework for them), they're awesome devices, and the chinese clones are so cheap if you see what they're capable of :)
But they are not officially maintained anymore, right? I'll have a lokk into these anyway. At first I need to finish my current Project. It's just the first time I got into that arduino/microcontrollers stuff.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 12, 2016, 04:04 pm
But they are not officially maintained anymore, right? I'll have a lokk into these anyway. At first I need to finish my current Project. It's just the first time I got into that arduino/microcontrollers stuff.
maple has stopped maintaining them, but the stm32duino.com community picked it up from there and is very much alive :). and chinese retailers will probably keep selling their maple mini clones for quite a while :).
It's not a platform with no future, there's still plenty of development :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on May 12, 2016, 04:12 pm
Well, if someone could port MOZZI for arduino to maple, it would be a great start to work on that lightsaber multilayer sound stuff, cause half the work and heavy lifting would've been done.
32bit processing sounds like MOZZI would work even better on maple than on arduino!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 12, 2016, 04:41 pm
Well, if someone could port MOZZI for arduino to maple, it would be a great start to work on that lightsaber multilayer sound stuff, cause half the work and heavy lifting would've been done.
32bit processing sounds like MOZZI would work even better on maple than on arduino!
I'm not sure about everything that mozzi offers. But i've got simple Maple mini code that lets you send 12 bit sound samples to a very cheap I2C dac (MCP4725) at sampling rates up to 60Khz :). (and that code is available on the forum).
Isn't that about all you need? It means you've got true analog output, at up to 60Khz sampling rate, and it's very lightweight (it uses a timer to trigger sending the next sample, and the hardware i2c port to make the actual sending very lightweight). And instead of needing the rc filter on the pwm output, you now need a dac that costs about 1.5$ :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on May 12, 2016, 05:03 pm
But i've got simple Maple mini code that lets you send 12 bit sound samples to a very cheap I2C dac (MCP4725) at sampling rates up to 60Khz :). (and that code is available on the forum).
12bit would be sufficient to sound samp...Wait...60KHz?? You're effin' kidding me!!
Can you post the link to that forum?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 12, 2016, 05:08 pm
12bit would be sufficient to sound samp...Wait...60KHz?? You're effin' kidding me!!
Can you post the link to that forum?
http://www.stm32duino.com/viewtopic.php?f=19&t=1048 (http://www.stm32duino.com/viewtopic.php?f=19&t=1048)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DWMiller on May 14, 2016, 10:28 am
    Interesting design gentlemen. I've been trolling around the net for a couple weeks looking to build three sabers for a niece and two nephews for christmas this year. I wanted better than the hasbro toys without a $300+ pricetag. It was worth joining the board when I saw how far you had come on this project. All the shops will talk about is how they machine their hilts, they want you to buy their electronics as a "black box" unit. This is something I can tweak to get what I'm after at a price that doesn't break the bank.

    I had a preliminary design on paper already using three color LED string blades with 5 segments. 3 250Watt PWM supplys and 5x3 NPN switching transistors in an array. One blade partially built and tested as individual segments running off a breadboard. I was at the stage of trying to miniturize enough to get eveything into a hilt. After seeing Neopixel addresable led strings in a blade that concepts out the window. Its soooo much easier and cleaner than what I was trying. I already had DFPlayer mini's on order along with pro mini boards as controllers. So i'm onboard with your style build as of now. Got SaberOS to compile in my test Uno R3 tonight using the Arduino IDE 1.6.7, with minor tweaking to the library codes. My DFPlayer started making sound when it started up. :D  I'll start breadboarding as the rest of the parts come in from China. I'm waiting on the gyros and RGB led 144/M Neopixel tape.

    The interesting thing I noticed is that you are trying to use one controller to do sound as well as blade effects. It also seems that our running into the limits of the hardware with the code package. Has anyone thought about porting the blade control onto an ATTiny85 and linking it to the nano with interupts? Let it handle the led's and leave the heavy sound proccesing to the nano? I could be wrong but my original design was two nano's, one as blade control, the other as sound. Distribute the procceser load....

    Has anyone given any thought to Electro-luminencent wire blades for this hardware? I'm thinking along those lines as the kids are going to be hard on these things and EL wire's hold up for the kendo guys doing demo's. I know they are not super bright, but they are tough.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 14, 2016, 02:51 pm
The interesting thing I noticed is that you are trying to use one controller to do sound as well as blade effects. It also seems that our running into the limits of the hardware with the code package. Has anyone thought about porting the blade control onto an ATTiny85 and linking it to the nano with interupts? Let it handle the led's and leave the heavy sound proccesing to the nano? I could be wrong but my original design was two nano's, one as blade control, the other as sound. Distribute the procceser load....
If you're using a DFUPlayer, there isn't that much sound processing going on i think? Or do you mean the motion processing? Splitting it up into multiple controllers is always an option, it'll just take a bit more space :).
For my project (with true sound processing on the microcontroller), i went for a maple mini clone instead of an arduino. It's the size of an arduino nano, but far more powerful. And driving the neopixel chain hardly taxes it at all. (it's not even 1% of it's cpu cycles required to update a 288 ledchain at 30fps).
Has anyone given any thought to Electro-luminencent wire blades for this hardware? I'm thinking along those lines as the kids are going to be hard on these things and EL wire's hold up for the kendo guys doing demo's. I know they are not super bright, but they are tough.
Haven't seen them yet, but indeed also sounds as an option :). I don't know much about drivers for EL wire, do they come compact & easily fed from a battery? how much do they consume?. On my first blade i wrapped my neopixel string in bubblewrap. I wouldn't leave it lit for too long at once (might get hot in there XD), but it should also be able to withstand a fight :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on May 15, 2016, 11:26 pm
Has anyone thought about porting the blade control onto an ATTiny85 and linking it to the nano with interupts? Let it handle the led's and leave the heavy sound proccesing to the nano?
AFAIk jakesoft did something in that direction, but rather a simplified version of the Lightsaber OS (https://www.youtube.com/watch?v=h6MxzAfy5jM). He's the man you should connect with.

Currently I try to break down the LSOS code to only the neccessary stuff I'll need, since I also ran into the space problem and I definitely ran out of PWM pins, since I planned a motorized crystal chamber with three individual leds...

If all works out, I consider adding an ATTiny85, if not, I'll switch to the maple mini as controller. Regarding the whole Arduino stuff I am pretty much a noob, but it is obvious that it was developed to fulfill simple needs. Lightsaber stuff is not simple. :-D
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DWMiller on May 16, 2016, 01:14 am
If you're using a DFUPlayer, there isn't that much sound processing going on i think? Or do you mean the motion processing? Splitting it up into multiple controllers is always an option, it'll just take a bit more space :).
For my project (with true sound processing on the microcontroller), i went for a maple mini clone instead of an arduino. It's the size of an arduino nano, but far more powerful. And driving the neopixel chain hardly taxes it at all. (it's not even 1% of it's cpu cycles required to update a 288 ledchain at 30fps).Haven't seen them yet, but indeed also sounds as an option :). I don't know much about drivers for EL wire, do they come compact & easily fed from a battery? how much do they consume?. On my first blade i wrapped my neopixel string in bubblewrap. I wouldn't leave it lit for too long at once (might get hot in there XD), but it should also be able to withstand a fight :).
Yes, I mean the motion processing. As its so integrally tied into the sound scheme of a saber. I'm not going for anything quite that involved. As I said these are for children and will take a LOT of abuse. Simple and robust. Thats one of the reasons I dumped the original clash sensors and started down the 6050 road. By the way if anyone needs some of the things (clash sensors) I ordered from my chinese supplier by the hundred, all three weights. The same ones Adafruit sells. :(

   I'm relearning and updating a lot of my electronics knowledge as I go through this project. I haven't done much circuit design work for the last 10 years, moved over to the managment side of the house a while ago. So the Arduino is a get my feet wet kind of project for micro controllers. I code half a$$ed in C++, Visual basic and Pascal. But I'm no programmer. So I'm learning as I go.

   I'll post some data on the EL strings as soon as mine arrive from china. Neon bright green, 5 meters long, with controller/battery holder cost me under $6 with shipping on ebay. Only useful thing I could find was the string diameter is 2.7mm. That means you can pack a bunch of strands into a standard blade. No specs sheet avalible but they run off 2-AA's and will supposedly run for 12+ hours on a couple. According to my reverse engineering that can't be more than ~75mA draw at 3V. The drives will have to wait till I can tear one apart and get a better look. Original thought for these was a couple simple toy blades/combat blades with no sound. No solder joints in the blade, so it ought to be pretty hard to break. Simple styled built up PVC hilts, and heavy wall polycarbonate blades. :D

UPDATE: I just talked with someone with EL wire experience. The wires are driven with 3V powering an inverter to push 100+V ac at 2-4Khz. It seems that the higher frequency you drive it at the brighter it glows. Its outdated tech but it works, the problem seems to be an anoying hum from the controller box. Here's a link, the info is at the bottom of the page...

Wayne Schmidt's Lightsaber Blade Research Page (http://www.waynesthisandthat.com/lightsaber.html)

AFAIk jakesoft did something in that direction, but rather a simplified version of the Lightsaber OS (https://www.youtube.com/watch?v=h6MxzAfy5jM). He's the man you should connect with.

Currently I try to break down the LSOS code to only the neccessary stuff I'll need, since I also ran into the space problem and I definitely ran out of PWM pins, since I planned a motorized crystal chamber with three individual leds...

If all works out, I consider adding an ATTiny85, if not, I'll switch to the maple mini as controller. Regarding the whole Arduino stuff I am pretty much a noob, but it is obvious that it was developed to fulfill simple needs. Lightsaber stuff is not simple. :-D
On my original design lack of pins was my first design problem. I ran out of PWM's long before I ran out of led segments to control. Three of my 5 segments only did on and off, no brightness functions. That was the original reason for two Mini's. One was barely enough to handle the LED string. I needed a second to have any sound functions at all.

   I'm loath to switch controllers at this point as I'm just starting to get a handle on the arduino. The maple mini sounds like a much more powerful controller, but its probably best if I stick with what I'm trying to learn right now.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 16, 2016, 04:54 pm
I'm loath to switch controllers at this point as I'm just starting to get a handle on the arduino. The maple mini sounds like a much more powerful controller, but its probably best if I stick with what I'm trying to learn right now.

I understand :). I find it a bit sad that i started out with arduino, and now ended up with the maple mini. I would love it if arduino would make anything similar. With there zero and due boards, they're starting to use the same kind of microcontrollers that are far more powerful. Now we only need one that's small enough to fit into a lightsaber :).
I had to put LOTS of work into getting the maple mini do my bidding (as it's far less supported than an arduino), but learned a lot about microcontrollers, and i'm now more of an STM32 adept than arduino/AVR...
I'll release (at least some of) my code, but it'll be limited in how many people can use it since it's targetted to the maple minis.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 16, 2016, 10:45 pm
*long post*
Cheers, Mo
Hi MonoMoto, good to have one more guy with full of new ideas! The idea of generating the sounds using the Atmega already crossed my mind, but only superficially, as it was much more easier to go the real Arduino way of using shields and distributed computing instead of doing all tasks with a single powerful processor. Probably the Arduino philosophy choose this path due to the fact that most Arduino projects need a controller and not a processor.

Your approach is the one implemented by some of the high-end saber electronics like PlecterLab products, using a single PIC processor and aglx345 and nothing else, all sound file streaming and processing is done in the processor.

At the beginning my big dream was also to adjust the hum as a response to swing movements, but as time went by the quest for gapless playback became all consuming. Now your post relaunched that old passion. To be very frank, I never felt very happy the way currently all saber boards deal with swings, i.e. launching swing sound fonts. I also feel that they do not fully recapture how a lightsaber cuts the air and triggering them at the rigth time is really a pain. Not to mention that they are in a way also not essential, people want   clashes, lock-ups, blaster effects, swings are not so spectacular. But with the ideas in the last couple of posts this could change!!! I already thought about instead of triggering swing sounds to trigger slightly modified hum sounds (changing pitch of frequency) as a reaction to blade movement. In fact in the early days I experimented with adjusting the volume of the hum as a swing reaction, the more forceful a movement gets the louder the hum sounds. But this failed with the DFPlayer as changing the volume is very slow to execute.

So I just wanted to say: keep up the work on it and post your experiments!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 17, 2016, 09:38 am
<long post>
I don't know if you've seen the latest posts in my rgb saber thread, but after tons of work, i've managed the gapless playback and all sound processed on the maple mini :).
I've still got some work todo, but i've now got all frameworks working that allow me to cache several sounds, and play them simultaneously & mix them together nicely. And i'm not sure how to use it yet (since my first attempts at using it gave poor results), but i can also dynamically adjust the sampling rate :).
Saber sound mixing (https://www.youtube.com/watch?v=6xhmoGAFOUo)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on May 17, 2016, 03:15 pm
OK. That is cool.

Of course, here I am with my first Arduino ever en route for this project, and now I'm finding out it's not going to be powerful enough for cool dynamic sound. Çést la vie. I'll still have plenty of work in front of me trying to figure out how to incorporate Neopixels into LSOS despite my entire lack of programming experience. All you geniuses have really shown me how cool this stuff can be and gotten me excited to start trying things firsthand.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 17, 2016, 03:41 pm
I don't know if you've seen the latest posts in my rgb saber thread, but after tons of work, i've managed the gapless playback and all sound processed on the maple mini :).
I've still got some work todo, but i've now got all frameworks working that allow me to cache several sounds, and play them simultaneously & mix them together nicely. And i'm not sure how to use it yet (since my first attempts at using it gave poor results), but i can also dynamically adjust the sampling rate :).
Saber sound mixing (https://www.youtube.com/watch?v=6xhmoGAFOUo)
@racemaniac: Awesome! I like the hum-adjust technique of yours! I wonder how many samples you need for basic hum, maybe it could be stored in eeprom and the Atmega and the dfplayer could both share the same audio amp for sound mixing. Am I getting too much carried away? I think I will have a lot of experimenting to do with the hardware.

@AadvarkSagus: don't be frustrated, all extraordinary lightsabers out there work the same as the DIYino design (i.e. triggering different sound files as reaction to certain events), it's just that this community has now ideas which could take lightsaber FX to the next level. If you own a Porsche, you will still admire a Ferrari, nothing wrong with that.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on May 17, 2016, 03:51 pm
@AadvarkSagus: it's just that this community has now ideas which could take lightsaber FX to the next level. If you own a Porsche, you will still admire a Ferrari, nothing wrong with that.
The next level is right. This may forever alter the direction of the saber building community. However you are also correct about the DIYino method still being very high quality. I'm not too frustrated. I'm enjoying sitting back here and observing brilliant people making ever cooler things, and hoping I can mimic them once I get my own parts.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on May 17, 2016, 06:46 pm
@racemaniac: Awesome! I like the hum-adjust technique of yours! I wonder how many samples you need for basic hum, maybe it could be stored in eeprom and the Atmega and the dfplayer could both share the same audio amp for sound mixing. Am I getting too much carried away? I think I will have a lot of experimenting to do with the hardware.

@AadvarkSagus: don't be frustrated, all extraordinary lightsabers out there work the same as the DIYino design (i.e. triggering different sound files as reaction to certain events), it's just that this community has now ideas which could take lightsaber FX to the next level. If you own a Porsche, you will still admire a Ferrari, nothing wrong with that.
at 22khz, and 2s each, the samples take 40kb each. so still to big for an arduino >_<. You could make them shorter (they're more texture sounds after all), so it may be possible, would need some experimenting.
And maybe "mixing" the hum & the dfplayer can be as simple as using a stereo amp and having 2 speakers on your saber :).
It may be possible, but won't be easy :). Another annoyance i had with the atmega is: how do i get the sound out? Using a PWM port is an option, but i think that doesn't give such great results (not entirely sure though, may work better than i thought). I use an I2C dac on my maple mini, but the I2C port on the atmega is so limited that it's pretty useless for using it for sound (at the very least you'll have very little control over the sampling rate if you use 1 transaction to send multiple samples). On my first saber i used a DAC with parallel input, and just used direct port manipulation to send out the samples as bytes :).

*edit*
I just gave it a quick try to make a really short sample via audacity. It may be viable, but you can hear it's repeating
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on May 19, 2016, 05:24 am
http://i462.photobucket.com/albums/qq342/Murderocrows/Mobile%20Uploads/20160516_194619-1.jpg
My base saber is almsot complete. I have gone back to mya arduino before chasis construction and I'm still dismayed. I need to do some more testing to make sure my dfplayer or 6050 are not messed up as I'm not having much success with this pro mini. I did by a nano but it's a knock off and I'm having trouble with Windows 10 and the driver. Geez ... Patience and time I guess, I'm trying to contact my local pcb assemblier to see about integration of the cheaper into one board like protonerd did. I have a friend who is an electrical engineer I may need to enlist him to put together the design.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on May 22, 2016, 08:01 pm
sorry for the question but .....
which is the circuit to connect the RGB LED? pins?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: snyperdead on May 23, 2016, 08:29 pm
if i not bad, the pins for RGB led are D3, D5 and D6 in the arduino nano.

And

change the code like this.

B. RGB LEDs

In Config.h comment this line :

#define LEDSTRINGS

Regards.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on May 24, 2016, 07:34 pm
I bought a RGB (+, r, b, g) 350mA
2.0-2.6 V red, green: 3.0-3.6 V. Blue: 3.0-3.6 V
Do I need one Constant Current Regulated LED Driver 1W 320 ~ 350mA?
digital outputs have only 20mA
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: snyperdead on May 24, 2016, 08:11 pm
Paquito, Did you check the wiring diagram????

I don't think you need a driver for a single RGB LED,

the mosfet with the resistor, do the work, but i'm not an expert jejejej

and the input power and current for the led, comes from the battery pack, not for the arduino, i guess.

the digital output from the arduino is for pwm signal to the LED (i think, but maybe im wrong jejejej)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: paquitosoler on May 25, 2016, 01:29 pm
But it is that the battery is 7.4 V and R G B LED Work Around 3v
Has anyone tried any LED RGB and know the circuit?
and another thing .... of common anode or common cathode ?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: snyperdead on May 25, 2016, 03:42 pm
I have an RGB Led in my project, but at this time the voltage suplies its from arduino and work perfectly.

The Blue and Green LED connect at 5v and the Red in 3.3v

even i try the RGB completely at 3.3v without a problems.


in my case, i use the same diagram of protonerd, only one change, the mosfet are an IRFZ44N.


And respect of the anode and cathode, in the protonerd diagram, the common is anode.

even this image work's for clarify the concept.




But i only offer my little experience and i'm not an expert, correct me if i wrong and is my bad. jejejeje

Regards.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 25, 2016, 10:44 pm
But it is that the battery is 7.4 V and R G B LED Work Around 3v
Has anyone tried any LED RGB and know the circuit?
and another thing .... of common anode or common cathode ?
Common anode, like snyperdead rightly sketched. 7.4V is more common in case of led-string blades, if you plan on building an rgb based saber you'd be better off with 3.7v supply, otherwise you have to limit the voltage using resistors, which is huge power waste. I see I have to fully characterise my DIYino and write a comptehensive documentation with a lot of application examples. I will start with rgb leds in combinstion with a single 18650, as I anticipate this becoming the most common setup.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 26, 2016, 04:03 pm
Hey guys !
It's been a long time and there you have been very productive :D.

I'm very interested by this MOZZI solution. That's a neat finding. I'll get my hands on it too to experiment when I'll have something to work with.

Which, by the way, should be a really near future since I've almost finished my new chassis design :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160526_152502_zpssswvgvsg.jpg.html) (http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160526_152419_zpsqq1oqbma.jpg.html)
(more photo on my photobucket).
On the first picture you can see a small dot right bellow the window: it's the future position of the AUX switch. But as I still don't know what kind of button to use, I left this space untouch.

So I have to go throught the soldering stage - again - but this time I let this to someone more experienced in soldering.

Since I have to wait, I'll start to rewrite LSOS with JakeSoft's Usaber lib.
In this process I will eliminate a lot of "options" to keep just a really basic and stable system.
Tuning will be left to the end user.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on May 26, 2016, 04:07 pm
Sweet! That chassis is looking great! Out of curiosity, will you be including Neopixels in the revised LSOS?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 26, 2016, 04:29 pm
Thank you

I still don't know if it will fit in terms of size inside the Arduino chip.
I first need to rewrite and test the whole thing and it will take some time.
I'd like to embark it but if I can, again, as for the other branches, I will keep it very simple/basic this time to let you, people, customize it to your liking.

LSOS 2 will be more a working skeleton than a complete solution.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: pert on May 26, 2016, 05:03 pm
I still don't know if it will fit in terms of size inside the Arduino chip.
You may already be aware of this, but just in case... If you burn the Uno bootloader on the Nano and then use it as an Uno after that you get an extra 1.5 KB of program space to work with. Of course you can get another 500 bytes if you just use a programmer to upload but using the USB port might be more convenient depending on how your saber is laid out. It's nice to make LSOS work with a stock Nano but considering the amount of work you all put into your sabers it's not so bad to have to buy a $3 USBasp programmer and wire it up to the Nano to burn the bootloader if it allows more space to add features. As an added benefit, this will allow you to use the watchdog without encountering the endless reset loop bug (https://github.com/arduino/Arduino/issues/4492) of the Nano's bootloader.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Mawg on May 26, 2016, 05:25 pm
Hi Guys,

First post here but have been following along for awhile now!  First let me say that the arduino community never cease to amaze me - great work everyone! 

I have just started a build using Perts arduino compatible derivative of LSOS - it works great (tried it on 1.6.4 and now on 1.6.9 with no issues).

The problem I am having is with the MPU6050 unit, it connects successfully but then everything hangs on "Initializing DMP..."

I have checked,  and rechecked wiring, let it sit for hours and nothing seems to help.   Anyone have any ideas?

Thanks
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 26, 2016, 05:34 pm
Hi Guys,

First post here but have been following along for awhile now!  First let me say that the arduino community never cease to amaze me - great work everyone! 

I have just started a build using Perts arduino compatible derivative of LSOS - it works great (tried it on 1.6.4 and now on 1.6.9 with no issues).

The problem I am having is with the MPU6050 unit, it connects successfully but then everything hangs on "Initializing DMP..."

I have checked,  and rechecked wiring, let it sit for hours and nothing seems to help.   Anyone have any ideas?

Thanks
First check again your wiring. Then use the mpu calibration sketch (part of/linked on Lsos on GitHub). If it still does not work, you have a bad unit. But I suspect the wiring, does the led on the board lights up?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 26, 2016, 05:36 pm
You may already be aware of this, but just in case... If you burn the Uno bootloader on the Nano and then use it as an Uno after that you get an extra 1.5 KB of program space to work with. Of course you can get another 500 bytes if you just use a programmer to upload but using the USB port might be more convenient depending on how your saber is laid out. It's nice to make LSOS work with a stock Nano but considering the amount of work you all put into your sabers it's not so bad to have to buy a $3 USBasp programmer and wire it up to the Nano to burn the bootloader if it allows more space to add features. As an added benefit, this will allow you to use the watchdog without encountering the endless reset loop bug (https://github.com/arduino/Arduino/issues/4492) of the Nano's bootloader.
Yes I know this :) I already have a USB programmer because I did crash a Nano clone earlier. I had to order one to reburn a bootloader on it.

The problem I have (maybe others won't) is that when you want to install the nano board inside the tubes of your saber, you need room. So I removed all the pins including the programmers ones. I think, but I could mistake, that many people will do the same, so , for me, it's not a good solution for just a 500 bytes bonus.

The other thing is that all of you already took LSOS to customize it to your liking. I'm really not complaining it's a really good stuff. But the more I think of it the more it become obvious that thos eoptions can be derived to Usaber and can then be implemented by users f they want to include them to their builds.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Mawg on May 26, 2016, 06:02 pm
Thanks for the fast response Protonerd!

The LED is on,  wiring verified,  and calibration sketch run.  The calibration sketch gives out no offsets, only 0's for all readings.  Sadly you may be correct worth the bad unit,  hopefully not though...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 26, 2016, 06:20 pm
@Mawg Did you solder your wires ?
Maybe you have a broken wire

How did you test them ? With a multi meter ?
if the led is on try to retest INT  SCL and SDA connections.

Look also if you don't have some residu that could shortcut something on the board

It's best to double check :p before declaring the unit broken (even if it can happen)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Mawg on May 26, 2016, 06:49 pm
Hi Neskweek,

No soldering yet,  just have it down on a bread board with Adafruit male to male jumpers.

On your suggestion,  I did meter the connections and everything is looking good  but on closer inspection of the MPU the soldering on the QFN chip looks very suspect,  almost like it was touched up by hand...

Good news is that for $5 amazon well send me a new one ;).  Hopefully that will fix things!

Thanks again!

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 26, 2016, 07:42 pm
When I first start on breadboard I had a lot of problems with my MPU.

Soldering did solve my problems: even if I did make sure my handle did make contact with the board it seems they didn't make it correctly.


Maybe it could be the same for you
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 26, 2016, 11:52 pm
The problem I have (maybe others won't) is that when you want to install the nano board inside the tubes of your saber, you need room. So I removed all the pins including the programmers ones. I think, but I could mistake, that many people will do the same, so , for me, it's not a good solution for just a 500 bytes bonus.
No undue advertisement intended, but this room challange was the reason I created an integrated solution called DIYino. And in fact reflashing the bootloader does not neex an isp-header, I bootload my DIYino boards without. I definitely will try the uno bootloader, after all its a 5% bonus to code space. Squeezing in all the circuits to a saber tube is cram-fu enough, at least I want to be more leisure with the virtual space.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on May 27, 2016, 03:18 am
Neskweek is that chasis made of wood?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 27, 2016, 12:40 pm
Yes, it is made out of wood.
The essence I used is boxwood which is very sturdy while lightweight and quite easy to work with.

No undue advertisement intended, but this room challange was the reason I created an integrated solution called DIYino. And in fact reflashing the bootloader does not neex an isp-header, I bootload my DIYino boards without. I definitely will try the uno bootloader, after all its a 5% bonus to code space. Squeezing in all the circuits to a saber tube is cram-fu enough, at least I want to be more leisure with the virtual space.
Once again I read to fast. Please excuse me Pert.
Something is still bothering me : why Arduino have made a specific bootloader for Nano then ?
There is maybe a reason for that.
I still don't want to rely on this extra space this could give, because every user won't be able to do it. This time I would really like to not fail at providing a generic piece of code (thank you again by the way for your Arduino IDE solution. If you're OK I'll put a link in my github so people can directly go to yours right now ;) I did test it and pulled into my github)

It is still a good thing to know if someone will be in the need of an extra ko to add a functionality (I know I will, at least for testing).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on May 27, 2016, 10:42 pm
Since I have to wait, I'll start to rewrite LSOS with JakeSoft's Usaber lib.
In this process I will eliminate a lot of "options" to keep just a really basic and stable system.
Tuning will be left to the end user.
Ooo... really looking forward to this. DFPLayer support is already in there as of the last drop. Several kinds of blades too (but not neopixel strings). All you should have to do is create a motion manager class for the MPU module and you'll be on easy street. From what I've seen, you are more than capable. I'll include your class in an official release of USaber (with permission and credit given of course).

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 28, 2016, 10:37 am
Thank you Jake.

I already said it before : You've made a really neat job with this.

Actually I think I already almost finish the MPU integration part. I still need to make the example/test sketch but this should take no time.

I did take a look at the DFPlayer implementation. Since it's not totally the same logic that the one I made it might require some adaptation in LSOS too.

But I will need to make some changes too. The first I saw is that you did embark SoftwareSerial lib.
I will need to mod this one because I will use some timer interrupts, and this damn librarie reserve/lock all the timer interrupts available.
I use interrupts to generate flickering effects and color changing effects that are sound aligned. I don't think it's DFPlayer dependent : as long as you can plug SPK+ and SPK- of your module to two pins on the arduino (I will use A6 and A7) those effects can be generalized.

Then maybe an Interrupt class might be a good addition

Adding a general config.h to regroup all constant macros would be a good idea too.

I don't know if you want to talk about this in private or here so I let you the choice ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on May 28, 2016, 03:02 pm
Thank you Jake.

I already said it before : You've made a really neat job with this.

Actually I think I already almost finish the MPU integration part. I still need to make the example/test sketch but this should take no time.

I did take a look at the DFPlayer implementation. Since it's not totally the same logic that the one I made it might require some adaptation in LSOS too.

But I will need to make some changes too. The first I saw is that you did embark SoftwareSerial lib.
I will need to mod this one because I will use some timer interrupts, and this damn librarie reserve/lock all the timer interrupts available.
Thanks! And yeah, I don't like that I had to do it that way with the SoftwareSerial library. If we can cut that out and do it a different way then I'm all for it. Hopefully lighter weight too, as including the SoftwareSerail library eats up a ton of RAM with buffers and stuff.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on May 28, 2016, 04:39 pm
Ha ha !

I was just speaking of a little modification of SoftwareSerial :P

When I first started with the DFPlayer I did search for a lightweight alternative but I didn't find any.

But now , I have a better idea on how this thing works, I can give it another shot to find something smaller.

Another solution might be to use arduino's RX/TX pins to connect DFPlayer and use the native serial line but, if I remember correctly from my early tests, it disable USB communications :/ (so no uploads :(). And anyway DIYino is not wired that way

[EDIT]
Yep, still don't found a lightweight alternative...

Do you use SoftwareSerial  for DFPlayer operations only?
If so, and if debug is not implied , we just need the UART send protocol part.

Another alternative might be to rely on Cosa API (https://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/index.html) instead of Arduino API, but it would imply a lot of rewriting.
And I don't know if it would be beneficial in terms of hex size.
Not even sure it's a good idea
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on May 29, 2016, 10:02 pm
Is there a current wiring diagram for usaber for use with the dfplayer?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on May 30, 2016, 01:45 am
Is there a current wiring diagram for usaber for use with the dfplayer?
Not as far as I know. However, it's not too difficult to work out. Just wire Rx on the module to whatever pin you are using for Tx on the Arduino. All the rest is just voltage in and ground connections for power.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on May 31, 2016, 12:38 am
Thanks sorry was too specific, I just meant an updated wiring diagram for use with usaber, I suppose it doesn't matter whether it uses dfplayer or not. Does the pro mini when connected via ftdi not supply voltage to vcc like it does if you lose from raw? I think I'm saying that correctly.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 31, 2016, 03:43 pm
Ha ha !

I was just speaking of a little modification of SoftwareSerial :P

When I first started with the DFPlayer I did search for a lightweight alternative but I didn't find any.

But now , I have a better idea on how this thing works, I can give it another shot to find something smaller.

Another solution might be to use arduino's RX/TX pins to connect DFPlayer and use the native serial line but, if I remember correctly from my early tests, it disable USB communications :/ (so no uploads :(). And anyway DIYino is not wired that way

[EDIT]
Yep, still don't found a lightweight alternative...

Do you use SoftwareSerial  for DFPlayer operations only?
If so, and if debug is not implied , we just need the UART send protocol part.

Another alternative might be to rely on Cosa API (https://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/index.html) instead of Arduino API, but it would imply a lot of rewriting.
And I don't know if it would be beneficial in terms of hex size.
Not even sure it's a good idea
My credo is always to try to change the software first, being more easy than to change hardware. This holds true to the SoftwareSerial as well, I'm happy that the YX5200 works with the SS, it could work with HardwareSerial as well, but it has to be confirmed first. But before I invest time in that, first I would like to know which library "eats up" how much code space? Is there a good way to estimate/measure it? Only practical solution which comes into my mind is to start with an empty sketch and add the libraries one at a time. Then once we have the figures, we can have a look which library offers the biggest saving potential.

Actually for instance if I think about the MPU6050 library, it is a very complex library from which we use a tiny bit, but still the whole resides in the code space. So instead of trying to explore tweaking the HW, I would first make the used libraries to include only the code which we need for our particular purposes. I guess this would achieve the most with the least effort.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jun 01, 2016, 01:58 am
My credo is always to try to change the software first, being more easy than to change hardware.
I chuckled when I read this. As a pro dev I've done some strange things in SW throughout my career to cover mistakes made by the HW and network folks. They still haven't given me a cape or spandex suit... the latter is probably for the best. ;-)

This holds true to the SoftwareSerial as well, I'm happy that the YX5200 works with the SS, it could work with HardwareSerial as well, but it has to be confirmed first. But before I invest time in that, first I would like to know which library "eats up" how much code space? Is there a good way to estimate/measure it? Only practical solution which comes into my mind is to start with an empty sketch and add the libraries one at a time. Then once we have the figures, we can have a look which library offers the biggest saving potential.
I think you'll find that compiler optimizations may cloudy that approach a little. In theory, you can #include all day long, but as long as you don't call a method or use a class, then they should be optimized out and the cost should be nothing. However, different compilers/linkers approach this in different ways and some are better than others at recognizing when something is not needed and leaving it out. Global variables, for example. Some compilers will allocate the memory for an unused variable, while others (with the right options) will not. It's... well, let's just call it "icky".

I do have some encouraging evidence that the compiler used by the Arduino IDE is pretty good at this. I was able to import my USaber library, which collectively is a decent chunk of code, but my image was still only about 6K for my ATTiny85-based saber board that I'm working on now. Because I didn't use most of it, only what was needed was actually included in my Hex file. If I were to new-up an object for every single kind of blade and sound board that it supports, I'm sure we'd see a much larger image.

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 01, 2016, 01:58 pm
I think you'll find that compiler optimizations may cloudy that approach a little. In theory, you can #include all day long, but as long as you don't call a method or use a class, then they should be optimized out and the cost should be nothing.

I do have some encouraging evidence that the compiler used by the Arduino IDE is pretty good at this.
I learned something again. I really naively though that all libs wouldsimply be dumped into the code space no matter if used or not. This is encouraging, at least it does not matter which libs you include and there is no need to put effort into making them lean :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MonoMoto on Jun 02, 2016, 07:24 pm
The last weeks I slimmed down the core code of LSOS, not only to get it fit for just the stuff I need, moreso I added even more with every kb I freed. Now I am able to control a crystal chamber rgb led (which I so badly wanted to have), some additional fancy blinking lights, and I need some more ins and outs on the arduino for a heat sensor and a cooling fan.
Yes, you read right. My plan was to power a photon pump as blade lighting (it eats 30 Watts like peanuts, but squirts 1600 lumen in full rgb), unfortunately this little sucker gets hot as hell, and just a copper cooling plate under the star array chip isn't sufficient anymore to catch up.

Is there a way to get two additional pins by moving the serial stuff to the RX/TX pins of the arduino? From what I've read so far this disables uploading the sketch, but after that the USB connection isn't used anymore, so has someone arround here tried a possible solution, or could point me in a direction?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 09, 2016, 07:33 pm
Ok, so for those in the know, I am getting married saturday and made some staff sabers using my Robo R1+ 3D printer...this video shows one that was my design but made by a pro (though the quality kind of sucks in ABS). It uses LSOS software with my own PCB designed to house an Arduino Pro Mini 3.3V....I reinforced the PLA with Gorilla Glue to help keep it together from the vibration of impact. When I am completely done and have down time I will post a rudimentary mockup 3D design you can modify for your own custom hilts

https://www.dropbox.com/s/9lhs1layn4wpdwk/File%20Jun%2009%2C%209%2055%2050%20AM.mov?dl=0

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 09, 2016, 07:52 pm
Here with short blades in (the staff coupler piece is not shown) https://www.dropbox.com/s/x4wlvvsqycuom0r/File%20Jun%2009%2C%2010%2050%2053%20AM.mp4?dl=0
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Jun 10, 2016, 01:48 am
I'd be curious how you wired your promo I up.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jun 10, 2016, 03:19 am
Ok, so for those in the know, I am getting married saturday and made some staff sabers using my Robo R1+ 3D printer...this video shows one that was my design but made by a pro (though the quality kind of sucks in ABS). It uses LSOS software with my own PCB designed to house an Arduino Pro Mini 3.3V....I reinforced the PLA with Gorilla Glue to help keep it together from the vibration of impact. When I am completely done and have down time I will post a rudimentary mockup 3D design you can modify for your own custom hilts

https://www.dropbox.com/s/9lhs1layn4wpdwk/File%20Jun%2009%2C%209%2055%2050%20AM.mov?dl=0
Looking pretty good! I'd be interested to see and hear more about what's under the hood.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 10, 2016, 11:09 am
Ok, so for those in the know, I am getting married saturday and made some staff sabers using my Robo R1+ 3D printer...this video shows one that was my design but made by a pro (though the quality kind of sucks in ABS). It uses LSOS software with my own PCB designed to house an Arduino Pro Mini 3.3V....I reinforced the PLA with Gorilla Glue to help keep it together from the vibration of impact. When I am completely done and have down time I will post a rudimentary mockup 3D design you can modify for your own custom hilts

https://www.dropbox.com/s/9lhs1layn4wpdwk/File%20Jun%2009%2C%209%2055%2050%20AM.mov?dl=0


Looks terrific, I like non-metallic hilts more and more. Acually I will also upload some photos on what I'm working on now, it's sooooo much more fun to modify/tweak a plastic hilt! You can do much more with much simpler tools (like having a dremel and a few screw is sufficient) and achieve great results.
@Jake, I recall you are the champion of plastic hilts, aren't you?

Have fun on your wedding DJWing! Have you been able to finish also the DIYino based sabers in time for your wedding?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 10, 2016, 12:04 pm

I just wanted to share with you guys some pics I've made from my most recent build. It is intended for my son, because he masqueraded as Kylo Ren in the school Carneval day (Carneval is a big event in some parts of Germany, where people go around and about in different costumes).

First of all I wanted to implement this using neopixels, due to 2 reasons:
- I still had 2m of the 60LED/m type I wanted to use up. Although I know it cannot be diffused very well and the individual LEDs will still be visible, but for a child's toy it would be sufficient, also considering that for kids color change and a long battery life is way more important than optimal blade homogenity.
- I plan to program a flicker using neopixels which comes closest to the agitated, flame like flicker in TFA.

For hilt I modified a toy Darth Vader kid saber hilt I had still at home, because I deemed that the DIYino and all other stuff will fit snugly if I remove all unnecessary plastic parts and also because I can work on a plastic saber with tools I possess at home.

There is a short video (https://youtu.be/9rPTMMzFlpw) intended only as a sneak peek and proof of concept. It shows the saber running an example FastLED code. I still have to re-code my version of the LSOS I upgraded with neopixels, simply because I've overwitten it accidentally with a new version which does not have neopixels support....and my biggest goal is to code a flicker sequence coming closest to a screen accurate Kylo Ren blade.

This is how it started, by taking an old you Vader lightsaber and starting to modify it to look like a Kylo Ren. DIYino is still not wired up, just dropped in there to see if it fits the space available.

(http://s1035.photobucket.com/user/Kunci1/media/Mobile%20Uploads/IMG_20160517_140201584_zpsiukxqt2l.jpg.html)

The internals of the hilt, including board, neopixels (inside the blades), and recharge port.

(http://s1035.photobucket.com/user/Kunci1/media/Mobile%20Uploads/IMG_20160605_221906943_zpsirda9cod.jpg.html)

Full saber view:

(http://s1035.photobucket.com/user/Kunci1/media/Mobile%20Uploads/IMG_20160605_221915860_zps72fxlfiz.jpg.html)


I will post some more pics from the fully finished hilt. Yesterday I added a hole and fixed the recharge port just below the activation box, moreover I stabilized the cross-guard by tapping the blade segments and secure them with screws. Still no pics, but I will show them in an update later...

BTW: I now uploaded a draft DIYino Prime User Manual (https://forum.arduino.cc/index.php?action=dlattach;topic=393174.0;attach=170276)

Most of the content is quite generic, so it can be used even if you are implementing the circuit using different components.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jun 10, 2016, 01:19 pm
Great Job guys ;)
@DJWing79 You made some really kick ass sabers. Happy wedding day buddy !


I too have some great news. I finally achieved a fully functionning hilt !!! I'm so glad !

I ended up soldering the puppy by myself, ended that yesterday night and only burned my left pinkie.
This morning I resolved the two last minors short cuts and made a test with the nearly completed ledstring blade I've made (I need to wrap it and tube it).
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160610_131056_zps7grdprvi.jpg.html) (http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160610_131200_zpsvcpgs2ep.jpg.html)

All is working perfectly ! AT LAST !!!
The hilt body  in itself still need some work to be ended but it now can be used : I still need to wrap some leather on the tube section, carve the pomel, add two strips in the battery holder to ease battery removal and make a better  AUX button.


Now the DIYino build is in progress. I'm still at the body design, but at least this time the chassis is ready to go.
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160608_175843_zpsx3pvtant.jpg.html)
 Hopefully I'll settle myself for a simpler design, something between Obi Wan's and Saberfoge's Gladius. Parts should be easier to make.

@Protonerd Nice manual ;)


I have some question :
- Can the recharge port be used without modification to charge 2 batteries in serial ?
- If yes, what kind of charger (Voltage and amperage) should I use (these are  2 LiMn2O4  18650 batteries)?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 10, 2016, 10:39 pm
I have some question :
- Can the recharge port be used without modification to charge 2 batteries in serial ?
- If yes, what kind of charger (Voltage and amperage) should I use (these are  2 LiMn2O4  18650 batteries)?

Just slightly before the last minute! I was about to drop you a mail, you went dark for so long. But the result justifies the reclusion fully! Make a video once you complete it!

For battery charging I use this one:
https://www.conrad.de/de/ansmann-li-ion-ladegeraet-lic-1-2-5307232510-lic-1-2-liion-lipo-510741.html
It has on the bottom/belly side a roraty sweavel which can be used to select 4.2V charging for a single 3.7V battery or 8.4V charging for a serial connection of 2x3.7V=7.4V battery pack. Depending on if I charge my HP-LED or neopixel saber I use the 4.2V, for LED-string saber I rotate to the 8.4V option. One of the male connectors supplied is compatible with the 2.1mm socket commonly used as recharge port.
I'm not sure if a LiMn2O4 needs a different charging scheme, you know about batteries more than I do...

Quote
@Protonerd Nice manual ;)
BTW, I made a recent update again of the User Manual. Phrasing is still very basic and needs serious polishing, but foremost I want to give guys out there using either DIYino Prime or similar home built circuitry some starting point for the wiring, therefore I've put emphasis on the pictures.
I'm also happy for feedbacks!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jun 10, 2016, 11:41 pm
It's wonderful to see so many projects coming along.  :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: stinky1 on Jun 12, 2016, 08:36 am
Some video you should see....

Lightsaber Sparring Dummies
https://www.youtube.com/watch?v=Q6qGnragnkc (https://www.youtube.com/watch?v=Q6qGnragnkc)

Cat Fights Dog Lightsaber
https://www.youtube.com/watch?v=888xNxpF2sc (https://www.youtube.com/watch?v=888xNxpF2sc)


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 12, 2016, 06:17 pm
So...funny story...I had to reprint my wife's saber just before the wedding....so she had one I made (the white one from the video...I printed one for my nephew...mine was printed for me by a professional house....so...first swing and mine snaps...epic fail....I pick up the two pieces and swing (it was the center connector that snapped...and the ones I printed held up like a champ....sooooo...lesson learned...print my own damn sabers...now for what's under the hood...I didn't have time to wire the diyino because I couldn't find my 5v boost boards and wanted them to work right...I used a arduino pro mini 3.3V atmega 328...the mpu 6050 and the DFPlayer...only problem I had with them using the LSOS is that when I twirled them too much the audio would lock up and the saber would become unresponsive (but light stayed on) and if they were left on for more than 5 min it would shut off and not turn back on until I put in kill switch and pulled it back out...then it worked fine for another few minutes..so...in conclusion...the white one in the video is with my new design for printing the bodies on a 3D printer...I will share a basic design file soon. It involves gluing pieces together and leaving the access bays as the only thing that needs to screw on...thus eliminating a stress point for breakage...oh and I designed this sled for the electronics, battery and speaker but I couldn't use it because my soldering skills still kind of suck and the electronics ended up being a little too tall to fit in the hilt...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 12, 2016, 10:53 pm
So...funny story...I had to reprint my wife's saber just before the wedding....so she had one I made (the white one from the video...I printed one for my nephew...mine was printed for me by a professional house....so...first swing and mine snaps...epic fail....I pick up the two pieces and swing (it was the center connector that snapped...and the ones I printed held up like a champ....sooooo...lesson learned...print my own damn sabers...now for what's under the hood...I didn't have time to wire the diyino because I couldn't find my 5v boost boards and wanted them to work right...I used a arduino pro mini 3.3V atmega 328...the mpu 6050 and the DFPlayer...only problem I had with them using the LSOS is that when I twirled them too much the audio would lock up and the saber would become unresponsive (but light stayed on) and if they were left on for more than 5 min it would shut off and not turn back on until I put in kill switch and pulled it back out...then it worked fine for another few minutes..so...in conclusion...the white one in the video is with my new design for printing the bodies on a 3D printer...I will share a basic design file soon. It involves gluing pieces together and leaving the access bays as the only thing that needs to screw on...thus eliminating a stress point for breakage...oh and I designed this sled for the electronics, battery and speaker but I couldn't use it because my soldering skills still kind of suck and the electronics ended up being a little too tall to fit in the hilt...
Hi Damien, do you have videos to share? That must have been a real Star Wars festivity on your wedding! I'm sorry to hear that yours snapped, but hey, it shows the power of DIY! I hope you had a great party!!! Congratulations!!!

As to the 5V boost modules: while if you find the room in your printed hilts they sure help, but they are not a must, today I fully integrated LSOS with my DIYino based neopixels Kylo Ren saber and it works just fine off a single 18650 (3.7V) like I predicted earlier. You can check the DIYino Prime User Manual for wiring details.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 13, 2016, 06:40 am
so LSOS supports neopixels now? I really wanted to use those!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 13, 2016, 06:46 am
I clicked on the link for the manual and it says I am not allowed
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 13, 2016, 06:59 am
NM, I was able to find it by consulting the oracle at Google...now question about the neopixels....did you use the LSOS to run the show? If so....how are you setting it up? Using the String LED coding or some other kind of modification?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jun 13, 2016, 10:19 am
Hello Damien
Congratulations for your wedding.

I'm sorry for the bugs you did encounter with LSOS. I read the bug report on LSOS this morning. I also did encounter it myself with the saber on battery only. Until now I only tested it with saber powered by USB cable.

The problem comes from the "battery level monitor" part of code which doesn't work as intended.


We (JakeSoft, Protonerd and I) are talking together about a rewrite of LSOS, and I will get back to work on it this week. I won't correct bugs on current version but I don't think we're going to use this monitor code anymore.

As for Neopixel support, it should be part of it.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 13, 2016, 05:08 pm
part of the next release? Ok cool...in the meantime what line do I need to // to disable the battery monitor? I can't wait for the next release.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jun 13, 2016, 05:31 pm
Part of the next major release (V2) , maybe ;)

I did comment out  the "Low Battery Montoring" code in the main branch in github. It was lines 443 to 517 ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Mawg on Jun 15, 2016, 07:59 pm
Hi guys,   I finally got things sorted - bad IMU from amazon...

I loaded the latest LSOS with the battery monitor bug patch.. still freezes up.

I have been doing some troubleshooting but am getting nowhere.   

What I do have:
No freezes in config mode (10+ minutes)
No freezes in standby mode (going on an hour now)
Freezes in action mode after about 2 minutes..

Any thoughts or help would be greatly appreciated!
 
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Jun 16, 2016, 03:47 am
So, I've abandoned eclipse for now as I've found it just randomly breaks for me. I went to Pert's arduino ide base and tried to use it with 1.6.9 no go out of the box, but once I ensured all libraries were in the sketch folder I was able to manually edit all of the includes from "" to <> based and get things going. Now, I will go back to the drawing board with my board. I plan to begin building my chasis and I'll probablly just solder most of it together instead of using a bread board.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Jun 16, 2016, 03:58 am
My first goal before trying to shift towards oop, is to replace a lot of #ifdefs with an enum for blade types which probably will give way to classes.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 16, 2016, 09:53 am
NM, I was able to find it by consulting the oracle at Google...now question about the neopixels....did you use the LSOS to run the show? If so....how are you setting it up? Using the String LED coding or some other kind of modification?

Hi DJWing79,

In the current Arduino compatible LSOS neopixels are still not supported, but I have a modified LSOS version which does. So you can wait for the next LSOS release mentioned by neskweek or if you already have the strings, I can send you my code, the API is there with some simple examples. But definitely neopixels need a different coding and also a different hardware wiring.

BTW, the User Manual I moved to GitHub now:
https://github.com/Protonerd/DIYino/blob/master/DIYino_v1_User_Manual_draft_v03.pdf

You can check the wiring for neopixels, there is a full wiring diagram towards the end I prepared for a friend experimenting with neopixels.

Versions might change, but it will be there form now on.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 17, 2016, 04:27 pm
I can wait for the official release for neopixels, but one question...how do you put them in the blade and keep them straight?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Jun 17, 2016, 04:41 pm
I can wait for the official release for neopixels, but one question...how do you put them in the blade and keep them straight?
I did it with a layer of bubblewrap around them, also protects them
but i would use them for more than half an hour at once since the heat can't dissipate...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jun 17, 2016, 05:14 pm
My first goal before trying to shift towards oop, is to replace a lot of #ifdefs with an enum for blade types which probably will give way to classes.
That sort of thing has already been started in the Universal Saber library. You may want to take a look at that as an attempt has already been made to establish a generic blade interface.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Soulbp on Jun 17, 2016, 10:08 pm
Thanks I'll try to find the link, maybe I'll migrate stuff over. The arduino ide doesn't seem too bad to work with and you can have two instances with different sketches open.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 23, 2016, 11:17 pm
Do we have a more simplified "How To" instructions on how to get LSOS to work on Arduino IDE? I've had a look at the previous instructions and I am still a little confused and don't want to mess things up. Can anyone who has successfully done it write up a step-by-step how to file?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: pert on Jun 23, 2016, 11:53 pm
Do we have a more simplified "How To" instructions on how to get LSOS to work on Arduino IDE?
These instructions should work for IDE version 1.6.0 and greater and may work with 1.5.x also. If compiling hangs with 1.6.4, try again with File > Preferences > Compiler warnings: None.


I've been meaning to submit a pull request to add Arduino IDE installation instructions to the LightSaberOS readme so please let me know if you have any feedback on the above instructions.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jun 26, 2016, 01:45 pm
I added those to the readme.

Thanks again Pert
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jun 29, 2016, 01:18 pm
I'm currently building my neopixel blade to be able to make and test neopixel code integration inside Usaber lib.
To make the center support I first thought of using a wood rod prism shaped but I can't find any in stores and I don't have any tools to do that.
So last week I found this :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160626_155917_zpsp0l82gn3.jpg.html)
a plastic transport case. I do some cuts in those channels in order to be able to make a nice prism shape :
(http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160626_155940_zpsd1tlvkvy.jpg.html) (http://s1073.photobucket.com/user/cest_bastien1/media/Lightsaber/IMG_20160627_145036_zps6iahpiz9.jpg.html)
Then I cut and pasted the strings on this support.

And of course nothings did go as easy as I first thought (why? .... WHY !?!  :'(  :'(  :'( ):
Once pasted, I did tested the strings and .... a lot of pixel did broke  :smiley-mad:
They were perfectly working before pasting.

Electricity goes throught the whole string but broken pixel stops data channel transport, so to fix this I started to replace broken pixel with the one left on the previous cutted parts (more soldering ... Yeah ...  :-*  ). One of the three (the one with the more broken pixel) is already fixed. Hopefuly I should have enough to fix the 3 string.

I don't know if it is the paste (Araldite) or the (small) pression I put on them to paste that broke them.

I doubt this blade will be very solid: I doubt I will be able to use it in fight situation. Prism shape is to much rigid, even with this souple plastic, and seeing how my ledstring is deforming during a clash, I doubt it will be able to resist those constraints.

If any of you have ideas/comments, I take them ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DWMiller on Jun 29, 2016, 03:31 pm
I'm currently doing something similar on my led tape blade. I'm using a piece of 1/4 poly tubing split lengthwise as my base and wiring channel. Four strips of led tape up the sides of the tube and the wires back down through the center. No pics yet as this is still rough concept at this point.

I looked for a square support first with no luck. Dispersion angle on the leds would make that ideal. Maybe aluminum to heatsink the strip a little??? Any thoughts on this...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jun 29, 2016, 04:32 pm
I've also thought of aluminium. But I was scared the rod move inside the blade ruining the end cable or the connector
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 30, 2016, 02:45 am
I just had a thought....could you slide them inside a smaller diameter tube and glue/anchor the neopixel to the end and then put that tube (no diffusing material) inside the blade without the tip on and literally glue it to the tip so that its anchored? I also posted a question on adafruit's forum. I'd like to see this work for medium dueling...would be epic. Maybe I can custom print a piece to lock it in place with my 3d printer. almost ready to upload pics and STL btw
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 30, 2016, 05:01 pm
long message

If any of you have ideas/comments, I take them ;)

Hi neskweek,

I'm still not sure if a triangle shape is going to be much better than simply using the stripe tape glue to attach 2 stripes back-to-back. I did it with my neopixels and wrapped it in a kind of plastic foam sheet to cushion it in the blade. Even this way it fits just barely if I wrap a few times. But I can tell you from experience that with right cushioning it will withstand medium duelling.

Oh yes, what I wanted to state is that even with 2 instead of 3 striped I see no serious shadowing where the edge of the stripe is. But you have to try it out for yourself, I guess with you 144LED/m type all those LEDs with a proper diffusion should give a homogeneous lit blade.

I really wonder about the broken LEDs. I recall you bought yours from aliexpress? Maybe they are cheaper but not so durable as the Adafruits or more expensive clones? This might be an issue. Just looking at the stripes I have so far they seem far superior as far as durability is concerned than even well made LED-strings (and do not believe if someone says otherwise).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 30, 2016, 05:08 pm
What about these? https://www.adafruit.com/products/1426
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 30, 2016, 07:47 pm
Hey Protonerd,

I am looking at your DIYino manual regarding the Neopixels and I have a small question about the Kill Switch setup. Do you have to split the ground to all of of LS pins? or is that simply showing that any will do? Also, If I were to do this on my own setup would I simply use a mosfet to control opening and closing of the negative line?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 30, 2016, 08:04 pm
One last (hopefully) question about the neopixels, are you using the 60/m version? Are they brighter on one side than the other or are you using two strips back-to-back?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jun 30, 2016, 09:22 pm
Hey Protonerd,

I am looking at your DIYino manual regarding the Neopixels and I have a small question about the Kill Switch setup. Do you have to split the ground to all of of LS pins? or is that simply showing that any will do? Also, If I were to do this on my own setup would I simply use a mosfet to control opening and closing of the negative line?
Hi Damien,

I use the 60LED/m version, 2 stripes of 50LEDs each back-to-back. But if you go for neopixels, go for min 90L/m, or the densest one 144L/m. With the 60ties you still see the individual LEDs no matter how well you diffuse. I only used them because I anyway had 'em so to say.

As to the programmable kill key feature, each of the transistors can take ~1.1A worst case, which gives a total current capability of max 6.6A, but although the mosfets would bear the strain, the PCB probably would fry. So I recommend to use the DIYino Prime mosfets only up to 3A, the more evenly distributed the best. If neos become a trend, then in an upcoming redesign I can allow for a larger area to dissipate the heat...
But way better is what you suggest: to buy a big, fat logic level FET and put it on a small PCB with enough copper and use it instead of torturing the saber core. This would work on your own setup as well.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 30, 2016, 10:55 pm
I've been thinking of an easy way to plug in the blade and unplug the blade when you need to store it if you're using Neopixels, and, well....what if we used a 4-line audio jack? I has 3 data channels and a ground...would that work? male on the blade, female in the hilt...slide in, click, hold in with retention screw....thoughts?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jun 30, 2016, 11:02 pm
What about DotStar?

https://www.adafruit.com/products/2237

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jun 30, 2016, 11:16 pm
Hi neskweek,

I'm still not sure if a triangle shape is going to be much better than simply using the stripe tape glue to attach 2 stripes back-to-back. I did it with my neopixels and wrapped it in a kind of plastic foam sheet to cushion it in the blade. Even this way it fits just barely if I wrap a few times. But I can tell you from experience that with right cushioning it will withstand medium duelling.

Oh yes, what I wanted to state is that even with 2 instead of 3 striped I see no serious shadowing where the edge of the stripe is. But you have to try it out for yourself, I guess with you 144LED/m type all those LEDs with a proper diffusion should give a homogeneous lit blade.

I really wonder about the broken LEDs. I recall you bought yours from aliexpress? Maybe they are cheaper but not so durable as the Adafruits or more expensive clones? This might be an issue. Just looking at the stripes I have so far they seem far superior as far as durability is concerned than even well made LED-strings (and do not believe if someone says otherwise).
This time I will trust you word for word.
I'm more and more persuaded that the prism shape will be too much rigid to accept blade wobbling. One hit and I am assured to break some connections.

I managed to repair 2 strings of 114 LEDS each and the third seems heavily touched. This process is worse than building a ledstring...
Throught testing I can tell its the SK6818 solderings which broke, so its due to bad factory building. (they were sold for WS2812 which as 6 pin, SK6818 have 4pins...like those on my strings)
Yeah I bought them from aliexpress, from CHINLY ELECTRONIC TECHNOLOGY CO.,LTD exactly (it's not adrvertising, I denounce crap sellers).
In fact it's so bad that when I finally fixed the first one, I tested it and it worked. I leaved the whole mount untouched overnight. Next day I plugged the USB connector to my board to restest ,without moving anything, and another "healthy" connection was broken...
I will remove them from my prisms and will paste them back to back since you say you don't see light gaps with yours.
It will reduce stress on batteries too.
If those break, I may ask you were you bought yours again (hoping your seller sells quality 144/m strings) or I may even consider using APA-106 leds (no need for seriallell with those since they can take 6v, If I'm correct adjusting mosfet driven pins should reduce voltage going threw those leds, right ?)

Damien, I personally choose to wire them to 8pin DIN just like my ledstrings
As for DotStar, I don't know if their protocol is compatible with Neopixel one. If they are, why not. From my point of view Neopixels are fast enough for our use.
The main benefit would be on ignition which needs to be fast enough. For that I personaly choose to light them 2 by 2. DotStar may allow to light them 1 by 1. The effect would be even smoother than what you can see on my proof of concept video.
I said that without having doing math about the interrupts I use, I don't even know if we could benefit from this speed upgrade.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 01, 2016, 12:12 am
The DotStar have that second control pin...I'm wondering if that could be used to make sure that the LEDs turn off, rather than still sucking up power?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 01, 2016, 12:19 am
hehehehe.....I got better idea....USB connector..its keyed...it allows for simple slide-in/slide-out connectivity and I can buy the connectors cheap and wire them for my own purposes....4 channels...boom...comments?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Jul 01, 2016, 01:20 am
I've been thinking of an easy way to plug in the blade and unplug the blade when you need to store it if you're using Neopixels, and, well....what if we used a 4-line audio jack? I has 3 data channels and a ground...would that work? male on the blade, female in the hilt...slide in, click, hold in with retention screw....thoughts?
I've been thinking of using a ¼" stereo phono plug for just this purpose. 3 connections. 2 for power, remaining one for data. No?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DWMiller on Jul 01, 2016, 08:03 am
http://i.ebayimg.com/images/g/8TkAAOSwUuFWwga-/s-l1600.jpg

I've been using these 7 pin avation plugs I found on ebay on my 3/4" saber blades. The female part slides up i nto the blade, a little epoxy makes it thread into place inside the tube ends. Then the male plug is inside the saber handle wire is long enough so it pulls out far enough to connect. Then push blade down into holder and lock with set screw.

These are six section tape blades but the plugs are avalible in several connector configs. Search "Aviation Plug 16mm GX16" on ebay to find these. Never had one come unplugged while banging it around yet.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 01, 2016, 06:42 pm
Maybe I should clarify...I want quick and easy release of the blade (with ledstring/neopixel inside) and the hilt for storage when not in use. Anyone have any suggestions that won't require a lot of force?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Jul 02, 2016, 05:07 am
Maybe I should clarify...I want quick and easy release of the blade (with ledstring/neopixel inside) and the hilt for storage when not in use. Anyone have any suggestions that won't require a lot of force?
That's what I'm hoping to accomplish with the 1/4" Phono plug and a retention screw. If that's not going to work, I'd love to know before I sink money into it.

Either way, it's going to be awhile though before I can get to it though, since I'm finding it hard to solder with a broken arm.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 03, 2016, 07:35 am
Adafruit suggested embedding the neopixels in silicone. Would provide shape, shock absorption and diffusion
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 03, 2016, 10:19 pm
Well they do break again.
Without touching them. I tested them yesterday after having installed themp in the blade and all worked fine.
I did restest them this afternoon and ... nothing... RIP pieces of crap.
This is maybe specific to 144Leds/m. I don't think there is a lot of factory in the world that are making those stuffs.

On the bright side : while they were working, I did paste them back to back and I concur with Protonerd: it does the job pretty well.
I did roll them inside some foam, and diffuse the thing with industrial paper toilet, since crystal paper and cooking paper aren't enoughh to my eyes (You still see hotspots). With toilet paper there's no hotspot, but it eats a lot of light.
It was less luminous than my current ledstring (tested with same colors: pure green).

So now I think I'm going to hunt down for some APA-106-F5  or PL9823-F5 to make an adressable ledstring. Since they are compatible with neopixel protocol...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 03, 2016, 11:23 pm
This is to both Proto and Nes,

I have wired up my first DIYino and I am having a slight issue....When I // out the battery lines that Nes suggested back in page 32(?) of this forum, eclipse gets errors and won't create the hex file (ironically it worked when I uploaded to my Arduino Pro Mini). If I comment starting at 436 (instead of 443) then I get it to upload and the boot sound plays but none of the buttons work. I then commented the range of 436 to 513 (you had recommended 517) and I get the buttons to work in config mode and it will turn on, but then it is stuck in on, won't turn off, won't take the aux button input and swing and clash don't work. I am using the Arduino Nano build as suggested. The MPU is calibrated and that sketch went fine. Did you guys have any issues like this? I can't seem to figure out what the problem is. I am not super-code guy like you guys and only have a basic understanding (my own code was very simple compared to you guys) but I am wondering if the signal from the MPU is what's hanging the system. I currently have BLADE_Y defined as that was what my setup had, but I have no idea how the DIYino should be set for this.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 04, 2016, 01:16 am
This goes out to any other programmers...the issue I posted to Nes and Proto seems identical to what happens when I try to use a Trinket Pro. The Trinket Pro can't use pin 2 due to it being used by USB and so you have to use pin 3 for interrupt. When I test this setup on my uno it behaves just like the issue I posted last. If I can get help solving this for diyino (nano) then I'm convinced that the trinket pro will work
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 04, 2016, 06:59 am
Just tried out the same code that isn't working on the DIYino on my Uno and it worked fine....same pin assignments, same everything and it works. not sure what's going on...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 04, 2016, 12:41 pm
This is to both Proto and Nes,

I have wired up my first DIYino and I am having a slight issue....When I // out the battery lines that Nes suggested back in page 32(?) of this forum, eclipse gets errors and won't create the hex file (ironically it worked when I uploaded to my Arduino Pro Mini). If I comment starting at 436 (instead of 443) then I get it to upload and the boot sound plays but none of the buttons work. I then commented the range of 436 to 513 (you had recommended 517) and I get the buttons to work in config mode and it will turn on, but then it is stuck in on, won't turn off, won't take the aux button input and swing and clash don't work. I am using the Arduino Nano build as suggested. The MPU is calibrated and that sketch went fine. Did you guys have any issues like this? I can't seem to figure out what the problem is. I am not super-code guy like you guys and only have a basic understanding (my own code was very simple compared to you guys) but I am wondering if the signal from the MPU is what's hanging the system. I currently have BLADE_Y defined as that was what my setup had, but I have no idea how the DIYino should be set for this.
I did made an update on github recently that remove all battery management stuff (there's a bit more than what I told you earlier).
Try with that one and tell us the result ;)
PS: You don't need eclipse anymore. You can use Arduino IDE if you like.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 04, 2016, 04:00 pm
I recall there was at the beginning of the MotionManager a piece of code polling the MPU which led to a hang and turned out to be not necessary at all. I though you already removed it though....

As far as I recall it was this piece:
Code: [Select]
// if programming failed, don't try to do anything
if (!dmpReady)
return;

// wait for MPU interrupt or extra packet(s) available
// while (!mpuInterrupt && mpuFifoCount < packetSize) {
/* other program behavior stuff here
*
* If you are really paranoid you can frequently test in between other
* stuff to see if mpuInterrupt is true, and if so, "break;" from the
* while() loop to immediately process the MPU data
*/
// }
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 04, 2016, 04:08 pm
I made a new video of my LSOS based Kylo Ren lightsaber using neopixels. It turned out pretty much like I wanted it to be (or rather how my son wanted it to look like in action mode) and I'm happy with it :)

The video can be found HERE (https://youtu.be/PjXLKvWpA8A)

I know you guys are going to skip all the intro and fast forward to the place where the blade lights up, no bad feelings about it, all you miss is my broken English explaining what I already told in an earlier post about it. So feel free to enjoy the light show.

It would be a lot more formidable with a 144LED/m stripe!

But maybe a general programming question: I always assumed that global variables can be accessed all throughout the sketch, does not matter in which tap I'm working in. But if I want to for instance access the sound found index in the Light.cpp, I need to somehow knit a function which transports this information from one tab to another.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 04, 2016, 04:28 pm
Got this newest message when trying to use Arduino IDE 1.6.9 with LSOS

Arduino: 1.6.9 (Windows 7), Board: "Arduino Nano, ATmega328"

sketch\Buttons.cpp: In function 'void mainClick()':

Buttons.cpp:40: error: 'class DFPlayer' has no member named 'playPhysicalTrack'

     dfplayer.playPhysicalTrack(soundFont.getForce());

              ^

sketch\Buttons.cpp: In function 'void lockupLongPressStart()':

Buttons.cpp:170: error: 'class DFPlayer' has no member named 'playPhysicalTrack'

    dfplayer.playPhysicalTrack(soundFont.getLockup());

             ^

sketch\Buttons.cpp: In function 'void lockupLongPressStop()':

Buttons.cpp:218: error: 'class DFPlayer' has no member named 'playPhysicalTrack'

   dfplayer.playPhysicalTrack(soundFont.getHum());

            ^

exit status 1
'class DFPlayer' has no member named 'playPhysicalTrack'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 04, 2016, 04:41 pm
Figured it out, was an old DFPlayer library still inside the file. It works now!!!!!! Oh and one more thing, when using the Arduino IDE I can now get it to work with setting Interrupt to 1 (pin 3) so I can use this with my trinket pro
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 04, 2016, 05:12 pm
Protonerd, if you want to use a global variable inside another file, you need to declare it "extern".
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 11, 2016, 07:52 pm
Hey Nes and Proto,

Did you guys finish the coding for Neopixels in the LSOS yet? I finally ordered some generic 5050 60led/m rgb led strips from Amazon. I wanted to test them with the silicone solution Adafruit suggested as well as wiring them with just a headphone jack. do you need all 6 N-Fets to close the circuit or would one beafy one do the job? I ask because I don't want to waste one of the DIYino's on this test.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 12, 2016, 05:06 pm
One beefy external FET would suffice. If the current goes up steep, even when using the DIYino I would recomment to use external FETs. With the 60LED/m the DIYino can still eat the power, but with the 144LED/m I would not put my hands in fire...

But the FET is not strinctly necessary. If you have a kill key anyway, it does the job. You just have to plug it back every time you switch off your saber otherwise the idle current of the stripes will discharge your battery preatty soon (1mA/LED roughly).

I think the official code on GitHub still does not contain the neopixels extension, but I can provide you my Kylo Ren code, you can modify it to your needs, it is also an LSOS base.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 12, 2016, 06:51 pm
Ya, please send that to me. The reason I ask is I use N-FETs to control the power on my LED sabers, do Neopixels even require them? If so, would you have a recommendation or would the one I currently use for LED work?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 13, 2016, 04:20 pm
Hello everyone.

You wanted it so we decided to release it.... :

LightSaberOS 1.2 is out 

Changes :

Oh.... and :


Known Bug :


I have something to ask to people that have a completed saber :  I would like you to test and report your feelings about default swing sensitivity. 

As a start value I encourage you to use the max value -1 (300 if you check serial output).
At this value I would like you to report if your saber react good (and please tell where your MPU/DIYino is placed inside your saber (Top, middle, bottom of your hilt) )
To be clear: I would like to know if swing sensitivity menu is still needed (that would allow us to get back a little more code space)

Hoping you'll like that ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Jul 13, 2016, 05:23 pm
Oh.... and :
  • Neopixel blade management added. :D  8)
    This is a basic implementation but it should work ok.
    Some warnings :
     
    • Those eats a lot of power, especially if you use combined colors (purple, yellow, white,....)
    • ledstrip heats quite a lot, don't use them for too long
    • When buying ledstring/pixel leds or stuffs like this check those are compatible with WS2812 protocol otherwise it won't work


I think I love you.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 13, 2016, 07:36 pm
So question, will the neopixels essentially just be like ledstrings or did you program the LSOS to give us that cool fire look? If the fire look is a special feaure, can we get code to choose between stable blade and unstable? Maybe comment a line in the config to switch between the two?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 13, 2016, 07:44 pm
As I wrote it this is a basic implementation. There's no fire like effect.
This is "like" ledstrings version
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 13, 2016, 08:06 pm
That's fine by me....though I smell a software request in the works...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 14, 2016, 12:16 pm
Hello everyone.

You wanted it so we decided to release it.... :

LightSaberOS 1.2 is out 


Woooooooowwwwwwwwww!!! Man, that was fast! We just talked about it yesterday and now it's out! It's like suddenly it's Xmas!

I will give it a try as soon as I'm back home (after the weekend!). End of next week will see my son's 8th birthday, I'm going to give him the Kylo Ren saber, I want it to use this version already!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 14, 2016, 12:24 pm
So question, will the neopixels essentially just be like ledstrings or did you program the LSOS to give us that cool fire look? If the fire look is a special feaure, can we get code to choose between stable blade and unstable? Maybe comment a line in the config to switch between the two?
I would personally not put it into a generic open source code like LSOS, because the fire effect is too special and specific to neopixels. Let's consider it to be a user generated add-on to the LSOS framework. As I mentioned, I'm going to merge together the v1.2 and my current copy of the LSOS+fire_effect and then I can release an add-on with instructions how to include it into the framework of the v1.2 .
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 15, 2016, 06:45 pm
that will rock! My brother's birthday is in september and he's kind of a gearhead and loves racing. So I am making him a custom lightsaber on my 3D printer (so far my new method is holding up, but am going to try an even better one in nylon probably this weekend). So I am going to make it shaped like a piston and make audio recordings of my dad's cobra revving and starting and blend them into the font. would love to make the blade a flame to top it all off.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 15, 2016, 09:16 pm
Hey Nes, not to be a pain, but I remember you stating once that you'd eventually find a use for the double-click feature in the One Button sketch....and I think you could do it this way...

if people want to have a single button setup then you could have a single button version of LSOS that basically does this....

press-hold enters config mode when not in Run mode

double-click changes which way the value goes..for instance...if you're pressing the button and raising the value of say the color, the double-click would then set the button to going down....

press-hold performs clash effect during run mode

double-click turns saber off during run mode

just an idea...I'm always trying to modify my hilt designs to make the hilt smaller and smaller or rearrange things so the buttons don't get in the way of the electronics..



so here's what i've been working on (btw I recommend Autodesk Fusion 360 if you don't have a CAD program, its free)

http://a360.co/29UMj2B

this first one is one I am planning to make for myself so it has some personalizations

http://a360.co/29W6RpX

this next one is a test bed I'm going to use to print in nylon, it can be modified as a reference tool. The items inside the area where the blade goes is for when I try to use it to test neopixels..those objects are to encase (in theory) the audio pin and connector that I bought to house the wiring so I can slip the blade in and out.

http://a360.co/29UQN9r

this is one I made for my nephew and uses an older design, where the top and bottom parts of the hilt are glued together. This was printed in PLA so I lined the inside of the hilt with gorilla glue for extra durability and its still going strong... the designs I posted before this use two 8-32 set screws to join the pieces together so I have better access to the electronics when placing it inside. I don't plan to continue using the glue unless I have to (it has to be grinded down in places where it pools) because I hear that using Nylon has great layer adhesion and superior strength than PLA. Will test it and let you guys know...

http://a360.co/29B0Ot2

Finally, this is the staff saber I made for my wife for our wedding...this is an older design I used because I'm now trying to do setups with flush buttons...this one also uses screw threads which ended up being a pain if you didn't get them exactly right (they'd lock and you'd be unable to unscrew them), but I wanted to show how you can make embossments directly into the model (they came out beautiful)...if you make cuts into the model (like the bees in hers) make sure you have a fine tipped screwdriver or something to clear out the holes in the model so the light can shine through...I also have an electronics sled design so you can mount the speaker, electronics board and battery all on one unit and be able to slide it up inside the hilt, but I abandoned it in my finished sabers due to my horrible soldering jobs (the wiring and boards ended up being too tall to sit directly on the sled) but if anyone wants those I can post them...anyways...that's what I got...


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 19, 2016, 02:43 pm
that will rock! My brother's birthday is in september and he's kind of a gearhead and loves racing. So I am making him a custom lightsaber on my 3D printer (so far my new method is holding up, but am going to try an even better one in nylon probably this weekend). So I am going to make it shaped like a piston and make audio recordings of my dad's cobra revving and starting and blend them into the font. would love to make the blade a flame to top it all off.
Hi guys,

I've put my LSOS-based neopixels code with the fire effect on GitHub, as a zip file. Please feel free to use, provided as is -> i.e. you need to do some adjustments, but if you know LSOS, I'm confident you will be able to do so.

I will also provide one which is compatible with the LSOS 1.2 neskweek just released recently, but it will be some effort to do so, that is why I decided to give the current code for those wanting to try it.

https://github.com/Protonerd/DIYino/blob/master/LightSaberOS_v1_FireBlade.7z
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Hellraiser0170 on Jul 19, 2016, 08:52 pm
Hi. I have found this Thread on GitHub.
Very very cool.
I have a lot of questions pls.
1. Is the Wiringdiagramm ready to use?
2. Can I use the WT588D 16Pin. / difference?
Same programm? Iam newby.....
3. I can copy all codes for sketches ready to use?
4. I have a Arduino mini pro. Is it the same to use as nano in your project?

Big sorry for my bad english!!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 19, 2016, 08:58 pm
Hello and welcome.

I will made quick answers since all those have been answered in this thread or the other one (http://forum.arduino.cc/index.php?topic=261980.0) :
1.Yes
2. Not with LSOS. Check Usaber lib
3. Needs you to tweak config.h for your personnal use/device
4. No. Untested but might work depending on your choices. Usaber lib might be better suited.

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Hellraiser0170 on Jul 19, 2016, 09:06 pm
Thanks for your help.
But i understand all.
I can use the mini pro ( not testet,ok). But what must i do to test it?And what is Usaber lib and what is LSOS?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Hellraiser0170 on Jul 19, 2016, 10:06 pm
Only different Mini to Nano i can find is nano have a USB programmer include.......
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 20, 2016, 07:04 pm
Yes Pro Mini will work, I have them in my design. I'm using 3.3v version
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Hellraiser0170 on Jul 20, 2016, 07:36 pm
Yes Pro Mini will work, I have them in my design. I'm using 3.3v version
Big thx ;)

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Hellraiser0170 on Jul 20, 2016, 10:12 pm
Ok question.....
I see the Wiringdiagramm on GitHub "LS Saber Board V1"

This is up to Date? And i see on the right side the Blade Male with Pin 1-8 .

If this connector then power LED or LED strips connected ? and the LED driver I have to choose to fit itself ? Which is what pins clamped ?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 20, 2016, 10:25 pm
Thanks for your help.
But i understand all.
I can use the mini pro ( not testet,ok). But what must i do to test it?And what is Usaber lib and what is LSOS?

Or if you don't want to solder, you can use a DIYino Prime ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 21, 2016, 11:01 pm
Ok, so update time....Nylon is AWESOMELY strong...as long as you make it thick enough....so I am using Taulman 910 at 50% infill and 5 shells....255 degrees C and a heated bed at 45 degress C....I used no glue this time to strengthen the part and I hit my test hilt up HARD and even tried to break it with my hands, it flexed a little but didn't give....so I am reposting my 3D models for everyone to take a look at in case they have a 3D printer and want to print their own hilts....nylon can withstand up to 90 degrees C of heat. I want to warn people about the small amount of shrinkage that nylon has...so if you're printing small parts, be prepared for post-processing (I use a dremel to make sure lines are straight and what-not). I still encourage the use of a glue on the inside of the hilt for extra durability (not to join the pieces so you can still take it apart).

here are the updated links

Base model that can be modified for outer design changes, is setup for  LED and Neopixels using my audio pin setup, but if you're using straight LED, then you can close up the hole closest to where the LED heatsink will sit. This particular model uses the following buttons, ( https://www.e-switch.com/product-catalog/pushbutton/product-lines/lp1-series-illuminated-round-pushbutton-with-multiple-color-options#.V5E1w_krLRY ) but if you choose to have different buttons you will have to modify the button holder.


http://a360.co/29W6RpX

the hilt is 12.06 inches long and can accomodate up to 108mm long circuit board, 20mm speaker and mount (which is in the model) and a 18650 battery with protection circuit. I made the bay for the circuitry extra long so you can modify it down to your needs like if you're using DIYino, you can shorten the hilt down or maybe add bigger buttons. All my models are setup for in-hilt charging. All hilts are 1.65" in diameter so a little thicker than MHS parts but still easily able to be used by a child (my son can swing it around pretty easily and he's 9). By making slight cosmetic alterations you can pretty much make almost any kind of saber you want from it. One note, make sure the wall thickness for each joining piece (where they screw together) is at least .15" thick, you might be able to get away with .13 if you glue it, but anything less will make it snap easier. Also, make sure the leading edges of that thick wall (before and after the screw threads) have some room or the screw will wiggle and tear up the nylon and break free.

Proto and Nes...thanks for all the help you've given me in getting the DIYino and LSOS up and running for my projects...if you want, I will make each of you a custom piece and ship it to you, just send me a message with your rough design.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: sligs78 on Jul 23, 2016, 09:51 am
How do I go about getting one of these?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 23, 2016, 09:38 pm
Damien, that's a nice design you made here.
Well done.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 24, 2016, 10:35 pm
Proto and Nes...thanks for all the help you've given me in getting the DIYino and LSOS up and running for my projects...if you want, I will make each of you a custom piece and ship it to you, just send me a message with your rough design.
Damien, awesome designs!!! I'm really thinking about a saber staff lately and I've seen the one you sketched, looks sweet! Thanks for your kind offer, really!!! If these guys can be made durable, they are going to become a real alternative to expensive metal hilts.

I recall earlier you also made a sledge/chassis for DIYino(-similar) boards, my dream would be such a sledge, which can hold the board, 1 or 2 Li-Ion batteries (maybe customizable), neatly all wirings staying inside and not going out, a place for a DIN 8-pin plug going out, openings for recharge port, USB and SD-card, and a holder for the speaker. A basic design which could be modified, especially the wall thickness/outer diameter, so that it can be made fit different saber builders inner diameter (MHS, SF ASP, etc.)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 25, 2016, 08:22 pm
The only problem with a sled that has the charge port on it, is getting it into position to be accessible while still retaining hilt integrity. I have a sled that mounts the speaker, battery and has a place to put the board (as long as its thin enough and you tape it down). I can upload that for you.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 25, 2016, 09:50 pm
The only problem with a sled that has the charge port on it, is getting it into position to be accessible while still retaining hilt integrity. I have a sled that mounts the speaker, battery and has a place to put the board (as long as its thin enough and you tape it down). I can upload that for you.
Is that sled compatible with DIYino? What is the OD of it? I would be much indepted if you could upload it for me! Thanks!

BTW, the saber staff you made for your wife, how long is that? From the picture it looks formidable.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 25, 2016, 10:12 pm
I would recommend using the newer design for staff, which I can make for you and upload to you. this one is literally two lightsabers joined together with a center piece, if you want it to always be a staff, I can rig one so that the buttons are in the center. Also....for your measurements, you need a staff that is at least as long as your shoulders are wide...makes greater ease in twirling and handling. that being said hers is nearly as big as mine and a little wider than her shoulders, at 28.5775 inches...here's the sled

http://a360.co/2a586CJ


It has a stopper that is 1.29" in diameter so I usually make my ID of my hilts something like 1.26", it can hold a 20mm speaker and a 18650 battery with the protection circuit (either from customsabershop or I get the Tengen batteries), if the height of the circuit board is less than 10mm then it can fit on the sled, which is also 22.7mm wide and 98.82mm long (designed for my own boards but definitely can be shaved down for smaller boards. I reinforced it so it wouldn't snap or bend if you had to push the front end back to dislodge it from a saber.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 26, 2016, 01:08 am
Proto, I've been thinking about your request for the charge-port-sled....I think I can make one, if it slides in from the top and not the bottom....let me play around and get back to you
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 26, 2016, 10:43 pm
My initial run on my saber for my brother...shaped like a piston (though not to true dimensions obviously) and will use the fire effects and engine sounds from my dad's 427 cobra...

http://a360.co/2aolmTU

my brother is a mustang nut....so I added the side vents to have the silhouette of the mustang logo
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Sincenatic on Jul 27, 2016, 10:44 am
Hello,

I have been following the forum for some time, but as an "end user" rather than a developer. My particular interest is more on the led string itself, and I have just posted some information on how I made a blue-white color mix using 4 strings. If you're interested you can check out the post on:
http://www.fx-sabers.com/forum/index.php?topic=50315.0 (http://www.fx-sabers.com/forum/index.php?topic=50315.0)

I am using the DIYino board with LSOS, and I thought I give you a report. I have had the DIYino board waiting for me for months, but the building process has been slow. Before starting to solder I had, what appeared to be a large setback; in my intention to prepare something to hold the board still while soldering I accidently put pressure on the tiny "thing" next to the mini USB port and it fell off. I took a careful look at the situation, but left it for the next day (which was a wise decision). I decided to try to solder it back, and to my surprise I actually managed! I wanted to include this comment as warning, but it is by no respect a fault in the production - I was completely responsible. Apart from this setback I did not experience any problems in soldering on the board and wiring up everything.

When I was ready to install LSOS I opted for the Arduino IDE version. (The Arduino IDE version in Spanish use a very rough translation and it took some time to recognize everything).  I downloaded and installed the latest version 1.6.9 (now it is actually 1.6.10). Unfortunately LSOS did not compile correctly, but I tried version 1.6.5 that was confirmed to work. It did work. At this stage I just want to use the sound fonts exactly as prepared, and I selected, dragged and dropped all files (instead of using copy and paste). It turned out that this created the chaotic ordering. The next day I dragged and dropped file by file (in the correct ordering) and it worked. Instead of using the calibration process I used the prepared information for the DIYino board. I have had some problems that I think is related to the swing detection. While trying I could suddenly loose the sound (while the light still worked as normal). The sound was recovered by disconnecting the batteries. (I don't have a kill key, because I use external charging of the batteries). Initially I considered that it was related to the "thing" that I had to solder back on the board, or possibly that the hilt put physical pressure on the board in some way. I found that if I used the option "swing sensitivity" - pressing "up" a few times this problem went away. I use a very long hilt and the board is in the lowest part. Since it seems to work fine now it is not a big concern, but I thought I report it in any case. So far I have not recorded any video, but I will do so whitin a few days.

Thanks for all the work on the DIYino board and LSOS!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 27, 2016, 11:57 am
Hello Sincenatic.

The build process is indeed veeeeeeeeeeeeeeeeeeeery long. I started mine 6 month ago and I'm still not finished (Hopefuly I just have cosmetics modification left to be done).
From the photo you posted on FX Sabers you did a marvelous work !

Those tiny cards must be handle with much care indeed. I did ruin 2 DFPLayer and one MPU6050 myself.

From a diffusion perspective with leds, foam is only there to protect the blade you don't need that much indeed, and to resorb shadow aspects I do use crystal paper. Only 1 wrap around the foam does miracles without eating a lot of light.

Also beware of the MAX_BRIGHTNESS settings, EVERYONE (ledstrings, Luxeon or Neopixels users) !
I did ruin 2 segments myself with that too.
Make sure you set it correctly so you receive the correct amount of voltage.
You must keep that in mind at all times when you're building your device : OVERVOLTAGE WILL RUIN YOUR LIGHTS !!!
Use a multimeter, and don't take your weared segments as a reference: some leds (the first ones to receive current actually) has started to die and their inner resistance did climb.
The best way to do, in my opinion is to start low (around 120 not below !) and test a valid segment (with config menu) and NEVER set it to attain the max voltage your LED can take: that's a very, very, VERY bad idea !!!
For instance, The LEDs I use for my segments are rated l 3.2V, 3.4V. 3.4V is the max 1 LED can handle.
Mounted in seriallell II they should be able to take 6.8V.I use a power supply that can provide up to 8.4 volt (BAD, bad idea :P)... At MAX_BRIGHTNESS=190, with fully charged battery (very important) in config mode, when I mesure each LED they do receive 3.14V. In action mode they get between 2.7V and 2.9V. That's it. (Keep in mind that those values are specific to my device. You need to find the correct values for yours)
You won't get much more light from an extra 0.3V anyway and risk breakage.
That's something I need to warn users about:
Multimeter must be your best buddy when setting this.
And beware of connection breakage/shorts on your segments too. If a connection broke you can be sure the segment will die very soon from overvoltage.


Be sure also to use latest version of LSOS (>1.2). I made some corrections around that matter too, to ensure segments never receive more than the MAX_BRIGHTNESS the user did set.
I'm very sorry, version below 1.2 had major flaws in this regards, for ledstring users only. Please accept my apologies.



The very best solution, Protonerd gave me, on this is to NEVER, EVER use a power supply that exceed the max voltage your segment,LEDs, or strings can handle.
Again very sorry on this, I also learned that the hard way lately.



I don't understand very well the problem you encountered with LSOS. As far as I understand it, the fact you didn't run a calibration, your DIYino motion detector might always find a movement where there is none resulting on an endless loop of swing triggering (that can result in no sound, or choped sound start).
Changing swing sensitivity values would indeed dampen this problem, but the movements detection might not be very accurate.
Calibration process must be done to obtain best results ;)
In fact , from what I read in the past concerning motion detectors, calibration process should be done every 6 month or even less, depending on your location (altitude, position on earth relative to the pole - even if there's no magnetometer) and on the season (they are sensitive to temperature changes).



On the other hand if you were forced to remove your battery... This smells like short cuts/soldering weakness somewhere to me.
I'll add this shortly to LSOS "manual" too :
Don't take it bad but this is a common problem. Even If you did take a lot of care in your solderings, if you do move your board a lot, those wire/solderings WILL break over time. Believe me.
Rob Petkau from Genesis Customs Sabers explained it at several occasion in his tutorials video and I did experience it mysef on several occasions.
Shorts will then create unpredictable behavior. But most of the time it makes the board unsresponsive, it must trigger somekind of inner chipset protection.
You see it quite instantly: no more flicker, no more swings or clash gets triggered and you can't stop your saber unless you cut power off.


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jul 27, 2016, 10:07 pm
Hello,

I have been following the forum for some time, but as an "end user" rather than a developer. My particular interest is more on the led string itself, and I have just posted some information on how I made a blue-white color mix using 4 strings. If you're interested you can check out the post on:
http://www.fx-sabers.com/forum/index.php?topic=50315.0 (http://www.fx-sabers.com/forum/index.php?topic=50315.0)
Hey William, wonderful work on that string, they way you assembled your string is certainly unique, I've read every source of information about strings a while back and never encountered your idea, so you can rest assured that you made a new design which is worth to explore to those people building string sabers. I have a fellow here in Germany, he is also on the forum, I will recommend your technique to him, he explained he wanted to make the brightest LED string lade, he had quite a success so far, with your design he might even come closer to his ultimate goal. 400+ LEDs, that is crazy!!! On a video we will never see the nuance differences like the core being white and getting bluish towards the balde periphery, but if it really looks like howyou described it is closest to a movie feeling. If you can control the white segments independent of the blue, hell you can even pulse the white core and leave the blues at constant brightness, that would look awesome!

But you need to make a better sketch of the LED bending technique, from the few pics you've posted I could not decipher the method.

Looking at your picture with the saber I can now understand why you wanted to make a Thor's hammer BTW :)

Concerning the problems: I guess one of the passive components came loose, if it was a capacitor, probably you will never see the difference. But I'm glad you managed to solder it back, there are a few components which are really crucial for proper operation.

I think what was meant regarding the calibration is that I send out the DIYino boards with the calibrated values stored in EEPROM. Of course I cannot tell wether you included the code which actually reads out the values and assigns them to the offset registers... if not the MPU might not react correctly as neskweek described.
Regarding the stop of sound, it should come again if you make a special FX (swing, clash, blaster block or lockup), reasonbeing that in the current LSOS there is no hum relaunch. We are discussing with neskweek how to do it, but currenty you have to hum-extend all sound files like described in the LSOS readme. Once the individual FX sounds "run out of " hum reserve, sounds stops. This is normal. If there is nothing shorted in your boards, battery wherever, it should not be necessary to kill power, just trigger any FX and sound cames back.

As to the drag and drop of files, if you follow the naming instructions from neskweek, you do not need to copy one by one (until before neskweek showed me how to do it the smart way I also copied one by one, very tedious). Important is that the files have to begin with a number which increases for each sound. Like 001_hum 002_swing1, 003_swing2 etc. Put these files into a folder names 1, and drag&drop the whole onto your SD card, and the order will be kept. I will include a description how to do it right in the DIYino User Manual.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Sincenatic on Jul 27, 2016, 10:53 pm
Neskweek, thanks for the long and complete answer. I will definitely calibrate it. Initially I was just happy to have it working. Now I can try to take advantage of more of the capabilities. Concerning the "lost sound-problem" that occurred; I cover the board and the batteries with a plastic that I roll around everything, but it is possible that some sharp solder joint on the board has made a small hole in the plastic, which would mean that it can touch the inside of the hilt. The change in the settings could just have been a coincidence with not experience this problem. I will change the plastic for some harder plastic.

I have been using LSOS v1.2, so any overvoltage is my responsibility. If anyone gets confused, you can read my post on fx-sabers forum. I think the heating problem was caused by a poor solder joint, leaving too much current for the rest of the LEDs in the segment. Actually all the LEDs are still working, but the foam has melted in one part close to the hilt. The LEDs I use are fairly cheap, so I don't mind learning by doing - I will take your advice on the multimeter though! I will build a green - white mixed blade using the same technique, so I am not too concerned about the one that I use now.

Protonerd, Yes, I got completely caught up in the building process, and I didn't document all the steps for the bending. I will make sure to document it better the next time. Concerning the drag and drop, I had everything ordered in an archive, and selected all, dragged it and dropped it. Visually the order looked good, but apparently it was not. In any case, it was very quick to take one by one, so, as long as it works, I'm fine! For the calibration, what I did was just to uncomment the following values (and comment the UNIT1):
mpu.setXAccelOffset(-84);
mpu.setYAccelOffset(788);
mpu.setZAccelOffset(1137);
mpu.setXGyroOffset(7);
mpu.setYGyroOffset(6);
mpu.setZGyroOffset(7);
I will look into the script. Thanks for the comments!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: neskweek on Jul 28, 2016, 10:19 am
There's a trick for a "good" Drag and drop :

Order them by name.
Select all the files you want to copy.
click on the very first file on the list and drag to your SDcard.

Now the copy should be ordered.
Stupid Windows !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Sincenatic on Jul 28, 2016, 04:44 pm
Perfect. Thanks for the clarification.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Sincenatic on Jul 29, 2016, 04:49 pm
I have used the multimeter and in action mode each segment receives about 6.2V and since I have two sections in series, the LEDs are exposed to their minimum FV (according to the information sheet). (This test was done with fully charged batteries). The LEDs has a typical FV of 3.4 and I have no information on their maximum. In config mode they are overpowered, because I find voltage drop of 7.3-7.6V. I currently have the MAX_BRIGHTNESS set to 245. (Remember that I have 426 LEDs in the blade). What is the reason to allow higher voltage in config mode? If it would be possible I would like to reduce it, to be able to slightly increase the brightness in action mode. I should also clarify that I have no heat problems at all now. 
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jul 31, 2016, 08:29 am
So I think I made a boo-boo here with the LEDString...I tried to be cheap and not purchase the neo-pixels from adafruit and tried to go generic...problem is...the led strip I got is 5050 smd with 60 leds/meter but they have 4 connectors. RGB and Common ground. Are they still usable with LSOS? If so what modifications would I need to make...Proto...can the fire effect still be used with these or will I need to go to Adafruit and buy the genuine neopixels?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Aug 01, 2016, 09:26 pm
Hi Damien,

Can you post a photo of the string you bought? From the description it does not sound like a neopixels.

Generally neopixels are not cheap, but you can find cheaper than Adafruit. But look at the vendor or ask around in the forum, some sell degraded ware.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 01, 2016, 10:15 pm
definitely not neopixels
http://www.ebay.com/itm/331879405233?_trksid=p2057872.m2749.l2649&var=540944848752&ssPageName=STRK%3AMEBIDX%3AIT

I think for fire I will still have to buy the neopixels....but for these, they seem to have a common anode (that's the positive lead right?) and one lead each for R G B (which I assume are negative leads) and so it SHOULD work like a rgb LED with the need for mosfet gates (got this info from adafruit for their other led strings non-neopixels) but I may need more power...not sure...either way...I need to buy neopixels now
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 02, 2016, 02:38 am
Proto....I haven't tested this....BUT....it should work....I made a redesign to give you a sled that can house your electronics, battery, speaker and recharge port all on one unit....the trick was having it slide into the hilt from the top and then have the blade holder and button holder sandwich it in...like I said...I haven't printed it out to test it...BUT it SHOULD work....the wall thickness (if printed in nylon and reinforced with glue) should hold up to medium dueling...and...it's only 8.8" long...my shortest design ever...its not much to look at...no fancy design work. but when I get the chance I will print it out and test it.

http://a360.co/2anB8xc
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 04, 2016, 06:12 am
printing up a modified version of the test hilt I posted for Proto....my additions include room for either LED or neopixel quick release...so I can use it as a testbed....will let you know how it does....17 hour print here we come....(and that's without the pommel)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Torndo on Aug 04, 2016, 01:30 pm
First off I'd like to commend everyone in this thread for the outstanding work you have all done with a special shout out to Jakesoft, Nesweek and Protonerd for their hard work and the extra miles they take to push thus project along.

I stumbled on this thread when looking for a way to improve my Hasbro signature series Luke skywalker ANH removable blade saber (no luck finding a replacement blade holder yet) and have all the components on hand, just waiting on my LEDs to arrive, and had one question! In the wiring schematic on the github page do all the "to ground" symbols go to a common ground on the nano? eg on the right hand side of the board save for the negative side of the batteries which I assume would go to the ground on the left under the 5v pin?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 04, 2016, 07:24 pm
Yes
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Aug 05, 2016, 01:04 pm
First off I'd like to commend everyone in this thread for the outstanding work you have all done with a special shout out to Jakesoft, Nesweek and Protonerd for their hard work and the extra miles they take to push thus project along.

I stumbled on this thread when looking for a way to improve my Hasbro signature series Luke skywalker ANH removable blade saber (no luck finding a replacement blade holder yet) and have all the components on hand, just waiting on my LEDs to arrive, and had one question! In the wiring schematic on the github page do all the "to ground" symbols go to a common ground on the nano? eg on the right hand side of the board save for the negative side of the batteries which I assume would go to the ground on the left under the 5v pin?
All GND signals on the nano are shorted together on the board. So feel free to connect the signals marked with the GND symbol to connect them to any one of them.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 12, 2016, 02:58 am
So here's what I am going to try to build next

http://a360.co/2b9TxQO

Proto.....it's using a new version of that sled idea my wife had...so it should fit inside MHS hilts, I have the charge port in the pommel to save space....I just need something a little more compact for my dueling style....by the way...the nylon hilt I made to test its durability is still going strong in medium dueling....I have whacked it multiple times very hard and it's still going..
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 15, 2016, 10:56 pm
has anyone tested the neopixel blades in daylight conditions? how bright are they? I used a z6 led from naigon and I could only see color at the base of the blade, whereas my son's blue single die led was very dim but still brighter than my blade.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Aug 17, 2016, 08:18 am

For those planning to build a lightsaber using neopixel strips, I've put together a neopixels Characterisation (https://github.com/Protonerd/DIYino/blob/master/Neopixels_Characterisation_report1.pdf) for you guys to help with the dimensioining of your battery concept.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 18, 2016, 12:00 am
um thanks.....I have no idea what any of that meant....how BRIGHT is it during the day?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: novchinnikov on Aug 18, 2016, 07:54 am
Hello, guys!

i've been thinking about using single ws2812b with lens instead of luxeon led to achieve Neopixels advantages.

I have no Neopixel at hand so i trying to judge by the datasheets.

Is single neopixel piece that dim? Judging by my calculations from millicandela conversions it is around 1(!) lumen maximum for each color channel.

Is this game is really not worth the candle?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Aug 18, 2016, 11:13 am
um thanks.....I have no idea what any of that meant....how BRIGHT is it during the day?
It depends where you are during the day. In a dark room or outside under the sun on a clear day?

But to keep it simple:

Rule#1: no matter what kind of technique you use, there is no competing with the Sun!

Rule#2: it is not only about brightness but also about the lightsaber look. If you compose an LED string or a neopixel stripes, at full power they will be visible outside, but then they are not yet lightsaber-like AND you seriously endanger your eyesight by looking at them. You do not want to do that, instead the string/stripe has to be diffused and put into a blade tube. This will decrease brightness but make the lighting of the blade more even, which is what you wanna achieve.

Having said that, if you make a LED string blade from really good, high brightness rating LEDs, it might be visible even if you are outside. But still faint (see Rule#1). Neopixels is a new technology, so there is really no reference to judge. First people need to build lightsabers with stripes of different densities, different diffusing etc. and try them out in daylight.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Aug 19, 2016, 03:06 am
ever on the hunt for more powerful beams.....

https://www.youtube.com/watch?v=AYkxskCmInM

wonder if I could get just the laser module and modify it....
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Torndo on Aug 20, 2016, 12:20 pm
Hey guys,
I'm having a little trouble getting my nano to save the configuration mode settings. Everything works perfectly action mode, swings blocks and the config mode saves while powered but once I put the kill key in all config settings (fonts, volume etc) revert back to what it was set at at the first boot.

I've looked over the sketch but the solution eludes me.

I was going to put this on the github page but it won't let me sign up at the moment

I'd really appreciate any help
Thanks guys
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: sligs78 on Aug 23, 2016, 11:46 pm
Can buckpucks be used with the DIYino? I plan on making a RGB string blade with adjustable colors; three different buckpucks would be on each leg of the RGB led. Would the buckpuck interfere with the output of the DIYino and PWM?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Aug 24, 2016, 07:21 pm
I am curious, is there an updated full-saber schematic for Neopixels, now that they're integrated into LSOS? I'm kind of basing my wiring off a combination of the LSOS diagram, and the DIYino wiring diagrams showing neopixels (as well as I can understand it. Learning a lot here). I'd love to have one that's dedicated to running neopixels from the individual components though for those of us attempting a scratch build. Might be nice to have a separate diagram for an RGB LED as well, in case someone is running that, since it's also supported.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Sep 29, 2016, 06:52 pm
Does anyone know of a safe way to charge batteries running in parallel for extra amp hours? I am thinking of combining two 18650 6000mah 3.7v batteries to double the amps to run the neopixels.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Sep 29, 2016, 10:01 pm
Does anyone know of a safe way to charge batteries running in parallel for extra amp hours? I am thinking of combining two 18650 6000mah 3.7v batteries to double the amps to run the neopixels.
I do not know any reason why that should not work... if you have a Li-Ion charger which can charge a single 3.7V cell, it can be used to charge 2 of them as well. I have such a config and for my neopixels I already wired up 2x 18650 in parallel, going to a single recharge port. I charged this combo a few times, so far no adverse effects. I use 2 protected ones. I'm not sure if that counts though...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Sep 30, 2016, 01:27 am
My dad who has experience in electronics said that doing it that way can eventually lead to voltage irregularities as one charges better than the other, but I'm thinking the PCB on each one should help that. Proto, how are you putting them inside your hilt? Side-by-Side or one in front of the other?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Sep 30, 2016, 08:52 am
My dad who has experience in electronics said that doing it that way can eventually lead to voltage irregularities as one charges better than the other, but I'm thinking the PCB on each one should help that. Proto, how are you putting them inside your hilt? Side-by-Side or one in front of the other?
That is something you are the master in  :) with your superb 3-D chassis. I would like to have such sleds to simply slide in.
Side-by-side is a nogo for most hilts, there is simply to enough room to accomodate 2 18650 (they are at least 18mm wide, 36 side-by-side, there is no hilt on the market which have an ID so large). So in my next build I will place them on top of each other, this basically already fills that particular hilt (ASP from SaberForge, nice hilt but awefully small room inside), maybe I can squeeze in a DIYino on top of the lower battery facing down to the pommel.

BTW, your father I guess is right, that is why those who use such batteries in larger quantities like RC cars/planes etc. use balancing circuits.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 06, 2016, 06:46 pm
I bought some charging boards and am waiting on my second string of neopixels to finish my brother's birthday saber, will show off when its all done.

Anyone with coding experience want to tackle the code LSOS is using for neopixels to allow it to also use the RGBW version of neopixels?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 07, 2016, 08:52 am
I bought some charging boards and am waiting on my second string of neopixels to finish my brother's birthday saber, will show off when its all done.
Looking forward to see the pics!!! We are all thirsting to see new neopixel sabers, so don't be shy :)

Quote
Anyone with coding experience want to tackle the code LSOS is using for neopixels to allow it to also use the RGBW version of neopixels?
I'm not sure the gain would justify the effort. Reason is, neopixels draw a dramatically high current with 3 LEDs per pixel, my assumption is that with an additional die they could easily trip a magic threshold from where onwards they could be simply technically not be viable for lightsabers.

I personally think people should try to build saber first with high-density stripes and once it has an established supply scheme we can consider going to the next level:
https://www.adafruit.com/products/2242
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 07, 2016, 07:08 pm
I agree with high density, but I accidentally got rgbw...so...pretty useless...also I am working on a parallel battery setup using two 3.7v 18650 6000mah batteries....shoudl provide plenty of juice, still waiting on my P channel MOSFET to arrive, my 3D design has my hilt at 11" long, going to see if I can shrink it down to 10"
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 10, 2016, 12:22 pm
p-channel MOSFET? Wow, that must be a new idea! Explain!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 11, 2016, 09:07 pm
P-Channel MOSFET would go between the protection circuit for the batteries and the DIYino's link to the charge port. Basically, when it detects the negative lead coming from the open charge port it will connect the circuit, but when Kill Key is in charge port, it will disable power so the battery won't drain.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 12, 2016, 11:50 am
P-Channel MOSFET would go between the protection circuit for the batteries and the DIYino's link to the charge port. Basically, when it detects the negative lead coming from the open charge port it will connect the circuit, but when Kill Key is in charge port, it will disable power so the battery won't drain.
I'm not sure I get the meaning... if you plug in the kill key, the battery is decoupled from the circuitry. So no current can flow, no discharge can happen. That is why it's called kill key, it "kills" power from battery to anything else it supplies. There is no need for any additional measure. But maybe I got you wrong, maybe a drawing would be helpful.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 14, 2016, 08:57 pm
I am referring to my parallel battery setup. Each battery needs a circuit board to regulate power and prevent overcharging a dying battery, the current board I have would then not have a shutoff feature, so I will use a P Channel MOSFET to turn it off and on
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 17, 2016, 08:14 pm
Nevermind, I used the negative output lead to feed back to the charge port and everything is fine, but in order to charge it I have to use a 7.2v charger instead of 3.7. Just something new I was playing around with.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 17, 2016, 09:31 pm
I am referring to my parallel battery setup. Each battery needs a circuit board to regulate power and prevent overcharging a dying battery, the current board I have would then not have a shutoff feature, so I will use a P Channel MOSFET to turn it off and on
Care to make a drawing and share? This could be a new idea to further the hobby!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 17, 2016, 09:33 pm

I started to brainstorm on a v2 of the DIYino Prime board over the last weekend, collecting ideas in my head, reading through the numerous posts on the Arduino Forum to collect the Feedbacks from others using the board what Features saber builders would like to see in an improved version.

The very first thing I wanted to give a try was an idea I had for a Long time: to connect both an FTDI and a USB device on-board to the USB port and see what happens. I knew that the FTDI chip (USB to UART) would likely dominate the bus, so I thought about how to make it release the USB signals.
I looked at the Manual, but no hint, then I saw a pin named reset. Wow, a resetted chip shal leave the bus alone for sure. Idea was quickly followed by action, I made the FTDI reset pin accessible, hooked up the MP3/Wav Decoder chip on-board to the USB, resetted the FTDI and...
... my Windows displayed the content of the SD-Card on the DIYino.

I was able to format the SD-Card without even removing it, upload new set of sound files. So the DIYino Prime v2 will for sure contain signals to pull this trick, imagine not even removing the SD card to upload new content! I'm quite happy that I found this trick...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Oct 17, 2016, 09:42 pm
Man, that sounds amazing. I've gotta figure out what I can sell to be able to grab one.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 17, 2016, 11:17 pm
Would you also be willing to give us guys who build our own board setups an idea on how to wire that? I asked Nes if there was a way to make LSOS a One Button setup, using the double-click feature of the OneButton sketch....I know he's got better things to do, but if anyone out there can figure it out, I'd love see that..would make my saber designs more compact if I could eliminate the extra button.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 18, 2016, 10:30 pm
Would you also be willing to give us guys who build our own board setups an idea on how to wire that? I asked Nes if there was a way to make LSOS a One Button setup, using the double-click feature of the OneButton sketch....I know he's got better things to do, but if anyone out there can figure it out, I'd love see that..would make my saber designs more compact if I could eliminate the extra button.
Do not nail me down on it, but I also plan on making a saber with only one button. The new LSOS I'm going to release in the coming weeks make use of different button tap modes, so I'm confident that a single button Code would still be able to maintain most of the Features, other could be moved to Settings stored attached to a sound font.

But actually with the button library neskweek provided with the original LSOS it's a fairly easy game to make it one-button compatible. Remember, I started this whole project with no experience in C++ coding, it's a proof that you can learn these skills as well.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 18, 2016, 10:49 pm
I'd love to see that....I have seen sketches use the double-tap of OneButton to change direction of input values from the button...for instance...

in Config Mode

click increases value in positive direction....then double-click reverses the direction until you have it set to where you want....

When in Run Mode

double-click could enter Config Mode
click enables ignition, if saber is running, click now puts saber into lockup mode until next click toggles off
hold button turns saber off

Just some thoughts
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 18, 2016, 10:56 pm
Also, I tested out wiring NeoPixels through an audio connector so I can detach the blade for storage, first test worked well..I now have to solder the connectors permanently to the neopixels and then place them inside my 3D printed housing to keep them in the blade. the mate will sit inside the hilt. finally got my second string of neopixels and am working with a 6000mah battery I got from ebay. Will probably finish the wiring and assembly on Wednesday. This is a project I've been working on for my brother's birthday present. So when I'm done, I will post pics of the final product. I am using this also as a test bed for my future designs.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 30, 2016, 10:10 pm
After months of work, lot of soldering, coding, field testing I happy to announce

LightSaberOS 1.3 (https://github.com/neskweek/LightSaberOS/tree/LSOS-1.3)

The new version is based fully on neskweek's orignal release and targeted to improve the structure of the code, clean up stuff, and add new features.

What is new (in a nutshell):
- Hum Relaunch - yes, it is finally here. Now the hum never stops playing as nong as the saber is on and you just need to add a few secounds of hum to the sound files. How many? You can define it in the code.
- Finite State Machine rework: state transitions are now clearly defined as verbose names in the code, to ease modification
- added Jukebox to play music files with light effects from the saber
- smooth ignition/retract for LED string sabers
- blaster blocks can be triggered both with button and gestures
- SoundFont.h file has a clearer structure, supporting folders on the SD-card
- neopixel blades can go up as high as 120 neopixel LED modules (i.e. 240 back-to-back!!!), enough to populate a 32" long blade fully with the densest neopixel stripe available)
- added FireBlade effect selectable for neopixels to replace traditional blade FX
- optimized MP3 and MPU libraries for leaner code
- no audion Pop upon start-up
- new version makes use of double click on main and lockup buttons
- new blaster bolt dispersion effect for neopixels

What stays:
- still Supports ALL currently available blade types: HP-LED (LUXEON), segmented LED strings (LEDSTRINGS) and RGB neopixel stripes (NEOPIXEL)
-  implements all FX common to High-End saber boards: power-on, power-off, blade lockup, blaster bolt deflect on-the-go and press-button, swing detection with neskweek's quaternions-based algorithm, instant clash detection and some more like wrist twist, spin
- config menu to adjust volume, select Sound font etc.

I'm now working on a better readme on GitHub, in the meantime I uploaded pics for the Finite State Machine:
FSM top level (https://github.com/neskweek/LightSaberOS/blob/LSOS-1.3/README/LSOS13_TopLFSM.jpg)
FSM action mode (https://github.com/neskweek/LightSaberOS/blob/LSOS-1.3/README/LSOS13_ActionModeFSM.jpg)

Special thanks to
neskweek for his initial Code, laying the foundation of the world's first open source saber Software
JakeSoft for his many inspiration and ideas along the way
DJWing for his valuable field testing

Please note that although a lot of field testing was done before this release, the Code still might contain bugs. If you happen upon any, kill them by Fixing them. Please only shout to me or anyone if you can't find the solution. If all else fails, please report such persistent Bugs on GitHub and I will try my best to fix it.

But first and foremost: enjoy!!!




Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Nov 01, 2016, 12:29 pm
Nice, well done :)
and glad to see you're trying to make the code clear by using a very descriptive state machine approach :D. i hope it helps a lot of other people better understand how to code :).

I'm slowly coming back to making my stm32 based saber :). Have got lots of awesome things i'd love to experiment with in combination with sabers. I hope i'll find the time (and that the result will be nice :) ). Gotta love saber building/programming XD.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 02, 2016, 11:30 am
Nice, well done :)
and glad to see you're trying to make the code clear by using a very descriptive state machine approach :D. i hope it helps a lot of other people better understand how to code :).

I'm slowly coming back to making my stm32 based saber :). Have got lots of awesome things i'd love to experiment with in combination with sabers. I hope i'll find the time (and that the result will be nice :) ). Gotta love saber building/programming XD.
Glad to see you are back to build sabers again :) Feel free to reuse parts or all of the code and tweak it to your needs. I improved the FSM exactly for the reason you rightly guessed at: to make it easy for people to understand and change it. Since most of the state transitions happen due to an interaction with either one of the buttons, it makes it even easier to adapt the code without touching the core functionality.

What will be your next build? Still experimenting with neopixels? I could well use someone with experience there.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Vulkan on Nov 03, 2016, 10:43 am
Hi all,
I love the work that's been done here, been flicking though a few pages per day trying to absorb all the information. More of a built it type of person so not too great on code and can solder components together quite well, with superb cable management.
I have been looking into different power supplies, obiously LiPo supplies. The issue im running into is space, as always. The space I have are the ASP saberforge components. Havent ordered the saber yet as im working with the electrics first. With 1 inch diameter, I cant fit 2 18650's atop of each other. I have 2 options and I wanted to get some opinions:

1. Boost a single 18650 to 7.4 volts and run that to my Luxeon tri rebel and the arduino nano. I can then sit the electrical components in front of the battery. I like this idea as the 18650's are in great availability however if I do this I will loose saber usage time by about a half factor, turning 3000mah @ 3.7v to 1500mah @7.4v (considering that I get a perfect step up to 7.4v.

2. I use 16650 sanyo batteries, where I can fit them in front of each other, and the electronics atop of it. That way I get 2200mah @7.4v.

How have you approached the issue of power supply.



Also a quick note, do I need to put a resistor between the batteries and the Blade male (as per the diagram) or will the mosfets do that if I set the right max power.

Thanks
~Vulkan
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Nov 03, 2016, 01:40 pm
Glad to see you are back to build sabers again :) Feel free to reuse parts or all of the code and tweak it to your needs. I improved the FSM exactly for the reason you rightly guessed at: to make it easy for people to understand and change it. Since most of the state transitions happen due to an interaction with either one of the buttons, it makes it even easier to adapt the code without touching the core functionality.

What will be your next build? Still experimenting with neopixels? I could well use someone with experience there.
finalizing what i set up earlier (maybe even for the first time try to make a custom pcb to make things a bit more compact). And indeed still working with the neopixels.
I'm also still looking into how i'll stream sounds (and i've been thinking about what would be needed to make a basic arduino sound module. I think it would be possible to take an arduino nano, attach an I2C dac to it, an SPI flash ship, and make a custom little sound module that allows for very dynamic saber sounds.)
But first i have to finalize such functionality on my stm32 based project and see how well the results are :).

I'd love to have a nice first version to demo with very natural sounding sounds, that react nicely on your swinging/clashing.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 03, 2016, 02:27 pm

I managed to put together a release video showing the major features of the new LSOS 1.3

LSOS v1.3 release video (https://www.youtube.com/watch?v=serx8EY3zgw)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Nov 03, 2016, 03:35 pm
I managed to put together a release video showing the major features of the new LSOS 1.3

LSOS v1.3 release video (https://www.youtube.com/watch?v=serx8EY3zgw)
niiice :)
i'm impressed how far you got with the neopixels on a little arduino :)
i love the extra headroom i get with the stm32's with the extra ram & dma capabilities to address things like neopixel strings, but you've got some nice effects running on it via a humble avr :).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Nov 04, 2016, 03:02 am
After months of work, lot of soldering, coding, field testing I happy to announce

LightSaberOS 1.3 (https://github.com/neskweek/LightSaberOS/tree/LSOS-1.3)

The new version is based fully on neskweek's orignal release and targeted to improve the structure of the code, clean up stuff, and add new features.

I may have to snag some of these optimizations for the Universal Saber Library. It's something I wanted to look into. Thanks for saving me some work!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Nov 04, 2016, 03:37 pm
Proto, you amaze me...here is what I did with Proto's code and my 3-d printer...

https://www.dropbox.com/s/9gxm6g7gvfjcqa4/IMG_3123.MOV?dl=0


Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 11, 2016, 10:47 pm
I'm currently in the brainstorming phase what to change for a v2 of the DIYino board. During my searches I stumbled upon another AVR, the Atmega32U4. This one has an in-built USB controller!!! Maybe the one controller I've been looking for all these times? I quickly collected pros and cons:


Pros:
- it has USB, I do not need FTDI
- this in turn saves space on the board
- it has 2.5k SRAM, so less likely to run into memory leakage problems. Considering that I'm looking at a board which can deal with memory eaters like neopixels and OLEDs for blasters, not to be neglected.
- one more PWM channel, lot of I/O (OK, I do not really need them)
- seems similar to 328P, it is also a low-power chip in sleep mode
- I can eliminate the board access for bootloader signals (all these AVRs come with pre-burned bootloader) and the FTDI breakout signals (no need), reducing board size even more

Cons:
- slightly bigger? OK, then what? Still less space than a 328P + FTDI
- 32 kBytes of Flash, but 4 kBytes are used up by bootloader. I.e. less code space than the 328P (28.672 bytes, like Leonardo). Current LSOS does not fit into it. I guess the code has to be optimized or some nice to have's eliminated?

Unknowns:
- if I can somehow connect both AVR USB port and the MP3 chip USB port both to the USB connector? This is what I'm mainly working on for a Prime v2.
- generally unknown AVR, but should be similar to 328P I guess

Any insight from more experienced Arduino developers?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Nov 12, 2016, 03:58 pm
I'm currently in the brainstorming phase what to change for a v2 of the DIYino board. During my searches I stumbled upon another AVR, the Atmega32U4. This one has an in-built USB controller!!! Maybe the one controller I've been looking for all these times? I quickly collected pros and cons:


Pros:
- it has USB, I do not need FTDI
- this in turn saves space on the board
- it has 2.5k SRAM, so less likely to run into memory leakage problems. Considering that I'm looking at a board which can deal with memory eaters like neopixels and OLEDs for blasters, not to be neglected.
- one more PWM channel, lot of I/O (OK, I do not really need them)
- seems similar to 328P, it is also a low-power chip in sleep mode
- I can eliminate the board access for bootloader signals (all these AVRs come with pre-burned bootloader) and the FTDI breakout signals (no need), reducing board size even more

Cons:
- slightly bigger? OK, then what? Still less space than a 328P + FTDI
- 32 kBytes of Flash, but 4 kBytes are used up by bootloader. I.e. less code space than the 328P (28.672 bytes, like Leonardo). Current LSOS does not fit into it. I guess the code has to be optimized or some nice to have's eliminated?

Unknowns:
- if I can somehow connect both AVR USB port and the MP3 chip USB port both to the USB connector? This is what I'm mainly working on for a Prime v2.
- generally unknown AVR, but should be similar to 328P I guess

Any insight from more experienced Arduino developers?
IMO, less code space is a deal breaker. I'm running out of space already to add features that I want to my USaber-based sketch. As you said LightsaberOS is running out of space too. Code optimizations can only take you so far, although I do agree there is still plenty of work to be done there in both solutions.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Nov 13, 2016, 06:22 pm
Is there any way we can store the code on the SD Card of the DFPlayer Mini and have arduino board pull it from there?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Nov 13, 2016, 06:32 pm
Also, when I do a search for the board I get the Arduino Micro and it shows that pins 2 and 3 are the SCL and SDA, so we're lose a PWM, we also don't have pin 11, so isn't that fewer PWM than pro mini?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Vulkan on Nov 14, 2016, 09:19 pm
Hi all,
Getting real excited about my project for this, all my parts are arriving in the mail but by bit, and I'm starting to assemble the electronics. I jus st want some advise about the batteries.

I'm running 2 18650's Samsung 3000mah in series, should I add a protection circuit to both of them? Or don't add a protection circuit to them?

Thanks
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Nov 14, 2016, 11:16 pm
Don't run in series, run in parallel, and each one will need it's own protection circuit...you don't need 7.4v for these builds, 3.7v is actually what we mainly use, unless you're going LEDString..but I recommend the Neopixels.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Nov 14, 2016, 11:29 pm
Especially when you consider that 3.7v is actually closer to 4.2v when fully charged. That makes the 7.4v More like 8.4v.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Nov 15, 2016, 02:11 am
Also, when I do a search for the board I get the Arduino Micro and it shows that pins 2 and 3 are the SCL and SDA, so we're lose a PWM, we also don't have pin 11, so isn't that fewer PWM than pro mini?
If it's anything like the 328p, then the SCL and SDA pins are only so when the reset is held low, so the pins may still be usable when running a sketch.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Nov 15, 2016, 02:31 am
I don't know how that works with the MPU6050 wired to them...would we get weird signals? Also, is pin 2 and 3 the interrupt pins for this model?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Vulkan on Nov 15, 2016, 03:58 am
Well actually, the two batteries were from portable chargers. So they have an output of 5v. Putting them in parallel I'll have around 2.2amps per battery. That being 4.4amps in total, at 5v with the charging circuit and pcb integrated (the board was originally made for charging you phone). All I need to do is run the kill key where the button currently is, so that it's always on or always off, otherwise I'll need to kick the button constantly to keep clicking the button.That sound better?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Vulkan on Nov 15, 2016, 09:29 am
Also, made some progress throughout the day, and got it to the bread board. So far necessary resistors, the MP3 module, accelerometer/clash sensor and ardino uno (for testing) is wired together, however my MP3 module is heating up where the micro SD card goes. The only other thing the MP3 module needs is speakers. Is the heat being produced because the left over current necessary for the speakers?

heres what the debug gives me on the serial monitor

DEFAULT VALUE
Initializing I2C devices...
Testing device connections...
MPU6050 connection successful
Initializing DMP...
Enabling DMP...
Enabling interrupt detection (Arduino external interrupt 0)...
DMP ready! Waiting for first interrupt...
Connecting to DFPlayer...

it hangs at that point and that is when the heating starts.



I think I have the wrong MP3 module, ordered a new one, should arrive in 1-2weeks =P
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Anonomas11 on Nov 26, 2016, 05:12 am
Hi all, newbie arduino user here

I'm using an arduino clone but i can't seen to get this thing to work. I've wired up according to the diagram, except for the led wires as im in the process of ordering them. i've put the code in but i keep getting a message saying include <df player.h> . Could someone point me in the right direction?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Nov 27, 2016, 11:23 am
I finally assembled my stm32 saber with the sound dynamically reacting to motion (haven't implemented collisions yet). I'm quite pleased with the result, it's working pretty nice already XD.

Lightsaber test (https://www.youtube.com/watch?v=uuLPOUw_mIM)

Still lots & lots of work on it, but it's slowly improving :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 27, 2016, 06:52 pm
I finally assembled my stm32 saber with the sound dynamically reacting to motion (haven't implemented collisions yet). I'm quite pleased with the result, it's working pretty nice already XD.

Lightsaber test (https://www.youtube.com/watch?v=uuLPOUw_mIM)

Still lots & lots of work on it, but it's slowly improving :)
Awesome! I'm thinking about how to achieve the same, best if wo/actually needing to do Sound processing on the uC.
How much code space and RAM does one need to be able to pull of this feat? With this swing processing becomes obsolete, which I would definitely be happy to ditch if a better option comes my way.

Really awesome!

Just to continue the row of good news: DJWing79 implemented an altered version of LSOS v1.3 using a single button, and still all high-end saber functions work!!! I tried it out with a sabe I had having a single button, I was really amazed. I guess from now on I will not bother to have multiple swicthes!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: racemaniac on Nov 27, 2016, 07:32 pm
Awesome! I'm thinking about how to achieve the same, best if wo/actually needing to do Sound processing on the uC.
How much code space and RAM does one need to be able to pull of this feat? With this swing processing becomes obsolete, which I would definitely be happy to ditch if a better option comes my way.
It's really hard to translate this between an 8-bit AVR and a 32-bit arm processor. right now i think i'm using about 6kb of ram for the sound processing (but that's then capable of 8 channels! the swinging you here there is just 2 of those channels being mixed between). and the processing power is also not that much (the IO is far worse, which ofcourse is why i love having an STM32 which does it all in the background via DMA).

If i'd make something like that with an arduino, i think making a small sound module with an arduino nano (i2c port for the DAC, spi port for sd card & flash memory chip to cache on), and then maybe communicate to it in parallel via some pins (or a shift register attached to some of the pins). would be possible. 2kb of RAM should be enough to set up 2 soundstreams, and do some basic math to mix them together.
btw, i'm not streaming directly from an sd card since latency, the 512 bytes block size, ... so i read wav files from an sd card, store them on an spi flash memory chip (which is on the same port spi port), and then stream from that memory chip which is a lot faster, has no latency, and can work in blocks of 128 bytes :).
Currently i use a flash chip with only 4 megabytes capacity (but the demo you see there uses 800kb of sound data XD. you don't need huge samples if you process the sound dynamically :D).
but i've got some flash chips here that can store 128 megabytes, which would be a nice upgrade XD. (and more work).
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Vulkan on Nov 27, 2016, 11:19 pm
Hay protonerd, where on github can I find that singular button code?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: MacPhersonX on Nov 29, 2016, 01:14 pm

Code: [Select]
int16_t ax, ay, az;
  int16_t gx, gy, gz;
  int16_t accgyro_temp[6];



    else { // motion engine actions
      accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
      accgyro_temp[0]=ax;
      accgyro_temp[1]=ay;
      accgyro_temp[2]=az;
      accgyro_temp[3]=gx;
      accgyro_temp[4]=gy;
      accgyro_temp[5]=gz;
     
      ax = ax- ax_prev;
      ay = ay- ay_prev;
      az = az- az_prev;
      gx = gx- gx_prev;
      gy = gy- gy_prev;
      gz = gz- gz_prev;
     
      ax_prev=accgyro_temp[0];
      ay_prev=accgyro_temp[1];
      az_prev=accgyro_temp[2];
      gx_prev=accgyro_temp[3];
      gy_prev=accgyro_temp[4];
      gz_prev=accgyro_temp[5];
     

      // ************************* blade movement detection ************************************
      if ((abs(ax) > 1000 or abs(ay) > 1000 or (az) > 1000)) { is there any movement to trigger motion detection

        if ((abs(ax) > 4000 or abs(ay) > 4000 or (az) > 4000)) { // threshold for Clash (values depend on Acceleration Range used!!!)
          if (SupressCounter >= 3) {
            if (verboseprint) {Serial.println("Clash") ;}
            Sound_PlayClash(SoundFontIdx);
          }
        }
        else {
          if (SupressCounter >= 30) {
            if (verboseprint) {Serial.println("Swing");}
            Sound_PlaySwing(SoundFontIdx);
           
          }
        }
      }
      else {
        if (verboseprint) {Serial.println(F("\nNo activity, continue hum"));}
      }
      // ************************* blade movement detection ends************************************
   



I want to warn you that my english is very bad.
I would like to know what is meant by verboseprint and SupressKounter in your code. 

sketch_nov29a.ino:117:15: error: 'SupressCounter' was not declared in this scope

thank you in advance
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 01, 2016, 09:05 pm
Hi all, newbie arduino user here

I'm using an arduino clone but i can't seen to get this thing to work. I've wired up according to the diagram, except for the led wires as im in the process of ordering them. i've put the code in but i keep getting a message saying include <df player.h> . Could someone point me in the right direction?
Care to tell which Arduino IDE and board Manager version are you using?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 01, 2016, 09:07 pm
Code: [Select]
int16_t ax, ay, az;
  int16_t gx, gy, gz;
  int16_t accgyro_temp[6];



    else { // motion engine actions
      accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
      accgyro_temp[0]=ax;
      accgyro_temp[1]=ay;
      accgyro_temp[2]=az;
      accgyro_temp[3]=gx;
      accgyro_temp[4]=gy;
      accgyro_temp[5]=gz;
     
      ax = ax- ax_prev;
      ay = ay- ay_prev;
      az = az- az_prev;
      gx = gx- gx_prev;
      gy = gy- gy_prev;
      gz = gz- gz_prev;
     
      ax_prev=accgyro_temp[0];
      ay_prev=accgyro_temp[1];
      az_prev=accgyro_temp[2];
      gx_prev=accgyro_temp[3];
      gy_prev=accgyro_temp[4];
      gz_prev=accgyro_temp[5];
     

      // ************************* blade movement detection ************************************
      if ((abs(ax) > 1000 or abs(ay) > 1000 or (az) > 1000)) { is there any movement to trigger motion detection

        if ((abs(ax) > 4000 or abs(ay) > 4000 or (az) > 4000)) { // threshold for Clash (values depend on Acceleration Range used!!!)
          if (SupressCounter >= 3) {
            if (verboseprint) {Serial.println("Clash") ;}
            Sound_PlayClash(SoundFontIdx);
          }
        }
        else {
          if (SupressCounter >= 30) {
            if (verboseprint) {Serial.println("Swing");}
            Sound_PlaySwing(SoundFontIdx);
           
          }
        }
      }
      else {
        if (verboseprint) {Serial.println(F("\nNo activity, continue hum"));}
      }
      // ************************* blade movement detection ends************************************
   



I want to warn you that my english is very bad.
I would like to know what is meant by verboseprint and SupressKounter in your code. 

sketch_nov29a.ino:117:15: error: 'SupressCounter' was not declared in this scope

thank you in advance

Wow, holy cow, that Looks like my ol' first goody saber Code :)

While I really grew fond  of it, I think you'd be better of with USaber from Jake or with LSOS:
https://github.com/neskweek/LightSaberOS/tree/LSOS-1.4_singlebutton
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 01, 2016, 09:24 pm
I'm happy to announce yet another release of the LightSaberOS from neskweek and myself. Now the number of contributors grew from two to three heads, including DJWing79 who came up and went on to implement a spin-off using only a single button but still managing to keep all the features we currently have in LSOS, which is turn includes pretty much everything proprietory saber boards offer.

LSOS v1.4 - Single Button (https://github.com/neskweek/LightSaberOS/tree/LSOS-1.4_singlebutton)

Here is a video showing the new control mechanism in action:
Single Button demo (https://www.youtube.com/watch?v=qAy1VTHSvfs&t=3s)

The new feature can be enabled by uncommenting:
#define SINGLEBUTTON

Using a single button works like this:

Idle Mode:
- click: turn on saber (Action mode)
- double click: start Jukebox
- Long press: enter Config Mode

Config Mode:
- click: increment/next
- double click: go to next config menu item
- Long press: Exit config mode

Jukebox:
- click: pause/resume
- double click: Exit Jukebox
- Long press: next song

Action Mode:
- click: enable lockup-on-clash, this is my favorite new Feature. The lockup mode is entered but actual lockup FX only starts with a clash. This is a much better approximation of th esequence leading to a lockup and does not need exact user interaction during the "heat of the fight". A new click stops the lockup. If you have an illumnated switch with an accent LED, you can make it blink.
- double click: similarly to the lockup-on-clash, a double click starts/Ends Motion triggered blaster blocking.
- Long press: turns off saber
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Dec 03, 2016, 04:26 am
I created a video tutorial that walks through the MPU6050 calibration process. I use one of Protonerd's DIYino boards in the video, but same process will obviously work with home-brew solutions with MPU6050 breakout boards as well.

https://youtu.be/sKuiGC6Mxf0 (https://youtu.be/sKuiGC6Mxf0)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: xl97 on Dec 06, 2016, 05:46 pm
Awesome! I'm thinking about how to achieve the same, best if wo/actually needing to do Sound processing on the uC.
How much code space and RAM does one need to be able to pull of this feat? With this swing processing becomes obsolete, which I would definitely be happy to ditch if a better option comes my way.

Really awesome!

Just to continue the row of good news: DJWing79 implemented an altered version of LSOS v1.3 using a single button, and still all high-end saber functions work!!! I tried it out with a sabe I had having a single button, I was really amazed. I guess from now on I will not bother to have multiple swicthes!
Reminds me of the same approach form Hilt Works..  (5+ years ago)


https://www.youtube.com/watch?v=YdohjIt8hOs

dynamic audio/altering in real time based on saber position/action
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 07, 2016, 11:36 am
Reminds me of the same approach form Hilt Works..  (5+ years ago)


https://www.youtube.com/watch?v=YdohjIt8hOs

dynamic audio/altering in real time based on saber position/action
How come it never went into production?

I would also love to do it, but I feel it would not be an Arduino open-source project any more. What I mean is: audio processing is advanced stuff
- it requires much bigger processing power, i.e. a bigger, faster, more expensive uC
- hardware wise it would require access to the storage media, could be done, but not easily if there is also a dedicated MP3 chip with unknown protocol implementation
- the coding of such a dynamic mixing goes well beyond the scope of most people's skills in programming (including myself probably, at least without spending considerable effort), which means people will simply take the code available, without actively contributing to its development
Summing it all up: as it would end up in having to provide/sell both HW and SW, people could as well buy a proprietary saber core available with this feature (PL CF has this dynamic effect already).

But what keeps popping up in my mind is (and now it's time for hardware expertise guys!), how this feature could be implemented simply by adjusting parameters of the audio amplifier? Could somehow the DAC values or feedback ratio be distorted in a controllable manner to have a similar effect?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Dec 08, 2016, 01:34 am
How come it never went into production?

I would also love to do it, but I feel it would not be an Arduino open-source project any more. What I mean is: audio processing is advanced stuff
- it requires much bigger processing power, i.e. a bigger, faster, more expensive uC
- hardware wise it would require access to the storage media, could be done, but not easily if there is also a dedicated MP3 chip with unknown protocol implementation
- the coding of such a dynamic mixing goes well beyond the scope of most people's skills in programming (including myself probably, at least without spending considerable effort), which means people will simply take the code available, without actively contributing to its development
Summing it all up: as it would end up in having to provide/sell both HW and SW, people could as well buy a proprietary saber core available with this feature (PL CF has this dynamic effect already).

But what keeps popping up in my mind is (and now it's time for hardware expertise guys!), how this feature could be implemented simply by adjusting parameters of the audio amplifier? Could somehow the DAC values or feedback ratio be distorted in a controllable manner to have a similar effect?
If there was some way to mess with the clock on the MP3 chip it could be tricked into modifying the playback speed. I suspect that's how the effect is accomplished. Much like spinning a record slowly or faster changes the pitch.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Mazza99 on Dec 08, 2016, 03:11 pm
I definitely need a working lightsaber...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Dec 21, 2016, 12:18 am
Has anyone ever tried these? It says it needs a different protocol than neopixels, and I'm wondering how difficult it'd be

https://learn.adafruit.com/pixie-3-watt-smart-chainable-led-pixels/overview
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Dec 21, 2016, 02:16 am
Has anyone ever tried these? It says it needs a different protocol than neopixels, and I'm wondering how difficult it'd be

https://learn.adafruit.com/pixie-3-watt-smart-chainable-led-pixels/overview

Hmm... I wonder how they compare brightness-wise to traditional HP-LEDs from Luxeon and Cree. Trying to chain them in a string blade would probably run into some power and/or battery life limitations. Maybe  could use it for an in-hilt LED set-up though. Although, I don't see the advantage over just doing the traditional way if you're going to do that.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 22, 2016, 01:52 pm
Hmm... I wonder how they compare brightness-wise to traditional HP-LEDs from Luxeon and Cree. Trying to chain them in a string blade would probably run into some power and/or battery life limitations. Maybe  could use it for an in-hilt LED set-up though. Although, I don't see the advantage over just doing the traditional way if you're going to do that.
When I first saw it I also though that it was more your domain Jake! I did not read the full documentation, but I gleamed that

1. they limit the current to ~350mA, which happens to be the nominal current of most HP-LEDs, so in a sense this module makes sure not to overdrive the LEDs.
- pros: less current consumed, longer battery life
- cons: less bright. As you mentioned, I assume they are not as bright as Luxeon or Cree, but I could be proven wrong. I need to look more at the details.

2. It also takes care about overheat, which means there is no need for a heat sink
- pros: less space in hilt
- cons: well, not exactly a con, I just wanted to note that I do not know how they compare to a star PCB size-wise.

3. In-built PWM:
- pros: no need for external drivers, more precise color mixing as with a traditional approach


Chaining them is a nogo IMHO. In terms of wiring, well, they need 3 wires, an RGB HP-LED needs 4, not a big difference. If you have a kill-key, then it has the advantage of not needing drivers for sure, but I guess they have a current consumption which needs attending to (like neopixels).

Nevertheless I will definitely buy one and try it.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Dec 22, 2016, 08:06 pm
I ordered one of those pixies, though they said you need a different control setup than neopixels, so not sure how to make it work, but i'm also getting one of these to test

https://www.adafruit.com/products/2524

what do you guys think?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Dec 22, 2016, 08:21 pm
Oh and the pixies, you don't have to chain, they'd be too big anyway, was thinking solo unit to replace HP-LED, but am also thinking of using the 9W RGB, though they didn't tell me what battery it's designed for or how to put the proper resistor on if needed since it uses a common anode.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 23, 2016, 09:26 am
Common anode is all right, it is the way you would wire it anyway with a DIYino or any other driver with a low-side drive. Common anode means all the LED + terminals are connected together, that saves you the trouble to do it yourself. The resistors are still needed, since there is no in-built PWM or protection like in the pixie. But I strongly suspect that the pixie uses the same LED module, for sure the manufacturer is the same.

As to integrating a pixie to Arduino, they mention that they have an Arduino library, knowing Adafruit I'm pretty sure it is easy to use.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Anonomas11 on Dec 23, 2016, 10:36 am
Care to tell which Arduino IDE and board Manager version are you using?
i believe the IDE is 1.8.0 and not too sure what you mean by board manager.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Dec 23, 2016, 05:48 pm
so I'd put the resistors on the negative lead?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Dec 23, 2016, 06:49 pm
the pixie does use the same module, but the 3W version, not the overpowered 9W version.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Dec 29, 2016, 11:38 pm
I created a PC app to streamline adding hum extensions to sound files.

Demo Video:
https://youtu.be/8rtOaMDS7Lw (https://youtu.be/8rtOaMDS7Lw)

The utility is attached to this post.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: BigCSurprise on Jan 08, 2017, 10:36 pm
hello guys, i'm new to the forum and i have several questions regarding this setup.

i have read the github page on how to build the sound board and read a couple of pages in this thread ( didnt go trough all the 40+ pages :/ ).
 first of all i was wondering if the batteries i bought could be too powerful for the boards; i have 2x 10650 (AA sized) batteries of 1300mah, i have burnt my first setup and when i built this one i also burnt my arduino nano( might be a wire i soldered to a wrong pin).
also after rebuilding everyrhing, i was wondering how you would send the code to the arduino under windows 10. the first time everything went well but i was under win7 but not too long after my computers got forcefully upgraded to win10... :/
lastly, i have a problem understanding how to connect my rgb rebel light (i understand from the first post that it was meant for led strings)

sorry if its a lot to ask but any help will be appreciated

thanks, BigC
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Jan 09, 2017, 09:03 pm
Hi BigC,

Ok, so you comment out (putting // in front of) the LEDSTRING and NEOPIXELS values near the top of the Config file. I use arduino IDE on windows 10, so you may need to uninstall and reinstall. Did you need anything else? Or was it wiring you had a question on? For your batteries, what voltage are they and how are you wiring them?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: BigCSurprise on Jan 09, 2017, 09:38 pm
Hey DJ,

i get the config file, it's more regarding the schematic. i mean, since i have a rebel die, i only have 3 leds on it and have 6 pins on the arduino (17-25) that connects to the resistor and the fet, then connects to i don't know what kind of hardware/plug it is to finally connect to the blue led.

as for my batteries they are both 3.7v

Thanks in advance

BigC
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 11, 2017, 03:19 pm
Hey DJ,

i get the config file, it's more regarding the schematic. i mean, since i have a rebel die, i only have 3 leds on it and have 6 pins on the arduino (17-25) that connects to the resistor and the fet, then connects to i don't know what kind of hardware/plug it is to finally connect to the blue led.

as for my batteries they are both 3.7v

Thanks in advance

BigC
Hi BigC,

Read the manual :)
https://github.com/Protonerd/DIYino/blob/master/DIYino_Prime_v1_User_Manual.pdf


You will have all your wiring answers in there.
The batteries you use are OK for the purpose, definitely not too powerful, usually we use over here bigger ones (18650). In terms of max current draw you need to consult the data sheet, but an RGB setup hardly uses more than 2 amps.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: BigCSurprise on Jan 11, 2017, 03:33 pm
Hi BigC,

Read the manual :)
https://github.com/Protonerd/DIYino/blob/master/DIYino_Prime_v1_User_Manual.pdf


You will have all your wiring answers in there.
The batteries you use are OK for the purpose, definitely not too powerful, usually we use over here bigger ones (18650). In terms of max current draw you need to consult the data sheet, but an RGB setup hardly uses more than 2 amps.

Oh thanks for that!

I actually didn't went trough it since i tought it was for the DYIno board, which, when i think about it, is pretty much the same thing....
I really feel dumb as i was really pulling my hair on that :P

Anyway, thanks to both of you DJWing and Protonerd, i'll read the doc and finish my sound board!

BigC
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: shiryu55 on Feb 05, 2017, 01:28 pm
I am currently running a luxeon LED project lightsaber os, and I would like to use a led strip neopixel.

1m WS2812B 18W/M 5V 60LED 2811 IC , 5050LED.

Comment the neopixel line, and LED number 60.,,Set output d13 in the program and compile.

Use the d5 to give the negative to the power circuit led, As if feeding a cree led.

The led lights on if others do not, do not light in sequence or anything.

Could you tell me a connection diagram for this type of led chain, on the page

https://camo.githubusercontent.com/10cee13f9659305e1ad49e8911a819153336cbc6/687474703a2f2f69313037332e70686f746f6275636b65742e636f6d2f616c62756d732f773338352f636573745f6261737469656e312f4c6967687473616265722f4153325f4c4544737472696e67536162657241726475696e6f5f4e65736b7765656b526576697365645f7a707375356b306c6a636b2e706e67


#define DATA_PIN          13 //A0
#define STRING1            5
#define STRING2          6
#define STRING3          9
#endif

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: billpealer on Feb 05, 2017, 03:34 pm
Anyone looking to use the DFplayer in a "bare bones" approach?  I found some sketches that were made with the Arduino Particle.  They needed some tweaking for the Nano and ProMini.  I have a sample sketch and video link below. No libraries needed.

set up your memory card FAT32 with an "MP3" main folder.  If you put your audio in the root directory it does not work for some reason.  I also can't get it to play wav's at all.  i assume it is the primitive nature of the sketch and its power over the DF.
https://www.youtube.com/watch?v=N4GI_8PXZl0 (https://www.youtube.com/watch?v=N4GI_8PXZl0)


Code: [Select]
//billpealer@gmail.com  Simple Blaster Core Arduino Nano and DFPlayer
// Disclaimer- you have been warned.

# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]
int trigger = 9;
int reload = 11;
bool isPlaying;
int LED = 13;

void setup () {

pinMode(trigger, INPUT);
digitalWrite(trigger, HIGH);
pinMode(reload, INPUT);
digitalWrite(reload, HIGH);
isPlaying = false;
Serial.begin(9600);
execute_CMD(0x3F, 0, 0); // Send request for initialization parameters
pinMode(LED, OUTPUT);

 while (Serial.available()<10) // Wait until initialization parameters are received (10 bytes)
 delay(50); // Pretty long delays between succesive commands needed (not always the same)
 // Initialize sound to medium volume. Adapt according used speaker and wanted volume
 execute_CMD(0x15, 0, 5); // Set the volume to medium (0x00~0x30)
delay(500);
}

void loop() {

//your code for on/off and sound triggers
 if (digitalRead(trigger) == LOW)
  {
    if(isPlaying)
    {
      execute_CMD(0x03, 0, 1);
      isPlaying = false;
      digitalWrite (LED, LOW);
      delay(150);
    }
    else
    {
      isPlaying = true;
      execute_CMD(0x03, 0, 1);
      digitalWrite (LED, HIGH);
      delay(150);
      digitalWrite (LED, LOW);
    }
  }
  if (digitalRead(reload) == LOW)
  {
    if(isPlaying)
    {
      execute_CMD(0x03, 0, 2);
      isPlaying = false;
      
      delay(150);
      
    }
    else
    {
      isPlaying = true;
      execute_CMD(0x03, 0, 2);
      
      delay(150);
    }
  }
}
// DF serial command code
void execute_CMD(byte CMD, byte Par1, byte Par2) // Excecute the command and parameters
{
 // Calculate the checksum (2 bytes)
 int16_t checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);

 // Build the command line
 byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge, Par1, Par2, checksum >> 8, checksum & 0xFF, End_Byte};

 //Send the command line to the module
 for (byte k=0; k<10; k++)
 {
  Serial.write( Command_line[k]);
 }
}
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: shiryu55 on Feb 09, 2017, 02:54 am
fault in compile

lsos 1.4

Arduino: 1.6.0 (Windows 7), Board: "Arduino Nano, ATmega328"

Using library SoftwareSerial in folder: C:\arduino-1.6.0\hardware\arduino\avr\libraries\SoftwareSerial

Using library DFPlayer in folder: C:\LightSaberOS\libraries\DFPlayer (legacy)

Using library I2Cdev in folder: C:\LightSaberOS\libraries\I2Cdev (legacy)

Using library MPU6050 in folder: C:\LightSaberOS\libraries\MPU6050 (legacy)

Using library EEPROMEx in folder: C:\LightSaberOS\libraries\EEPROMEx (legacy)

Using library OneButton in folder: C:\LightSaberOS\libraries\OneButton (legacy)

Using library LinkedList in folder: C:\LightSaberOS\libraries\LinkedList

Using library Wire in folder: C:\arduino-1.6.0\hardware\arduino\avr\libraries\Wire

Using library light_WS2812 in folder: C:\LightSaberOS\libraries\light_WS2812 (legacy)



C:\arduino-1.6.0/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10600 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\arduino-1.6.0\hardware\arduino\avr\cores\arduino -IC:\arduino-1.6.0\hardware\arduino\avr\variants\eightanaloginputs -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\SoftwareSerial -IC:\LightSaberOS\libraries\DFPlayer -IC:\LightSaberOS\libraries\I2Cdev -IC:\LightSaberOS\libraries\MPU6050 -IC:\LightSaberOS\libraries\EEPROMEx -IC:\LightSaberOS\libraries\OneButton -IC:\LightSaberOS\libraries\LinkedList -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\Wire -IC:\LightSaberOS\libraries\light_WS2812 C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\Buttons.cpp -o C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\Buttons.cpp.o

C:\arduino-1.6.0/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10600 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\arduino-1.6.0\hardware\arduino\avr\cores\arduino -IC:\arduino-1.6.0\hardware\arduino\avr\variants\eightanaloginputs -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\SoftwareSerial -IC:\LightSaberOS\libraries\DFPlayer -IC:\LightSaberOS\libraries\I2Cdev -IC:\LightSaberOS\libraries\MPU6050 -IC:\LightSaberOS\libraries\EEPROMEx -IC:\LightSaberOS\libraries\OneButton -IC:\LightSaberOS\libraries\LinkedList -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\Wire -IC:\LightSaberOS\libraries\light_WS2812 C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\ConfigMenu.cpp -o C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\ConfigMenu.cpp.o

C:\arduino-1.6.0/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10600 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\arduino-1.6.0\hardware\arduino\avr\cores\arduino -IC:\arduino-1.6.0\hardware\arduino\avr\variants\eightanaloginputs -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\SoftwareSerial -IC:\LightSaberOS\libraries\DFPlayer -IC:\LightSaberOS\libraries\I2Cdev -IC:\LightSaberOS\libraries\MPU6050 -IC:\LightSaberOS\libraries\EEPROMEx -IC:\LightSaberOS\libraries\OneButton -IC:\LightSaberOS\libraries\LinkedList -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\Wire -IC:\LightSaberOS\libraries\light_WS2812 C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\Light.cpp -o C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\Light.cpp.o

C:\arduino-1.6.0/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10600 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\arduino-1.6.0\hardware\arduino\avr\cores\arduino -IC:\arduino-1.6.0\hardware\arduino\avr\variants\eightanaloginputs -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\SoftwareSerial -IC:\LightSaberOS\libraries\DFPlayer -IC:\LightSaberOS\libraries\I2Cdev -IC:\LightSaberOS\libraries\MPU6050 -IC:\LightSaberOS\libraries\EEPROMEx -IC:\LightSaberOS\libraries\OneButton -IC:\LightSaberOS\libraries\LinkedList -IC:\arduino-1.6.0\hardware\arduino\avr\libraries\Wire -IC:\LightSaberOS\libraries\light_WS2812 C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\LightSaberOS.cpp -o C:\Users\casita\AppData\Local\Temp\build5442600151535237468.tmp\LightSaberOS.cpp.o

LightSaberOS.ino: In function 'void setup()':
LightSaberOS.ino:229:18: error: 'loadConfig' was not declared in this scope
LightSaberOS.ino:250:12: error: 'saveConfig' was not declared in this scope
LightSaberOS.ino:480:16: error: 'InitDFPlayer' was not declared in this scope
LightSaberOS.ino:485:22: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino: In function 'void loop()':
LightSaberOS.ino:525:21: error: 'HumRelaunch' was not declared in this scope
LightSaberOS.ino:545:43: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:565:17: error: 'motionEngine' was not declared in this scope
LightSaberOS.ino:578:16: error: 'motionEngine' was not declared in this scope
LightSaberOS.ino:598:47: error: 'LoopPlay_Sound' was not declared in this scope
LightSaberOS.ino:612:42: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:653:53: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:882:48: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:907:21: error: 'HumRelaunch' was not declared in this scope
LightSaberOS.ino:935:22: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:953:22: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:960:22: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:977:41: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:1165:44: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:1191:15: error: 'saveConfig' was not declared in this scope
LightSaberOS.ino:1203:22: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino:1241:26: error: 'SinglePlay_Sound' was not declared in this scope
LightSaberOS.ino: In function 'void HumRelaunch()':
LightSaberOS.ino:1387:38: error: 'LoopPlay_Sound' was not declared in this scope
Error compiling.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: shiryu55 on Feb 13, 2017, 10:51 am
Resolved, was by version, works correctly with version 1.6.11

Title: SD Card Writing
Post by: jonnieZG on Feb 16, 2017, 08:26 am
Hi, guys! I am re-posting this from JakeSoft's thread (http://forum.arduino.cc/index.php?topic=261980.1170). You might find it useful...

To simplify writing sound files to the SD card, and their further referencing from the source code, I wrote a simple utility in Java (available on GitHub here: https://github.com/jonnieZG/SDCardRecorder (https://github.com/jonnieZG/SDCardRecorder)).

It copies files originally organized in sub-folders, respecting their natural (sort-by-name) order, flattening their structure for faster referencing by the DFPlayer, required for gapless play. Their reference numbers are created into an .H file with definitions of sound file indexes and their original names in the comment. That file will be written to SD as 9999.H, just for your reference only - it does not affect the sound card functionalities in any way.

The utility also formats the SD prior to copying, and names the target files as 0000.EEE (0000 being order number and EEE the original file extension. The original files in source directory remain unchanged.

This is an example of the created header file:

Code: [Select]
#define SND_EFF_BEEP 1 /* 01-EFF/001-beep.mp3 */
#define SND_EFF_BEEP_FUZZY 2 /* 01-EFF/002-Beep Fuzzy.wav */
#define SND_EFF_SELECTED 3 /* 01-EFF/003-Selected.wav */
#define SND_EFF_BACK 4 /* 01-EFF/004-Back.wav */
#define SND_EFF_SHUTTER 5 /* 01-EFF/005-Shutter.wav */
#define SND_SETTINGS_BATTERY_LEVEL 6 /* 02-Settings/00 Battery Level.mp3 */
#define SND_SETTINGS_RELEASE_FOR_SETTINGS 7 /* 02-Settings/000-0 Release for Settings.mp3 */
#define SND_SETTINGS_SETTINGS 8 /* 02-Settings/000-1 Settings.mp3 */
...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 17, 2017, 11:36 am
I also want to share with you my own flavor of the DFPlayer Mini driver (https://github.com/jonnieZG/DFPlayerMini (https://github.com/jonnieZG/DFPlayerMini)) that I used in my lightsaber.

It was proven very reliable and responsive. Besides being very light-weight, what makes it special is that it provides support for a busy-wait callback, allowing you to slip in your own routine that is being ticked on every wait cycle, while the driver is waiting for a timeout, or performing a delay. The result is responsiveness similar to that in multi-threaded environments. I am using this for reading motion sensors and updating blade.

I hope it helps.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Feb 18, 2017, 03:06 am
I also want to share with you my own flavor of the DFPlayer Mini driver (https://github.com/jonnieZG/DFPlayerMini (https://github.com/jonnieZG/DFPlayerMini)) that I used in my lightsaber.

It was proven very reliable and responsive. Besides being very light-weight, what makes it special is that it provides support for a busy-wait callback, allowing you to slip in your own routine that is being ticked on every wait cycle, while the driver is waiting for a timeout, or performing a delay. The result is responsiveness similar to that in multi-threaded environments. I am using this for reading motion sensors and updating blade.

I hope it helps.
Good stuff. I may borrow from this to build a leaner DFPlayer controller for USaber. It's nice to see some more pro devs diving into the fray.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 19, 2017, 01:00 am
Good stuff. I may borrow from this to build a leaner DFPlayer controller for USaber. It's nice to see some more pro devs diving into the fray.
Well, you are welcome to do so! This thread was a great reading and inspiration when I started working on Arduino projects a year ago. Now it's time to give something back.

There are also a few other libraries that I wrote when I needed to go an extra mile, while pushing the memory footprint to the minimum, like my alternative (https://github.com/jonnieZG/EButton) to the good old OneButton. Feel free to use it as well. I'll keep sharing some of my drivers and libraries that might be interesting to the community.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 20, 2017, 08:52 pm
I also want to share with you my own flavor of the DFPlayer Mini driver (https://github.com/jonnieZG/DFPlayerMini (https://github.com/jonnieZG/DFPlayerMini)) that I used in my lightsaber.

It was proven very reliable and responsive. Besides being very light-weight, what makes it special is that it provides support for a busy-wait callback, allowing you to slip in your own routine that is being ticked on every wait cycle, while the driver is waiting for a timeout, or performing a delay. The result is responsiveness similar to that in multi-threaded environments. I am using this for reading motion sensors and updating blade.

I hope it helps.
Hi jonnieZG,

If this DFPlayer lib of yours is really capable of 2-ways communication, the DIY community will enclose your name in their prayers! I have always been struggling with the lack of timing capabilities due to only a simplex comm to the DFPlayer chipset, if this could be improved would be worth the while.

The OneButton lib works like charm, but now that the open source saber codes reach the upper roof of code space I already had two cases I had to refrain from using a 2nd button, so if you have a lighter one, worth the try!

Thanks for the contribution! Very much appreciated! Keep up the good work! This community is amazing
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 20, 2017, 09:20 pm
Hi, Protonerd!

If this DFPlayer lib of yours is really capable of 2-ways communication,...
I've been using it for some time now with the DFplayer Mini. It took me a while to do figure out the protocol, but it is in a mature phase now. Just keep in mind that if you using a 5V power source, you must put a 1k resistor between data-out on Arduino and RX of the Player. Busy and DX must be connected to their counterparts on the Arduino directly. Even if you are powering the player at 5V!

The OneButton lib works like charm, but now that the open source saber codes reach the upper roof of code space I already had two cases I had to refrain from using a 2nd button, so if you have a lighter one, worth the try!
You can take a look at the manual in README.md, there's a section just on minimizing the memory footprint.  

Funny thing about object programming in C++ is that a more verbose source code does not always compile into more bytes. ;)

Cheers,
JonnieZG
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Feb 23, 2017, 03:40 am
For a long time it has bothered me how much code space is consumed by the MPU6050 functions. In all of my saber sketches that use it, it has accounted for a full third of the total hex file size. I was running out of flash to add new features.

After a lot of research, I discovered that there was lots of room for optimization. For example, the MPU6050 library that both USaber and LightsaberOS are using fills up over 2K of program memory with a huge buffer of registers that gets written to the MPU6050 at initialization... and then is never used again. It just sits there eating up program memory. There were also a lot of unnecessary calls to set resisters to what they already are by default on power-up according to the MPU6050 datasheet.

I have manged to boil down the core swing/clash detection functionality to a highly streamlined approach. I just uploaded the code to GitHub tonight. Look for the MPU6050LiteMotionManager class. If you use this in your sketches instead of the older MPU6050MotionManager you are sure to free up some program flash. In my sketches I'm seeing a savings of ~7K!

You can always get the latest version of the library here:
Universal Saber Library (https://github.com/JakeS0ft/USaber)
Note that an example sketch is included in the library for the new class.

Here is a video I made of the alpha version. (The version linked above works even better.):
MPU6050 Lite Demo Video (https://youtu.be/a4jJm_uP-iQ)

In the video I talk about there being no interrupts. I discovered afterward how easy it was to use the interrupt register on the MPU6050 and also that using it allowed me to save about another 1K over what I show in the video. So, just ignore that comentary. (I was just so excited that I got it working! :) ) The point is: it consumes far less code space and still works just as well for detecting swings and clashes.

Try it out and enjoy all the extra room to add new features.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 23, 2017, 08:46 am
I found the MBU6050 to be a huge overkill for use in a lightsaber. It uses I2C protocol which brings a few ugly issues in the project, such as problems with power-saving modes. It also requires a heavy driver.

An ADXL335 is quite sufficient and gives great results. You just need to do analog reads from its 3 axes and interpret them properly. No driver, no interrupts.

After a *LOT* of time that I spent studying readings from the ADXL335, I have managed to get 100% reliable and responsive information about "clash", "swing" and "swirl" events. It was tricky, but IS possible, which you will see soon. The project "KyberOS" is now in its final stage, and as soon as I wrap it up, I will share with you the videos and a few other parts of the code.

Until then, I will just give you a hint that instead of using buffers (requires memory!) I rather used something called EWMA (or Motion Average) Filter, and a derivation filter - which do not require any buffers, resulting in minimal memory use. The first is used to smooth the readings, and the latter, if properly applied to the absolute length of the acceleration vector sqrt(sq(ax)+sq(ay)+sq(az)) gives you basis for information about clashes. Detecting swings and swirls was the tricky part. Let's just say for now that it requires tracking and counting passes of da (derivation of absolute accel vector) through zero, and the orientation of its slope. ;)

There's also something else built into this one, that will definitely blow your mind... ;)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Feb 24, 2017, 02:21 am
I found the MBU6050 to be a huge overkill for use in a lightsaber. It uses I2C protocol which brings a few ugly issues in the project, such as problems with power-saving modes. It also requires a heavy driver.

An ADXL335 is quite sufficient and gives great results. You just need to do analog reads from its 3 axes and interpret them properly. No driver, no interrupts.
I once thought as you do. In fact there is an ADXL335 motion manager included in USaber as well. I used one for my Mk. III and Mk. IV systems. Once I understood the register map, these issues you mention were quite easy to overcome. The beauty of DIY is you can use whatever you are comfortable with. I actually have an ADXL345 in my parts stash that I'll probably add support for at some point too. I like options. 

After a *LOT* of time that I spent studying readings from the ADXL335, I have managed to get 100% reliable and responsive information about "clash", "swing" and "swirl" events. It was tricky, but IS possible, which you will see soon. The project "KyberOS" is now in its final stage, and as soon as I wrap it up, I will share with you the videos and a few other parts of the code.

Until then, I will just give you a hint that instead of using buffers (requires memory!) I rather used something called EWMA (or Motion Average) Filter, and a derivation filter - which do not require any buffers, resulting in minimal memory use. The first is used to smooth the readings, and the latter, if properly applied to the absolute length of the acceleration vector sqrt(sq(ax)+sq(ay)+sq(az)) gives you basis for information about clashes. Detecting swings and swirls was the tricky part. Let's just say for now that it requires tracking and counting passes of da (derivation of absolute accel vector) through zero, and the orientation of its slope. ;)

There's also something else built into this one, that will definitely blow your mind... ;)
Sounds really interesting. I look forward to seeing it in action.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 24, 2017, 08:11 am
I once thought as you do. In fact there is an ADXL335 motion manager included in USaber as well. I used one for my Mk. III and Mk. IV systems. Once I understood the register map, these issues you mention were quite easy to overcome. The beauty of DIY is you can use whatever you are comfortable with. I actually have an ADXL345 in my parts stash that I'll probably add support for at some point too. I like options. 
Your LightsaberOS is indeed a great project, packed with options. I didn't use the ADXL345, because of the I2C protocol, which brings me to the same issues as the MBU6050.

Sorry if that has already been explained before, but why exactly did you remove the power saving mode? Was it the I2C, or something else.

BTW, I am studying a few papers on Li-Ion battery state-of-charge estimate, in order to build a proper power management. I'll share the results with you once I have something to share.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 24, 2017, 08:18 am
I once thought as you do. In fact there is an ADXL335 motion manager included in USaber as well. I used one for my Mk. III and Mk. IV systems. Once I understood the register map, these issues you mention were quite easy to overcome. The beauty of DIY is you can use whatever you are comfortable with. I actually have an ADXL345 in my parts stash that I'll probably add support for at some point too. I like options.  
Your LightsaberOS is indeed a great project, packed with options. I didn't use the ADXL345, because of the I2C protocol, which brings me to the same issues as the MBU6050.

Sorry if that has already been explained before, but why exactly did you remove the power saving mode? Was it the I2C, or something else.

BTW, I am studying a few papers on Li-Ion battery state-of-charge estimate, in order to build a proper power management. I'll share the results with you once I have something to share.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 24, 2017, 03:27 pm
It is actually an MPU6050 and somehow I agree that for a lightsaber project it might be an overkill, however it is a perfect match to my DIYino lightsaber board family, as I found a source I can order them cheaper as the regular price for simpler acc/gyros like the ADXL chips. Therefore I will stick with the MPU, I'm very satisfied with its performance when it comes to clash and swing detection.

The power saving options will be back soon, I did not yet publish it, but I already built in a DIYino Prime v1.5 into one of my sabers and currently field testing the power saving options. So far after 3 days I can still switch on the saber, no visible dimming of the light and no kill-key used.

Reason for the power saving modes removed earlier was that with the home brew solutions with Arduino Nano or DIYino Prime v1, power saving did not achieve much, as even with deep sleep mode the current consumed by the modules wo/sleep mode was so high that it did not make any difference. WIth the DIYino v1.5 it changed  :) .
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 24, 2017, 04:02 pm
Therefore I will stick with the MPU, I'm very satisfied with its performance when it comes to clash and swing detection.
Since you have it as an part of the DIYino Prime, I think it is a great choice, because it gives a user more choices, because one does not have to stick just to lightsabers. You can do a lot of other interesting things with that board.

I just read the manual, and I must pay you greatest compliments on that! There is just one thing that I'd like to suggest, if you don't mind: regarding the simple MOSFET drivers, I would prefer to have a constant-current driver like the one described here (the second one on the page) (http://www.pcbheaven.com/userpages/LED_driving_and_controlling_methods/?topic=worklog&p=5). It requires (per driver) an extra NPN transistor, a resistor, and leads for an external resistor that controls the max current, but it is more efficient than the simple MOSFET switch.

The power saving options will be back soon, I did not yet publish it, but I already built in a DIYino Prime v1.5 ...... WIth the DIYino v1.5 it changed  :) .
I am looking forward to seeing the performance of the lastest version!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Feb 24, 2017, 06:04 pm
It is actually an MPU6050 and somehow I agree that for a lightsaber project it might be an overkill, however it is a perfect match to my DIYino lightsaber board family, as I found a source I can order them cheaper as the regular price for simpler acc/gyros like the ADXL chips. Therefore I will stick with the MPU, I'm very satisfied with its performance when it comes to clash and swing detection.
I agree. My only problem with the MPU6050 was how much code space was required to use it. Now that the issue is sorted, I don't have any complaints and quite like it.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 24, 2017, 08:38 pm
There is just one thing that I'd like to suggest, if you don't mind: regarding the simple MOSFET drivers, I would prefer to have a constant-current driver like the one described here (the second one on the page) (http://www.pcbheaven.com/userpages/LED_driving_and_controlling_methods/?topic=worklog&p=5). It requires (per driver) an extra NPN transistor, a resistor, and leads for an external resistor that controls the max current, but it is more efficient than the simple MOSFET switch.
I am looking forward to seeing the performance of the lastest version!

Hi jonnie,
I don't mind at all, that is why this and Jake's thread exist here, becasue we want to talk tech. I did not consider your setup as of yet, but if you can explain the pros I could think about such a drive concept in a next generation of DIYino.

The mosfet drivers are good, mostly becasue they can carry a lot of current, they can be controlled by PWM acting as a voltage controlled resistor, and last but most importantly they are tiny and space saving is a selling feature. That is why I did not consider putting a more complicated circuitry.  I'm pretty satisfied with the efficiency if you mean power loss (negligible), where I see a bit of an improvement potential is the linearity: a mosfet is a non-linear device i.e. the current of the load will no tincrease linerly proportional to the PWM voltage, which for our purpose means that the LEDs will not light up evenly with increasing PWM. There is an optimum range somewhere along the lower half and above that the extra gain is minimal. If this could be overcome then it would warrant a reconsideration.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jonnieZG on Feb 25, 2017, 10:46 pm
where I see a bit of an improvement potential is the linearity: a mosfet is a non-linear device i.e. the current of the load will not increase linerly proportional to the PWM voltage, which for our purpose means that the LEDs will not light up evenly with increasing PWM. There is an optimum range somewhere along the lower half and above that the extra gain is minimal. If this could be overcome then it would warrant a reconsideration.
Yes, it will increase linear dependency between PWM and current. The problem is NOT the MOSFET being non-linear, because we are driving the MOSFET with a square signal that goes to saturation, so the effective current should be linearly proportional to PWM. The problem is the voltage drop on LED being significantly dependent on the current. With the simple MOSFET switch, it results in non-linear LED current, while the current source with the MOSFET and an NPN + emiter resistor is not affected by the voltage variations on the LED.

Here, take a look here: simple MOFET (https://circuits.io/circuits/4124443/edit#breadboard) and a current source (https://circuits.io/circuits/3320897-the-unnamed-circuit/edit#breadboard). Try to change voltage on the LED (the upper of the two power sources) and you will see how it works.

Here are the voltages of my Luxeon Rebel RGB. Voltage increases linearly with the I:

Imin = 100mA, Imax = 1000mA
Vr min = 2.3, max = 4.9
Vg min = 2.5, max = 4.1
Vb min = 2.8 max = 4.1

Here is an Excel sheet (https://www.dropbox.com/s/t4z7vygs0l3ggwk/LED%20Driver.xlsx?dl=0) that calculates power dissipation on each element. You can change Vcc and Re (that regulates voltage) and see the dissipation on a Luxeon RGB LED star. I will also add support for Cree RGB.

BTW, I am using an IRFL024ZPBF N-MOSFET with low gate switching voltage, that is made especially for 5V gate voltage, and a BCV47 NPN transistor.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Mar 03, 2017, 04:27 am
Hey guys! I'm having some trouble setting this up. Everything is working except for the sound. When I hook the DFPlayer up by itself and short the "play-next" pin, the module plays each file on the SD card in order just fine. However when I plug everything in as the github diagram shows, I don't get the proper sounds. It plays something... but it doesn't sound like any of the files on the card. It's kind of a high pitched, but soft type hum. My Neopixels will ignite and the 6050 seems to respond, but the module just won't work. I have three of these modules and every one does the same. Any help? I must have re-done the wiring 700 times, lol. Thanks guys!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on Mar 03, 2017, 06:05 pm
Okay, here's a little update: For some reason the DFPlayer was not happy using pin 8 for Rx and 7 for Tx. After changing these around a bit, I finally found a pair of pins that will reliably work every time. I've changed the code to use pin 7 for Rx and 5 for Tx. I have no idea why this would matter as they're both digital pins. It doesn't seem like it should make a difference, but it does. Just wanted to post this here in case anyone else has this issue. Now to get my batteries and test out the second neopixel string. =]
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Mar 16, 2017, 05:53 pm
has anyone considered this?

https://www.adafruit.com/products/2795

I know it's not using the DFPlayer so no amp, but would it be viable?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Mar 17, 2017, 08:05 pm
has anyone considered this?

https://www.adafruit.com/products/2795

I know it's not using the DFPlayer so no amp, but would it be viable?
You could use it as an MCU, sure. But it's not a sound board, it's just an Arduino with a built in SD card slot for storage.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 20, 2017, 12:25 pm
You could use it as an MCU, sure. But it's not a sound board, it's just an Arduino with a built in SD card slot for storage.
We made a brainstorming with Jake about this MCU at the time I prepared the plans for the DIYino Stardust, and finally decided to keep the 328P. Reason is, the 32u4 comes with 500bytes more SRAM but its bootloader - to accommodate the USB protocol - takes much more program flash space. We calculated that it will be a challange to fit the saber code into that. Looking back it was the right decision, the Stardust uses new QFN packages for both the FTDI and the avr, therefore the added PCB room over the 32u4 is mininal, but this compo is much more flexible in terms of bootloader options.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Vulkan on Mar 24, 2017, 11:05 pm
This may sound weird and all, but could you not use the AMTMEGA2650 chip. It's voltage range is 5-12v where as the banks is 5-7.9. It's much larger being a problem. It's got 4x sram and flash.

I don't know if it could work
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 26, 2017, 10:04 pm
I've just made an announcement about my newest saber board creation, the Stardust, if wanna know what it is, go here: Stardust coming (https://forum.arduino.cc/index.php?topic=393174.75)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: dannyc09 on Apr 04, 2017, 04:02 pm
Can anyone help...

getting these error messages on compile:



In file included from Buttons.cpp:8:
C:\Users\Dan and Heather\Documents\Arduino\libraries\DFPlayer/DFPlayer.h: In member function 'void DFPlayer::receive()':
C:\Users\Dan and Heather\Documents\Arduino\libraries\DFPlayer/DFPlayer.h:278: error: invalid conversion from 'uint8_t*' to 'char*'
C:\Users\Dan and Heather\Documents\Arduino\libraries\DFPlayer/DFPlayer.h:278: error:   initializing argument 2 of 'size_t Stream::readBytesUntil(char, char*, size_t)'


Thanks
Dan
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 05, 2017, 08:46 am
Can anyone help...

getting these error messages on compile:



In file included from Buttons.cpp:8:
C:\Users\Dan and Heather\Documents\Arduino\libraries\DFPlayer/DFPlayer.h: In member function 'void DFPlayer::receive()':
C:\Users\Dan and Heather\Documents\Arduino\libraries\DFPlayer/DFPlayer.h:278: error: invalid conversion from 'uint8_t*' to 'char*'
C:\Users\Dan and Heather\Documents\Arduino\libraries\DFPlayer/DFPlayer.h:278: error:   initializing argument 2 of 'size_t Stream::readBytesUntil(char, char*, size_t)'


Thanks
Dan
Hi Dan, can you post this error on GitHub? Do you use LSOS or any other software? Or are you programming your own code (yeah, gogogo!)? Did you try to download the libs from LSOS:
https://github.com/neskweek/LightSaberOS/tree/LSOS-1.5_GravityColorBlend
?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: dannyc09 on Apr 05, 2017, 09:50 am
Hi Dan, can you post this error on GitHub? Do you use LSOS or any other software? Or are you programming your own code (yeah, gogogo!)? Did you try to download the libs from LSOS:
https://github.com/neskweek/LightSaberOS/tree/LSOS-1.5_GravityColorBlend
?
So I'm using the LSOS code from here:
https://github.com/neskweek/LightSaberOS

I'm using the DIYino prime.

I'll post the error up on GitHub now...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 07, 2017, 03:06 pm
Please note you have to use the branches. Shame on me, but the master is so outdated, that it could considered obsolete by all means.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: shiryu55 on Apr 08, 2017, 12:12 am

New tests, with the neopixel strip of 144led cut to 119 led, with a single string works ok, with 2 comes out the failure of low battery, but if it happened to connect it to the fet, and I connect it to negative of the battery and arduino mass It works properly, but that way I commit protonerd that it spends battery even at rest.

The thing is that I do not know because I miss the way by connecting it to the fet, one all 6 Fet to the negative of the neo pixel strip, positive to battery and pin 13 to signal.

On the other hand with the led strip 60 led and only 4 Fet works, then incorporate the other two Fet to the plate to see if it was for low mass or not to put the 6 fet, with the other led type cree sin Problems too



Which smd fet me you recommend, just because I do not use the appropriate ones


http://subefotos.com/ver/?71f23318548ced07a93c688aa97b1f93o.jpg
http://subefotos.com/ver/?fd6d214b1ba773970bbffcdee2ca269co.jpg

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jesjhoward on May 04, 2017, 03:07 pm
Hi all, I'm having a bit of an issue with my arduino based saber. I think I know what the issue is, but I need some master-class guidance. I have the arduino, DFPlayer, and MPU 6050 wired properly and powered by two 14500 batteries. I'm using two neopixel strips at 144 leds per meter. Each strip has less than 119 leds (due to bad tests and repairs, lol) but the problem comes in when using the flash on clash feature, or any function that turns all leds white. The second this happens the board shuts down. I'm guessing that the leds are pulling too much current for the batteries to handle. Does this sound right? Any suggestions on how to improve this set up? Thanks guys!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 04, 2017, 04:51 pm
Yes, your assumption is correct. I had the same issue when using 2x120 pixels and a protected 18650 battery. When the overcurrent protection is triggered, the battery shuts down, so does your circuit too.

You can do 2 things:
- reduce the pwn to a max of (?) 100
- swap the batteries with unprotected ones, but beware of the heat

Since I use an unprotected cell, I can turn on all pixels full, of course with the 3.7V and all the IR drop the voltage is reduced, so the full brightness cannot be reached, but hold the saber for a few minutes and you will feel the "heat of the action" :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Andong on May 13, 2017, 07:14 am
Hi all. Recently started building a lightsaber using all the usefull info and tools everyone kindly shared but after some testing and couple burned hp-leds i've got couple questions:

1. In the schematics you use 100k resistors but i didn't find any notes if it's supposed to be 0.5w, 1w, 2w or any other?

2. I tried single 18650 battery with dc-dc step up connecting it to 5v pin on arduino but it doesnt seem to work, well it powers up but instead of normal sounds the df player starts to produce some crackling sounds. So i switched to 2x16340 to get 7.4-8.2v. As for mosfets i tried 2 different types

IFRD120PBF - https://www.amazon.com/10PCS-IRFD120PBF-MOSFET-4-DIP-IRFD120/dp/B01DI5ZZOO/ref=sr_1_4?ie=UTF8&qid=1494651293&sr=8-4&keywords=irfd120

IRLD024 - https://www.amazon.com/5PCS-IRLD024-MOSFET-N-CH-4-DIP/dp/B01973D5TI/ref=sr_1_1?ie=UTF8&qid=1494651721&sr=8-1&keywords=irld024

With IRFD120 the led lights up and sounds are played but i noticed that some of the colors are way brighter than others. So i connected mulitimiters to red, green and blue lines of hp-led and based on the data sometimes the voltage is really low(certain colors), for exmaple it may be 2.5v on green or blue led so overall it's pretty dim. But with some colors the voltage may jump up to 4-4.2v. So i started to wonder if it is normal or i'm doing something wrong?

With IRLD024 one i turn on the lightsaber it lights up but instaed of normal sounds i get that constant loud crackling. So then again i started to wonder if i'm doing something wrong or just IRLD024 isn't fit for this?

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 13, 2017, 12:38 pm
Hi all. Recently started building a lightsaber using all the usefull info and tools everyone kindly shared but after some testing and couple burned hp-leds i've got couple questions:

1. In the schematics you use 100k resistors but i didn't find any notes if it's supposed to be 0.5w, 1w, 2w or any other?

2. I tried single 18650 battery with dc-dc step up connecting it to 5v pin on arduino but it doesnt seem to work, well it powers up but instead of normal sounds the df player starts to produce some crackling sounds. So i switched to 2x16340 to get 7.4-8.2v. As for mosfets i tried 2 different types

I would advice you to grab a DIYino Prime board instead of expermenting. Proven, reliable and you can focus on programming the effects you would like to have.

As to the supply scheme you used, with a single 18650 (3.7V) battery you will be very close to undervoltage for most of the chis on board. If you on top of it turn on the LEDs, which causes a substantial inrush of current, ground shift and IR drop over the wiring will cause the voltage to drop even further. I also know from expeience that the first module which will fail to work is the audio amp, hence the crackling sounds. I made once a E11 blaster using a single cell, works, but there I have only small burst of lights whereby in a lightsaber the lights are continuosly on.

In terms of mosfets, it's important to select those which can carry a min of 2A, low Rdson and logic level (meaning a Vgs threshold not greater than 2.5V). If the Vgs is close to your battery, the fets are not fully in which could explain the dimness. And if your red LED will switch on earlier than the blue and greed due to a lower threshold, it could "steal" the current from the other 2 if your battery cannot supply enough current for all 3.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Andong on May 13, 2017, 02:17 pm
In terms of mosfets, it's important to select those which can carry a min of 2A, low Rdson and logic level (meaning a Vgs threshold not greater than 2.5V). If the Vgs is close to your battery, the fets are not fully in which could explain the dimness. And if your red LED will switch on earlier than the blue and greed due to a lower threshold, it could "steal" the current from the other 2 if your battery cannot supply enough current for all 3.
Thanks for a fast reply, Protonerd. As for now it became kind of a challenge for me to complete a fully working lightsaber with the components i already have :) But for the next one i'll definetly grab a DIYino, put my eyes onto Stardust version.

According to IRLD024 datasheet it can carry up to 2.5A, the Vgs threshold is 1V to 2V and Rdson is 0.1, also in the datasheet it states a logic-level. So if i understand correctly it's supposed to be good but for some reason once lightsaber is powered there is constant loud crackling.

As for IRFD120, again according to the datasheet it can carry up to 1.3A, Vgs threshold is 2-4V and Rdson is 0.27. Does it mean it's not logic level thus not suited for a lightsaber project?

Sorry if my questions sound dumb but i'm new to all this stuff, just recently got interested in electronics.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 13, 2017, 09:13 pm
No stupid question, only stupid people who do not dare to ask. If a transistor has 2-4V Vgsth, you need a 5V supply. I would anyway urge you to use either a DC/DC to boost your 3.7V to 5V or power the board over the VIN with >6V. But then there should  not be any crackling. Did you have any Wav files on the SD card you use? If yes, in the right format?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Andong on May 14, 2017, 04:50 am
No stupid question, only stupid people who do not dare to ask. If a transistor has 2-4V Vgsth, you need a 5V supply. I would anyway urge you to use either a DC/DC to boost your 3.7V to 5V or power the board over the VIN with >6V. But then there should  not be any crackling. Did you have any Wav files on the SD card you use? If yes, in the right format?
All contents of SD card is made according to LSOS readme on github. (I use LSOS 1.4)

Tried powering with 3.7v and boosting it to 5v with dc-dc converter. First i tried connecting to VIn but then i found your post that need to connect to 5v pin so i tried it but sadly same thing with crackling sounds.

With 2x16340 baterries the voltage is 7.4-8.2V. If using IRFD120 mosfets i get some of the colors dim and some are perfectly fine(sometimes the voltage is even too high, around 4-4.2v on green or blue) but everything works including sounds and motion/clash detection. Also, based on the mulitmeter readings, voltage fluctuates but as i understand it's made on purpose and based on the sounds played by df player(kinda represents the hum).

If i switch mosfets to IRLD024 (based on the datasheet those seemed more suited) and turn lightsaber on i get the crackling sounds. My first thought was that mosfets were defective but i have 6 of those and tried all with same outcome. So either all 6 are defective or they aren't suited for this project for a reason i don't understand.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 19, 2017, 03:42 pm

New DIYino Prime v1 boards ara available from the 5th Run, sale is open as of NOW. If you are interested, drop me a PM. For conditions, look into the DIYino thread.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jbkuma on May 25, 2017, 03:33 am
I agree with Andras, the DIYino is a great board and definitely more reliable and a good value.  For your problems, connect the 5v for the DFplayer directly to the battery + and it may help.

The best part of the DIYino is that it just works really well.  The components all work together perfectly and there's no need to fuss around with figuring out why your MPU isn't triggering swings or the DFplayer is making funny sounds.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: lakron on Jun 16, 2017, 04:03 am
Hello. First of all, thanks a lot for the LSOS.
I use arduino nano, mpu6050, dfplayer, neopixels.
LSOS 1.5 compiles with error "Sketch too big. Sketch uses 31,338 bytes (102%) of program storage space. Maximum is 30,720 bytes". So I use 1.4.

1) I have TP4056 to charge 18650. Can I connect microusb port to use dfplayer mini as usb microsd reader?
2) I have ws2818 strip with 100 pixels. I want to bend strip in half. If use strip as one part - need to change the code in cycles NUMPIXELS/2.
If I cut into two stripes with 50 pixels, can I connect both data cable in one to arduino port? and set NUMPIXELS to 50/
3) How add, replace sounds? What wav format should I use? Where can I get sound font? Add hum sound to each effect sound?
4) What material do you use for the blade with neopixels? I plan to use PVC pipe, but I think the pixels will be not so bright in the pipe. Polycarbonate tube is better? I don't know if I can find this tube in my town.
And what material for the the hilt?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: whosle on Jun 19, 2017, 06:13 pm
Greetings Protonerd (and all others!)

 Really awesome build you have created.

 I am a bit of a lurker on TCSS and Fx-sabers (same name), and I have only been successful with Hasbro econo boards.

 I recently bread-boarded up a prototype and after reading a bit , I believe my Mosfet choice is not the best (IRFZ44N)

 I have some FQP30N06L http://bc-robotics.com/datasheets/FQP30N06L.pdf which I will be using on a teensy build, will they be good for this build?

 I will attempt to up my voltage as you had mentioned above.

 I am using A tri-cree/ luxeon LED for my first prototype, but I have neopixels on the way.

 Questions:

1)  You had mentioned the GitHub repository for the saber Os is obsolete, can you elaborate?

2) I have trouble reading the CAD/tech drawing inside the zip, JBkuma linked me some nice cartoon/color coded wiring diagrams, but mentioned that it is still in the beta/testing /unreleased phase, are there any errors on this wiring diagram that I need to be aware of?

3) See the Mosfet question in intro, are FQP30N06L good for this build? If not which are the ones you are using? (S12304DS? I am having trouble sourcing/finding data sheets for these, and may be too tiny for myself to solder, and I have no reflow skillet)


4) is there any way to use TIP42c or other Transistors for this build? Or would it take some major re-coding on the pins?

That's it for now, I think all my issues are voltage and mosfet related as I seem to have the same issues as Andong above.  

Thanks again for making this build. Both yourself and Jakesoft really paved the way for dummies like myself. I can only imagine the headaches it would have created to get it running proper.  

Cheers

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jbkuma on Jun 19, 2017, 06:34 pm
2- The wiring shouldn't change at all, but especially if you are building from scratch some of the pins can be redefined.  We've kept the pins _mostly_ the same since 1.3, the only changes have been obsoleting undeveloped features, and re-purposing for new features.  The software is under development, so major changes should be expected until we "launch" it (announce on FX and elsewhere).

4- I've used TIP41s and TIP42s.  As long as you are wiring based on what the functions do, you should be fine.  On my bread board setup I use TIP41s.  TIP41 (NPN type) will "switch on" with a "high" signal, TIP42 (PNP type) "switch on" with a "low" signal.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: whosle on Jun 20, 2017, 04:30 am
Thanks again JBkuma!

  I will look into trying tip42c and see if I can run it with a single Liion. 

  I will look into the coding to see what the pin output state is , and change it accordingly.

 I am starting to understand overall picture of machine/Arduino code. I just need to understand the syntax!

 Growing up on a commodore 64 should be helpful for that.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: zimpah on Jul 22, 2017, 06:54 am
hi everyone, quick question.  i've got my saber almost finished, but cant upload the code into the board.  getting the failed to sync message.  i've tried all the usual solutions.  different usb cable/port, different computer, checked all my soldering, triple checked all my settings, etc... just no luck.  any advice???  thank you!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: JakeSoft on Jul 22, 2017, 03:09 pm
hi everyone, quick question.  i've got my saber almost finished, but cant upload the code into the board.  getting the failed to sync message.  i've tried all the usual solutions.  different usb cable/port, different computer, checked all my soldering, triple checked all my settings, etc... just no luck.  any advice???  thank you!
What Arduino board are you using?

Some common issues include ensuring that you have the right board (and processor speed) selected in the Arduino IDE and making sure you have the correct com port selected.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: AardvarkSagus on Sep 05, 2017, 06:53 pm
I am trying something probably very stupid. I have a RGB illuminated switch that I'd like to use with my DIYino board, neopixel blade, and LSOS, ideally having the switch match the selected blade color. I know using a single neopixel would be a smarter move as a matching accent LED, but I don't have another place on my hilt that I'd like to put an accent LED.

I see in the Config.h file a place where I can define MULTICOLOR_ACCENT_LED, but as far as I can tell, there is nowhere in the entirety of the rest of the code where that is used. Is there a way to do this, or am I stuck just picking the color of my LED during construction, and sticking with it? If I can, what pins should I connect it to? I'd love to still use blade power-off feature with the built in MOSFETs on the DIYino, but if I need to repurpose the PWM digital pins, I have another beefier MOSFET I can use to kill power to the neopixels.

Feel free to educate me on how I'm being an idiot and not understanding what I'm doing. I'd rather learn than think I'm right.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Sep 12, 2017, 01:37 pm
I am trying something probably very stupid. I have a RGB illuminated switch that I'd like to use with my DIYino board, neopixel blade, and LSOS, ideally having the switch match the selected blade color. I know using a single neopixel would be a smarter move as a matching accent LED, but I don't have another place on my hilt that I'd like to put an accent LED.

I see in the Config.h file a place where I can define MULTICOLOR_ACCENT_LED, but as far as I can tell, there is nowhere in the entirety of the rest of the code where that is used. Is there a way to do this, or am I stuck just picking the color of my LED during construction, and sticking with it? If I can, what pins should I connect it to? I'd love to still use blade power-off feature with the built in MOSFETs on the DIYino, but if I need to repurpose the PWM digital pins, I have another beefier MOSFET I can use to kill power to the neopixels.

Feel free to educate me on how I'm being an idiot and not understanding what I'm doing. I'd rather learn than think I'm right.
It might need some consideration, but as the used voltages are roughly the same for high power and regular RGB LEDs, what I've done one time was to simply connect the illumination regular 5mm RGB LED parallel (red to red, blue to blue, you get the idea) to the Star LED module illuminating the blade. Easiest, guaranteed to have matching colors.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: padawan on Sep 16, 2017, 05:44 pm
Wow! I love seeing Star Wars projects in the forum and it's giving me some crazy ideas for my own future projects ! I just hope I can get to a level to make something like a lightsaber in less than 100 years!
-p.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 04, 2017, 12:51 am
Has anyone tried to code LSOS to use the Adafruit Pixie instead of the Luxeon style HP-LED? I ran a generic code for the pixie once I had the focusing lense on and the blade over it and it's bright  enough for a replacement and has built-in resistors making wiring easier to do.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 04, 2017, 02:12 pm
I'm pretty sure it would be simple to update the open source saber codes to support the pixie. For that the right trigger would be someone showing off a blade, best to compare it against one of the more popular RGB LED types like Cree. If the brightness is comparable, I expect that the interest will be there to warrant a code update.

I do not have a pixie, so I cannot experiment with it. But if I saw some pics showing a blade against a reference one, I might decide to update FX-SaberOS to support it.

Therefore Damien, send the pics :) !
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jbkuma on Oct 04, 2017, 03:32 pm
If you look at some of my LightSaberOS code I used an RGB Cree with a WS2811 chip.  The only really imporant change was that I simply made the first pixel represent the blaster block effect.  I also made the ignition sequence fade up and down which affected the whole blade, and the meter effect for the menus lit the first pixel in accordance with the level. 

The main reason I really did this was really for illuminated blade plugs.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 05, 2017, 03:07 pm
If you look at some of my LightSaberOS code I used an RGB Cree with a WS2811 chip.  The only really imporant change was that I simply made the first pixel represent the blaster block effect.  I also made the ignition sequence fade up and down which affected the whole blade, and the meter effect for the menus lit the first pixel in accordance with the level. 

The main reason I really did this was really for illuminated blade plugs.
Is it possible to resuse the neopixel lib to drive these LEDs? If yes, that would be great, as no need to use another API.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jbkuma on Oct 05, 2017, 03:33 pm
Is it possible to resuse the neopixel lib to drive these LEDs? If yes, that would be great, as no need to use another API.
It does require transistors, but even my RGB only sabers are really pixel sabers.  My first saber was made this way because I was using a lot of pixels for accents and it was just the easiest way to keep everything in sync.  That saber uses a Nano Biscotte with a Pro Mini companion board.  Since I designed it to be modular I've debated between making a second Arduino based core, or just gutting it and making it a DIYino based saber (and possibly pixel blade capable).

I have played with designs for a cheap and easy PCB that can be installed inside the HP LED heatsink. It isn't that complicated but I haven't ever made my own PCB and got busy so I lost interest and forgot about it. (I'm pretty sure I emailed you some ideas about this)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 10, 2017, 07:05 pm
The main problem I'm running into is that the Pixie Library requires SoftwareSerial but they it conflicts with the DFPlayer....the designed of the pixie said is someone was to write the firmware for the Pixie and update it to communicate at 400khz then it should be able to use the WS2812 library. But I have no clue how to do that....any volunteers? Proto...if you're willing to try it, I will buy you a Pixie and have it shipped to you.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 11, 2017, 01:44 pm
Nice offer, but currently I'm working on a different project. But I thought you can use multiple instances of the SoftwareSerial as long as the 2 pins used are different and the Prime has still quite many pins to spare. Nevertheless I might just buy a Pixie myself, I anyway have to replenish my Flora stocks (single neopixles, I love them!)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 12, 2017, 06:25 am
I don't know how to make that work, I tried it and nothing happened.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: SkyWolker on Oct 19, 2017, 04:10 pm
Hi everyone!) People, I have problems ... decode, please, the circuit .. I do not know how to connect the LEDs.
I understand correctly?(https://drive.google.com/open?id=0B3eGrROZR0EJNGs2c3VHSnNaX0U)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 23, 2017, 12:59 pm
Hi everyone!) People, I have problems ... decode, please, the circuit .. I do not know how to connect the LEDs.
I understand correctly?(https://drive.google.com/open?id=0B3eGrROZR0EJNGs2c3VHSnNaX0U)

Did you look into either the Stardust or the Prime manuals? They both have full wiring diagrams for whatever lightning you wish to use.
https://github.com/Protonerd/DIYino/blob/master/DIYino_Stardust_v2_User_Manual_v1.pdf
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: SkyWolker on Oct 23, 2017, 04:16 pm
Did you look into either the Stardust or the Prime manuals?
I do not have DIYino board. I collect according to this scheme.
https://drive.google.com/open?id=0B3eGrROZR0EJYlNiZmp3TzNlXzQ
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Mattleshman on Oct 28, 2017, 12:21 am
I have the same problem wiring a single RGB Star LED. There's no schematics that works for me yet.

I test the LightSaberOS 1.4 and works sound and accelerometer. But LED don't turn on.

I don't understand yet how to connect LED to pins to MOSFET and which one MOSFET is the best for my 3w RGB LED.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DJWing79 on Oct 28, 2017, 03:05 am
If anyone is willing to try to modify the LSOS code for the 2 SoftwareSerial connections and include the Pixie library, I'd be very grateful. They look like an easy replacement for HP-LEDs with no need for N-FETs or resistors.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: SkyWolker on Oct 28, 2017, 10:24 am
If anyone is willing to try to modify the LSOS code for the 2 SoftwareSerial connections and include the Pixie library, I'd be very grateful. They look like an easy replacement for HP-LEDs with no need for N-FETs or resistors.
But in LOSS there is already a code for Pixels. You just need to select it in the settings. In the description for github.com everything is there.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Oct 31, 2017, 06:49 pm
If anyone is willing to try to modify the LSOS code for the 2 SoftwareSerial connections and include the Pixie library, I'd be very grateful. They look like an easy replacement for HP-LEDs with no need for N-FETs or resistors.
I might give it a try, I'm thinking about installing one at the base of the blade and one at the tip facing each other to have an more even lighting. Problem is, it seems they can be ordered only from the Adafruit website (US), with all that implies for Europian customers...

Damien, if you buy me 2 pcs and send them to me as gift I will pay for them and try out. How does that sound?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: SkyWolker on Nov 08, 2017, 11:57 pm
Hello! I have a problem .. my sound module refuses to work ..

Here's a video. on the first work with a standard library.
On the second with LSOS.
Sometimes the module plays a sound, but does not respond to movements. and the buttons behave strangely. Everything connected according to the scheme in Readme.

https://youtu.be/9evUSPzsogs- on the first work with a standard library

https://youtu.be/DcUurRfH-rk- on the first work with a standard library

https://youtu.be/XymXAmOg8zo-LSOS

https://youtu.be/G3sggHCqvR0-LSOS
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Justicezz on Dec 06, 2017, 08:46 pm

Hello, the blade does not change the color in the settings, what could be the problem?
I use LSOS1.5
https://youtu.be/3YWQcZkM9A4
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Dec 12, 2017, 11:16 am
Hello, the blade does not change the color in the settings, what could be the problem?
I use LSOS1.5
https://youtu.be/3YWQcZkM9A4
Look here:
https://github.com/Protonerd/FX-SaberOS/wiki/Gravity-Color

And use FX-SaberOS.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: notabadguy on Dec 18, 2017, 11:20 pm
Hello!
I want to make a lightsaber for my son, but I have problems
I use:
arduino uno ATmega328P-PU 16mHz
or
arduino Pro Mini  ATmega328P-AU
ledstring   30 pieces
arduino IDE 1.8.4
LightSaberOS-LSOS-1.5_GravityColorBlend
or
LightSaberOS-master
I do everything according to the instructions:
in Config.h I make the following changes :
1) //#define BATTERY_CHECK // comment to disable - disable BATTERY CHECK
2) //#define LEDSTRINGS
   //#define STAR_LED
   #define PIXELBLADE   // choose WS2812B
3) #define CROSSGUARDSABER  // i.e. Kylo Ren saber - in fact, I chose any of them
4) #define NUMPIXELS 30 // 30 pieces WS2812B
5) #define DATA_PIN 13 // D13 - I tried to assign a different pin
6) //#define DIYINO_PRIME
   //#define DIYINO_STARTDUST
   #define ARDUINO_HOMEBREW  // as I understand the two coming for a special board all in one
7) //#define SOFT_ACCENT // changing the pin number tried to include this parameter (if enabled -
                                            compilation error)
that I have in the end:
after the firmware nothing happens, there is no reaction to the button press, the LEDs do not catch fire ... I repeat that I tried to change the assigned pin, I also checked the modules included in the libraries (WS2812.h , OneButton.h)  with examples of them! all the individual parts work properly:  arduino, button and WS2812b...
at this moment DATA_PIN  WS2812B connected to pin 13 arduino uno , button connected to pin 12 and GND
I'm not a programmer, but in electronics I understand very well, I ask for help!
just at the moment I did not connect the MPU6050 and the player, I hope it's not critical
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jbkuma on Dec 18, 2017, 11:25 pm
How are you connecting the power for the pixels? The board will not be able able to power even 30 directly, it must be powered from the battery or power source directly with a common ground.

That being said, the initialization is probably failing because the the DFplayer isn't attached.  Open a serial monitor and see what it says.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: notabadguy on Dec 18, 2017, 11:35 pm
in fact for the test I use only 8 LEDs, DFplayer
and the MPU6050 uses the I2 bus and I'm afraid that the controller can poll the device .. ok I'll look in the serial monitor
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: notabadguy on Dec 18, 2017, 11:48 pm
that's it! Thank you!!! help please properly turn off the player until it is delivered
L03⸮⸮ ?? ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮ ???????????????????????????????????? Extraterrestrial
Connecting to DFPlayer ...
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: lakron on Dec 25, 2017, 10:16 pm
Hello. I've downloaded FX-SaberOS from github master branch. I have arduino ide v1.6.7.
I have some errors during compiling Cannot convert int to enum type,  cannot convert 'cRGB' to 'uint8_t*. What ide do you use?
Edit - with Arduino IDE 1.8.5 ok. Only if not defined BATTERY_CHECK, there are errors in BATTERY CHECKING FUNCTIONS, added #ifdef BATTERY_CHECK.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: NobAkimoto on Jan 18, 2018, 10:01 am
So one thing that I've found to be a bit of a pain is the fact that it appears almost every commercially available DFPlayer Mini comes with pre-soldered headers.

Does anyone know of a DFPlayer Mini supplier that doesn't pre-solder the headers in place?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 18, 2018, 12:26 pm
So one thing that I've found to be a bit of a pain is the fact that it appears almost every commercially available DFPlayer Mini comes with pre-soldered headers.

Does anyone know of a DFPlayer Mini supplier that doesn't pre-solder the headers in place?
I only know the DIYino boards which come wo/header <evil grin>. Of course you get much more than a DFPlayer mini...

Joke aside, no, I only know the ones with the pre-soldered headers. But you can easily unsolder them, just make sure you remove the plastic band holding the header pins together. Afterwards it's just pull-and-throw.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: NobAkimoto on Jan 18, 2018, 03:32 pm
I mean...if you have more boards to sell... *Ahem* (In all honesty, when factoring in things like size and just labor of setting things up, DIYinos are quite a bargain)

The hassle isn't a dealbreaker when making budget test rigs or things I want to test a little more...extremely than I would with a DIYino, but I was hoping someone, somewhere had found a source without the headers.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: RobMonty on Jan 21, 2018, 03:58 pm
No links to photobucket work for me... odd....
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Jan 24, 2018, 03:31 pm
No links to photobucket work for me... odd....
Photobucket links do not work anymore for anyone. That *** of a company changed their policy wrt 3rd party hosting, deleting a decade of visual documentation on nearly all internet forums around the globe.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Jan 31, 2018, 10:37 pm
Hi guys

I'm building a homebrew (right now as prototype using Aurduino UNO) + neopixel strip version.
Final target is to use 18650 battery but currently I'm using laboratory power supply fixed to 5V.

After configuring the OS and burn the code mainly all seems working fine. Congratulations Protonerd !!!!!  :smiley-yell:

But operating it a little bit I found one audio issue.
SOME of the sounds keep in infinite loop after playing them. For example the saber ignition off or some config menu voices. I can solve the issue provoking another audio execution or rebooting.

Are someone facing a similar problem?

I could notice some uP reboots navigating through config menu always including some strange noise in loop as well... but I'm not sure if it's related or not.

I'm using the serial resistor in DFPlayer RX line to adapt arduino tx 5V.

Thanks in advance !!!
Pedro.-
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jbkuma on Jan 31, 2018, 10:53 pm
This is not a common or persistent problem, it sounds like a configuration issue.  It could be that your sounds are not addressed properly and they are repeating as a hum.

Are you using one of our supplied fonts or a font of your own? Did you convert it properly?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Feb 01, 2018, 12:49 am
Hi jbkuma, thanks for so quick reply!

I'm using supplied fonts.
In fact, I used all the content included in the file DIYino_Prime_SDCard_image.7z
Basically I uncompresed all the content, and after format SD card I drag and drop all the content (config sounds and 5 soundfonts folders).

For example when I turn off the sable, the retraction sound seems the proper one, bit just keep in loop.
Also the config vocals seems matching with the proper configuration option.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 01, 2018, 01:26 pm
Are you using FX-SaberOS? If yes, do you configure your board type correctly? If you are using a home brew solution, you shall define DIYino Prime as board, because the Stardust only expects 3 sound fonts, with a different structure, it might be the source of your problems.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Feb 01, 2018, 09:42 pm
Hi again !!!

I'm using FX-SaberOS (github.com/Protonerd/FX-SaberOS) master version.
Yes, I defined DIYino-Prime as hardware type, and I confirmed the soundfont structure defined in the code and it's exactly same as the one you supplied.

I made I video showing the behaviour: http://gofile.me/2aJqt/u99y6rddR

While recording I notice I thing. Ignition OFF is working properly (no loop) if I turn off saber before HUM sound is starting the second loop. In de video you can see it looking the DFPlayer LED.
Also I extend the video navigating through Config Menu to show you what happens with sound changing config options and modifying volume value. Maybe this strange noises are related.
As I mention before I'm facing some resets during config for example changing volume value.

As you can see, the sounds are apparently selected properly inside de soundfont.
Anyway I tried two different SDCards, 3 different DFPlayers and I format many times the card to write files by different ways, as for example drag and drop all folders at the same time, one by one in other...

I will agree some ideas to test ! :-)

Thanks a lot.
Pedro.-
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Feb 03, 2018, 11:54 pm
Hi guys!
Still I don't know exactly the root cause of why I facing the audio problem I explained... but after some hours investigating I have some details I wanna share.

Basically what happens is that at least my DFPLAYERmini boards are no disabling the loop mode automatically when executing the function SinglePlay_Sound what is basically executing the library function dfplayer.playPhysicalTrack. So once a track has been played using LoopPlay_Sound (library dfplayer.playSingleLoop).

I simulated this working mode in a test scketch using original DFRobot library (DFRobotDFPlayerMini), and I could reproduce exactly the same with a this simple code:
Quote
myDFPlayer.loop(59);
    delay(20000);
    myDFPlayer.play(35);
    delay(5000);
When track 35 starts player keeps in loop mode.
¿Only my DFPlayer boards? I don't know.... :-o

Checking a little all available functions in the library I could found the function disableLoopAll(), and I added it before reproduction of track 35... and... it starts to work as expected !

I created inside DFPlayer_LSOS library a function to call this serial command (0x11 0x00) and executing it like this, the issue is solved...:
 
Quote
dfplayer.disableAllLoops();
  delay(100); 
  dfplayer.playPhysicalTrack(track);
This high delay is not so good but without delay the playback of the single track is not executed...

I will continue the investigation!

By the way... I detected a short noise at the end of some soundfont wav tracks (in my previos video is possible to heard them).
I read something about it, and it's related with the metadata included in the wav files. I removed all this metadata and these noises disappears at all !!!

It happens only with my DFPlayer boards?
They are from china, and if they are the origin of my problems I will try to obtain a pair of the original ones.... :-o

Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 05, 2018, 11:26 am
This problem is not known to me. If a new playback is started, the previous playback (no matter if looped or single playback) will end. There will be a gapless transition.

It's interesting what you wrote about the metadata. Can you share more info on that? Never encountered this.

If you want to be sure that it is a genuine DFPlayer, look at the main 24-pin chip. It shall be either a YX5200-24SS or YX6300-24SS type.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Feb 05, 2018, 08:12 pm
Hi,

Regarding metadata, I read about it from the developer of this library: https://github.com/jonnieZG/DFPlayerMini.
He mention about it in the readme:
"The DFPlayerMini supports both WAV and MP3 formats. When using WAV files, you should make sure to remove any metadata from the WAV file, since the player will interpret it as noise."
Attached an example screenshot of the metadata included in volume.wav.
After remove this data and save save the file without them "my" dfplayer is not reproducing noise at the end of the track.

By other side, I confirmed the IC mounted in my board and it's not one of the references you mentioned. I added a picture. It's like "JC AA1746CJ1Uxxxxx"Any number is matching... and I cannot find any reference in google about it... :-)

Maybe the firmware version of my boards are different or just olders... I will investigate about it because according datasheet there is a query for software version.

I will post If I have updates.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Feb 06, 2018, 10:55 am
Hi,

Regarding metadata, I read about it from the developer of this library: https://github.com/jonnieZG/DFPlayerMini.
He mention about it in the readme:
"The DFPlayerMini supports both WAV and MP3 formats. When using WAV files, you should make sure to remove any metadata from the WAV file, since the player will interpret it as noise."
Attached an example screenshot of the metadata included in volume.wav.
After remove this data and save save the file without them "my" dfplayer is not reproducing noise at the end of the track.

By other side, I confirmed the IC mounted in my board and it's not one of the references you mentioned. I added a picture. It's like "JC AA1746CJ1Uxxxxx"Any number is matching... and I cannot find any reference in google about it... :-)

Maybe the firmware version of my boards are different or just olders... I will investigate about it because according datasheet there is a query for software version.

I will post If I have updates.
This certainly does not look like a genuine DFPlayer... where did you get it? The DFPlayer chips are from a Chineese company called YX and the 2 products mentioned are the only ones mounted on genuine DFPlayer parts.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Feb 08, 2018, 08:55 pm
I bought them from Aliexpress. But there are a lot of sellers offering this product.
Exactly this one in my case: https://es.aliexpress.com/item/5Pcs-DFPlayer-Mini-MP3-Player-Module-For-Arduino/32750446150.html?spm=a2g0s.9042311.0.0.3BHe06
Of course the chip I received is not the one you can see in the pictures. They are showing DFRobot module, same as the original com DFRobot.com

I will order form another seller or the original ones. In Aliexpress I could see customer pictures of the product and the mounted IC are the YX one.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: xl97 on Mar 01, 2018, 11:54 pm
I ordered some DFPlayers to play with as well..

stand alone used with an Arduino, not a completed DIYino board to be clear.

They are legit boards/chips..

I have 1 hardware question and some software questions if anyone has dealt with this, I'd appreciate some feedback.

I currently get a loud POP from the speaker conected to the DFPlayer when the project is powered on/off..

Audio playback once powered up is fine.

Has anyone had this issue?  And what was your fix?  I read about a MOD to the DFPlayer board itself.. (but was hoping for alternate solutions?)


Secondly..  (I'm currently using the DFRobot lib, but will use another if meets my needs and has documentation about the functions/how to use them..etc)..

How are people detecting the 'end' of the file playback?  (ie: playback completion?)

I am currently attempting this as so:

I only need to know when track '2' is done playing (which is only set to be played once)... so I can automatically trigger another file to play an in infinite loop..

currentTrack is var to hold the currentTrack playing
doCompletion check is a var so the 'check' only happens one time in my loop.

Code: [Select]
if(currentTrack == 2 && doCompletionCheck == true){
    if(myDFPlayer.available()) {
       if(isFinished(myDFPlayer.readType(), myDFPlayer.read()) == 1){           
        //Serial.println(F(">>> PLAYBACK COMPLETE <<<"));       
        currentTrack = 3;
        doCompletionCheck = false;   
        myDFPlayer.loop(3);                         
      }             
    }
}


I have tried
readState()
readType()...

and combinations of both..

I found the serial output seems correct, but the audio gets 'janky'... 

project summary:
press button, triggers 001.wav to play (once)
if button is still being pressed and 001.wav is complete,..trigger 002.wav to play immediately, and loop forever (until button is released)
when button released, play 003.wav file (once)..

I have/am experiencing the same issue as PedroRS is....
Is there a proper procedure/order when playing a file one time and playing a looping file.. and then going to another file to play it once?

sometimes the 001.wav doesnt trigger
after running the looped file for a while, sometimes the 003.wav file doesnt play.. or the 001.wav doesnt play when the button is pressed again.

I -feel- like there is supposed to a proper way to 'stop' the files from playing before calling a new one to play?  (but sometimes it DOES work)..

I have no delays in my sketch, its a FSM type of approach...

The above is even more prevalent when I added in some Neopixels..  (more audio playback issues)

Any ideas? or suggestions?

Is there any specific documentation about the other DFPlayer classes out there? DIYino or neskweek variant?  (I'm looking for some documentation of the public methods, and what they do/examples of usage)..

Maybe these have built in 'watch dogs' for when I file completes playback? 



Update question:  Has anyone else ran into issues while using NeoPixels, and serial comm. with the DFPlayer?  The NeoPixel lib (form my understanding) disables interrupts during its updating of the led strip...  disabling of interrupts causes issues with serial communication (which is needed for communicating to the DFPlayer)..   what has everyone been doing to address this issue?  Different approach? Different libraries? (although I'm not sure if you can work around the timing requirements of the Neopixels)..

Thanks!



@Protonerd

Yikes!  Sorry I didnt realize until now this was a gallery post!!  (sorry)..
I just saw others discussing their component issues..etc..etc..  and posted.
I can move it if you like.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 02, 2018, 12:28 pm
Good news for all those who want to have a known-good module with a proven architecture, and that for a very friendly price:

I proudly and happily announce the newest member of my Arduino compatible family of boards, the

DIYino Stardust V3 (NEW!!!)





More info can be found here:

Link to Stardust V3 thread (https://forum.arduino.cc/index.php?topic=393174.msg3628969#msg3628969)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Mar 09, 2018, 11:09 pm
Hi guys

I'm building a homebrew (right now as prototype using Aurduino UNO) + neopixel strip version.
Final target is to use 18650 battery but currently I'm using laboratory power supply fixed to 5V.

After configuring the OS and burn the code mainly all seems working fine. Congratulations Protonerd !!!!!  :smiley-yell:

But operating it a little bit I found one audio issue.
SOME of the sounds keep in infinite loop after playing them. For example the saber ignition off or some config menu voices. I can solve the issue provoking another audio execution or rebooting.

Are someone facing a similar problem?

I could notice some uP reboots navigating through config menu always including some strange noise in loop as well... but I'm not sure if it's related or not.

I'm using the serial resistor in DFPlayer RX line to adapt arduino tx 5V.

Thanks in advance !!!
Pedro.-
Replying myself.... and just to help somebody facing same issue.

I confirmed the route cause of problem with DFPlayers mounting non XY devices (they have a lot of incorrect behaviors).
After replace in my modules the IC with an XY all is working as expected (audio loop stops, metadata in wav files are not provoking noises, and no more hung ups while navigating the config menu).
Seems like a firmwares issue or similar...

Regards!
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 12, 2018, 07:03 pm
Great, so the clear message is: check that you have a genuine DFPlayer wih an YX chipset. Or even better, get a DIYino board, then you do not have any risk, all the components are genuine, and sure to work :)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: PedroRS on Mar 13, 2018, 01:59 pm
Taking into account all extra parts I bought to resolve the problem it don't seems a crazy option, sure... :-D
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Mar 19, 2018, 10:37 am
Taking into account all extra parts I bought to resolve the problem it don't seems a crazy option, sure... :-D
That is one reason among a few I decided to make the DIYino boards. At the price point the V3 is currently sold, it's nothing short of a bargain.

I made quick statistics, 95% of the problem support I give to people over on GitHub how to use FX-SaberOS are related to homebrew solutions. No complaint so far with any DIYino boards other than folks not reading the manual.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: dgkavanagh on Jun 18, 2018, 12:41 pm
I created inside DFPlayer_LSOS library a function to call this serial command (0x11 0x00) and executing it like this, the issue is solved...:
Hey Pedro!

I'm having the same issue, after i bought a DFplayer from Ali Express. I don't have the requisite knowledge to modify the library correctly.

I've tried adding the following code to the DFPlayer.h in the DFPlayer_LSOS library:
Code: [Select]
inline void disableAllLoops() {
setSendBuffer(0x11,0x00);
}


I then added your amendment to the FX-SaberOS script.

Would it be possible for you to provide more details so i could reproduce your fix please? :)

EDIT: I forgot to add the send(); command to the above. So i added the following and it now works!!
Code: [Select]
inline void disableAllLoops() {
setSendBuffer(0x11,0x00);
send();
}
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: DUSTY36 on Oct 30, 2018, 06:15 pm
üdvözletem nekem olyan gondom lenne hogy a  hang fagyási problémáim vannak és nem tudok rájönni hogy mi
lehet a gond arduino nano 3  dfplayer mini Mpu6050  ezeket használom meg a Fx-saberOs programot de valamiért mindig van fagyási probléma mi lehet a gond


mindent beálítottam de valamiért folyton a hang beakad  ezen a címen elészt peterfekete81@gmail.com
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: xl97 on Oct 31, 2018, 12:46 pm
what???
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Nov 23, 2018, 02:29 pm
The one before your message was written in Hungarian language, basically the guys was complaining about freezes with his setup.

@DUSTY36: I guess the problem might be a too high usage of RAM leading to instabilities. Can you specify for me how you configured the code? Especially if you have a neopixel blade with more than 120 pixels, stability problems can arise. The code is prepared for it however, so the worst thing what can happen will be that the system will be restarted by the watchdog.

If under "freezing board" you mean that the sound file keeps repeating, then you simply have a fake DFPlayer which is not fit for use. In this case make sure you have one with a genuine chipset from YX (that is a chineese company manufacturing these chips)
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: cslee_work on Dec 18, 2018, 05:14 am
I want to use a Wemos ESP-32 module with 18650 batery holder. Does anyone know how to compile for it? I complains about avr/eeprom.h is not there. I think it's the board issue. I compiles if I set the board for arduino Uno.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: jbkuma on Dec 18, 2018, 06:17 am
ESP32 doesn't have EEPROM, you would either need to use preferences or spiffs.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: bigdean65 on Feb 19, 2019, 11:57 am
I am running into the same issue.  Typically it loops whenever I turn the saber off.  It will play the saber shut down over and over. 

I have ordered some new DFPlayer's with the YX chip... hopefully that will fix it.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Theultimatesaber on Apr 01, 2019, 07:14 pm
Greetings Arduino community!

1) I'm looking for someone that can help me with a bring-up of Arduino on a new platform. To simplify the task this new controller will mimic a prior popular Creative Commons design (proffieboard) (https://fredrik.hubbe.net/lightsaber/v4) and provide similar features (strip LED, color profiles, possibility of accelerometer integration with smooth swing, flash on clash etc). Looking for someone with some prior experience or strong firmware skills to help get this project underway.

2) Secondarily I'm also looking for someone that can assist in saber application development.  This can be Python or other scripting to develop the observable aforementioned behaviors.

This new controller design once completed will be sent to our pcb design house and will be available to the public once our final build is complete.

Payment for this project will include the final production saber and is open to negotiation. This is an opportunity to work with an extremely exciting product and should serve as a wonderful new stepping stone for the sabering community and other DIY builders.

For more info please feel free to contact me directly at: theultimatesaber@gmail.com
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: xl97 on Apr 02, 2019, 03:26 am
?

1.) What would be any different than the retail boards? (plecter/naigon)
* feature wise

2.) What is any different from the number of DIY solutions out there?
* what different features? (and why?)
* why would I (as a consumer) want your new board over these others?


I see  you also posted at the fx0sabers forum too....(good luck)

I'm not sure I really understand your intent here?

Its like some saying "I want some to help make a new car"  (when there tons of different cars already exist)

probably cheaper to just buy one, thast fits your needs..

Is your new board planning on being open source as well or closed? and sold for profit?

What do you mean by this: "Arduino on a new platform"?
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on Apr 04, 2019, 09:55 pm
And the Arduino Saber Story is continuing...

I've been working on a new development for some months now pondering on what could be the next step in saber board design. Looking at the existing portfolio of established board manufacturers and open-source boards, we have seen an awesome development since the DIYino Prime board started the open-source revolution back in 2015.

Powerful processors, mid- to high-end motion engines, installation optimized board layout, USB-charging, cheap boards, quality boards, programmable boards, GUIs, advanced power saving, you name it. Not to mention the features implemented in software, SmoothSwing, full features with single button, neopixel animations, etc., all of which were implemented by the community whose cradle this very Arduino forum was.

I came to the conclusion that there is only one thing not existing yet, which would be a great addition, opening up endless new possibilities: a board having all these AND integrated Bluetooth capability.


Therefore I made research into what is required to build a over-the-air controllable board with BLE. Most major industrial nations require a certification in order to sell Bluetooth capable devices, so that was what I'd been looking for. And I found the ideal candidate: the new board will be built around a ready-to-use BL module, which is certified for all the countries where a certification to use a BL device is needed: MDBT42Q (http://www.raytac.com/product/ins.php?index_id=31).

This beauty integrates an nRF52 chip from Nordic, which in turn has an ARM Cortex M4F. I.e. it has one of the most powerful 32-bit controller cores on the market, with 512k Flash and 64k RAM. I dubbed this new Board

DIYino Infinity




, as it offers nearly infinitely more resources than the AVR open source sabering started with. Infinity is engineered for perfection and quality without compromises known for all DIYino boards: I use the world's most advanced PCB design tool for professionals. It is developed with the full power of two expert EEs, using state-of-the-art Design Rules. More, it will be among those few boards which utilize 4 layers for routing, therefore it will have the highest density of features on the smallest PCB possible. I guess this is already formidable, but I haven't mentioned the best part: it is designed by someone who actively builds sabers   Oh yeah, Infinity will be infinitely and definitely open-source, both in hardware and software.



The CPU of the BLE module has one more unique feature I instantly fell for: all of the pins can be configured for all possible functionalities. I.e. all 7 GPIOs available in addition to all signals controlling the motion engine, audio amp, power saving and UART link can be used for PWM, SPI, I2C etc. This makes the board ideally suited not only for saber boards but a whole range of other props and creations. The board supports USB charging of a single Li-Ion battery cell and has provisions to connect an external USB breakout board for both charging and programming the board, without the need to access the board itself. Well, not to mention that once BLE is up and running the saber can be interacted with, including config settings, from a smart phone or PC.



The CPU of the BLE module has one more unique feature I instantly fell for: all of the pins can be configured for all possible functionalities. I.e. all 7 GPIOs available in addition to all signals controlling the motion engine, audio amp, power saving and UART link can be used for PWM, SPI, I2C etc. This makes the board ideally suited not only for saber boards but a whole range of other props and creations. The board supports USB charging of a single Li-Ion battery cell and has provisions to connect an external USB breakout board for both charging and programming the board, without the need to access the board itself. Well, not to mention that once BLE is up and running the saber can be interacted with, including config settings, from a smart phone or PC.

The CPU of the BLE module has one more unique feature: all of the pins can be configured for all possible functionalities. I.e. all 7 GPIOs available in addition to all signals controlling the motion engine, audio amp, power saving and UART link can be used for PWM, SPI, I2C etc. This makes the board ideally suited not only for saber boards but a whole range of other props and creations. The board supports USB charging of a single Li-Ion battery cell and has provisions to connect an external USB breakout board for both charging and programming the board, without the need to access the board itself. Well, not to mention that once BLE is up and running the saber can be interacted with, including config settings, from a smart phone or PC.

Currently board bring-up is progressing well, most of the integrated modules, including the capability to connect to a smart phone are up and running! Keeping the fingers crossed and very excited about this new prop board.
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: xl97 on Apr 05, 2019, 03:58 am
+1
Title: Re: Arduino Lightsaber for/with LED string blade
Post by: Protonerd on May 08, 2019, 11:13 pm
Yes, but not just any +1, but one from the original creator of Open Source Saber Boards!  :)