Introduction: How to Make a WiFi Controlled LightSaber (kid's Size)

This lightsaber runs a simple web server, so you can connect to it over WiFi and control the color (e.g. from a phone, smart watch, tablet, etc.)

How many colors? Too many to count. It serves up a javascript colorpicker, so you can tap whatever color you want on your phone screen.

How does it look?

  • Very, very bright. It has 144 LEDs in a half-meter blade. It's much brighter than any toy lightsaber I've found. It's much brighter than the adult-sized FX series lightsabers I've seen.
  • Very smooth. You can only see the individual LED dots near the tip, where the tube tapers. I want to try a tube that doesn't taper, but haven't had time.

I plan to upload follow-on projects (someday):

  • I made it work with a Pebble smart watch.
  • I've added the turn-on & turn-off "whoosh" sounds. This version has no sound, but the hilt has cutouts for the speaker.

Step 1: Materials Needed

  • 3D printer and filament, for printing the hilt.
  • White plastic blade tube from a kid's toy lightsaber. You want something roughly 1/2 meter in length.
    • I bought these for $3 each on Amazon. Notes:
      • They used to come in a 3-pack, but at last check I could only find the 6-pack.
      • This tube tapers narrower toward the tip, which forced me to trim some materials in later steps. An un-tapered tube might be easier.
  • Plastic diffuser panels. I used these. One $4.50 39" (~100cm) piece is enough for 1 blade.
  • LED strip. I used this NeoPixels strip from Adafruit. It's costly at $60. I recently bought a strip from BTF-Lighting which appears work, and costs only $22 from Amazon. It's possible that any WS2812B strip with 144 leds/m (each a SMD 5050) could work. Note you should get one with the silicone rubber weather tube on it (I used that).

  • Battery. I used the ALLPOWERS Power Bank 5400mAh Portable Charger External Battery. I bought it for $9 (in silver) from Amazon. It's great for fitting into a lightsaber hilt, because it's a round cylinder 30mm in diameter. NOTE: Even though this battery can provide 5V at 2.1A, we cannot safely drive all 3 RBG elements of all 144 LEDs to the maximum brightness (i.e. the brightest white). This could draw too much current from the battery. This is a lithium-ion battery, and care should be taken with its use. In my example code, I limit the actual brightness setting used, for this reason. For more information on the power requirements of these LEDs, see Adafruit’s guide.

  • Disclaimer: The author of this instructable is not responsible for any damage or injury and/or death resulting from the building and/or use of this item. Any and all legal responsibility or resulting civil action due to said damage, injury and/or death belongs solely to the builder.

Step 2: Prepare the Blade Tube.

  • Remove tube from toy.
  • Cut off the end of the tube, just past the end of depressed design.
  • This leaves ~20 1/4" of useful tube remaining.

Step 3: Prepare the Diffuser Panels.

  • Cut the ~100cm diffuser panel in half, so you have 2 pieces each 50cm long.
  • Taper each of the 2 pieces, so the entire length will fit into the tapered blade tube.
    • You'll cut off a 2 triangular pieces from each diffuser piece (1 from the top edge, 1 from the bottom edge).
    • Choose 1 end of the diffuser piece.
    • Do the following steps to cut off 1 triangular piece:
      • Mark a spot on the end, ~0.35cm down from the top edge.
      • Along the top edge, mark a spot 19cm from the end.
      • Cut in a straight line between these 2 spots.
        • To do this, I connected the 2 marks with a strip of blue painters tape, then cut along the edge of the tape with scissors. The plastic isn't very hard, but it's tricky to cut it straight.
        • It doesn't need to be pretty (mine never were).

        • Repeat the above steps, to cut off a triangular piece from the bottom edge, at the same end.

Step 4: Prepare the LED Strip

  • Identify which end of the strip is the input. On the NeoPixels strip, there are arrows indicating this, on the strip itself between the LEDs.
  • On the output end (although it's likely the same on both ends), identify which color wire is used for each connection. There are only 3 connections:
    • Power: On my strips, this was labelled with "+" or "VCC", and was a red wire.
    • Ground: On my strips, this was labelled with "-" or "GND", and was a white wire.
    • Signal: The remaining wire. In my case, it was green.
  • Remove the connector from the output end of the strip. Save this connector, to use with the Wemos board.
  • Remove any extra wires from the input end of the strip, leaving just the connector & its 3 wires attached to the strip.
  • Prepare the silicone rubber tubing:
    • Remove the silicone rubber tubing from the strip.
    • Cut the silicone rubber tubing into 2 equal length pieces, each ~50cm long.
    • Taper each of the 2 pieces:
      • Mostly just cut off the sides from the last 10.5cm of both 50cm pieces.
  • Cut the 100cm LED strip into 2 pieces, each 50cm long. In the case of both brands of LED strips I bought (NeoPixels & BTF), the 100cm strip was actually two 50cm strips soldered together, so I just desoldered them.
    • Keep track of which ends were connected before you did this. We're going to reconnected them.
    • To be clear, I refer to these ends as:
      • The output end of "the 1st 50cm strip" (the one with the connector soldered to its input)
      • The input end of "the 2nd 50cm strip".
  • Assemble the two 50cm LED strips, back-to-back:
    • Flip the strips over, so you see the side without the LEDs.
    • On the 2 ends we need to connect (output of the 1st strip, input of the 2nd) find the 3 solder points (aka "dots"). Using your soldering iron, put a small dab of solder on each of these dots (don't connect them to anything).
    • Use tape to cover all of the dots on the back of 1 of the strips, except for the 3 dots you just added solder to. I used white gaffer's tape, but Scotch tape will do. We just want something non-conductive to prevent unwanted electrical connections.
    • Place the 2 strips back-to-back. The 2 ends we need to connect should be touching (i.e. the dots with solder from one should be touching the dots with solder from the other). Use some tape to hold the strips together while you solder them (next step).
    • Use your soldering iron to melt the small dabs of solder together, making 3 electrical connections between the 2 strips [power, ground, and signal].

Step 5: Assemble the Blade

  • Assemble a "sandwich"
    • Place the LED strip in the center.
    • On either side, place 1 piece of the silicon rubber tubing (previously removed from the LED strip).
      • This is important for keeping the LEDs away from the diffusers, which really helps evenly spread out the light.
    • On either side of that, place 1 piece of the diffuser.
  • Slide the sandwich into the blade tube.
    • You should be able to insert it in until pretty much the entire length of the LED strip is in the tube.

Step 6: Solder the Connector to the Board

  • Solder the connector you removed from the output end of the LED strip (in step 4) to the Wemos board.
  • There are only 3 connections, and in step 4, you should have made note of which color wire went to each.
    • Power: Labelled “+” or "VCC" on the LED strip goes to “5V” on the Wemos board (mine was the red wire).
    • Ground: Labelled “-“ or "GND" on the LED strip goes to “G” on the Wemos board (mine was the white wire).
    • Signal: The remaining wire goes to “D4” on the Wemos board (mine was the green wire).

Step 7: Setup the Arduino IDE & Connection to the Board

  • This step is comprised of one-time setup work. Once successful, you shouldn't need to repeat any of these steps, even if you customize the program running on your board.
  • Add the USB serial driver, to communicate with the Wemos (It uses a chip called the CH340). See this guide.
    • Note: DO NOT use the cable which came with the battery for connecting the Wemos board to your computer. This cable is only good for providing power (not the data your computer needs).
  • Download the Arduino IDE and add support for the Wemos board. See this guide.
  • Add the NeoPixel library to the Arduino IDE. See github.com/Makuna/NeoPixelBus.
  • Add SPIFFS file system support to the Arduino IDE. See github.com/esp8266.
  • Extract the attached tar file (with my example code) in the sketchbook directory of your installation of the Arduino IDE.
    • On Unix/MacOS, you can use the following command:
      • tar -xvf Windsabers1.tar

Step 8: Program the Board

  • I called this out as separate from the previous step, because you'll need to repeat some or all of these steps if you customize the code running on your board.
  • Please don't judge me by the quality of this code. It was written in the very little time I could steal on weekends, when not 3D printing the hilts. Someday I'll clean it up, and post it on github ...
  • In the Arduino IDE, open the "Windsabers" sketch in your sketchbook folder.
  • Upload the "data" subdirectory to the flash of the ESP:
    • Click Tools > ESP8266 Sketch Data Upload
    • This takes a few minutes, but after a few seconds the LED on the Wemos board should start blinking to show something is happening.
    • If this fails with "error: espcomm_open failed" try closing the Arduino IDE’s Serial Monitor window, then try it again a couple of times.
    • I have often seen some warnings like the following, but they seem harmless:
      • warning: espcomm_send_command: wrong direction/command: 0x01 0x07, expected 0x01 0x08
  • Upload the sketch itself.

Step 9: Connect to the Web Server, to Control the Color.

  • After the board is programmed, anytime it is connected to power it will host a WiFi network, with an SSID like "ESP..." or "AIThinker...".
    • Note: I haven't had time to figure out why the name isn't always matching what I specified in the code.
  • To change the color of the LEDs, do the following:
    • Connect a device (e.g. your phone) to the saber's WiFi network.
    • Open a browser, and enter "http://192.168.4.1/".
      • You should be shown a page that has
        • 3 text areas, where you can type integer values from 0-255 for each of [Red, Green, Blue]
        • A button labelled "Pick a color" which will make the color picker appear, so you can choose a color by tapping the screen.
        • A button labelled "Send Color" which communicate your color selection to the saber.
      • Note: You can turn the LEDs off by sending all 0's.

Step 10: 3D Print the Hilt