Introduction: DIY Arduino NeoPixel Lightsaber With Light and Sound Effects

This instructable details how to make a realistic looking and sounding lightsaber with a ton of customizable light and sound effects.

To construct the soundboard (the electronic 'heart' of the lightsaber), we'll be using a simple Arduino Nano as the main controller, extended with several modules such as the DFPlayer Mini MP3 module to play the sounds and the MPU-6050 gyroscope/accelerometer to detect motion. To drive the soundboard, I opted for the open source FX-SaberOS. It offers many features, such as selectable and extensible sound fonts, timed ignition and retraction, volume control, color selection, flicker/clash/lockup/tipmelt effects, basic smoothswing and even a jukebox mode.

Of course there exist ready made and even much more feature rich soundboards such as the open source Proffieboard running ProffieOS. If you aim for the ultimate lightsaber, that's currently the way to go. However, if you're like me, you prefer building stuff yourself from basic components rather than buying a ready made (and significantly more expensive) solution. Personally I find as much fun in the building & learning process as in the end product and I also always wanted to do an Arduino based project, so this was the ideal challenge to get to know the Arduino ecosystem and programming environment.

Supplies

All together the build cost me about 50€/$ in material, not including the items I already had lying around (junk metal & some PVC pieces used for the hilt construction, old electrical cable and the tools listed below).

Electronics:

  • Arduino Nano (2.5€/3$ on Aliexpress)
  • MPU-6050 sensor (1.7€/2$ on Aliexpress)
  • DFPlayer Mini (*) - 5.5€/6$ at DFRobot or in electronics stores
  • Micro SD card (1.7€/2$ on Aliexpress)
  • 2m 144 LED WS2811B 5V DC LED strip (6.6€/7$ on Aliexpress)
  • 3W 4Ohm speaker 28mm (2.85€/3$ on Aliexpress)
  • LED momentary non-latching button 5V 12mm (0.7€/0.8$ on Aliexpress)
  • Optionally a second non-latching button if you opt for a two-button build. Personally I opted for a single control button build.
  • No light fixed self-locking button 5V 12mm (1.3€/1.5$ on Aliexpress) - used as an (optional) kill switch
  • Protected high drain (10A) 3500mAh 18650 battery (**) - 6€/6.5$ for Keeppower battery
  • Battery holder (0.5€/0.6$ on Aliexpress)
  • 4.2V USB-C charger module: tp4056 or the more compact tp4057 (0.9€/1$ on Aliexpress)
  • Resistor kit (1.6€/1.8$ on Aliexpress)
  • Some electrical wire

(*) there are cheaper DFPlayer Mini clones available (e.g. 1.3€/1.5$ on Aliexpress), but these have slower chips which may result in sound looping issues. Better go for an original with YX5200 chip or the slightly cheaper but also good JL AS21CN270C chip rather than cheap clones with GD3200 or MH2024K chip.

(**) don't buy cheap 18650 batteries - these often have false specifications. A powerful battery is required to drive this many LEDs, so at least 10A continuous output is required. Make sure you buy a battery with a protection circuit. The Keeppower 18650 A10 3500mAh is a good and budget friendly choice.

Step 1: Supplies - Other Material

Other material:

  • 92cm/36" empty lightsaber blade (2.5cm/1 inch diameter) or similarly sized polycarbonate tube with end cap (typically 15-20€/$, e.g. on Etsy, Ultrasabers, The Saber Armory, ES Sabers,...)
  • Blade diffusion film wrap or other diffusing materials such as cellophane or thin flexible packaging foam
  • If you don't go the 3D printed route, then some parts to build the hilt from:
  • Outer shell:
  • Metal or PVC pipe (or 3D printed alternative - see below) with a diameter slightly larger than 2.5cm/1inch (the blade should fit inside) and a length of 25-30cm (10-12"). You may have usable junk pipes lying around which can be used for this purpose - e.g. I used part of an old metal vacuum cleaner tube.
  • Decorative junk parts (scrap metal buttons, plumbing parts, machine parts, leather strip,...) which can be attached to the outer shell to give it that typical lightsaber look.
  • Inner chassis:
  • PVC pipe (or 3D printed alternative - see below) which snugly fits into the above outer shell.

Tools:

  • Soldering iron and solder
  • Glue (glue gun, super glue and/or 2 part epoxy glue)
  • Dremel multitool or other tools for sanding/drilling/cutting parts for the hilt chassis and enclosure
  • Optionally a 3D printer if you wish to 3D print the hilt components
  • Optionally paints and sandpaper for weathering the hilt

Step 2: Wiring

The diagram above (from the FX-SaberOS wiki) details how the components are wired. In my build I made a few minor alterations:

  • Added a 1k resistor between the Arduino D7 pin and DFPlayer TX pin (pink wire in the diagram). This prevents the speaker "popping" sound when booting.
  • I did not implement the (optional) battery monitor circuit (resistors and light blue wire connected to A3 in the diagram)
  • As I opted for a single action button, I did not add the "aux switch" in the diagram. The differences in usage are described on the single button mode and dual button mode wiki pages. I found the single button mode to operate very intuitively, so no need for the second button.
  • Instead, I did add a kill switch (in fact a self locking button) where the positive cable leaves the battery. This allows fully breaking the circuit and ensuring no power is drained from the battery when the lightsaber is not used for extended periods of time.
  • Finally, I added a USB-C charger module, connected to the positive and negative terminals of the battery. This allows charing the battery in place, without having to remove it. Just make sure to set the kill switch to "off" while charging, so as not to draw too much power from the charger.

It is advisable to first build the entire circuit on a breadboard and validate that everything is working correctly (see "Software & Configuration" below) before actually soldering everything together. Also make sure you worked out exactly how and where everything will be placed into the inner chassis (see "Hilt" below) before finalizing the wiring.

Step 3: Software & Configuration

Once you've wired the electronics, it's time for the big test.

  • Download, install and configure Arduino IDE following the steps detailed in the wiki. Select board type "Arduino Nano" and processor type "ATmega328P (Old bootloader)"
  • Download the FX-SaberOS code and copy the contents of the "libraries" folder to the Arduino libraries folder (on Windows, by default: C:\Users\<your username>\Documents\Arduino\libraries)
  • Configure FX-SaberOS based on your hardware choices and user preferences. This involves updating the Config_HW.h and Config_SW.h files. The process is explained here: https://www.youtube.com/watch?v=ajB9LSI9zVg
  • Calibrate the MPU following the steps described here.
  • Prepare the MicroSD card using the "DIYino_Prime_SDCard_image.7z" package found here (decompress with 7zip). DFPlayer takes into account the order in which the files are copied to the card, rather than the order of the file names, so follow this tutorial to correctly prepare the card: https://www.youtube.com/watch?v=gQez-gkhUhc
  • Place the MicroSD card in DFPlayer, compile and transfer the code to your Arduino and if all went well you should now be able to test out the features :).

More information can be found on the FX-SaberOS wiki.

Step 4: Hilt - Inner Chassis

I won't go into the details of building the hilt as there are plenty of ways to go about it and much will depend on the specific tools and materials you have at your disposal.

The electrical components, speaker, battery, optional charging port (and in most chassis designs also the buttons) all need to be affixed to an inner chassis. Make sure the SD-card and Arduino USB port remain accessible. The inner chassis can then be slid into the outer shell (which has openings in the right places to expose the buttons).

If you have a 3D printer, you could customize the Open Chassis System (https://www.thingiverse.com/thing:3635780) to your liking, or use the following chassis which fits a 38mm/1.5" pipe (which is typically a plumbing pipe): https://www.thingiverse.com/thing:4732077

If you don't have access to a 3D printer, you can simply use part of a PVC pipe (with a diameter which snugly fits into the outer shell) and make the necessary cut-outs to fit all the parts into. The electronics can then be fixed to the chassis using a glue gun, so they don't come loose while wielding the saber.

Step 5: Hilt - Outer Enclosure

If you have a 3D printer, there are many free hilt designs you can choose from (e.g. on Thingiverse). You may need to customize the hilt dimensions to fit your inner chassis and components.

Alternatively, with some creativity and junk parts (e.g. plumbing parts, parts from old electrical equipment,...) you can also create a DIY lightsaber hilt in true Star Wars spirit. Personally I created my hilt from a piece of a metal vacuum cleaner tube and added some interesting looking parts stripped from old/broken electrical equipment (e.g. an electric razor) as well as some leather wrapping.

Here are some other example builds which may provide inspiration and insight into the construction process:

https://www.instructables.com/Lightsaber-Hilt-Prop/

https://www.instructables.com/DIY-Darth-Vader-Style-Lightsaber-Tutorial/

https://www.youtube.com/watch?v=URhQFw47cX4

https://spockspickledbrain.blogspot.com/2019/12/how-to-make-great-lightsaber-prop-hilt.html

The top of the outer shell will need to have the right width to slide a part of the blade into and optionally one or two tightening screws to avoid blade wobble. The bottom of the outer shell needs to be either open or perforated to allow the speaker sound to emanate.

If you hilt is a little too clean looking, you can give it a weathered (battle scarred) look using some spray paint and sandpaper as shown in this video. As a finishing touch, you may opt to wrap part of the hilt with some scrap leather as illustrated in this video.

Step 6: Blade

For the blade it's easiest to buy an empty polycarbonate lightsaber blade which already includes a mounted tip, opaque white coloring and reflective film. Alternatively, you can build one yourself using a similarly sized clear polycarbonate tube, but turning this into a usable blade may cost the same or more unless you have some material already laying around.

As interior LED strip it's best to use a high density (144 LEDs/m) strip with individually addressable LEDs (type WS2812B). With the addition of some diffusing material around the LED strip, the high density will ensure colors nicely blend together and it will no longer possible to identify individual light spots when the blade lights up. As each LED can be assigned a separate color it's possible to produce localized effects such as an extending/retracting blade, flame effects, a heated tip or blaster bolts exploding along the blade.

Measure the length of LED strip which will fit inside the blade and cut the LED strip to size along the cut lines. You will need to stick two strips back-to-back, so the total length of strip required will be twice as long as the blade. Wire the two strips together, making sure to correctly connect their positive and negative connectors.

Wrap the strip in diffusion material (for e.g. some thin flexible packaging foam) and slide it into the blade tube.

Step 7: Conclusion

Now it's just a matter of assembling your blade and get swinging!

FX-SaberOS is fully open source, so if you know some C++, you can even program your own new features and effects and contribute them to the codebase for others to enjoy (e.g. I added the smoothswing, tip melt and soundfont quickselect features).

This was such a fun project!