The New Project

IMAG1104It’s great to look out and see all the ingenious things people have build with the nifty WS2812b LEDs pixels from WorldSemi, but I’m quite surprised that I’ve yet to see any project use them in the way they were intended. I speak, of course, of Lightsabers.

Most custom Lightsaber designs are built around either a superbright LED module in the hilt shining up into the blade, or a string of LEDs up through the blade. In both designs it is difficult to emulate the effect of the blade growing up from the hilt when turned on, and then drawn back in when it is turned off. However, WS2812b LEDs are individually addressable, so a small microcontroller can easily animate the blade growing and shrinking effect. Blade shimmer and flash effects are equally easy to implement and it can be any colour you like. Therefore it is obvious that this is what the WS2812b was designed for.

After finishing a few simple projects, my children and I have been looking for something new to build. When I suggested building Lightsabers they jumped all over the idea. Our friend Mandy, who is also a huge Star Wars nut, was going to be visiting us, so we made sure to start the project while she was in town.

Our Family's Lightsabers
Our Lightsabers

Building Lightsabers at home is by no means a new idea. Plans, kits and guides are all over the Internet. I spent a lot of time reading about what other people have done to prepare for this project and have gotten a lot of good suggestions about what to do. There are some incredibly ambitious projects out there even to the point of precision machining the hilt, but we’re not going to be nearly so ambitious.

Most of our materials will come from the plumbing section of our local B&Q, electronics from Proto-PIC and Aliexpress, and polycarbonate tube from theplasticshop.co.uk. Right now my prototype is running at about £46 in parts which includes £12.50 for LEDs and £11.50 for electronics, but I’d like to get the total down to about £25. ((I’m blithely ignoring shipping costs here. Once the design is sorted out I’ll purchase enough parts to build about a dozen sabers for my son’s birthday party. Buying that many at once diffuses the shipping costs somewhat.))

Shopping for Lightsaber parts
Shopping for Lightsaber parts

For the prototype we’re using lengths of ABS waste water pipe which is easy to work with. Hopefully we can find paint which will adhere to it well when sanded. The blade is a length of 25mm polycarbonate tubing and a half-sphere polycarbonate cap for the tip. The LEDs are inside a second length of smaller 16mm polycarbonate tube which keeps the LEDs straight and holds them in the center of the blade.

Polycarbonate blade
Polycarbonate blade

Polycarbonate tube is transparent and the individual LEDs can be seen right through the tube, so the light needs to be diffused in some way. Two suggestions I’ve come across are to either sand the inside of the tube, or to use a roll of diffusing film on the inside of the blade. I’ve used the sanding methods which makes it look better, but the individual pixels can still be seen, at least in person. On photos it looks awesome, but only because it saturates the camera sensor.

Illuminated blade
Illuminated blade

You can see on the photo on the right the individual pixels showing up in the reflection of the blade even though the blade itself looks like a single beam of light. I’m still experimenting with how to make it look better and I’d love to hear about how others have solved the problem.

LED strip and supporting 16mm tube
LED strip and supporting 16mm tube

To light the blade, I used 2 lengths of 60 pixels/m WS2812b LED strip and pasted them back-to-back. Originally I merely used one 2M length and folded it in half, but doing it that way requires twice the memory and processor time to drive the pixels.

Lightsaber electronics
Lightsaber electronics

The controller is a Digispark which uses the attiny85 microcontroller and is Arduino compatible. The Digispark has an on-board 500mA regulator, but that isn’t nearly enough for 110 WS2812b LEDs which can draw up to 60mA per pixel when fully lit. Instead I added a Pololu 5V/3.5A regulator module to provide power to the strip, which is still less than the theoretical maximum of 6.6A for all the LEDs, but for how they are being used, somewhere around 2.5A will be the typical draw. Finally, I’m merely using 6xAA batteries to provide power, which is fine for now, but I will be replacing it with a rechargeable pack soon.

Control is provided via a button and a potentiometer wired to GPIO pins on the attiny. The firmware itself is trivial. ((eventually I’ll post a git repo with the source)) I’m using the NeoPixel library from Adafruit to drive the control signal. Pressing the button toggles the saber on and off. Colour is set based on the potentiometer voltage reading. I’ve yet to add any other effects.

Mechanically, the potentiometers I’m used have turned out to be a bad choice. I’ve damaged two so far while mounting them inside the case. What happened is I ended up flexing the base so that the wiper doesn’t make solid contact any more and it causes the colour to flicker badly. I’m considering replacing it entirely with the sensor board from a Wii Nunchuck. Cheap replicas can be found on Aliexpress for about £3 each which I can teardown for parts. That would give me two buttons, a 2-axis joystick and 3-axis accelerometer all readable from a single i2c transaction.

The next thing I need to do is get all everything to fit inside the hilt. It’s mostly there, but the battery pack is a little large and the controls are interfering with the circuit boards. I may replace the digispark and power regulator boards with a single custom board to keep the size down. I would also like to add sound effects. A speaker could be attached to one of the attiny85 PWM pins, but generating the sounds may be asking a bit to much out of it. It only has 8K of flash and 512 bytes of SRAM after all. I could switch to a more capable microcontroller, but it is rather fun to see how much I can do with a small device.

Our friend Mandy succumbs to the dark side
Our friend Mandy succumbs to the dark side

8 thoughts on “The New Project”

  1. I am building a similar saber. I was wondering if you would be willing to share your code.

    1. Certainly. I’ve been meaning to post it for quite a while now. It’s up now on git.secretlab.ca:

      git://git.secretlab.ca/git/neosaber

      I used the Arduino IDE. You’ll need the Adafruit Neopixel library to get it to work.

  2. After being on your blog for a while I have come to conclusion that I wish I was an engineer. I wish I could travel back in time 8 years to when I had to make the important choices at high school… Great work!

  3. Hi, could you send me your program to help me get some experience please? I have no idea how to download the git file. Thanks

  4. Would you please send me a ling to where you bought those Led drivers? Also how much Would you sell one of those for, base model (bare necessities)?

Comments are closed.