Introduction: Star Wars Crossguard Neopixel Lightsaber
For all "those wierd kids that are board" and looking for something to do on a dark winter's night...
Make the new crossguard triblade lightsaber from Star Wars: Episode 7, (VII in Roman numerals, if they even teach that in school anymore)
This instructable will go over the physical build but it is more my tale of making, so be it.
CAUTION: Lightsabers should only be used by those trained in the ways of the Force. Same goes for soldering irons and cutting tools. Make it safe.
Step 1: Stuff Found on Tatooine and Not Canal Street...
Maybe, maybe not...
You can also use any Arduino to control Adafruit Neopixel strips.
I am using the Adafruit Trinket Attiny85 based microcontroller.
Adafruit Neopixel strips - higher density 60 LEDs/meter
- main strip has 60 Neopixels
- 2 crossguard strips of 10 Neopixels each
momentary pushbutton switch - normally open
3xAAA battery pack (LiPo is nice, an on/off switch would be nice to have)
fluorescent light protector - shatter guard tube (comes in 8-ft lengths) The clear plastic is like a water or soda bottle so you can cut with scissors or utility knife. Stop by the industrial lighting aisle at the home center to find one and then go on to browse the plumbing aisle to find the right pipes and fittings to make a more authentic lightsaber handle.
fiberfill batting in sheet form/rolls. The flat sheet form gives a more even diffusion as a wrap rather than trying to pull clumps from a bag of batting meant to stuff as loose fill.
Lots of thin hookup wire, use whatever you've got. Stranded is preferred but I have a mix of speaker wire, ethernet cable wire, regular solid core hookup wire.
electrical tape or patterned duct tape to cover the handle/hilt.
And if you've got some spare electronics parts to make the mini breakout board (headers and perfboard)
This project is good for practicing your soldering skills.
Step 2: Inspiration and Derivation...
So I was reading up on the Adafruit blog and came across Gewfy's make of a mini 3D printed lightsaber . So I says to myself, "That's not a lightsaber, mate. This is a lightsaber..." And I have a bag-o-Trinkets, 5v and 3v ones and I am not afraid to use them.
Well, time to investigate further and read up on what he had to offer. I always wanted to make a lightsaber and with the technology available today, it makes it easy to recreate things. I know enough about electronics to be dangerous so this project might not be too hard to tackle. I wanted to make a full size one. Besides, I nae have a 3D printer.
He offers the code for the Attiny85 which he used to build his Neopixel wand. Hmmm, I think I should be able to pull that over and use it in the Adafruit Trinket which I have. I also have some Neopixel strips from my Halo Cortana LED scarf. I've got some experience with soldering and working with those Neopixel strips.
Those delving into the Attiny world for the first time will have frustration that the pinouts are all labeled differently and each will be addressed differently depending on its context in use. In looking at his code, this was new, using a press button switch as an interrupt. Since programming using interrupts(commands to access the microcontroller directly as opposed to the commands in the programming language or IDE) was most hacker-like, the commands are seemingly cryptic. The Attiny85 is a small 8-pin microcontroller that many use despite it's limitations. What we have is a Trinket with it's Arduino type environment built over the standard Attiny85.
I set up my switch to the Trinket on pin # 3 and some strands of Neopixel strips controlled on pin # 0. I had wired up a long strip of Neopixels. I pieced together two 30 LED segment pieces by chaining one to the other. I kept the power leads on both segments separate so I could inject power to the farther strip. Try to use a full 1 meter strip of 60 Neopixels. I had repurposed my strips from the scarf. You can see the gap when it is in the tube because the mess of wiring spaces out the Neopixel strips. I fired up strandtest sample sketch to make sure all the LEDs were good.
I copied in Gewfy's sketch to see if I could get it working.
There is some code to use a potentiometer to control brightness and a switch to cycle the light effect modes. Let me keep it simple with just a switch first. Besides, I didn't have a spare big knob potentiometer lying around to be used.
Programed the Trinket with the Arduino IDE. Nothing. Hmmm, I read up on all the discussion topics for using interrupts on the Attiny85 and Trinket. I was getting discouraged after reading that some say PCINT0 which is not the same as INT0 on pin PB2 or 7 on the Attiny85 but pin 0 on the Trinket is the only thing that works. Switch on Trinket Pin 3 might not be good because it is also used for USB. Best thing to do, put it down and go to sleep and get back to it in the morning.
So a few tries at changing the interrupt call, modifying the interrupt mask, and resoldering the switch to a different pin, still not working. Then I was reading up with using switches with Arduinos. I did not have a resistor with the switch since I knew you could activate the onboard or internal pullup in the code, available on PB3. I had the switch wired up to pulse the 5 volts +.Then I had what might have been a stroke of insight. I was going through some diagrams of the wiring setup for a switch. The program was looking for the switch to go HIGH but internally triggered as going LOW. Rewire to ground and things started working.
And once the switch was cycling through modes, I started to program some different light sequences.
But now, I am trying to wrap my head around how to debounce the switch. I have tried some sample snippets but it seems millis() may not be working correctly in the Trinket implementation (attach interrupt and delayMicroseconds() might be needed) or I may have to deal with timer registers to software debounce. As seen in the demo video, the point at which the interrupt is being sensed is not in sync with the light effect finishing and will skip one or two modes to a different programmed light effect. It should have filled with a solid color, pulsate that solid color, and then collapse the solid color and turn off.
Once I get that working, maybe I will incorporate one or more knock sensors along the tube. It will then trigger a white flash of light. You can film a lightsaber duel without needing to rotoscope it.
So, my code is such a mishmash of stuff and changes for troubleshooting that I'm not sure what to attribute anymore. If anyone has questions on what I did in my code I will glady answer questions. Someone should put up an ible on what to look for when posting up blocks of code.
Step 3: 3D Fabric-ation...
You will end up with some kind of prototype wiring assembly like this. The digital signal line out from the top of the main strand is wired back down to the hilt. It feeds into both crossguard Neopixel strips. This creates the effect that the lights radiate out from the center of the hilt. Since the strands are from one signal input, they will act in parallel. It also makes it easier to program the loops since they are addressed in one continuous manner from 1 to 70. Oh, one of the crossguard strips broke off at the wiring so I had to remove that Neopixel and resolder the connections to the next one on the strip. The missing Neopixel did not affect the way the program ran since the 70th pixel was on the other strand. Things may act weird if your program addresses non-existent Neopixels.
Now to cut your plastic tube to length. Since the lightsaber is a longsword, the length is around 4 1/2 feet. The crossguard is about 22 inches wide.
Cut the main tube to be equal the length of your main Neopixel strip plus about a foot more to be the handle.
Cut the crossguard piece based on the layout of your crossguard light strips extended out from the hilt.
Make a U-shaped notch saddle cut in the crossguard piece so it can fit on top of the main tube making that T-connection. You can trace the profile of the tube to make the cut but you can just nibble away to make it fit. It will be covered up later so no need to be really precise unless it bugs you.
Cut a strip of your sheet batting about 4 inches wide. You can then wrap that around the Neopixel strip which will diffuse the LED lights.
You now need to snake the Neopixel strips through the tubes. I fed my tape measure through the opposite end first so I could tape it to the end of the wires and use it to help pull it through the tube. You have to compress the batting and push that all in while pulling through so it helps to have another person assist. Guide it through and orient the Neopixel LEDs all facing in one straight line. Remember to gently position the Neopixel strips as the connections and strip are still vulnerable with all the strain relief you try to build in.
I plugged back in the endcaps that came with the tube into the crossguard ends.
Step 4: Watchen Der Blinkenlights...
Constantly test as you go along as you want to know when things break at each step and not have to take everything apart over and over.
Once the main Neopixel strip is seated in position in the main tube, you can cut a slit from the bottom to bring up the rest of the assembly to position the crossguard lights.
Stuff in the crossguard Neopixel strips.
Orient the Neopixel LED elements to all face the same way for best effect. You may have to adjust the amount of fill that was compressed in there to even out the diffusion of lights.
Remove excess batting so that the crossguard tube fits on the main tube.
Step 5: Finishing Touches...
Wrap up and finish the hilt with electrical tape or other suitable covering.
Really, you could do a better job in tucking everything into the handle but I needed access to the batteries to pull out - no on off switch and wasn't hardwired to Vout on the Trinket, wasn't sure if the load was going to be excessive and burn it out. Since this was the prototype, I needed access to the USB port on the Trinket to upload any refinements to the programming. The battery pack is held on with a rubberband. The rest is taped on.
You can now play a mean game of stickball with the other Lords or use it as a lightsaber prop.
Make one yourself and experiment with programming to create your own special effects.
Participated in the
Participated in the
Homemade Gifts Contest
Participated in the
Halloween Props Contest 2015