Go Down

### Topic: Arduino Lightsaber for/with LED string blade (Read 145761 times)previous topic - next topic

#### integra386

#30
##### Dec 15, 2015, 04:34 pmLast Edit: Dec 18, 2015, 12:46 am by integra386
I will use the Makoto's tecnique but I will use a small jig to bend the LED's leads, created with 3D printer.

Meanwhile I got the DFPlayer and I started to " play" with the sounds.

#### Protonerd

#31
##### 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:

@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)) {}

#### Protonerd

#32
##### Dec 20, 2015, 10:54 pmLast Edit: Dec 20, 2015, 11:00 pm by Protonerd
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

#### integra386

#33
##### 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?

#### racemaniac

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

#### Protonerd

#35
##### 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

#### racemaniac

#36
##### 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 .
I love a bit of a programming challenge .

#### Protonerd

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

#### integra386

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

#### neskweek

#39
##### Dec 28, 2015, 01:38 pmLast Edit: Dec 28, 2015, 01:45 pm by neskweek
Hello there !

So much you decided me to build my own.
I've ordered the boards and some leds :
• 110 x green 5mm leds  140° 4000mcd 20mA 3.2/3.4V
• 80 x red 5mm leds  140° 3000mcd 20mA 2.0/2.4V

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

Thank you !

#### Protonerd

#40
##### 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!

#### JakeSoft

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

#### neskweek

#42
##### Dec 29, 2015, 06:22 pmLast Edit: Dec 29, 2015, 06:29 pm by neskweek
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

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

#### racemaniac

#43
##### Dec 29, 2015, 10:59 pmLast Edit: Dec 29, 2015, 11:00 pm by racemaniac
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

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

#### ryang

#44
##### 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!

Go Up