Project tutorial

Dance Pad with Arduino and Smartphone © CERN-OHL

Dance Dance Revolution pad play with a smartphone via Arduino and 1Sheeld.

  • 1,872 views
  • 1 comment
  • 8 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
1sheeld%20android%20low%20quality
1Sheeld (Android shield for Arduino)
×1
Openbuilds wire cable by foot
OpenBuilds Wire Cable - By the Foot
8 wires 1 meter
×8
11026 02
Jumper wires (generic)
4 jumpers
×4
Tens70
9V battery (generic)
×1
Adafruit industries ada80 image 75px
9V to Barrel Jack Connector
×1
DMF wood sheet 8mm thickness
the sheet is approximately 8mm*120mm*240mm
×1
DMF wood sheet 4mm thickness
in fact we just need four piece 200mm*200mm so you don't have to buy sheet you can just buy 1/4 sheet
×1
cellophane roll
×1
foam sheet 4mm thickness
×1

Necessary tools and machines

Hy gluegun
Hot glue gun (generic)
spray black
Lasercutter
Laser cutter (generic)

Apps and online services

About this project

I was searching about dance pad (DDR pad) online to buy it but I founded it so expensive, so I decided to search how to make it with Arduino. Although there are many videos about how to make a DDR pad with Arduino and computer, there aren't any for a DDR pad with Arduino and smartphone. So I decided to make this DDR pad with a smartphone.

Simply, project is connecting the pad to a smartphone through the Arduino and 1Sheeld.

The way this project works: open the 1Sheeld app on a smartphone, choose GLCD shield for display dance instructions (arrows) and music player shield for choosing music to play while dance, and follow the instructions of the dance by hitting the same arrows with your legs on the dance pad. That's all!

How to make this project:

  • The concept of how it work is very simple. When programming the Arduino pins (pull up), pins are always high (5 V), but the pins can go to low level (0 V) when touching ground. So, first take two cellophane papers: one fixed on face board (cellophane1) and another fixed on the back of dance panel piece (cellophane2). Place the foam on the face board, then place the piece of wood.
  • The dancer will hit the dance pad arrows (the same arrows that display on smartphone screen). If the hit is the correct, the score will increase by one and the music will continue. If it is incorrect, it will pause the music for less than a second.

After getting the components, tools and material.

Laser Cutter Machine

  • In the design file, you will find all the designs (solidwork) and Dxf files that are acceptable for a laser cutter machine.
  • The video explains the number and dimensions needed from the different sheets of wood.
  • After cutting the wood, align the edges pieces onto the face board as shown in the images. I used a drill and screws to fix them.

Cut Cellophane and Foam

  • Cut the cellophane into 8 pieces of 110 x 110 mm. To cut the cellophane more easily, do so from the back and with paper as shown in the images.
  • A foam sheet of 4 mm thickness or foam tape should be cut into 16 pieces, 30 x 100 mm.

Paint the wood

  • Paint the wood with black spray .

fixed foam and cellophane and connect the wires

  • Using a hot glue gun, fixed the foam onto the board (panel by panel) to pass the wires under the foam and make space for the cellophane pieces to put onto the board.
  • Every panel will need four foam pieces (right, left, up and down).
  • Don't worry about the color of foam in the images. the important point is that the foam be 4 mm thickness.
  • fixed the foam in the center of each side by placing it 5 cm from the left and right as the images shown.
  • Using a hot glue gun, fixing the four pieces of cellophane in the center of the panels onto the board. Another four pieces fixed onto the back of the dance panels also in the center.
  • Connect the wires to the cellophane pieces as shown.
  • Make the cellophane that are fixed onto the board connect to the common ground wire.
  • Make every cellophane piece onto the back of the dance panels connect with a single wire.
  • In the last panel, with drill make a hole to allow all the wires going out from under of the board (for a nice view).
  • Once the wires are out, connect the wires with jumpers so that they can connect to the Arduino easier. Or you can skip this step and connect the wires directly to the Arduino if you don't want to solder the wires to jumpers.
  • Use black tape to roll up the wires as image.

Place the Graphic Stickers

  • The printable images are in the design file (Stickers).

assemble and install the Box

  • assemble and install the Box
  • fixed it with a drill and screws onto the bottom of the board.
  • Don't place the front and up side of box until you've uploaded the code and completed the wiring to the Arduino with jumpers.

Enter the wires through the hole on right side of box and wire the jumpers with the Arduino:

  • Common ground for the cellophane pieces fixed onto the board
  • Up panel (arrow) will be on pin 3
  • Down panel (arrow) will be on pin 4
  • Left panel (arrow) will be on pin 5
  • Right panel (arrow) will be on pin 6

The direction for each arrow is shown here.

Programming

Adjust 1Sheeld:

  • If you use an Arduino that works with 3.3 V like the Arduino Due, you must switch your 1Sheeld to operate on 3.3V as well, since it may otherwise damage your board. If you use an Arduino that works with 5 V like the Arduino Uno, then switch your 1Sheeld to operate on 5 V.
  • Place your 1Sheeld on your Arduino board, then plug the Arduino to your laptop or PC.

Download the 1Sheeld application

  • For Android smartphones, download the application from here.
  • For iOS, smartphones download the application from here.

Download the 1Sheeld library to your computer

  • Download the library from here.
  • After you've successfully downloaded the library, add the library .ZIP file to your Arduino program.

Compile and Upload your sketch to your Arduino board

  • Switch 1Sheeld to upload mode before uploading your sketch to the Arduino board to avoid conflicts between the 1Sheeld and Arduino.
  • Upload mode is turned on when the UART switch is pushed away from the 1Sheeld logo.
  • Then press the Upload button in the IDE and upload your code to Arduino.
  • After you've completed your upload, you need to switch 1Sheeld back to the operating mode.

Connect 1Sheeld to your Smartphone

  • You will be required to enter the pairing code (the default pairing code is 1234) and connect to 1Sheeld via Bluetooth.

Access Shields

  • GLCD shield
  • music player shield

Press on the multiple shields icon at the top right of the app.

Push the reset button on the Arduino to start the game. just for the first time

Code

ddr_01.inoArduino
follow steps:
1- download oneSheeld library from manager library or 1sheeld.com
2- make sure that shield on upload mode.
3- upload code to arduino.
4- install 1sheeld app on your mobile. it's available for android and oss
5-open the app.
6-make scan for discover the shield. after scan may required password 1111 or 0000
7- choose from list of shields GLCD shield and Music player shield.
8-open shields.
9- enjoy
/*
   written by raef atef
   raef.madim@gmail.com
   this code for Dance pad with 1sheeld

*/

#define CUSTOM_SETTINGS
#define INCLUDE_GLCD_SHIELD
#define INCLUDE_MUSIC_PLAYER_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>
int c = 0; // counter of score
int up = 3;
int down = 4;
int left = 5;
int right = 6;
int x = 0;
int y = 0;
GLCDTextBox score(1, 1, "score:");
GLCDTextBox number(40, 1, "0");
char charArray[5];
void setup()
{
  /*pinmode */
  pinMode(up, INPUT);
  digitalWrite(up, HIGH);       // turn on pullup resistors
  pinMode(down, INPUT);
  digitalWrite(down, HIGH);       // turn on pullup resistors
  pinMode(left, INPUT);
  digitalWrite(left, HIGH);       // turn on pullup resistors
  pinMode(right, INPUT);
  digitalWrite(right, HIGH);       // turn on pullup resistors
  /* Start communication. */
  OneSheeld.begin();
  /* Clear the GLCD. */
  GLCD.clear();
}
void loop() {
  MusicPlayer.play();
  x = selectrandom(); //draw dance instruction random
  delay(700);
  y = button(); //return the value of button fun
  if (x == y)
  {
    MusicPlayer.play();
    c++; //count score
  }
  else 
  {
    MusicPlayer.pause();
  }
  GLCD.clear();
  String(c).toCharArray(charArray, 5);
  number.setText(charArray);
  GLCD.draw(score);
  GLCD.draw(number);
}

int selectrandom()
{
  int x = 0;
  x = random(1, 5);
  if (x == 1) arrow(110, 70, 40, 40, "up");
  if (x == 2) arrow(110, 60, 40, 40, "down");
  if (x == 3) arrow(60, 43, 40, 40, "left");
  if (x == 4) arrow(200, 43, 40, 40, "right");
  return x;
}
int button()
{
  int y = 0;
  if (digitalRead(up) == LOW) return y = 1;
  if (digitalRead(down) == LOW) return y = 2;
  if (digitalRead(left) == LOW) return y = 3;
  if (digitalRead(right) == LOW) return y = 4;
  else return y = 0;
}
//don't edit any thing in arrow function
void arrow(int x, int y, int width, int lenght, char *t)
{
  if (t == "right")
  {
    GLCDLine line(x, y, (x + lenght) - (0.4 * lenght), y);
    GLCDLine line1(x, y + width, (x + lenght) - (0.4 * lenght), y + width);
    GLCDLine line2(x, y, x, y + width);
    GLCDLine line3((x + lenght) - (0.4 * lenght), y + width , (x + lenght) - (0.4 * lenght), y + 1.3 * width);
    GLCDLine line4((x + lenght) - (0.4 * lenght), abs( y - .3 * width), (x + lenght) - (0.4 * lenght), y);
    GLCDLine line5((x + lenght) - (0.4 * lenght), y + 1.3 * width, x + lenght , y + .5 * width);
    GLCDLine line6((x + lenght) - (0.4 * lenght), abs( y - .3 * width), x + lenght, y + .5 * width);

    GLCD.draw(line);
    GLCD.draw(line1);
    GLCD.draw(line2);
    GLCD.draw(line3);
    GLCD.draw(line4);
    GLCD.draw(line5);
    GLCD.draw(line6);
  }
  if (t == "left")
  {
    GLCDLine line(x, y, abs( (x - lenght) + (0.4 * lenght)), y);
    GLCDLine line1(x, y + width, abs( (x - lenght) + (0.4 * lenght)), y + width);
    GLCDLine line2(x, y, x, y + width);
    GLCDLine line3(abs( (x - lenght) + (0.4 * lenght)), y + width , abs( (x - lenght) + (0.4 * lenght)), y + 1.3 * width);
    GLCDLine line4(abs( (x - lenght) + (0.4 * lenght)), abs( y - .3 * width), abs( (x - lenght) + (0.4 * lenght)), y);
    GLCDLine line5(abs( (x - lenght) + (0.4 * lenght)), y + 1.3 * width, abs( x - lenght) , y + .5 * width);
    GLCDLine line6(abs( (x - lenght) + (0.4 * lenght)), abs( y - .3 * width), abs( x - lenght), y + .5 * width);

    GLCD.draw(line);
    GLCD.draw(line1);
    GLCD.draw(line2);
    GLCD.draw(line3);
    GLCD.draw(line4);
    GLCD.draw(line5);
    GLCD.draw(line6);
  }
  if (t == "down")
  {
    GLCDLine line(x, y, x, (y + lenght) - (0.4 * lenght));
    GLCDLine line1(x + width, y, x + width, (y + lenght) - (0.4 * lenght));
    GLCDLine line2(x, y, x + width, y);
    GLCDLine line3(x + width, (y + lenght) - (0.4 * lenght), x + 1.3 * width, (y + lenght) - (0.4 * lenght));
    GLCDLine line4(abs( x - .3 * width), (y + lenght) - (0.4 * lenght), x, (y + lenght) - (0.4 * lenght) );
    GLCDLine line5(x + 1.3 * width, (y + lenght) - (0.4 * lenght), x + .5 * width, y + lenght);
    GLCDLine line6(abs( x - .3 * width), (y + lenght) - (0.4 * lenght), x + .5 * width, y + lenght);

    GLCD.draw(line);
    GLCD.draw(line1);
    GLCD.draw(line2);
    GLCD.draw(line3);
    GLCD.draw(line4);
    GLCD.draw(line5);
    GLCD.draw(line6);
  }
  if (t == "up")
  {
    GLCDLine line(x, y, x, abs((y - lenght) + (0.4 * lenght)));
    GLCDLine line1( x + width, y, x + width, abs((y - lenght) + (0.4 * lenght)));
    GLCDLine line2(x, y, x + width, y);
    GLCDLine line3(x + width , abs( (y - lenght) + (0.4 * lenght)), x + 1.3 * width,  abs((y - lenght) + (0.4 * lenght)) );
    GLCDLine line4(abs( x - .3 * width), abs( (y - lenght) + (0.4 * lenght)), x, abs((y - lenght) + (0.4 * lenght)));
    GLCDLine line5(x + 1.3 * width, abs( (y - lenght) + (0.4 * lenght)), x + .5 * width, abs( y - lenght));
    GLCDLine line6(abs( x - .3 * width), abs( (y - lenght) + (0.4 * lenght)), x + .5 * width, abs( y - lenght));

    GLCD.draw(line);
    GLCD.draw(line1);
    GLCD.draw(line2);
    GLCD.draw(line3);
    GLCD.draw(line4);
    GLCD.draw(line5);
    GLCD.draw(line6);
  }
}

Custom parts and enclosures

design of board ,box and steps of assambly
after cutting wood with cutter laser (Dxf files uploaded)
fixed the edges of board and fixed the five piece of 8mm thickness on board as shown in step 2. (i used drill and screws to fixed them)
than fixed
E2Mcuz3JHaORJEKZH8ay.rar

Schematics

ZFm7fmYFymfVKF0r2Dew.jpg
Zfm7fmyfymfvkf0r2dew

Comments

Similar projects you might like

Controlling LED light intensity using smartphone light senso

Project tutorial by Nikola Travis

  • 2,021 views
  • 0 comments
  • 3 respects

Tweet from Arduino through your smartphone

Project showcase by Amr Saleh

  • 453 views
  • 0 comments
  • 2 respects

Control your RoboArm with your Smartphone

Project in progress by Zone Team

  • 9,820 views
  • 7 comments
  • 27 respects

Smartphone Controlled Atomic Weather Station

Project tutorial by Daniel Martin

  • 1,355 views
  • 0 comments
  • 2 respects

April Fool Project

Project tutorial by raef_madin

  • 1,350 views
  • 0 comments
  • 7 respects
Add projectSign up / Login