Arduino Lightsaber for/with LED string blade

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

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.

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.

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.

Good news.
Now I have all electronic materials.
Here is my progress

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 ... STRAWHAT STRAW HAT 180gradi 100 LED ROSSI 5000mcd 5mm + RESISTENZE A2C25.A2C48 | eBay).

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

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

Chivontekai ... Yes ... 96 leds

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

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 .

Thumbs up!

How do you intend to interlink the LEDs?

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.

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

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.

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?

Protonerd:
@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 :slight_smile: ), 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 :).

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 :slight_smile:

Protonerd:
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 :slight_smile: (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 :).

@racemaniac: :slight_smile: 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...

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 .