Motion Sensing Lightsaber Game Controller With Some Scrap

by leeonardson in Circuits > USB

675 Views, 2 Favorites, 0 Comments

Motion Sensing Lightsaber Game Controller With Some Scrap

20210219_025404.jpg
20210219_025418.jpg
sabre completo aceso.jpg
20210219_025426.jpg
20210219_025538.jpg
Sabre de Luz Gamer com latas de cerveja,pregadores de roupa e Arduino.

Imagine being under control of a lightsaber that is also a game controller?sounds cool ,and someone already tried this ,but i dont ow much money to afford a wiimote,or even a lightsaber so i decided making a lightsaber controller from scratch,mostly with stuff i already have,except for some electronics.

Itens

analogico de videogaame.jpg
arduino.jpg
bateria 9v.jpg
botão.jpg
cano pvc.jpg
clip bateria 9v.jpg
cola quente.jpg
dupla face fita.jpg
durex.jpg
ferro de solda.jpg
fita isolada.jpg
fotodovjoy.jpg
giroscopio.jpg
latinhas.jpg
led fita.jpg
lixa.jpg
mpu.png
parafuso.jpg
prega ropa.jpg
regua.jpg
sabre do luiz.jpg
saquinho plastico de cd.jpg
tampa de cano pvc.jpg
tesoura de ponta.jpg
Tools:
  • Hot glue gun and hot glue
  • Pointed big scissors
  • Isolating Tape
  • Transparent Tape(Durex)
  • A older soldering iron(for burning holes on the plastic)
  • Soldering Iron and Solder(for soldering wires)
  • Sandpaper(i used a skateboard one)

Mechanical parts for the lightsaber:

  • 1 meter of PVC 1/2" pipe
  • 50 cm plastic tube (i used these ones tthat come with Christhmas balls inside)
  • Beer cans(any aluminium can works well)
  • Cellophane paper,you choose the color(in the case you only have white LEDs)
  • 1 PVC 1/2" cap
  • 1 ruler 30x4 dimensions(or some cardboard or wood with same dimensions)
  • Plastic DVD bags

Electronical parts for the lightsaber:

  • 50 cm 12V white LED strip(or if avaible choose another color)
  • 9V Battery and 9V Battery clipper
  • Arduino Uno(can be any Arduino)
  • Accel/Gyro MPU6050
  • Toggle pushbutton on/off
  • A lot of copper wires,

General controller parts for the lightsaber:

  • 1 pushbutton
  • 1 analog stick(you can use more if you have room on the saber)
  • 3 Wooden Clamps
  • 6 Bolts
  • Copper wires
  • Plastic Botlle caps(or if avaible game controllers caps)

And the most important:

Lots of wire and patience,.

Lightsaber Structure:Hilt

FB20XXGKLGLA15A.jpg

For the hilt, we gonna to cut 30 cm of the PVC pipe, it's a very comfortable height to be handled, and after that the pipe must be sanded.

Mark with a pen where your fingers and thumbs rest naturally, it will be for the buttons and analog wires to pass, also make one for the led switch. Now let's drill a hole with the used soldering iron, watch out for the hot plastic.

Lightsaber Structure: Blade

FW8XJEUKLGL9ZP7.jpg

We gonna carefully sand the plastic tube, I used a plastic tube generally used for Christmas balls.

It is not tough enough for some lightsaber fights, but it is safe enough not to break your TV or monitor screen if you accidentally hit it with the saber blade.

To fit in on the PVC pipe, you can gently crumple the far end of the plastic tube, or carefully pass something hot(like the soldering iron) near the end of it, lately we gonna use tape to firm the blade.

Lightsaber Intern Eletronics: Accel/Gyro and Battery.

Hnet.com-image (1).gif
F7OPZSAKLGLA1RP (1).png

Our “saber crystal” the source of the power and of this gaming lightsaber are the Accelerometer /Gyroscope MPU6050, responsible for literally “sense the force” for responding our moves in game, and of course the battery that are responsible for powering the LEDs inside the blade.

We gonna mount the sensor in the middle of a ruler with approx same wideness dimensions of the PVC pipe for fitting inside it, positioning the sensor on the middle guarantees stability and precision on the sensor reading, because the only force acting on it is the one that you apply on it. Screwing or just fixing the sensor with tape shall make it not fall off the ruler while you move.

The 9V Battery are heavy enough to unbalance the motion of our lightsaber, so I glued and taped it down of the same point the sensor is fixed, these cames with the cost of a hard time replacing the battery, but I am working on a future design for making a “door” in the middle of the pipe to switch it.also these batteries have a good lifetime of like some months.

Solder the sensor following this diagram, a good advise is to hot glue the terminals after soldering, this guarantee that clashes and tensioning the wires are not going to make the solder joints “broke”.

Lightsaber Intern Eletronics: Saber LEDs

Hnet.com-image (2).gif
5-led off.jpg
5-led on.jpg

Follow this diagram for the LED switch circuit, just remember having longer wires for the switch, so you won't struggle with the wire stretching while working on solder them in the rest of LED circuit.

At this point you might have the ruler with the sensor and the battery mounted on it, solder longer wires for the LED part of the circuit, and now you have everything that must be fitted inside the pipe.

If you chose to have the wires for the buttons and analog stick to pass inside the pipe, the time for passing them inside is now, tape the other ends of the wires, they gonna be waiting till the time to solder the analog stick and buttons on them.

Also, tape every loose wire of the ruler with some tape to avoid bad tensioning of them and now fit our"saber crystal circuit" inside it.

Make a hole on the PVC cap with a little help from something hot, and pass every wire inside it, and thread it on the pipe.

You soldered longer wires for the LED strip, so now you won't have much problem soldering them, after that, wrap the strip with some of this CD plastic bags, this is going to help reflect more the light, pass some glue on the strip and fit it inside the blade.

Controller Buttons

6-back button.jpg
6-nude analog.jpg
6-scrap analog.jpg

A simple way for finding an analog stick, is salvaging it from older controllers, using the good soldering iron, a desoldering pump and patience, you can easily scrap out one from the controller board, i only used one analog stick for optional reasons.

You re going to solder it following these diagram, after that fix it with a lot of hot glue and tape, might look bad but its just be careful with the analog that you will have a great play.

Wooden Clamp Triggers

7-woody clamp finish.jpg
7-woody clamp middle.jpg
7-woody clamp start.jpg
7-luke hilt.jpg

I managed to find just one switch for the buttons, so I had to improvise the other with these wooden clamps triggers.

Split apart the wooden clamp, saving the metal clip for reassembling, and mark two spots with a pen for hammering the nails.

Hammer a nail on each marked spot for opening a hole(you can use a drill instead a hammer and nail)and screw some bolts into it, saving space for wrapping a copper wire on each bolt before totally screw them.

For protecting your finger from a possible short and improve the ergonomics of the button, you can hot glue a plastic cap(I used the caps of the old controller buttons)right on the tip of the screw above the wooden clamp. I hot glued these wooden clamp triggers on the bottom of the lightsaber, so it looks like the black parts from Luke's lightsaber.

Virtual Joystick Configuration and Arduino Code

8-vjoy device print.jpg

Download and install the following programs, vJoy is used for creating a virtual joystick on your computer, and vJoySerialFeeder is for feeding the virtual joystick with data gathered from your Arduino.

For the Arduino to gather angle information from the Accel/Gyro, you must add the MPU6050_tockn library, it is easily installed from the library manager, just go to tools, then library manager, a menu will open, and you will search MPU6050_tockn, just install and now Arduino is ready to gather angle data from the sensor.

Down below, I uploaded my Arduino code for a controller with,4 physic buttons,1 motion controlled button and a single analog stick. Compile it to your Arduino, and take note of the COM port showed in the footnotes of the compilation.

After download vJoy, install it and check if your computer recognize a vJoy device on the device menu.

VJoySerialFeeder Controller Setup

9-feeder print.png

Hang on my Padawan, we come closer to the functional Lightsaber Game Controller, now that you have previously downloaded vJoySerialFeeder, we must configure our controller on it.

After following the wiring diagram of our circuit to Arduino, you re going to plug the Arduino into the computer and open vJoySerialFeeder.

On the application, click refresh then port, choose the COM port that you took note previously and then click Connect(troubleshooting advise:usually if you face something like failsafe, after connecting, this means that something on your circuit is bad connected, generally something like pulling the saber too strong that the solder in the wires broke).

In the Channel Monitor option check if all channels respond, analogs should have a variation, while all the other buttons including the motion sensed, must vary from only 2 states.

Go to add buttons and start adding every button, checking the channel monitor for matching the buttons with the right channels. In the Setup option of every Button, set the threshold max to 1023 and the minimum to 0,check on your controller if its inverted, if is, just select the invert box to fix that.

Do the same process for the analog stick by going to add axis, and carefully matching the t axis X and Y for the two axis the analog have, go to calibrate and the program is going to help you calibrate each axis.

At this point you noticed that every button press blink a green circle on the program, pay attention to this to see if the motion sensing “button” is working well, if you have any issue maybe you have to change the angle manually on the code, and start experimenting values that best suite your play style by checking the angles with the "get angle" example included in the MPU6050_tockn library.

Decorating the Lightsaber: Hilt

10-hilt deitado.jpg
Hnet.com-image (4).gif
Hnet.com-image (5).gif

At this point my Padawan, you already own a game controller, but its not a lightsaber yet, so feel free to decorate your hilt in a way that express your alignment with “the force”, my alignment is with the beer, so I cut beer cans with a big scissors, being carefully in this process.

I left some books above the cut cylindrical pieces to plaining it a little, then I started covering the hilt with it, always in big pieces of aluminum, (some parts may be uncovered after all, so its up to you wrap the hilt with aluminum foil before, just to hide the uncovered parts a little).

If you have any wire passing out of the hilt, or any terminal from a button except for the triggers(they too far from the aluminum, and are isolated by the hot glue)please tape them with isolating tape, to avoid any shocking stuff.

For holding these aluminum parts, isolating tape and transparent tape are a good design choice, i optionally made a case for the analog stick with the cut beer cans.

Decorating the Lightsaber: Blade

11-cellophane off.jpg
11-cellophane on.jpg
11-darkblade.jpg
11-half painted blade.jpg

I only have White colored LED strip, so I wrapped the blade with green colored cellophane paper, with is also a cheap and alternative to buying colored LED strips,

Never paint the blade, just don't paint her, it's not going to glow so well.

Wires and Gaming Positions

12-arduino wires.jpg
12-gaming position.jpg

One of the counters of this controller are the wires, that's why I point out their importance, you gonna move a lot, and i often had issues with wires being pulled out, so don't be afraid to use longer wires, or even soldering more wires in the wires you already have, caring for they have almost the same size, and if possible mark the wires with something like a tape if you don't have many colors of wires, that's going to save you a lot of time.

My usual position for playing are holding the analog stick and the back button with my right hand(I m right-handed)and the other hand in the triggers' area.

Lightsaber Gaming

DIY Gaming Saber DEMO

And after all that, my Padawan, your training is now complete. You built your own lightsaber game controller, now show these games your control over “the force”.

With time and patience you get the way of swinging the lightsaber to the timing of some games.

And that's it! I hope you like to feel “the force” within wooden clamps buttons and beer cans lightsaber

May the force be with you all guys!