Arduino Based Lightsaber With Light and Sound Effects

123,345

635

235

Introduction: Arduino Based Lightsaber With Light and Sound Effects

About: I like to create things, handmade weapon, arduino projects, science and some crazy staff! Also I like to capturing videos about my projects and I have YouTube channel - MadGyver!

Hello jedi! This instructable is about making a lightsaber, that looks, sounds and performs like one in the movie! The only difference - it can't cut metal :(

This device is based on Arduino platform, and I give it a lot of features and functions, it was a very big job and I used all of my programming skills, but it was worth it!

So, let's talk about features! Also you can watch a short review in my video, in which I show all effects and functions of GyverSaber system and also there are two professional jedi fighting with my lightsabers in the end of video!

Features:

  • Smooth turning on/off with lightsaber-like sound effect
  • Randomly pulsing color (you can turn it off)
  • Sounds:
  • MODE 1: generated hum. Frequency depends on angle velocity of blade
  • MODE 2: hum sound from SD card
  • Slow swing - long hum sound (randomly from 4 sounds)
  • Fast swing - short hum sound (randomly from 5 sounds)
  • Bright white flash when hitting
  • Play one of 16 hit sounds, when hit:
  • Weak hit - short sound
  • Hard hit - long "bzzzghghhdh" sound
  • After power on blade shows current battery level from 0 to 100 percent

Battery safe mode

  • Battery is drain BEFORE TURNING ON: GyverSaber will not turn on, button LED will PULSE a couple of times
  • Battery is drain AFTER TURNING ON: GyverSaber will be turned off automatically

Control button:

  • HOLD - turn on / turn off GyverSaber
  • TRIPLE CLICK - change color (red - green - blue - yellow - pink - ice blue)
  • QUINARY CLICK - change sound mode (hum generation - hum playing)
  • Selected color and sound mode stored in EEPROM (non-volatile memory)

Step 1: Materials and Components

I always buy electronic staff on Aliexpress, but you can find same modules on Amazon, eBay, etc.

Electronic components:

Materials and instruments:

  • Polycarbonate tube (light diffusion, 32mm)
  • 2 stubs for this tube
  • Some tubes for hilt (I used PVC sewage pipe and tubings: 40mm for hilt, 32mm for PC tube mount)
  • Steel wire
  • Common instruments for soldering and cutting plastic

Step 2: Wiring

I decided to make this project on prototybe board, 3x7cm, you can see all schematics and some ugly-looking-wiring =)

IMPORTANT! Before wiring, connect DCDC step down converter to 12V DC power source and adjust output voltage to 4.5V!

Step 3: Hilt

I use sewage pipes for hilt, but these are russians sewage pipes, so I think you need to improvise.

Step 4: Batteries

I use 3 lithium batteries (ordinary 18650 from laptop battery). At first we need to put them inside 40mm tube (hilt), and we need to heat the tube for it. But at first we need fix batteries together by tape and thicken them with 2 layers of paper.

So heat the tube, put batteries inside and cool down the tube as fast as you can! Lithium batteries very don't like high temperature. Then pull them off and you will see perfect battery case.

Step 5: Soldering Batteries

As I said, lithium batteries don't like high temperature. So use flux and powerful soldering iron (100W) to solder batteries very quickly. So, connect them in serial.

Step 6: Blade and LED Strip

I have 75cm blade, so I cut 75+75=150cm piece of strip. LED strip will be folded twice around wire, so use double-side tape to fix all, and you will get double side LED strip with wire inside.

Strip needs some supports along the blade tube, I used 3 supports made of nail in thermal shrink tubes, and attach them to strip with thread and super glue.

Drill a holes in stubs for wire, wire will be strained between two stubs and fixed by 3mm screw, but not right now.

Step 7: MPU6050

I connected MPU6050 using old IDE flex wire, because it is good idea to place MPU as close to blade as possible. And I just glue it in low stub of PC tube :)

Step 8: Hilt Buttons

Make some holes for buttons and charging port, and a few holes in bottom for speaker. Also I painted hilt with black paint.

Step 9: Final Wiring

So, connect batteries, pull off wires for switch and charge, solder it all and fix in their holes. Also, solder speaker wires too.

Step 10: Speaker Fixing

I fixed speaker using a ring of 40mm tube and some nails =) It is brutal and very strongly.

Step 11: Programming

You can find Arduino sketch, libraries, SD sound files and a lot of instructions in project page on GitHub, but I attached sketch and archive with all project files here, in Instructables.

Simple guide:

  • Open GyverSaber.ino and tune:
  • Number of microcircuits WS2811 on LED strip (note: one WS2811 controls 3 LEDs!)
  • Turn on or turn off blade pulsation
  • Hardly recommend measure real resistance of voltage divider resistors
  • System can work without battery monitoring, just deactivate BATTERY_SAFE. BUT IT IS NOT RECOMMENDED
  • Flash arduino
  • Upload audio files to SD card
  • Enjoy!

MicroSD info:

  • Size < 4G
  • Format to FAT
  • Copy audiofiles in the root

If you want add your own sounds, convert them to .WAV:

  • 8 bit
  • 16-32 kHz
  • Mono
  • Use online converters or Total Audio Converter

WARNING! If you are flashing assembled scheme, you must power up it! Arduino will not work correct with connected DCDC converter!

Step 12: Tuning

I made GyverSaber fully customiseable so you can build your own saber with different blade length and other parameters, just take a look on sketch settings.

Step 13: Final Screw

So, lightsaber is almost done! Just one last screw, which fix blade to tube. I made some drawing with all saber body construction.

Step 14: Results

So, DIY lightsaber is ready to fight! You can watch some tests with spins, swings, object hits, chandelier crash (oops!) and also two real Jedi, fighting with GyverSabers (yes, I made 2 of them!!!) in my video review on this DIY lightsaber and it's functions and features.

Sincerely, MadGyver.

Arduino Contest 2017

Runner Up in the
Arduino Contest 2017

7 People Made This Project!

Recommendations

  • Furniture Contest

    Furniture Contest
  • Home Decor Challenge

    Home Decor Challenge
  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest

235 Comments

0
MALEw0579
MALEw0579

7 weeks ago

Hi, i have small problem. I builded lightsaber, but when i start sound, so velocity sound works ok, but and i switch to second sound (from sd) so doesnt work (little noisy, but sound from sd card does not play). Can you anybody help me ?thx

0
Necroxys
Necroxys

Reply 7 weeks ago

Make sure that the sd card is formatted to FAT and has less than 4GB of storage.

0
MALEw0579
MALEw0579

Reply 6 weeks ago

I found fail. SD card have to fotmatted via sw SD Card Formatter, when i formatted via windows doesnt work.

0
Cekix
Cekix

Question 8 weeks ago

I'm building a Kylo Ren lightsaber and trying to add sounds but sounds not clear and loud or too quiet. Can anyone help me with that?

0
Necroxys
Necroxys

Answer 7 weeks ago

What do you mean not clear? Are you using the default sounds or using other sounds? If the later, make sure to convert them to WAV 8-bit mono 16kHz

0
Cekix
Cekix

Reply 7 weeks ago

I converted it to WAV 8 bit 16khz but still the sound is not good. Its just like loud noise.

3
Sock Puppet
Sock Puppet

3 years ago

This is a great project - your code is very elegant. I have it working with a WS2812S strip on 5V.
I've tied A6 high as I'll have battery protection in hardware and I couldn't select more than 16 leds otherwise.
The BRIGHTNESS allows me to keep the current to a reasonable level for my single 18650 with a mod in the hit_flash for a brighter effect.
Again, fine code, great project. Thank you.

0
jimwithaninja
jimwithaninja

Reply 1 year ago

So making pin 6 high eliminates the voltage divider and am able to 5v batt ?

0
Sock Puppet
Sock Puppet

Reply 1 year ago

Worked for me (it was 2 years ago).

I had a 5V supply from a single cell with a charger/inverter - the sort you get with portable mobile phone chargers. I removed the step down thing in the schematic and used a 5V strip.

0
jonatanko666
jonatanko666

Reply 1 year ago

can you show schematics or picture ? i want this too make it on 5V supply but have no clue how :D

1
Sock Puppet
Sock Puppet

Reply 1 year ago

I've cobbled this diagram together from the original. I'm fairly sure this is what I did for 5V although I used proper ground connections for the MPU6050 and the MicroSD card reader. I also had a MOSFET to flash a bright LED on "hit".

schematic5V.jpg
0
jonatanko666
jonatanko666

Reply 10 months ago

so i tried this scheme and all works fine until i put inside SD card then arduino make strange sound like original sound on SD with some strange modulation . Without SD card is all working fine when SD card is inside is make some glytch sounds and then arduino freez ....also gyro stops working and push button have no longer reactions i also try modules from my previous 12v lightsabers same SD card reader or also tested several arduino nanos replaced. i used this "pure" schematics just i disabled battery monitoring ....its strange also i used SD card with SD module from previous 12V version and this card from this 5V saber i used on 12V version and there is all fine i dont understand why sound is strange on this 5V and "modulated" and i also try to test connections all was fine so i cant find issue and i have no clue how to fix can you help? debug mode shows me all is OK

0
Necroxys
Necroxys

Reply 8 weeks ago

Hi, did you find a solution? I'm having the same problem

0
dargon412
dargon412

Reply 1 year ago

Hi Sock Puppet, I'm trying to follow yours approach to make the saber work in 5V.
May I know if there any change in the code? I read some reply regarding set pin6 to high, why is that? Thanks in advance.

0
Sock Puppet
Sock Puppet

Reply 1 year ago

Hi. setting pin 6 high defeats the battery voltage monitor so there's no need to alter the code. Good luck.

0
rene_gadau
rene_gadau

Reply 8 months ago

What exactly do I have to change? Do I have to delete the rest? Can someone show me the code?

0
Peck76_2000
Peck76_2000

Reply 8 weeks ago

Well, so far I've figured out that the data wire for the leds cannot be close to the MPU5060. It seems to "scramble" the data for the leds and they do not work. The 2 batteries I'm using, the 26650 in series, seem to give me plenty of juice to keep 108 leds lit at a 155 brightness. Plenty bright. I've figured out that using a 1 1/4" sink drain tube works wonderfully for a hilt. Just have to add some slight modifications to make it look more like a hilt than a drain tube. The batteries fit perfectly and I use the compression nut to hold the 1 1/4" O.D. polycarbonate tube in place. So far so good.

0
Peck76_2000
Peck76_2000

Reply 2 months ago

I was able to change the code so I could use the volt monitor. I am using 5v with the ws2812s as well. I'll have to do some more work and change it. When testing I found that when the purple color comes up it'll shut down. I'm assuming that the purple draws enough to lower the voltage below 5. As of now I'm only to the point of testing the leds and the button functions. I'm still waiting for the sd card modules and sd cards. I'm using 2-26650 4200mah batteries and using a dc to dc step down. The batteries fit perfectly inside 1 1/4" drain pipe. Im also hoping the batteries will hold up for a long battle or two. Had to order smaller speakers though. Tried 32mm and they just barely didn't fit in the pipe so I'm going to try 23mm. I can't wait to have this project completed. I'm anxious to have a battle.

0
Sock Puppet
Sock Puppet

Reply 2 months ago

It's been a while... You could run the Arduino on its own connection to the batteries (switched). The regulator on the Nano has a maximum drop-out voltage of 1.3V so you should be fine as long as your total battery voltage is > 6.3V - the LEDs on their own step-down regulator would only dim although you could also play with the FastLED.setBrightness parameter. Good luck.