Arduino Based Lightsaber With Light and Sound Effects

by Mad Gyver in Circuits > Arduino

165804 Views, 688 Favorites, 0 Comments

Arduino Based Lightsaber With Light and Sound Effects

DIY LightSaber with light and sound effects
картинка видео как сделать6.jpg

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)

Materials and Components

DSC_6181.MOV_20171215_003858.178.jpg

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

Wiring

DSC_6182.MOV_20171215_004237.728.jpg
scheme1.jpg
scheme2.jpg
DSC_6184.MOV_20171215_011651.814.jpg
scheme3.jpg
scheme4.png
btn.jpg

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!

Hilt

DSC_6137.MOV_20171215_005657.784.jpg
DSC_6138.MOV_20171215_005705.416.jpg
DSC_6138.MOV_20171215_005711.288.jpg
DSC_6151.MOV_20171215_005722.168.jpg
DSC_6153.MOV_20171215_005732.319.jpg

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

Batteries

DSC_6155.MOV_20171215_010316.563.jpg
DSC_6159.MOV_20171215_010333.611.jpg
DSC_6161.MOV_20171215_010339.611.jpg
DSC_6162.MOV_20171215_010345.810.jpg
DSC_6168.MOV_20171215_010406.705.jpg
DSC_6169.MOV_20171215_010413.129.jpg

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.

Soldering Batteries

DSC_6226.MOV_20171215_010855.184.jpg
DSC_6266.MOV_20171215_010900.888.jpg

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.

Blade and LED Strip

DSC_6199.MOV_20171215_011006.656.jpg
DSC_6200.MOV_20171215_011011.953.jpg
DSC_6200.MOV_20171215_011015.209.jpg
DSC_6219.MOV_20171215_011844.534.jpg
DSC_6204.MOV_20171215_011033.568.jpg
DSC_6205.MOV_20171215_011041.448.jpg
DSC_6220.MOV_20171215_011620.399.jpg

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.

MPU6050

DSC_6206.MOV_20171215_012249.149.jpg
DSC_6207.MOV_20171215_012252.118.jpg
DSC_6209.MOV_20171215_012257.750.jpg
DSC_6210.MOV_20171215_012300.310.jpg
DSC_6213.MOV_20171215_012304.069.jpg
DSC_6214.MOV_20171215_012310.990.jpg

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 :)

Hilt Buttons

DSC_6175.MOV_20171215_012850.705.jpg
DSC_6176.MOV_20171215_012857.514.jpg
DSC_6276.MOV_20171215_012914.898.jpg

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

Final Wiring

DSC_6243.MOV_20171215_013207.616.jpg
DSC_6244.MOV_20171215_013211.064.jpg
DSC_6246.MOV_20171215_013214.640.jpg
DSC_6247.MOV_20171215_013217.487.jpg
DSC_6249.MOV_20171215_013225.495.jpg
DSC_6250.MOV_20171215_013228.304.jpg
DSC_6251.MOV_20171215_013231.024.jpg
DSC_6252.MOV_20171215_013233.856.jpg

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

Speaker Fixing

DSC_6253.MOV_20171215_013238.359.jpg
DSC_6257.MOV_20171215_013252.878.jpg
DSC_6258.MOV_20171215_013255.990.jpg
DSC_6259.MOV_20171215_013258.935.jpg

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

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!

Tuning

Screenshot_1.png

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.

Final Screw

draw.jpg
DSC_6274.MOV_20171215_013315.150.jpg

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

Results

DIY LightSaber with light and sound effects
C0038.MP4_20171215_023329.952.jpg
MAH01350.MP4_20171215_023224.007.jpg
MAH01351.MP4_20171215_023254.272.jpg
MAH01387.MP4_20171215_023443.183.jpg
MAH01389.MP4_20171215_023805.728.jpg
MAH01391.MP4_20171215_023616.176.jpg
MAH01393.MP4_20171215_023830.799.jpg

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.