Piano Tiles Playing Robot Arm

Intro: Piano Tiles Playing Robot Arm

The group is made up of 2 Automation Engineers from UCN, who came up with a brilliant idea that we are motivated to do and develop. The idea is based on an Arduino board controlling a robotic arm. The Arduino board is the brains of the operation and then the actuator of the operation, the Robotic arm, will do what it needs to. The more in depth explanation will come later on.

Step 1: Equipment

Robot arm:

Phantomx Pincher Robot Arm Kit Maek II ( http://learn.trossenrobotics.com/38-interbotix-ro... )

Software for the robot- https://www.arduino.cc/en/Main/OldSoftwareRelease... Color detection camera:

CMUcam5 Pixy camera - (http://charmedlabs.com/default/pixy-cmucam5/)

Software - PixyMon (http://cmucam.org/projects/cmucam5/wiki/Install_PixyMon_on_Windows_Vista_7_8)

Step 2: Arduino Setup

You can see the setup on the board here, which is very easy.

On the left is the Power Supply.

The middle one is for the first servo, which is later on connected to the other servos, servo by servo.

The bottom one is where we control the board from a PC or Laptop, that has a USB input on the other end.

Step 3: Final Program

||| PROGRAM |||

#include

#include #include "poses.h" #include //Pixy Library #include

#define POSECOUNT 5

BioloidController bioloid = BioloidController(1000000);

const int SERVOCOUNT = 5; int id; int pos; boolean IDCheck; boolean RunCheck;

void setup(){ pinMode(0,OUTPUT); ax12SetRegister2(1,32,50);//set joint number 1 register 32 to speed 50. ax12SetRegister2(2,32,50);//set joint number 2 register 32 to speed 50. ax12SetRegister2(3,32,50);//set joint number 3 register 32 to speed 50. ax12SetRegister2(4,32,50);//set joint number 4 register 32 to speed 50. ax12SetRegister2(5,32,100);//set joint number 5 register 32 to speed 100. //initialize variables id = 1; pos = 0; IDCheck = 1; RunCheck = 0; //open serial port Serial.begin(9600); delay (500); Serial.println("###########################"); Serial.println("Serial Communication Established.");

//Check Lipo Battery Voltage CheckVoltage();

//Scan Servos, return position MoveTest(); MoveHome(); MenuOptions(); RunCheck = 1; }

void loop(){ // read the sensor: int inByte = Serial.read();

switch (inByte) {

case '1': MovePose1(); break;

case '2': MovePose2(); break; case '3': MovePose3(); break;

case '4': MovePose4(); break;

case '5': MoveHome(); break; case '6': Grab(); break;

case '7': LEDTest(); break;

case '8': RelaxServos(); break; } }

void CheckVoltage(){ // wait, then check the voltage (LiPO safety) float voltage = (ax12GetRegister (1, AX_PRESENT_VOLTAGE, 1)) / 10.0; Serial.println("###########################"); Serial.print ("System Voltage: "); Serial.print (voltage); Serial.println (" volts."); if (voltage < 10.0){ Serial.println("Voltage levels below 10v, please charge battery."); while(1); } if (voltage > 10.0){ Serial.println("Voltage levels nominal."); } if (RunCheck == 1){ MenuOptions(); } Serial.println("###########################"); }

void MoveHome(){ delay(100); // recommended pause bioloid.loadPose(Home); // load the pose from FLASH, into the nextPose buffer bioloid.readPose(); // read in current servo positions to the curPose buffer Serial.println("###########################"); Serial.println("Moving servos to Home position"); Serial.println("###########################"); delay(1000); bioloid.interpolateSetup(1000); // setup for interpolation from current->next over 1/2 a second while(bioloid.interpolating > 0){ // do this while we have not reached our new pose bioloid.interpolateStep(); // move servos, if necessary. delay(3); } if (RunCheck == 1){ MenuOptions(); } }

void MovePose1(){ delay(100); // recommended pause bioloid.loadPose(Pose1); // load the pose from FLASH, into the nextPose buffer bioloid.readPose(); // read in current servo positions to the curPose buffer Serial.println("###########################"); Serial.println("Moving servos to 1st position"); Serial.println("###########################"); delay(1000); bioloid.interpolateSetup(1000); // setup for interpolation from current->next over 1/2 a second while(bioloid.interpolating > 0){ // do this while we have not reached our new pose bioloid.interpolateStep(); // move servos, if necessary. delay(3); } SetPosition(3,291); //set the position of joint 3 to '0' delay(100);//wait for joint to move if (RunCheck == 1){ MenuOptions(); } }

void MovePose2(){ delay(100); // recommended pause bioloid.loadPose(Pose2); // load the pose from FLASH, into the nextPose buffer bioloid.readPose(); // read in current servo positions to the curPose buffer Serial.println("###########################"); Serial.println("Moving servos to 2nd position"); Serial.println("###########################"); delay(1000); bioloid.interpolateSetup(1000); // setup for interpolation from current->next over 1/2 a second while(bioloid.interpolating > 0){ // do this while we have not reached our new pose bioloid.interpolateStep(); // move servos, if necessary. delay(3); } SetPosition(3,291); //set the position of joint 3 to '0' delay(100);//wait for joint to move if (RunCheck == 1){ MenuOptions(); } } void MovePose3(){ delay(100); // recommended pause bioloid.loadPose(Pose3); // load the pose from FLASH, into the nextPose buffer bioloid.readPose(); // read in current servo positions to the curPose buffer Serial.println("###########################"); Serial.println("Moving servos to 3rd position"); Serial.println("###########################"); delay(1000); bioloid.interpolateSetup(1000); // setup for interpolation from current->next over 1/2 a second while(bioloid.interpolating > 0){ // do this while we have not reached our new pose bioloid.interpolateStep(); // move servos, if necessary. delay(3); } SetPosition(3,291); //set the position of joint 3 to '0' delay(100);//wait for joint to move if (RunCheck == 1){ MenuOptions(); } }

void MovePose4(){ delay(100); // recommended pause bioloid.loadPose(Pose4); // load the pose from FLASH, into the nextPose buffer bioloid.readPose(); // read in current servo positions to the curPose buffer Serial.println("###########################"); Serial.println("Moving servos to 4th position"); Serial.println("###########################"); delay(1000); bioloid.interpolateSetup(1000); // setup for interpolation from current->next over 1/2 a second while(bioloid.interpolating > 0){ // do this while we have not reached our new pose bioloid.interpolateStep(); // move servos, if necessary. delay(3); } SetPosition(3,291); //set the position of joint 3 to '0' delay(100);//wait for joint to move if (RunCheck == 1){ MenuOptions(); } }

void MoveTest(){ Serial.println("###########################"); Serial.println("Initializing Movement Sign Test"); Serial.println("###########################"); delay(500); id = 1; pos = 512; while(id <= SERVOCOUNT){ Serial.print("Moving Servo ID: "); Serial.println(id);

while(pos >= 312){ SetPosition(id, pos); pos = pos--; delay(10); }

while(pos <= 512){ SetPosition(id, pos); pos = pos++; delay(10); }

//iterate to next servo ID id = id++;

} if (RunCheck == 1){ MenuOptions(); } }

void MenuOptions(){ Serial.println("###########################"); Serial.println("Please enter option 1-5 to run individual tests again."); Serial.println("1) 1st Position"); Serial.println("2) 2nd Position"); Serial.println("3) 3rd Position"); Serial.println("4) 4th Position"); Serial.println("5) Home Position"); Serial.println("6) Check System Voltage"); Serial.println("7) Perform LED Test"); Serial.println("8) Relax Servos"); Serial.println("###########################"); }

void RelaxServos(){ id = 1; Serial.println("###########################"); Serial.println("Relaxing Servos."); Serial.println("###########################"); while(id <= SERVOCOUNT){ Relax(id); id = (id++)%SERVOCOUNT; delay(50); } if (RunCheck == 1){ MenuOptions(); } }

void LEDTest(){ id = 1; Serial.println("###########################"); Serial.println("Running LED Test"); Serial.println("###########################"); while(id <= SERVOCOUNT){ ax12SetRegister(id, 25, 1); Serial.print("LED ON - Servo ID: "); Serial.println(id); delay(3000); ax12SetRegister(id, 25, 0); Serial.print("LED OFF - Servo ID: "); Serial.println(id); delay(3000); id = id++; } if (RunCheck == 1){ MenuOptions(); } }

void Grab(){ SetPosition(5,800); //set the position of joint 1 to '0' delay(100);//wait for joint to move

}

We have based our program on the manufacturers PincherTest program with some major tweaks in the case of positioning. We used the poses.h for the robot to have the positions in the memory. Firstly we tried to create our playing arm with Pixycam to be automatic, but due to light and small screen problems, that could not happen. The robot has a basic home position, after uploading the program, it will test all the servos found in the robot. We have set the poses for the 1-4 buttons, so it will be easy to remember. Feel free to use the program.

Step 4: Video Guide

Step 5: Conclusion

In conclusion, the robot is a fun little project for us and a fun thiing to play around and experiment with. I encourage you to try it and customize it as well.

Share

    Recommendations

    • Tiny Home Contest

      Tiny Home Contest
    • Fix It! Contest

      Fix It! Contest
    • Audio Contest 2018

      Audio Contest 2018

    Discussions