LED Sword




Introduction: LED Sword

This is a light sword made of acrylic that can be customized with your name, shape of choice and can be used in long exposure photography or as a cool gadget to bring in the club.

Two buttons select the program that controls the RGB LED light.The program changes the light according to a time sequence or the input from accelerometer / gyroscope. At the end of the handle there is a color sensor. The idea is that it can be used in the club to pick up the color of the shirt of someone, and light up the sword with that color.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials and Tools Needed:

- a CNC router that can cut acrylic (in the picture there is my CNC router made from second hand parts).

- a sheet of clear acylic thickness 6 millimeters dimensions 1ftx2ft

- a printed circuit board of the circuit of the sword, can be ordered from PCB manufacturer or made at home (no need for plated holes)

- arduino mini: Enhancement Pro Mini 5V adjustable 16M MEGA328P Arduino pro mini compatible (Ebay)

- Gyroscope+Accelerometer module: 6DOF MPU-6050 Module (Ebay)

- step up module: 5VDC-DC Power Supply Converter Step Up Boost Module 1A 3V to 5V (Ebay)

- lithium rechargable battery 1100 maH used for electronic cigarette(Aliexpress)

- battery charger module: 5V Mini USB 1A Lithium Battery Charging Board Charger Module (Ebay)

- 1×3W RGB led mounted on star PCB(Ebay)

- 1×photoresistor LDR (for color sensor)

- 1×5mm RGB led (for color sensor)

- 3×RQ5E035BNTCL MOSFET N-Channel 30V/3.5A,1W RDS(on) 28mΩ Typ.(Electronic source)

- 3×BC547Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs

- 1×1000 uF 6.3 V electrolytic capacitor

- 1×Various other components: switch, pushbuttons, resistors

Step 2: Make the Plastic Part

The sword is made of 3 pieces. All cut out from the same sheet of acrylic 6 mm thick of the dimensions of 1 ft x 2 ft

The central one has a pocket to hold the electronics and the two halves have cut out to make space for the electronic components and holes for the push button and switches.

The parts are cut using a 1/8" cylindrical woodworking router bit to make the pockets, outer perimeter and holes and a V 90 degrees bit to make the engravings and chamfer the edges

As the parts are machined on both sides it is necessary to flip the material on the router and position it in a precise way. To do so I drilled holes on the stock material and router bed to precisely position the material after i flip it.

I cut the material in 4 steps:

- first i cut the top side using the cylindrical 1/8" drill bit. In the drawing the tool path to cut in this step are named C-p1, C-p2 etc. where the number after the letter "p" indicates the cutting dept in millimeters

- the second step is to use the V bit on the top side of the material to chamfer the top edge and do the engraving. The tool path for this step are all the layers named v-p... where the number after p indicated the cutting dept

- the third step is to flip upside down the material on the router and use the V bit to chamfer the opposite side . The tool path for this step are all the layers named "V...lato opposto"

- the last step is to use the cylindrical 1/8" bit to cut pocket, holes and cut out the part from the material . The tool path for this step are all the layers named "C....lato opposto"

Of course you are free to change the design of the sword or the name engraved on it.

After the parts are cut the ending part of the handle has to be painted black as in the picture to prevent the ambient light to interfere with the color sensor.

Step 3: Make the Electronic Part

To make this sword I found easy and cheap to buy pre-made modules off Ebay/Aliexpress and mount them on a double side PCB .

I designed the PCB with a mechanical CAD because i used the same CAD also to cut pockets in the acrylic to accommodate the modules and components. The PCB supplier i used for the prototype (layercircuit in Bangkok) accepts the PDF format for the PCB traces so I did not need to use a proper PCB software. In one week, this supplier made 2 pieces of this double sided PCB for 116 THB (3.3 $) plus 80 THB (2.3 $) for the delivery. This price is unbeatable but the pads/vias are not plated.

This sword is illuminated by a 3W RGB LED mounted off the PCB. The power LED is driven by a constant current driver that supply about 350 mA for each channel. The LED driver is made of a MOSFET, a sensing resistor and a BJT transistor. The value of the sensing resistor for each channel (RGB) is adjusted to obtain a white color when all the three channels are turned on for the same duty cycle. I found that a 1.8 Ohm resistor on the B and G channel and a 2.4 Ohm resistor on the R channel is the best compromise using standard resistor values.
To accommodate the power LED with the PCB heat sink in the sword i had to cut off the sides of the PCB. For this reason I considered safe to reduce the power consumed by the LED to 1W. The power is supplied by a 3.6V 1100 mAh lithium battery that I got from an electronic cigarette battery. Ordering the electronic cigarette battery from Aliexpress is the cheapest way i found to get this slim and high capacity battery that can fit in the handle of the sword. A step up module converts the voltage to 5V and a charging module charges the battery at a rate of about 500 mA. Originally the charging module would supply 1A to the battery, but it would be too much for this battery so a resistor needs be to changed to adjust the charging current. To do this i replaced the SMD resistor marked in red in the picture with a 2.2 K trough hole resistor.

Step 4: Mount the Sword and Calibrate the Color Sensor.

After mounting the electronic part inside the plastic part the color sensor need to be calibrated because slight difference in the position of the components and tolerances in the LDR and RGB led will change the response from sword to sword.

The color sensor is based on this instructable i found:


A RGB led illuminates the surface to be detected one colour at time, and a LDR senses the amount of light reflected back. I tweaked the code a bit as i found that i get a better color recognition if I linearize the response of the phtoresistor (that is connected in series with a resistor). To obtain this graph I applied a white paper at the end of the word, i modulated the 5mm LED in PWM and i recorded the data from the photoresistor. The values in Y are the ADC readings and the values in X are the PWM values. I found a formula that that matches that characteristic and it's coefficients for each of the three channels. A free software online helped me to find the coefficients that almost perfectly matches my curve. According to this graph the sensor (RGB led + LDR) is more sensitive to the red color, this because all three channels inside the RGB led share a common resistor and when the red channel lights up it draws more current than the green and blue because it has a lower forward voltage.

To calibrate the sword apply a white cloth to the end of the sword, then load the program "calibrazione.ino" in the Arduino.

When pressing a button, this program will output on the serial monitor the response curve of the LDR for the 3 colors: red , green and blue. On each row the first number is the PWM value of the light emitted by the LED and the second one is the value read from the LDR.

Select a single color from the other two and feed it on this online tool that I have used l to find the coefficients that best fit the response of the LDR


Set the curve fitter with the formula as in the picture and get the coefficients a,b and c for each color.

Replace the coefficients on this line of code of the file "timerdmp6.ino":

const float ldrmap[]={841.03,21.294,0.29278,710.14,26.284,0.5443,568.87,35.717,0.7582};

where the numbers are: a-red,b-red,c-red,a-green,-b-green,c-green,a-blue,-b-blue,c-blue

Upload the modified file "timerdmp6.ino" in the arduino.

Have a look at the video of the color sensor in action.

Step 5: Use the Sword for Light Painting

Use a long exposure app on your mobile phone or a professional camera to make pictures like this.

The sword has various illumination modes that can be selected using the two push buttons.

The color changes according to the angular position and the mode selected.

When the handle of the sword is close to a surface it will take it's color without pressing any button. The color sensor does not work well with glossy, shiny surfaces or with LCD.

Circuits Contest 2016

Participated in the
Circuits Contest 2016

LED Contest

Participated in the
LED Contest

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    4 Discussions


    3 years ago

    Very cool project, look forward to seeing your next project.


    3 years ago

    It looks so nice, very good project.


    3 years ago

    These look really fun!