Come on. You KNOW you’ve always wanted one. I certainly did. I bought a rather high end lightsaber several years back from Saber Forge, which only lights up red, but is really amazing and everyone is always impressed with it. It’s customized and combines several Star Wars based sabers except for the grip. I haven’t ever taken it apart to see what was in it as far as components, but the speaker is extremely loud and it always sounds great.
I’m in the middle of building an Arduino Nano Stormtrooper E11 blaster and my wife asked me if I thought I could build the kids some lightsabers so we could feed their new obsession with Star Wars. My initial reaction was “Wow…..my wife just asked me to build a lightsaber for my kids!” I was pretty sure I could, but hadn’t looked much into it yet. I knew there were places to get Arduino lightsaber setups so I started researching and found that there were MANY ways to build a DIY lightsaber. There are so many videos of people building them. There’s actually a pretty nice open-source community for lightsabers.
Arduino Nano’s are super cheap and all of the components for the lightsaber could probably be purchased for around $25-$35 dollars. I’ve seen a lot of people using Proffieboard which is a custom board just for making lightsabers. These usually run $40 – $50 on the internet, but there is a big community for them. Eventually I may try those out, but for now, and since I have a bunch of Arduino Nanos, I want to try a Homebrew board.
Let’s get to it!
- Arduino Nano
- MPU-6050 Accelerometer
- 2-16GB SD Card
- Neopixel light strip (assignable WS2812B RGB)
- Two momentary buttons, non-latching type (my example uses non-LED buttons)
- 2W 8 Ohm Speakers
- Resistors (haven’t figured out all the types yet but I’m using some 15k and 150k in various places)
- 5v power supply
- 18650 battery
A Few Notes
For the most part, I followed the Wiki on FX-SaberOS but I kept hitting a LOT of “gotchas” and small issues here and there. Here’s a running list of the things that I’ve worked through. I hope it helps someone.
- One thing that I didn’t see documented anywhere is that you can not power this setup with a USB from your computer. You can get part of the way there, but the speaker and Dfplayer will not have enough power from your USB to make all components work. Normally I just use the USB since you have to use it to transfer files. I try to avoid plugging and unplugging a lot of the time because I want to avoid accidentally pulling a wire out.
- Make sure that you get a 5v power supply. Without it, your speakers will not work and you’ll likely get a “bep bep bep bep bep” sound. This took me a long time to figure out because it’s not really stated in the documentation but it’s “implied” by showing a battery connection in the FX-SaberOS wiring for the homebrew pixel blade saber. I found a 5v power supply in a junk box and just cut the ends off and it worked perfectly.If you have a 18650 battery on hand (which I did not and still do not), probably best to try to prototype with that.
- Several people have reported having buzzing or other sounds coming from the speaker. Putting a resistor on the RX pin solves that problem for me. I found that listed on a few DFplayer forums. They actually said to put a resistor on both the RX and TX pins, though just the RX worked for me. The same forum also mentioned that using both of the grounding pins on the DFplayer module can also help.
- The FX-SaberOS schematic is well done, but I found it a little hard to follow and not easy to tell which things need to be connected together, or to resistors, or how to power it with just standard buttons. I like the LED buttons, but I don’t have any and don’t really care to spend the money on them right now, so I’ve made a new schematic (below) showing standard momentary push buttons. These sabers are for my kids and, well, they already light up. They won’t miss an LED button.
- For the LED strips, I’m just using one right now for testing, but once you have both (installed back to back), you can wire them up exactly as the schematic shows. Otherwise, just pretend the one on the bottom doesn’t exist.
- When you connect the 5v power, connect it straight to the Dfplayer first, and then bridge over to the positive power line on the breadboard to power everything else. You’ll find that your setup runs much better if Dfplayer has enough power. This will also prevent you from having issues with the sound while you trying to figure out the config menus. For a while my sound kept cutting out because I wasn’t getting enough power to it, and setting it up this way fixed that issue.
- For Mac users, make sure that the SD card doesn’t have metadata files and dot files on it as you are moving files over. The only way I could get this to work properly for me was to manually create the folders and put the files in them one at a time. The sound files have to be perfect or nothing will sound right and the config menu won’t make sense. You’ll need to go to System Preferences > Spotlight > Privacy and add your Sd card to this list so that your computer will stop creating these “Spotlight” files on the card. If you don’t do this, it will create them again as soon as you remove them. If you’ve already removed them and thy reappear after you add your card to Spotlight, use
rm -rfv .Spotlight-V100to remove the file in a terminal window then
rm -rfv .Trashesto remove the files you just deleted. The other “dot” files can be deleted the same way just be sure all that is there is the soundfont files and directories.
Schematic for Prototyping
Downloading the Code
If you haven’t already gone over to FX Saber OS’ github repo, go ahead and check it out. There are some really good resources out there for this part. I stumbled on this video for transferring the files (which hopefully you know how to do) and a walk through of some of the configs that you can change for your setup.
Setting up the MPU
This step must be done before wiring up your components. The Wiki on FXSaberOS is pretty straight forward. I found that the jumpers for my breadboard didn’t work that well with my MPU so I went ahead and soldered wires to it. The startup will not move forward if the MPU is not configured or if it doesn’t connect to it and detect it working properly. The below directions are directly from the FXSaberOS page:
To use the calibration tool (either one):
- simply download the tool
- upload to your DIYino or Aruduino compatible board through the Arduino IDE with the Serial Monitor open
- Ensure that your DIYino or MPU6050 is level to the ground in the position it will be in your saber
- press any key to execute the script
- make sure the board is stable and do not touch the board while the board is being calibrated
- once the calibration is complete, press “y” to automatically write the calibration values to your board
It took several times for me get a “connected” reading on my board and that was only because the jumpers weren’t connected well. There should be an LED lit on the MPU when it is connected. In the serial monitor, you’ll see a running log of random numbers. That means it working.
Initial test troubleshooting
Once you get it all wired together, start trying to ignite the blade and see what happens.
Here are some troubleshooting hints that I worked through:
- Once your connect your power, you should hear an announcement saying “DIYinoLightsaber”. If you don’t hear that, either your speakers aren’t working or your sound files are not setup correctly on your microSD card.
- If you have a two button setup, you should be able to hold down the Aux button and entire into the Config menu while the saber is off. once you enter into the config menu, you should hear “Config Mode”. If you don’t hear that or hear something else, check your SD to make sure your files are in the right order and that you don’t have extra files there.
- I’ve already mentioned the “bep bep bep bep bep” sound. If you’re hearing that, you probably have a power problem between the DFplayer and your Nano.
- If you connect your setup and nothing happens, make sure you have an LED lit on all of the components. Check the MPU and make sure that is connected properly. If the Nano doesn’t connect to that, the software will not boot properly.
I’m in the middle of 3d Printing parts for these lightsabers, but here is the general idea of what they look like so far:
This is basically the top part of Darth Vaders saber hilt. The body is a 1 1/2 inch sink pipe. I’m working on a chassis and grips for it right now. I’ll cover the assembly in the second part.