If you’re anything like me, you grew up watching Star Wars. ALL THE TIME. The Jedi were the coolest heroes, and I wanted nothing more than to be one. Now that I’m old, I decided to fulfill my destiny and join the Order with Luke, Yoda, and Obi-Wan.
But where to start? What does every Jedi have? A Robe! Well, yes, but so does your grandfather. But what doesn’t your grandfather have? A lightsaber! The greatest weapon ever conceived! Every Jedi has a lightsaber they handcrafted themselves, so I too will follow the true path and craft my own. Of course, you can buy very nice movie replicas with sound and lights, but why buy when you can build?
I knew there were a few things I knew I wanted in my lightsaber: a removable blade that can withstand hitting and being hit (because I know myself, and there’s no way I wasn’t going to hit stuff with it), multiple colors, sound effects, and clash effects when it strikes something. I used some already made boards, as I didn’t want to design and etch a board myself. I used:
• 1568-1443-ND - Teensy 3.5 Microcontroller
• 1528-1900-ND - LSM9DS1 Accelerometer/Gyro board from adafruit –
• 1528-1492-ND – Audio amp board from adafruit
• 668-1592-ND – 3W speaker
• 1528-1834-ND – 3.7V 4.4AH Lithium battery
• 1528-1996-ND – Charger for the battery
• 1568-1870-ND – Addressable RGB LED strip
• 679-1070-ND – Vandal proof pushbuttons (2)
• CP-1040-ND and CP-1140-ND – M/F connectors for mounting the blade
• Blank blade from Ultrasabers.com
The Teensy 3.5 is a terrific little board, with a lot of features and power. It is Arduino IDE compatible, and there are a lot of existing libraries that work with no editing. It is based around a 120MHz ARM Cortex M4 with 512K flash memory, 192K RAM, and 4K EEPROM. 40 digital I/O pins (all of which can be configured as interrupts, and about ½ can be configured as analog pins) give plenty of room for almost any project that the chip can handle. I was particularly interested in the audio capabilities, as it has 4 channel digital audio input and output. Since my saber would need multiple sound effects playing at once – clash and background hum, for instance – finding a board with this capability was a huge help. Also, it has an attached microSD card slot to store my sound files. The teensy 3.5 has enough features and speed to handle the task of running the lightsaber.
There are different versions of the teensy board, and they all have different capabilities. Make sure to double check the documentation before buying one so you don’t miss out on a feature you need.
The next part was the motion control. Since the teensy 3.5 doesn’t have any built-in motion control, I picked up 1528-1900-ND. It’s a nine degrees of freedom sensor, incorporating an accelerometer, gyroscope, and magnetometer. I’m not using the magnetometer functions at all, but the gyroscope is used to determine swing motion of the saber, and the accelerometer the force of a clash. I was actually able to stack this board on top of the teensy. The row spacing is the same on each board. This did leave an issue of the correct pins not lining up with each other, however. The largest issue was with power and ground. After digging into the 1528-1900-ND datasheet, I saw that the board draws less than a milliamp at full power. Since this is well within the teensy’s 20mA I/O limit, I simple assigned the I/O attached to the gyro power as a high output, and the I/O attached to ground as a low output. I don’t recommend doing this often, but it happened to work out with this combination. The actual I2C communication pins lined up already, so no issue there. The picture below is of the boards I used, before I got smart, removed the headers, and stacked them.
I did the same stacking with the audio amplifier (1528-1492-ND) but mounted on the bottom of the board as there wasn’t room along the teensy to stack both on the same side (it’s TEENSY!). Unfortunately, since it draws a significant amount of current, I couldn’t use the I/O power/ground trick as with the gyro. In this case, it’s just mounted with a couple of unused pins, and the required connections are made via jumper wires. Here’s the schematic:
This is blade LEDs soldered to the connector, before housing and potting:
Here is is after the connector was assembled, potted, and glued into a 3D printed spacer to make a snug fit:
The power from the battery runs up through the blade and then back down to the microcontroller. This means the battery is completely disconnected when the blade is pulled out, stopping battery drain while not in use. Button 1 controls the blade power up/down, and button 2 changes the color. If button two is held down, the saber goes into “cross clash” mode. This is just constant flashing and sparking, as if the blade is crossed with another. The complete code can be found here: https://github.com/Oldspicy/lightsaber
Speaking of batteries, this thing can pull a lot of current; upwards of 5 amps through its 125 LEDs. Your standard AAs won’t cut it for long. 1528-1834-ND is a 4.4aH lithium battery pack, which so far has been able to keep up with the power requirements. Before moving to this pack, I was noticing a lot of glitches, reboots, and odd goings-on that I now attribute to browning out the microcontroller. In order to charge the battery, a 3D printed holder was designed for the charger and the same type of connector that’s on the blade - CP-1040-ND. It gets plugged into the end of the hilt in the blade slot and into a 5V power supply to charge up the internal batteries.
Sound is played through 668-1592-ND (speaker) connected to the audio amp. All the sound files are stored on the SD card mounted on the teensy (sorry, I can’t help you with finding the files. There are plenty of copyright-free and open-source files online, Google is your friend here). The speaker is glued to the inside of a 3D printed pommel which press fits onto the bottom of the hilt.
Speaking of the hilt… I’m not going to tell you how to do it. There are so many possibilities, use your imagination and go with whatever you think looks good and what can hold your electronics. Mine is a combination of a sink drain, a pipe I found in my garage, and various things I found at hobby and hardware stores along with a bit of 3D printing to get everything to fit together. Here it is, in all its glory.
Blade mounted. The visible thumbscrew holds the blade tight and keeps it from flying out while battling Sith in my living room.
Creating your own hilt from things you have available makes your saber as unique as you are, even if not accurate to anything shown in the movies. Remember, there are a lot of Star Wars stories and there’s room for every kind of Jedi!
Here are some random build and test pics: