Neopixel Lightsabers W/ Party Modes - Arduino Controlled
by Modustrial Maker in Circuits > LEDs
20785 Views, 32 Favorites, 0 Comments
Neopixel Lightsabers W/ Party Modes - Arduino Controlled
I have entered this in the Arduino contest -- if you like this Instructable, I would greatly appreciate your vote. Thanks!
https://www.instructables.com/contest/arduino2017/
This project started as part of my Halloween costume, and then expanded...a lot. I ended up making two lightsabers - a Kylo Ren style saber and a Rey / Anakin Skywalker style saber, and creating different Arduino code to simulate each. And, I decided to go beyond the normal lightsaber, and create a party mode with colorful animations on the saber. (You definitely want to watch until the end of the video to see Kylo's reaction when he tries out his newly constructed saber, and finds out it also has the party mode….) Now that the work is done, this Instructable shows how you can create this saber with inexpensive parts (about $75 for each saber), and simply upload the code I've linked to in this instructable, rather than having to code for the Arduino yourself.
Note on the code (links later) -- I was particularly happy with the code for the Kylo Ren saber for a couple reasons: (a) it imitates the sparking look of his unstable blade better than others I've seen, (b) the power on effect delays the side blades until just after the main blade powers just as in the movies (for those not obsessed with sabers, the side blades are exhaust vents for Kylo's unstable blade, and thus do not come on until the main blade is lit). Also, both blades have a sinusoidal power on effect that I think is a bit closer to the effect in the film than the linear power on effects I've seen in a lot of sabers.
These hilts are not intended to be replicas by any means (after all, every jedi’s rite of passage is making their own light saber). Instead, I wanted to focus on making something that looks high quality and cool, with a metal hilt and LED control button, at a reasonable cost.
Gather the Materials
SABER PARTS:
(NOTE: I used parts from Home Depot, which are a bit less expensive than Amazon.)
• Polycarbonate tube: http://amzn.to/2Dd9YYb
• Pop-up drain: http://amzn.to/2mgaZGX
• Drain Extension Tube: http://amzn.to/2mf829h
• 5V Momentary LED push button: http://amzn.to/2CLbu2E OR https://goo.gl/Cn1iDy
• WS2812 144 LED/m strips (2x / saber): http://amzn.to/2CLIlEB OR https://goo.gl/Cn1iDy
• WS2813 144 LED/m strips (new LED type) (2x / saber): http://amzn.to/2qQqPgC OR https://goo.gl/q88jDe
• 4AA Battery Holders: http://amzn.to/2qNJzxw
• 1.2V NiMH AA batteries - http://amzn.to/2DKrIdL OR http://amzn.to/2FPDp3o
• JST Connectors: http://amzn.to/2ALve4j
• 1 ¼” PVC pipe: http://amzn.to/2CKP95m
• ¾” PVC cross: http://amzn.to/2FlI5On
• O-rings: http://amzn.to/2Eq2FvB and http://amzn.to/2Eq2FvB
• Packing foam: http://amzn.to/2FoqrcL
ELECTRONIC TOOLS
• My favorite solder: http://amzn.to/2CNgjIF
• Quality Soldering Iron: http://amzn.to/2CKHoMC
• Blue Soldering Mat: http://amzn.to/2DboPCd
OTHER TOOLS:
• Tap Drill Bit (for threaded holes): http://amzn.to/2Fm7V4A
• RZ dust mask: http://amzn.to/2wM8F1t
• Bosch 18V cordless circular saw: http://amzn.to/2wcDgnN
• Bosch 18V cordless Drill & Impact Driver Kit: http://amzn.to/2BCI753
• Dewalt Table Saw w/ 32” Rip Capacity: http://amzn.to/2yQd2Fy
• Japanese Flush Cut Hand Saw: http://amzn.to/2yRa1Fd
• Dewalt 12” Miter Saw: http://amzn.to/2yQRgS6
Make the Hilt
The hilt is constructed primarily from plumbing parts you can find at Home Depot or any big box store, except for the 1" polycarbonate tube that you can buy from Amazon.
First I'll describe the Anakin/Rey-style single blade hilt, and then I'll describe the differences for the Kylo Ren crossguard-style hilt.
The main part of the hilt is made from a combination of a 1.25" pop-up drain and a 1.5" drain extension tube with a slip connector, which are attached to each other with o-rings and 1/4" bolts (so they can stand up to some punishment). The cool thing about the 1.25" pop-up drain is that a 1.25" PVC pipe will fit snugly inside of it, and in turn, the 1" polycarbonate tube for the blade will fit snugly inside of the 1.25" PVC pipe, making it easy to connect the blade to the hilt.
For the Kylo-style crossgaurd, you just use a 3/4" PVC cross connector instead of the 1.25" PVC pipe. The 3/4" PVC cross connector has basically the same dimensions as 1.25" PVC pipe (1" I.D.), so the polycarbonate tube fits nicely in it, and you can add two small pieces of the polycarbonate tube to complete the crossgaurd.
In both saber hilts, the drain and extension tube are held together by 1" O-rings around the drain pipe (which provide a tight fit when it is inserted into the extension tube) and 1/4" bolts.
Now that you have an idea how it goes together, here is what to do:
(a) Remove the drain plug from the pop-up drain.
(b) Cut down the drain pipe so it only extends into the extension tube by about 1.5" (otherwise, the drain pipe extends into the extension so far that the 4A battery holder doesn't fit inside of it). Use a miter saw, or a hack saw to cut it down.
(c) Use a 1/4"-20 tapping drill bit to drill threaded holes through the extension tube and drain pipe. Drill a hole and matching hole on opposite sides of the hilt.
(d) Drill a 5/8" hole in the hilt for the LED push button. This hole should be drilled above and centered between the holes for the 1/4" screws (I used a foerstner bit for this)
(e) Remove the slip ring from the extension tube and use it to mark its inner diameter on a piece of scrap acrylic or wood. Use a jig saw to cut this circle out of the acrylic/wood, and put it in the slip ring. This makes an end cap that will provide easy access to remove the battery holder and change batteries.
Make the Neopixel Blade
(a) Cut the polycarbonate tube to the length you want the blade plus a couple inches (since it will extend into hilt hiding a couple inches).
(b - Anakin/Rey): Cut a 3" length of 1.25" PVC pipe. Optionally, use a miter saw to an angle at one end (to mimic the look of the Skywalker saber).
(b - Kylo): cut small 1-2" sections of 1.25" PVC pipe and epoxy them to opposite sides of the 3/4" PVC cross connector. Optionally cut these sections at angles with a miter saw before gluing them. (These mimic the side exhaust vents for Kylo's unstable blade.)
(c) Use spray paint to paint the white PVC pipe pieces black (or a metallic color).
(d) Insert the polycarbonate tube into the 1.25" pvc pipe (or 3/4" cross connector) and use super glue and/or two-part epoxy to attach it.
(NOTE: you might want to wait until after you've done the electronics and tested with the LED strips, before inserting the LED strips into the blade. I'll describe it here, but you can just come back and do the following steps after testing that the LEDs work properly.)
(e) Cut two 144 LED/m neopixel (e.g. WS2812 or WS2813) LED strips to the length of your blade that is visible (I used two 32" of strips for the Ren blade, and two 30" + four 6" strips for the Kylo blade). Use the adhesive backing on the strips to attach them to each other back to back.
(f) Wrap the LED strips with a few layers of packing foam, and use a hot glue gun or clear tape to secure the foam around the LEDs.
(g) Pull the LED strips through the blade, pushing the end without the JST connectors in from the bottom, so the JST connectors are at the bottom after you pull them through. If you have a hard time getting the strips through, use Gaffers tape or Gorilla tape to tape a straightened coat hanger to the strips, and use the hanger to pull them through.
Wire the Electronics (outside of the Hilt)
Follow the above wiring diagram to wire the Arduino to the momentary push button and LED strips, and wire everything to the 4AA battery holder. I used JST connectors between all components to make the blade easier to assemble.
Anakin saber: I connected all matching wires from both LED strips, so I could run a single power and ground to the strips, and run a single control signal from the Arduino to both strips.
Kylo saber: same as Anakin for the two LED strips in the main blade, and then ran a second power, ground, and control signal to the four short LED strips in the sides of the blade.
One note on LED choice. This is really an application where the new WS2813 LED strips are a great choice. They have a redundant control signal, which means that if one LED goes out the rest of the strip continues to work without any issue. (With the old WS2811 and WS2812 strips, when one LED goes out, every LED after it does too.)
Upload the Code to the Arduino and Test
The code for both sabers is on my github: https://github.com/modustrialmaker
Individual links are:
Rei/Anakin: https://github.com/modustrialmaker/Lightsaber_sin...
Kylo Ren: https://github.com/modustrialmaker/Kylo_Ren_Light...
You'll need to download the Arduino application, and install the FastLED library, to run this code. Check out the video or one of the countless Arduino instructables if you need more details on this part. Nothing fancy with the code in this one....
The code is written so that pushing the momentary push button will cycle through modes in the following order: saber on, saber off, party mode, saber off. The code has a sinusoidal power on and off animation, and the party modes are a fun way to do something different with your saber. (These were a HUGE hit at the Halloween party I made the Kylo saber for.)
Assemble All the Parts
One thing that was surprisingly tricky about this build was getting all the electronics (arduino, wires, button, etc) inside the hilt. It is way easier to show and explain than put in writing. Watch the video starting here for a full explanation and walk-through of the assembly process.
One note on SOUND. Saber sounds are cool, for sure. (Heck, I added them in the video for this reason.) However, most environments where you'll actually use a saber (halloween parties, etc.) are noisy so you won't hear a little speaker in the hilt. Since adding sound also requires adding motion sensors, it greatly complicates the build, so I decided to leave them out for now. It also increases the cost because you need a $20 Teensy instead of a $2 Arduino nano (as I understand it). I would love to see someone add sound with an Arduino, if that is possible.
Power It on and Have Fun!
Once it is assembled you are ready to fire it up and have a good time! Kylo sure did when he picked it up (again, its worth watching the end of the video for his reaction :)
Hope this was helpful, and would love to see what kind of sabers others create using this type of hilt and/or this code.