Project showcase
Mechanical Musical Arm

Mechanical Musical Arm © GPL3+

A musical arm used to play 7 'sur' using only three fingers!

  • 724 views
  • 0 comments
  • 1 respect

Components and supplies

Necessary tools and machines

A4kb1xynkid5ebvjyil7
Digilent Screwdriver
9V DC Battery Connector

Apps and online services

About this project

Our project focuses on an arm which can do different things with the use of only 3 fingers. These 3 fingers can control up to 8 functions (7 different functions + 1 to turn it off), by making different combinations.

In the presented model we have taken an example of a music instrument. As we know there are basically 7 sur, so we have assigned a combination to a tone of music. When the user wears and initiates that combination, the frequency assigned to each sur is played. Also when connected with RTC (Real time clock) and SD card module which can store the tune if you like a tone you made and want to know it’s characteristics.

Code

MASTER_CODEArduino
To control Master Arduino!
#include<Wire.h>



const int ProxSensor1=8;
const int ProxSensor2=9;
const int ProxSensor3=10;

int buzz=11;
int i;
int pin[8]={0,1,2,3,4,5,6,7};



 
void setup() {  

   Wire.begin();              
  
  pinMode(buzz, OUTPUT);   
  
for(i=0;i<8;i++)
{ pinMode(pin[i],OUTPUT);
  }
  
 
  pinMode(ProxSensor1,INPUT);
  pinMode(ProxSensor2,INPUT);
  pinMode(ProxSensor3,INPUT);
  Serial.begin(9600);
}

void loop() {

Wire.beginTransmission(12);
  
  if((digitalRead(ProxSensor1)==HIGH) && (digitalRead(ProxSensor2)==LOW) && (digitalRead(ProxSensor3)==LOW)) {     
  tone(buzz,240,50);
  pin[0]=HIGH;
  pin[7]=LOW;
    Serial.println("saa");
    Wire.write(1);
   
  }



  


  
  else if((digitalRead(ProxSensor1)==LOW) && (digitalRead(ProxSensor2)==HIGH) && (digitalRead(ProxSensor3)==LOW))
  {
    tone(buzz,270,50);
    pin[1]=HIGH;
  pin[7]=LOW;
    
    Serial.println("re"); //set the  YELLOW LED on
    Wire.write(2);
  }



  
   else if((digitalRead(ProxSensor1)==LOW) && (digitalRead(ProxSensor2)==LOW) && (digitalRead(ProxSensor3)==HIGH))      
  {
    tone(buzz,300,50);
    pin[2]=HIGH;
  pin[7]=LOW;
     
    Serial.println("Ga");
    Wire.write(3);
  }

  
  else if((digitalRead(ProxSensor1)==HIGH) && (digitalRead(ProxSensor2)==HIGH) && (digitalRead(ProxSensor3)==LOW))
  {
    tone(buzz,320,50);
    pin[3]=HIGH;
  pin[7]=LOW;
    Serial.println("MA");
    Wire.write(4);
  }
  
  

    else if((digitalRead(ProxSensor1)==HIGH) && (digitalRead(ProxSensor2)==LOW) && (digitalRead(ProxSensor3)==HIGH))
  {
    tone(buzz,360,50);
    pin[4]=HIGH;
  pin[7]=LOW;
    Serial.println("PA");
    Wire.write(5);
  }



  else if((digitalRead(ProxSensor1)==LOW) && (digitalRead(ProxSensor2)==HIGH) && (digitalRead(ProxSensor3)==HIGH))
  {
    tone(buzz,400,50);
    pin[5]=HIGH;
  pin[7]=LOW;
    Serial.println("DHA");
    Wire.write(6);
  }

 else if((digitalRead(ProxSensor1)==HIGH) && (digitalRead(ProxSensor2)==HIGH) && (digitalRead(ProxSensor3)==HIGH))
  {
    tone(buzz,450,50);
    pin[6]=HIGH;
  pin[7]=LOW;
    Serial.println("NI");
    Wire.write(7);
  }
  
else{
  for(int i=0;i<8;i++)
  { pin[i]=LOW;
  }
 pin[7]=HIGH;
} 

}
SLAVE_CODEArduino
To control Slave Arduino!
/* SD card datalogger

 This example shows how to log data from TEMPRATURE AND HUMIDITY SENSOR,
 to an SD card using the SD library.

 The circuit:
 * analog sensors on analog ins 0, 1, and 2
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 10 (for MKRZero SD: SDCARD_SS_PIN)

by PIYUSH KUMAR SINGH
 

 */

#include <SPI.h>
#include <SD.h>

#include "Wire.h"
#define DS3231_I2C_ADDRESS 0x68

// Convert normal decimal numbers to binary coded decimal

int x;

byte decToBcd(byte val)
{
  return( (val/10*16) + (val%10) );
}
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return( (val/16*10) + (val%16) );
}








const int chipSelect = 10;




void setup() {
   
  Serial.begin(9600);
  Wire.begin(12); 

  Wire.onReceive(receiveEvent);
 
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.print("Initializing SD card...");
  

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
}


void setDS3231time(byte second, byte minute, byte hour, byte dayOfWeek, byte
dayOfMonth, byte month, byte year)
{
  // sets time and date data to DS3231
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set next input to start at the seconds register
  Wire.write(decToBcd(second)); // set seconds
  Wire.write(decToBcd(minute)); // set minutes
  Wire.write(decToBcd(hour)); // set hours
  Wire.write(decToBcd(dayOfWeek)); // set day of week (1=Sunday, 7=Saturday)
  Wire.write(decToBcd(dayOfMonth)); // set date (1 to 31)
  Wire.write(decToBcd(month)); // set month
  Wire.write(decToBcd(year)); // set year (0 to 99)
  Wire.endTransmission();
}






void readDS3231time(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
  Wire.beginTransmission(DS3231_I2C_ADDRESS);
  Wire.write(0); // set DS3231 register pointer to 00h
  Wire.endTransmission();
  Wire.requestFrom(DS3231_I2C_ADDRESS, 7);
  // request seven bytes of data from DS3231 starting from register 00h
  *second = bcdToDec(Wire.read() & 0x7f);
  *minute = bcdToDec(Wire.read());
  *hour = bcdToDec(Wire.read() & 0x3f);
  *dayOfWeek = bcdToDec(Wire.read());
  *dayOfMonth = bcdToDec(Wire.read());
  *month = bcdToDec(Wire.read());
  *year = bcdToDec(Wire.read());
}












void writeTime()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  // retrieve data from DS3231
  readDS3231time(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month,
  &year);

  String TIMEString="";
  File TIMEFile = SD.open("IR.txt", FILE_WRITE);
  

TIMEString += "TIME:   ";
TIMEString += String(hour, DEC);
TIMEString += ":";


if (minute<10)
  {
    TIMEString += "0";
    
  }

  TIMEString += String(minute, DEC);
 
 TIMEString += ":";


 if (second<10)
  {
    TIMEString += "0";
  }
  TIMEString += String(second, DEC);


TIMEString += "  ";

TIMEString += String(dayOfMonth, DEC);
TIMEString += "/";
TIMEString += String(month, DEC); 
 TIMEString += "/";
 TIMEString += String(year, DEC); 
  
  TIMEString +=" Day of week: ";




  switch(dayOfWeek){
  case 1:
    TIMEString +="Sunday";
    break;
  case 2:
    TIMEString +="Monday";
    break;
  case 3:
    TIMEString +="Tuesday";
    break;
  case 4:
    TIMEString +="Wednesday";
    break;
  case 5:
    TIMEString +="Thursday";
    break;
  case 6:
    TIMEString +="Friday";
    break;
  case 7:
    TIMEString +="Saturday";
    break;
  }

// if the file is available, write to it:
  if (TIMEFile) {
    TIMEFile.println(TIMEString);
    TIMEFile.close();
    // print to the serial port too:
    Serial.println(TIMEString);
  }
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening IR.txt");
  }
}

void receiveEvent(int bytes) {
  x = Wire.read();    // read one character from the I2C
}





void loop() {
 String TIME = "";
 
 switch(x)
 { 
  case 1: { writeTime();
            TIME += "SAA";
            break;
                 }

  case 2: { writeTime();
            TIME += "RE";
            break;
                 }

 case 3: { writeTime();
            TIME += "GAA";
            break;
                 }

 case 4: { writeTime();
            TIME += "MAA";
            break;
                 }                

 case 5: { writeTime();
            TIME += "PAA";
                 }   
 case 6: { writeTime();
            TIME += "DHA";
            break;
                 }  

  case 7: { writeTime();
            TIME += "NI";
            break;
                 } 

default :  { writeTime();
            TIME += "empty";
            break;
                 } 


 }


 File mainFile = SD.open("song.txt", FILE_WRITE);
  

  // if the file is available, write to it:
  if (mainFile) {
    mainFile.println(TIME);
    mainFile.close();
    // print to the serial port too:
    Serial.println(TIME);
  }
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening IR.txt");
  }

                 
}

Schematics

Master_Slave_Connection
To connect two Arduinos.
Ms rdz7qfxrol 8hylsahagf

Comments

Similar projects you might like

Robotic Arm Controlled by Human Arm

Project showcase by zezarandrade

  • 4,816 views
  • 0 comments
  • 11 respects

Simple Programmable Robotic Arm

Project showcase by Ryan Chan

  • 49,020 views
  • 63 comments
  • 145 respects

3D-Printed EEG-Controlled Prosthetic Arm

Project showcase by Ayush Kapur

  • 6,735 views
  • 1 comment
  • 48 respects

Musical Fairy Lights

Project tutorial by Ian Cumming

  • 4,914 views
  • 0 comments
  • 11 respects

Arduino Musical Tesla Coil

Project in progress by Brandon Michelsen

  • 4,429 views
  • 3 comments
  • 9 respects
Add projectSign up / Login