Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

Dance Dance Re'VI'lution with a myDAQ

Introduction

Inspiration for this project came from the video game Dance Dance Revolution, and from a submission of last years myDAQ competition (here).

The piano staircase from that video gave us the idea of stomping on switches as the input to the myDAQ, and DDR seemed be the perfect counterpart to stomping on switches.

My recommendation if you want to do this project is be creative. Use this guide for what it is, a guide. There are no hard and fast rules to this, the more you deviate from what we did, the more you'll learn.


Dancepad Construction

Here's what you need to get started:


myDAQ

carboard box

roll of foil

glue

packing tape

wire

small plastic cutting mats

Most of this you probably already have, which is one of the great things about this project. Almost everything you need you will be able to find at your local grocery store. The only thing I didn't have was the plastic cutting mats, and those were about 5 bucks. I happened to be lucky and find ones that were only about 6"X8", but you could also just get the more common full size ones and cut them to whatever size you want.

IMAG0273small.jpg

The steps I took to create the dancepad

1. Cut down the corners of the box.Make it into a kind of "plus shape"

2. Use Tape where necessary to improve structural integrity

3. Glue down some foil to the box so that it covers an entire plane of the box. (top or botttom, doesn't matter)

4. Strip the ends of a good length of wire (longer = better, you can always shorten it later, 6ft+ is good)

5. wrap one of the stripped ends of the wire in foil and make sure you get a good connection.

6. tape/glue that to somewhere on the foil on the box. I did it on the underside for cosmetic reasons. The idea here is that you will be using the 5V output of the myDAQ to charge the foil covered box, so there needs to be good electrical continuity to all of the foil that covers the box.

IMAG0271small.jpg

7. Take a plastic cutting mat and affix a pad of foil to one side with glue. It helps to attach a wire to the foil here at this step before gluing/taping.

8. Bend the cutting mat slightly and tape it down so that there is no continuity between the foil on the cutting mat and the foil on the box. When you step on the cutting mat, you then want a connection to be made between the foil on the box and the foil on the cutting mat, so tape down the cutting mats accordingly.

IMAG0272small.jpg

This is definitely not the only way to make the input for this project, this is just the method I used. Try to think of other creative methods! Really all we are making here is four 'Normally Open, Single Pole Switches'; which is a fancy name for some buttons.

myDAQ setup

We will be using the 5V output, and 4 of the DIO lines on the myDAQ

The foil covering the box should be tied to the 5V line, the 'switches' should be tied to DIO lines 0-3.

For the code that is attached DIO0=Left, 1=Down, 2=Up, 3=Right.

To output sound, you will need to plug in some speakers or headphones to the Audio Out of the myDAQ.

IMAG0274small.jpg

The Code

We kept this code very light on features. You can feel free to add as many more as you want in order to develop some LabVIEW skills. Some ideas are, a more complex scoring system like a streak counter or a %hit indicator, you could change the colors of the arrows so that each direction is a different color, add a song selection interface, add another player (there are 4 more DIO lines on the myDAQ) or implementing some sort of difficulty setting.

LV code Screen Shot.png

We got some feedback from various people that tested it out and changed a few things since we shot the video/took this screenshot. Here's the change list:

1. Added a "Hit" Boolean so the user can more easily see when they get a move right

2. Changed how LabVIEW checks a 'correct' move, so that you can be standing on more pads than are required to complete that move (Like real DDR)


Software Setup

We only made one song for the game, but it is open and flexible for more. The code reads in which arrows appear on the screen from a text file full of comma delimited 1's and 0's, there is also a header for this file that has the following information (in this order): # of chars left in current line, milliseconds per beat, and number of lines remaining in the file (total lines minus 1).

txtfilescreenshot.png

To figure out the milliseconds per beat number that you need to use in the header of the txt file, you need to find the bpm of the song (beats per minute) and use the following formula

milliseconds per beat = 30000/bpm

this formula is just some unit conversions and then we divided by a factor of two so that we could have empty rows in between the lines with dance instructions. It will make more sense if you run the code and look at the input file.

To run the code, open DanceDanceReVIlution.lvproj, and then open DDR Top.vi. In the song path you need to put the input text file. It's in the songs folder of the attached zip file and it's called demosongtxt. For the .wav path, you need to input the .wav file, it's in the same directory, it's called demosongwav.

For the Digital Input control you need to open MAX (Measurement and Automation Explorer) and see what name is assigned to your myDAQ. The control should look something like this: Dev1/port0/line0:3. In that case, the myDAQ was called Dev1 in MAX. Similar story for the Audio Out control. (Dev1/audioOutputLeft)

Here's a quick Demo Video that may or may not make things clearer

Video

Thanks all! Remember just have fun with it, there are no rules here,

Joel Carroll and Josh Durham




Comments
DeniseBeck
Member
Member
on
Thank you my friend, I might do it myself
Contributors