In Part 1 of this series, we'll go over the project's goals, how to choose the right components, and some of the software involved in constructing such a powerful device—and we'll be mindful of the dangers ahead by discussing battery safety and the safeguards in place to protect you and your saber.
First, I wanted to have the brightest blade ever—one that looked great on camera, even in daylight.
That was done with a 144 LED "Neopixel" strip (the highest density you can currently get of 24-bit programmable lights) and a modern DC/DC converter and LiPo battery capable of supplying the watts it can consume.
In fact, I made it so powerful that I melted my first blade. The real limitation is the heat generated by a double-sided strip in a tube; we're doing the very opposite of heatsinking, and to prevent thermal overload we should keep the power dissipation of the LED strip to not more than 40% of the maximum. This means that we can't have a full-brightness white saber because white requires all three LED colors (red, green, blue), but we can have full brightness of one color along with small additions of the other colors. And we can still "burst" for special effects.
Even with that limitation, it's certainly bright!
How to Make Arduino Lightsaber?
My secondary goal was more esoteric. A Lightsaber isn't just an extended torch. There is also "The Hum"—that growling purr that lets you know you're holding something of immense power.
In the movies, this sound effect is created by the legendary Ben Burtt retreating to a studio and waving microphones around for several weeks. There was never a real physical object that made that noise when wielded (unless you count his entire mixing desk).
Shanks FX did an extensive video on the original sound effects and how to recreate them in the studio that I found very helpful:
In fact, most of the time and effort in this project went into the software aspects of how to generate fluid real-time audio effects.
This "sword" knows you're holding it. If you become still, it does too. If you swing it unevenly, you will hear it. If you put it down, it will turn itself off.
This is possible because there's a computer inside. An Atmel 32u4 Arduino-compatible "Pro Micro" and a companion inertial measurement unit (IMU). To that end, another way of looking at this project is to ask: Can we create a “user interface” so natural that we completely forget we're using one? And so rugged we can drop it on bricks?
Completed (but unpainted) Shoto-length Saber. The blade still has a visible "glow halo" even in direct sunlight.
Lastly, I wanted my saber to look polished. At the end of the series, I'll go over the physical construction of my hilt (from hardware store PVC pipe and fittings). This is where I expect you to exercise your own creativity. No two Lightsabers should look quite alike because each is an expression of the maker's personality and local materials.
I'm not really a very artistic prop-maker—I tend towards basic and functional—but there are many fantastic examples on YouTube of saber hilts constructed from plumbing parts, hollowed-out metal torches, and even professional kits sold by various makers.
Be aware that the parts involved in this build are quite chunky and the “slimline saber hilt” kits are just too small (sorry). I used 32mm PVC pipe (which is actually 40mm across) as my main diameter, and even that was tight. But high-capacity batteries and DC/DC converters continue to shrink, so it won't be long before slimmer builds are possible. This project deliberately explores the limits of what is possible.
If you're good with Arduino code, you might reconfigure the controls or sound effects as well. My build had a voltmeter read-out to assist debugging that you'll see in all the pictures, but it's not an official part of the build, as it made wiring more complicated than it needed to be. Bench-testing with a multimeter serves the same purpose.
LiPo Battery Warning
This project is essentially a toy, but it uses an RC-grade LiPo (Lithium Polymer) battery and power system that can be dangerous if mishandled. The voltage is safe for humans, but there is enough power (20 Amps, 200 watts!) to start fires if a short-circuit occurs. If you build this saber, I expect you to carefully supervise its use.
LiPo batteries come with special handling requirements. They must be charged correctly and never be allowed to run "flat" or they may explode.
Always have a plan for the safe disposal of an overloading power cell. Fireproof bags are a good start. Be advised that water makes Lithium fires worse.
If you are experienced with building multirotors or RC (remote control) aircraft, this will all be familiar ground. (It's just a quadcopter without propellers, really.) Otherwise, this should be considered an advanced project that requires care and good construction skills, one which will hopefully give you experience with these kinds of power systems.
There's not much to this project's actual circuitry. We will make extensive use of pre-built modules and you'll mostly need to wire up connectors between them.
In essence, power comes out of the battery, flows towards the blade, and a control signal is added along the way. Most of the features are in software, which doesn't show up on this particular diagram.
Price per Unit
|Hobbyking YEP-20 SBEC||$18|
|(5x) Futaba 22AWG 15cm Servo Extension Cables||$4|
|FrSky Battery Voltage Sensor (FBVS-01)||$3|
|SparkFun Pro Micro (5V) (Atmel32u4 Arduino)||$15|
|MPU6050 IMU Breakout Board (GY-521)||$5|
|"Digital Volume" Rotary Encoder Switch||$1|
|TPA2005D1 Audio Amp (SparkFun / geeetech)||$7|
|8Ω 2watt speaker, 20-40mm diameter||$2|
|Resistors: 1kΩ, 150Ω, 1/4W (small)|
|Capacitor: 0.68μF electrolytic (anything from 0.47 to 1μF will do, but get as compact as possible)|
|1 meter (2x50cm joined) WS2812b RGB LED Strip||$40|
|144 LEDs/meter density, White PCB, Waterproof IP65 Silicone Insulated|
|600mm Polycarbonate tube (25mm Outer Diameter) and Blade Tip||$10-20|
|Foam Packing Sheet (500mm x 100mm)|
|Zippy Compact 1000mAh 3-cell Lipo Pack||$8|
|Turnigy 1000mAh 3S 20C 3-cell Lipo Pack||$8|
|Male JST Battery Pigtail||$1|
|10A “Mains” Switch (optional)||$2|
|Bullet Connectors or JST connectors (optional)||$2|
|Power lights or voltage indicators (optional)||$2|
|20mm (3/4") PVC Compression Pipe Coupler (with rubber o-rings and screw-ends)||$10|
|32mm (1 1/4") PVC Pipe (a 1m length is plenty)||$2|
|32mm (1 1/4") PVC End-cap (get a couple)||$2|
|32mm (1 1/4") PVC Pipe Connector (two or three of them)||$4|
|Any other bits you like the look of||$???|
*Note that the Futaba 22AWG 15cm servo extension cables are also used by the controller and the blade subsystems. (Futaba connectors have a polarized edge.)
The RC components like the battery, DC/DC converter, and connectors can be found at Hobbyking (if not your local model aircraft shop) and the rest at DigiKey, SparkFun, eBay, and the usual internet sources. The rest is PVC pipe and plumbing fittings from the hardware store.
The main component there is the Hobbyking YEP 20A HV (2~12S) SBEC (Switch-mode Battery Eliminator Circuit), also known as the MTTEC KETO HV BEC 12S. This device is really what makes a hand-held saber possible. I don't know of an equivalent, but I'll be looking. For now, it's the key to the build.
That takes care of the DC power. Now we have a pair of my favorite semiconductors: an Atmel32u4 microcontroller and the MPU6050 IMU.
The project uses features specific to the 32u4 (such as the high-speed Timer4) and is designed around the physical shape of the “Pro Micro”, but other Arduino Leonardo–compatible boards should work with minor modifications.
They must be the 5V version running at the full 16MHz clock rate. The 3.3V version is inadequate both in terms of voltage (to control the LED strip) and computing power (to run the sound synthesizer).
Of course, we need a nice LED strip for the blade:
Most of the "1 meter" LED strips you will find online are actually two 50cm strips joined together with an obvious gap in the middle. For a 50cm "Shoto" sized blade, that's great—we just need to disassemble the strip back into its original halves. Convenient! And cheap, too, at less than $30 on eBay right now.
If you intend to "battle" with your saber, I'd consider this a consumable. Enough hits and you're going to break it eventually, so keep an eye out for deals. The design allows for easy change-out of blades in the field, if you have backups prepared.
Close up of the "missing LED" where the two strips join, and the IP65 silicone coating.
If you want a longer blade (70-90cm is a full Lightsaber length), then you either need to go for more expensive continuous strips (and I don't know where you'd find them) or modify the cheaper strips to edit out the join gap with some whittling, tucking, folding, and resoldering.
Be sure you're getting WS2812b LEDs. The 5050-package LEDs should have FOUR pins per package and be right next to each other, and the strip should have THREE connections on each end. Three only. Not two (that's a single color strip), not four (that's an analog RGB strip, or a different serial protocol).
You also want a strip that has a WHITE background (not black) for maximum light reflection out of the blade, and that is coated with IP65 silicone for physical protection. (IP67 and IP68 have a thicker rectangular sleeve that likely won't fit.) It should be the same cost, just an option when ordering. You really want the waterproof version, because of the greatly enhanced physical robustness (shock-proofing) the silicone coating should give the blade, and the slight extra heatsinking it provides.
25mm polycarbonate tube
A critical part that you should source early is the blade tube. I used a 25.6mm Outer Diameter (1 inch OD) 22.2mm Inner Diameter polycarbonate tube (1.6mm wall thickness) from a local supplier called Profile Plastics, but I've since found a cheaper and better source at The Custom Saber Shop which are specifically for this purpose, and they have transparent "blade tips" too. Those are really hard to find!
My build used a clear tube with a packing foam sheet light diffuser wrapped around the LED strips, but I would definitely experiment with their Translucent White tube for an even-better-looking blade. The clear tube is a little too revealing when it comes to assembly mistakes or imperfections, and you can see the LED dots if you really look. An extra layer of diffusion would have been nice.
Packing foam sheet Light Diffuser for wrapping the blade and improving the glow. Free with eBay purchases in random sizes, or your local stationery supplies cupboard.
Normal/thin-walled tube is probably fine unless you want a full-length saber or intend to combat hard with it. The LED strip is fairly wide (12-15 mm) and we need some space for the light to diffuse around the edges, so I don't recommend the thinner 3/4 inch tube or the thick-walled tube to start with. I haven't tried them yet.
A note on material: Polycarbonate tube is what you absolutely need. Not perspex, acrylic, transparent PVC, or any other plastic. This is why:
Polycarbonate tube does not shatter. Ever. It will take a shotgun blast and remain in one piece. It can be bent and crushed (so don't drive over the tube with a car) but there are no conceivable circumstances where you'll suddenly be swinging half a broken and jagged plastic tube around. This is important to me and anyone who wants to be safe.
Polycarbonate has a slightly bluish tint compared to Perspex because it's less optically clear. That's not a problem for us, but it helps when trying to identify "true PC" if you're in doubt.
The build described here has the first 8cm of the blade tube held securely in the hilt by the Pipe Compression Coupler, and about 2cm of free space at the far end. Therefore you need 10cm more tube length than LED blade; so a half-meter blade needs a 600mm tube.
And yes, a 25mm OD tube fits inside a "20mm Pipe Coupler", with room to spare. (PVC water pipe sizes relate to the inner diameter of the iron pipes they replaced. PVC conduit connectors are correctly dimensioned, but aren't rated for pressure.)
Real-world physics means we have to firmly secure the tube in the hilt with sufficient leverage. "Compression couplers" are quick-release, can hold mains-rated pressure pipes, and look cool.
Another fairly personal choice is the shape and placement of the speaker for the sound effects. A traditional magnetic coil speaker is essential to capture the bass notes properly (sorry, piezo just doesn't cut it) but they come in many varieties.
A 2-watt speaker is nicely loud, and I used a reclaimed 40cm part that just happened to fit inside the PVC endcap that made the 'pommel' of the hilt. Replacement laptop speakers are interesting and come in long and rectangular shapes that may fit slimmer builds.
We need an amplifier to drive it and there are a plethora of small class D modules that will do nicely. We only need mono output and the quality doesn't need to be superb. The SparkFun/geeetech amp does the job nicely with a few additional parts.
There is a great deal of leeway with the individual components, but not much with the specifications. If you are making substitutions, don't downgrade anything. We're running all these pieces hard, in some cases close to their design limits, in order to fit all of this into a hand-held device.
Software and Controls
An explanation of how the firmware works would take another article and wouldn't help the build, so I’ll just describe how to use it for now:
The saber has many settings, like sound volume. If that was all, one volume knob would do the job. To set the blade color we could add another knob. We could add a third knob for the colour saturation, a fourth control to ignite/retract the saber, four more to tweak the audio frequencies, and then there wouldn’t be any room left on the hilt to put our hands.
So instead, one physical knob (which is also a push-button) is used for all the controls, by having the knob change its mode when pushed in. While you’re doing this, the first dozen LEDs along the blade will go dark and a “menu dot” will show the current mode. It also helps that these rotary controls can spin endlessly and have no specific zero point.
Push the knob and turn it to set the mode. Then release and spin it normally to tweak that parameter up or down. Got that?
Here’s the modes in order, and the color of the dot in the blade menu.
|0||White||Blade Extension / Retraction (startup mode)|
|2||Blue||Blade Hue (colour)|
|3||Blue||Blade Saturation (whiteness)|
|9||Black||Bump Lock (no action)|
Don’t spin the knob too fast or the controller will miss updates—it’s very busy doing many things—and you might even go backwards a notch. Be slow and definite. (This may improve in future software.)
Some of the modes loop around (like the color) and some hit max and minimum values (like volume and mode, itself) and some are just hard to describe (like the doppler division parameter which can go negative) but just give them all a try and I'm sure you’ll figure it out.
Frankly, it’s not the greatest user interface in the world, but I challenge you to fit more functionality into a single knob.
Also, remember that the saber will forget everything on power loss. If you want custom presets, you’ll have to modify some magic numbers in the source code and upload it again.
Power Management and Safety
Remember how we talked about why LiPo batteries can be dangerous? The following is how I designed this project to be safe and keep your blade from catching fire. Please don't remove these safeguards.
The firmware has a 'screensaver' that will retract the blade when you don't move the saber for 90 seconds—in case you set it down somewhere and forget about it.
It also constantly checks the battery sense voltage, and when it detects an undervoltage condition (defined in the firmware at about 10.5v, or 3.5V per LiPo cell), it darkens the blade and makes loud nasty beeping noises until you turn if off. This is a critical safety feature for dealing with high-capacity LiPos, and must not be disabled, and it's good to calibrate the numbers in the code for your power system.
If you disable the voltage sensor or otherwise allow the blade to stay on, the following badness will happen: The blade will continue drawing large amounts of power, the DC/DC converter will continue to drain the battery at increasing amperages and won't ever stop, and the battery will drastically HEAT UP as it gives up its last watts to the point where it can outgas, catch on fire, and EXPLODE. Rarely, but sometimes. I'm sure you've heard the stories. It will certainly degrade the LiPo's capacity and may render it less safe for future use. (Small LiPos often include protection circuits, but higher-current RC LiPos, like the one powering the saber, are "unprotected").
Monitoring the battery voltage and turning off the LEDs when necessary is really the most important job the controller has. That's the price we pay for pushing the limits and using such a high-density power system. Feel free to mess with anything, except that.
Understand, the lights won't even turn off when the power drops below 5 volts. The batteries will be screaming, the microcontroller will crash (taking out the alarms)—but the LEDs will continue to do what they were told until you turn them off manually. The controller must be able to detect the undervoltage condition coming and stop before going into the red zone.
Remember rule 9: "I will not include a self-destruct mechanism, unless absolutely necessary."
Give this project a try for yourself! Get the BOM.