Arduino Powered RGB Lightsaber: With Sound Effects and Flash on Clash!

2,137

27

5

Introduction: Arduino Powered RGB Lightsaber: With Sound Effects and Flash on Clash!

About: Highschool student obsessed with Arduino, Raspberry Pi, 3D printing, robotics and pretty much and kind of tinkering or making.

Video of lightsaber: https://photos.app.goo.gl/Xh7E3y69saTt38SHA

Lightsaber's are awesome, and making one of your own in proper jedi style is even cooler!

This lightsaber is powered by a single 18650 Cell, and runs on an Arduino Nano. The blade is RGB and can light any color you desire! The saber features sound effects as well as flash on clash, which adds to the awesomeness of this prop.

Disclaimer: I did not make the blade itself! The electronics are covered in this guide, but the polycarbonate blade with diffusion film was purchased from Ultrasabers for $8 as a used 'Grab Bag 24" Blade'

This guide isn't intended for replication of what I have made, but instead as an overview that shows one way of making the prop.

Supplies

Electronics you will need:

- Arduino Nano

- 3W RGB LED + Heatsink + Focusing Lens (https://www.addicore.com/3W-RGB-LED-on-Star-Board-...

- 18650 Battery & Holder

- Charge protection circuit w/ integrated boost converter for step up to 5V (https://www.amazon.com/MakerFocus-Discharge-Integr...

- LM2596 Or similar buck converter

- 3W 8 ohm or lower Speaker

- DFRobot SD Card MP3 Player Module (DFR0299)

- SD Card (32GB or Lower)

- Stranded Wire

- Momentary push buttons

- MPU6050 Gyro and Accelerometer

- 3x Small MOSFET

- 3x 100 ohm resistor

- Through Hole PCB

Other Supplies (No two lightsabers are the same, so get Creative, use anything you'd like!)

- Ultrasabers blade (This can be replaced with polycarbonate tube or even pvc pipe)

- 10" Plastic sink drain pipe (I got mine at a local hardware store for $3, any pipe of preference would do!)

- Screws and nuts (Any smaller size of screw, M3 - M5 would do, just use what you have and design appropriately)

- 1" Internal diameter copper pipe

- Primer, paint and enamel clear coat (again, preference is what matters here!)

- Superglue or other strong adhesive (might be optional dependent upon design)

- Hot Glue

- 3D Printer, Filament and Fusion 360 or Other CAD Software (This one could be optional as well, but having access to it myself, i used it for most of my parts)

- Thin decorative wood veneer (This one is highly optional, but I wanted a wooden handle, so I used the bentwood ring technique on a larger scale to make mine. Heres a reference:)

Step 1: Step 1: Design

You cant make something without knowing what you're doing! For this step id recommend looking at images of lightsaber hilts, drawing your own and deciding what features you want.

In my case, I knew I wanted a practical approach with a large flat surface that could comfortably fit both of my hands. I didn't want the movie style props that would be highly unrealistic to use, which is why I went with the simple wood wrap as majority of my hilt area.

Remember than anything goes, and you can do this however you'd like! Remember you will need space for two momentary switches, and if you want sound you will need an end cap that has holes to allow the airflow through.

I designed my lightsaber fully in fusion 360 before I started construction which was very helpful. All the parts were made to slide fit into the inside or onto the outside of the drain pipe, and make it look like a lightsaber. The second picture shows the internal chassis that holds the electronics in place inside of the drain pipe. The last picture is for reference to see how the parts fit together inside that frame.

You will want your blade to sit inside a short section of copper or other metallic pipe that is in the 1.5 - 2.5 inch range. This will help support the blade and hilt, and keep everything durable and in tact even through dueling. You will want to drill a hole through this (and a matching one through the pipe and any other parts that might be inline with this piece). This will serve as a set screw to hold the blade in place. In my design, I have a single M4 nut inserted into the printed piece where my drilled hole is in the emitter area. An M4 screw can be ran through this, which will then contact the blade. Tightening this down will hold your blade in place when its swung around.

Step 2: Step 2: Initial Construction and Painting

Assuming your parts are printed and or constructed by now, you will want to prime and paint them. Once this is done, a protective clear coat is recommended to give the parts a glossy finish and add some protection as well.

Make sure that the copper pipe holds your blade relatively snugly, and that the set screw lines up to hold it firmly in place once tightened. At this stage you would have a prop that could be finished, although the real magic comes once the electronics are inside!

A dueling test here might be a good idea. If you plan to use this lightsaber, testing it now is worthwhile, because its better to break in this stage than after all the electronics are finished and inside the saber.

Step 3: Step 3: Electronics

This step gets fairly in depth and im not going to provide a full circuit layout, but I'll do my best to give a good description. The lightsaber is powered by a single panasonic 18650 cell, but any would work.

On the very tightly packed pcb there is:

An arduino nano

MPU6050 Gyro and Accel

3x MOSFET and 3X 100 ohm resistor

DFR0299

Charge protection + boost converter circuit

The MPU connects to the nano via I2C lines, and uses its data to detect swings and impacts by looking at the change in accelerometer values over time (its taking the derivative of acceleration, AKA Jerk!) When a change is over a defined threshold, the lightsaber knows it was swung. If its over an even larger threshold, it knows it hit something.

When it detects one of these motions, it sends a signal to the DFR0299 via Digital pins 10 and 11. These two pins are used as software serial pins. This is because while using the onboard TX and RX pins would work, when you go to download a sketch you would get errors as there would be interference on the lines. This triggers an action respective sound file that was saved on the SD card. The output of the DFR0299 are connected to a 3W 8 Ohm speaker I used, which fit PERFECTLY inside of the pipe I purchased from Lowes. So amazing when that happens.

The LM2596 Buck converter has its input side connected to 5V, and is tuned with a multimeter to be around 3.0V. This is below the forward voltage of the LED's, but we will slowly tune that later.

Using 3 of the PWM pins on the Nano (In my case, pins 5, 6, and 9 as they were convenient with the pcb layout), the 3 MOSFETS are controlled. Each MOSFET has its gate connected to a PWM pin, and its drain connected to one of the cathodes of the RGB LED. The 3 Source pins are connected to the output of the LM2596 buck converter, which feeds the MOSFETS a lower voltage to prevent the LED from burning out. The red LED has a lower forward voltage than the other two, which is where the 3 resistors come in. They are connected together to form a resistor with 1/3 of the resistance ( 1/3 of 100 = 33 ohms), as well as be able to dissipate more power as a single 1/4 watt resistor would be far from ideal with the power levels of the LED. These 3 resistors are placed between the source pin and buck converter, to drop the voltage of the red led to somewhere in the 2 ish volt range.

The 3 outputs of the mosfets are fed to the cathodes of the RGB LED. I chained the anodes together to make a common anode, then connected it to the output of the buck converter. The led was placed onto its heatsink and the focusing lens was glued on top.

2 momentary switches will be nesecarry as well. One will be the ignition button, and can be connected to any free gpio pin on the arduino. The other is the power button, and connects to the KEY pad on the charging circuit that I used inside my Saber. This part can be replaced with a switch of any kind and may be dependent upon the exact part that you use inside your lightsaber.

Step 4: Step 4: Programming and Sounds

I got my sound files online (not sure whether the source was legitimate or legal, so ill simply say to search for lightsaber sounds online and use whatever you can find and trust.) Once i had them i loaded them onto the SD card and placed it into the DFR0299

Programming the arduino wasn't too bad, and like usual I wont go fully in depth. Ill post the poorly written and messy code for now, but i cant recommend it, as I know it could be improved upon.

https://pastebin.com/yvB07RtV

There is a 2D array for storing the user defined RGB color values. Pressing the button adds 1 to the cycle value. Every odd cycle value turns the saber off, and an even one turns it on. When on an even number, It will light the next color inside the array of values, until it reaches the end and starts over at the first color.

The arduino updates every 5ms to get better data from the accelerometer. When a change was above a manually tuned threshold, it knows it was swung or hit. It interupts its regular humming noise with a swing or clash noise. If it was a clash, the blade also flashes very bright for a short amount of time.

If you like the color you are on, you can hold the ignition button down. Doing this for over 2 seconds will lock the saber onto its current color, so you can ignite and shut off your saber on the same color over and over. Repeating this will turn off the 'color lock'.

Step 5: Step 5: Finishing Touches

This is the fine detail stage! Wooden handle wraps, weathered paint jobs, intricate engravings, wax or resin inlays, fancy paintings and other decorative features that make your lightsaber truly unique! This stage is really fun and makes the project a lot more impressive, so if you're going for more of a show prop this is great!

If you want more of a stunt saber or practice toy that you know is going to get beat up, this might not be important.

It's up to you and your imagination, make it however you'd like!

Step 6: All Done!

This project was a ton of fun, so much so that I ended up making 3 Lightsabers! One of them is a stunt saber, and has only a battery, switch, LED and resistor, but works fine if all you want is an on off single color saber. This project is great to do with friends, and if you make more than one you can duel! Also make for a great Halloween costume piece.

Hope this instructable was a good introduction to making your own lightsaber!

3D Printed Contest

Participated in the
3D Printed Contest

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Make it Fly Challenge

      Make it Fly Challenge
    • Metal Contest

      Metal Contest

    5 Comments

    0
    trevin_S
    trevin_S

    Answer 1 year ago

    I had not thought of that, no! However, I still think I'd stick with the nano, as the MKR Zero is rather expensive compared to a $3 nano clone. but if you had a zero, that would most definitely be a good option!

    0
    wnorman
    wnorman

    Reply 1 year ago

    I will Let you know how well I do with it

    0
    jessyratfink
    jessyratfink

    1 year ago

    That came out awesomely!

    0
    trevin_S
    trevin_S

    Reply 1 year ago

    Thank you! I was very happy with it as well!