The Ultimate Dancing Game Glove
by streepje8 in Circuits > Gadgets
238 Views, 0 Favorites, 0 Comments
The Ultimate Dancing Game Glove
In this project you will be making a glove which you can use to play a DIY dancing game on your computer. Its a lot of fun to make and play so I really recommend doing it!
(I do not own the characters you see in the sample image of the DIY game, they are taken from just dance 4, which is a game made and owned by Ubisoft, you can but it at https://www.bol.com/nl/nl/p/just-dance-4-nl-wii/1004004012546076/ but it won't work with our controller)
Supplies
For this project you will need the following things:
- An Arduino (the nano doesn't need a case like the uno in the tutorial) (https://store.arduino.cc/products/arduino-uno-rev3) + the cable
- An USB Extension cable A (male) to A (female) (i used a 5 meter one but you can take a longer one) (https://www.allekabels.nl/usb-verlengkabel/4965/1281064/usb-30-verlengkabel.html)
- A MPU-6050 Gyro Sensor (https://www.otronic.nl/a-62468557/sensors/acceleratie-versnellingsmeter-en-gyroscoop-i2c-mpu-6050/)
- A couple of jumper wires (the longer the better) (they were in my kit, I found this website that sells really long ones but I can't recommend it as its not a website where I've bought anything before)
- Access to a laser cutter (Only if you are planning to add the case)
- A 500 mm x 300 mm plate of MDF (it can be a bit smaller, but with this size you should be good, if you have a smaller plate and you want to know if it fits, you can check the .dfx file in your printer software) (Only if you are planning to add the case)
- A comfortable glove you are willing to loose
- An elastic band with a clip (i stole one from a sport belly bag by cutting it apart)
- A glue gun and a solder kit
- Some kind of saw and drill to make holes for the wires in the MDF
- A computer with unity installed on it, and a pre recorded clip of you dancing to some music (its even better if you did it in front of a green screen)
- (Optional) a git installation (makes cloning the code easier)
Soldering
First we will need to soldier the jump wires to the MPU board, you will only need to wire 4 of them since we won't need the information we get from the other ones (for this version of the glove). The ones we need to soldier are VCC, GND, SDA and SDL. I recommend color coding your wires so you can easily tell them apart when adding a case. I would use red for VCC, black for GND, white for SDL and yellow for SDA. When soldering I would also recommend cutting off the end of the wire on the chip end (and if you are using the nano, also on the Arduino end). This part of the wire has an anti-oxidizing layer and the soldier will not bind to it properly, if you are a soldering expert then go for it but I don't recommend it since the one that has 3 of them took me 4 times as long to solder and left burn marks all over the chip. Make sure you don't have any trailing ends of the wire and that the solder doesn't connect since the chip will not work that way. You can test the VCC and GND wire by connecting them to the Arduino and checking of the light turns on. The other ones can only be checked at a later step.
Glue the Chip to the Glove and Test
Now we want to test if our soldier is successful, and if the connection between our game engine and our Arduino works. First take the chip with the soldiered on wires, and connect the wires in the following way:
The VCC wire to the Arduino 5V
The GND wire to the Arduino GND
The SDL wire to the Arduino A4 (Analog 4)
The SDA wire to the Arduino A5 (Analog 5)
Then load up the .ino project files provided in the Arduino IDE and open the Serial Monitor. Then set the dropdown to 19200 baud. This is the speed that the code provides the rotational info to your computer. Upload the code to your Arduino, and check if the result in the monitor is correct with the image above. It should be drifting by a lot. Since we are not using any calibrating apart from the start-up since we won't need it for our game.
then we will need to glue the chip on to the glove, do this with the wires facing up so they won't have to bend in unnatural ways. If your chip still logs the same messages after putting it on the glove, you are ready to test it in a game engine.
Downloads
Lasercut and Assemble the Box
Download the dxf for the case at my site. You can cut this out of any material that can be cut with a thickness of 4millimeter. Once everything finishes printing you should be able to hold the parts together like in the image (but don't glue them yet). Mark the part where the Arduino usb plug is and cut a hole for it, on the opposite side drill a hole for the wires. then put your wires through the hole and glue all sides of your case together except for the top. Make sure your Arduino is firmly in place, if you want to sacrifice the ability to get the Arduino out for later, you can also hot glue it in to place instead of adding all this padding like I did. When you are finished, glue the top on and wait for everything to dry.
Attach the Wristband to the Box
For the final step, put in your short usb cable and tape your smaller cables together, now hotglue the black elastic band on to the box so its firmly in place and able to hold the box. Normally you want to put the box down more so you can bend your hand in all directions, but since the cables were to short and exiting in the wrong place on my prototype I had to move it up more to the wrist to make it work. This is less comfortable so only do this if you have to. When you're done attach the end of the glove to the box with some more hot glue and put it on to check if everything is in to place firmly.
Clone the Code From Git
Go to the git repo at https://github.com/streepje8/DancingGloveITTT. Then either do one of two things:
If you do not have git installed, press clone, download zip, and unzip the zip to open it in unity.
If you do have git installed, open a terminal and run the following and open the folder it created in unity:
git clone https://github.com/streepje8/DancingGloveITTT.git --recursive
Record Your Dance to the Game Engine
First drag your video in to the video folder of the unity project. Then link your video to the video player object as shown in the second image. Adjust the key of your video on the material shown in the third image, if your video doesn't have a green screen you can just put the treshhold to 0. Next enable RecordMode on the move manager. This tells the game you want to record a set of moves and not play. Next set the correct COM port in the ArduinoInput object. Now grab your glove, your mouse and click play. Every time before you do a move click your mouse to tell the engine that you want to store the following move. Dance out your entire song clicking everytime. When your video finishes nothing should happen. Walk to your computer, right click your game window and press the spacebar. Now a message should appear inside of your console. Copy all the text from the first [ to the ] before UnityEngine.Debug.Log (including those brackets. Then paste it in to notepad or another place and save it as a .txt file for later use. Next stop the game and locate the leveldata asset. Double click to open it and copy your level data over in to it. Then press ctrl+s to save the file. Now your dance moves are saved and the game engine knows how to grade people on it. When you go to the Movemanager and you Disable RecordMode its all set up to play.
Next time when you run the game you will be graded on how well you did, and in the end get a score to compare to your friends!
Enjoy
Congratulations, you have now successfully made your own dancing game controller. Sit back and watch others try to beat your impossible dances. Or download dances from online and try to beat them yourself! You deserved it!
Videos of the Working End Result
Above are a video of me showing the controller working using the Arduino console, and one of the controller working with me playing as one of the just dance 4 characters. I sadly had to mute the second video due to copyright restrictions (Which is fair since I do not own the song used on the just dance level).
That's it folks!
Thanks for reading! If you liked this post, leave a comment to make my day :)
Enjoy the rest of your day!