Project tutorial
PIANO

PIANO © GPL3+

Turn your smart phone into a piano.

  • 3,598 views
  • 0 comments
  • 1 respect

Components and supplies

About this project

Your smart phone is a piano. I will show you how to easily do that.

Wiring the Buttons

Bring your components mentioned above, connect the push buttons to bread board. You have 2 ways to do this: 

1- Pull up resistor 

2- Pull down resistor 

See the attached images to know the difference. Here I use the pull up resistor schematic so it will work when it gets LOW.

Setup the 1sheeld

Place your 1sheeld on the UNO board.

1sheeld turns your smart phone into more than 40 different Arduino shields  so it saves a lot of money by using sensors in your mobile and gives you the ability to make great projects and it's available at both Android Studio and Apple Store.

You can check all 1sheeld's tutorials from here. And you can buy it from here.

Arduino to Breadboard

Connect your breadboard with Arduino pins as in the schematic.

Program

Write your sketch in Arduino IDE. See the sketch from here.

Flash

Connect UNO with your laptop then upload the sketch on it. When uploading make sure that 1sheeld is in uploading mode. For more information about that see this tutorial.

The App

In your smart phone download the 1sheeld app. For the app and other downloads refer to 1sheeld here is the link. Turn on Bluetooth, connect with 1sheeld, choose Music Player shield.

Specify the piano tones in the play list. Here is a link you can download sounds from it.

See the video: 

Now play the PIANO.

Code

Arduino SketchArduino
/* 
This sketch shows an application on 1Sheeld's music player shield.
Piano =D 
you can use your android phone as a piano 
*/

#define CUSTOM_SETTINGS
#define INCLUDE_MUSIC_PLAYER_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>

/* Define some variables for piano buttons */
int pb1=13;
int pb2=12;
int pb3=11;
int pb4=10;
int pb5=9;
int pb6=8;
int pb7=7;
int pb8=6;
int Enable=1;

void setup()
{
  /* Start communication. */
  OneSheeld.begin();
  // initialize the digital pins for buttons as an output.
  pinMode(pb1,INPUT);
  pinMode(pb2,INPUT);
  pinMode(pb3,INPUT);
  pinMode(pb4,INPUT);
  pinMode(pb5,INPUT);
  pinMode(pb6,INPUT);
  pinMode(pb7,INPUT);
  pinMode(pb8,INPUT);
  pinMode(Enable,INPUT);
}

void loop()
{
    int i;
    int x;
    if(digitalRead(pb1)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=1;
    }
    else if(digitalRead(pb2)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      MusicPlayer.next();
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=2;
    }
    else if(digitalRead(pb3)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      MusicPlayer.next();
      MusicPlayer.next();
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=3;
    }
    else if(digitalRead(pb4)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      for (i=0 ; i<3 ; i++)
      {
      MusicPlayer.next();
      }
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=4;
    }
    else if(digitalRead(pb5)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      for (i=0 ; i<4 ; i++)
      {
      MusicPlayer.next();
      }
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=5;
    }
    else if(digitalRead(pb6)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      for (i=0 ; i<5 ; i++)
      {
      MusicPlayer.next();
      }
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=6;
    }
    else if(digitalRead(pb7)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      for (i=0 ; i<6 ; i++)
      {
      MusicPlayer.next();
      }
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=7;
    }
    else if(digitalRead(pb8)==LOW)
    {
      for(i=x;i>1;i--)
      {
        MusicPlayer.previous();
      }
      for (i=0 ; i<7 ; i++)
      {
      MusicPlayer.next();
      }
      MusicPlayer.play();
      MusicPlayer.setVolume(5);
      x=8;
    }
    
    
}
PIANO Sketch

Schematics

Schematic
Fritzing%20schematic

Comments

Similar projects you might like

Electronic Piano Keyboard With Preset Songs

Project tutorial by Lindsay Fox

  • 88,474 views
  • 67 comments
  • 176 respects

Unravel Preset Piano Easy Arduino (Even a Ghoul Can Make It)

Project in progress by ExeCuteLi

  • 12,620 views
  • 8 comments
  • 26 respects

Arduino Tutorial : Mini Piano

Project tutorial by the lonely programmer

  • 16,964 views
  • 2 comments
  • 27 respects

DIY piano using scratch and evive

Project tutorial by evive: an opensource embedded platoform

  • 3,450 views
  • 2 comments
  • 9 respects

Arduino Piano

Project in progress by Teo Zhi Yi

  • 3,362 views
  • 0 comments
  • 7 respects

Arduino + LEDs + MIDI Keyboard + MuseScore = Piano Tutor

Project tutorial by tcucinotta

  • 10,154 views
  • 3 comments
  • 19 respects
Add projectSign up / Login