Testing 3D Printed Gripper

We are trying out a few different 3d printed gripper designs.

For this one, each finger has a gear printed at the joint so that when 1 moves the other does also. This can be tougher to print but it is a nice mechanism.

The print went bad about 3/4 of the way through, but we were able to get a proof-of-concept test finished.

We are also making a rigid gripper that can hold a Sharpie, and one that is just a small hook.


The servo-actuated finger of the 3D printed gripper



GUI Demo: Real Time Video of Python Gui

This is a demonstration of using the python GUI implemented in Tkinter to control the servos of the 3D printed robot arm.



Python Gui V2: Real Time Control of the Arm

The code below gives real time control of the arm using scale bars in a python gui. There is a slight lag in control due to the speed of the USB connection but it has proven to reliable.

Arduino Code

#include <Servo.h>  //arduino library
#include <math.h>   //standard c library

#define PI 3.141

Servo baseServo;
Servo shoulderServo;
Servo elbowServo;
Servo gripperServo;

int command;

struct jointAngle{
  int base;
  int shoulder;
  int elbow;

Python + Arduino: GUI Control through Serial

I have created a basic gui program that allows me to move the arm to particular positions by controlling the angle of the servos. Scale bars created in python using Tkinter define the angle of the servo. Those angles are then sent to the arduino which uses the servo control function created earlier in the project to move the servos to the new desired position. For the moment the "move arm" button must be pressed to send a new value. It is very simple to have the arm follow the trackbar position live and that will come next, but for the moment this piecemeal layout makes the operations clearer.

Python Gui created in Tkinter




Below is the arduino code. 

#include <Servo.h>  //arduino library
#include <math.h>   //standard c library

#define PI 3.141

Servo baseServo;
Servo shoulderServo;
Servo wristServo;

int command;

struct jointAngle{
  int base;
  int shoulder;
  int elbow;
};

struct jointAngle desiredAngle; //desired angles of the servos

//+++++++++++++++FUNCTION DECLARATIONS+++++++++++++++++++++++++++

void servoControl (int thePos, int theSpeed, Servo theServo);

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Arduino Code: Kinematic Function for Servo Arm

Here is the arduino function that determines the location of the tip of the robot arm in 3D cartesian space using kinematics.

Note: While this function was designed to be used with the 3D printed microservo arm being built in this project. You may change the physical parameters of the arm to match those of any servo arm and the code will work perfectly.

The code below has the structure definition needed to setup the function and then the function itself. Soon an example program will be posted with this function implemented.


struct xyzPos{                //a struct to hold multple returned arguments for the 3D position
  float x;
  float y;
  float z;
};

struct xyzPos currentPos;     //current location of tip of arm
struct xyzPos desiredPos;     //desired location of tip of arm

//+++++++++++++++FUNCTION DECLARATIONS+++++++++++++++++++++++++++

void servoControl (int thePos, int theSpeed, Servo theServo);
struct xyzPos kinematics(float baseAng, float shoulderAng, float wristAng);

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

IN THIS AREA IS WHERE THE OTHER ARDUINO LOOP CODE WOULD BE
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


struct xyzPos kinematics(float baseAng, float shoulderAng, float wristAng){
  
    // this function takes the servo angles as input and computes the locaiton of the tip of the arm in 3D space
    Serial.println("in kinematics");
    
    struct xyzPos POS;

    // the physical parameters of the arm.
    float baseHeight   = 3;
    float upperArm     = 5;
    float foreArm      = 0;       // left at 0 since current arm does not have wriist
    double gripper     = .5;

    //convert servo angles to radians for trig functions
    baseAng = (baseAng * PI /180);
    shoulderAng = (shoulderAng * PI /180);
    wristAng = (wristAng * PI /180);

    // kinematic equations of the robot arm. These equations describe where it is based on the angle of the arm. 
    POS.x = (upperArm*cos(baseAng)*cos(shoulderAng))   +    (cos(baseAng)*(foreArm*cos(shoulderAng+wristAng))   );
    POS.y = baseHeight + (upperArm*sin(shoulderAng)) + (foreArm*sin(shoulderAng+wristAng)) ;
    POS.z = (upperArm *(-sin(baseAng))*(cos(shoulderAng))) - (sin(baseAng) * (      (foreArm*cos(shoulderAng+wristAng))          ));

    //Prints used for error checking if necessary
    /* 
    Serial.print("xpos = ");
    Serial.println(POS.x);
    Serial.print("ypos = ");
    Serial.println(POS.y);
    Serial.print("zpos = ");
    Serial.println(POS.z); */
    
    Serial.println ("done with function");
    
    return POS; //return the #D position of the arm
  
}

If you would like to learn more about using structures in c here are some explanations.

Arduino Code: Basic Servo Control Function

Here is a first iteration of a function that can be used to control the position of a servo. The user may user the arduino serial interface or some other serial program to send a position to the arduino and have the servo move to that position.

The code is below

#include <Servo.h> 

Servo baseServo;  
Servo shoulderServo;  
Servo wristServo; 

int command;
int pos = 0;    // variable to store the servo position 

//+++++++++++++++FUNCTION DECLARATIONS++++++++++++++++++++++

void servoControl (int thePos, int theSpeed, Servo theServo);

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

void setup() 

  Serial.begin(9600);
  baseServo.attach(9);  // attaches the servo on pin 9 to the servo object 
  shoulderServo.attach(10);
  wristServo.attach(11);
  Serial.setTimeout(50);


void loop() 

  if (Serial.available()){
    command = Serial.parseInt();  
    Serial.println(command); 
    servoControl(command, 15, baseServo);
    servoControl(command, 15, shoulderServo);
    servoControl(command, 15, wristServo);    

  }
}

//++++++++++++FUNCTION DEFINITIONS+++++++++++++++++++++++
void servoControl (int thePos, int theSpeed, Servo theServo){
  Serial.println("in function");
  //read the current pos
  int startPos = theServo.read();
  int newPos = startPos;
  
  //define where the pos is with respect to the command
  // if the current position is less that the actual move up
  if (startPos < thePos){
        while (newPos < (thePos - 5)){
          newPos = newPos + 5;
          theServo.write(newPos);
          delay(theSpeed);
        }    
  }

  else{
       while (newPos > (thePos + 5)){
         newPos = newPos - 5;
         theServo.write(newPos);
         delay(theSpeed);
       }     
  }
}

Design Specs: Goals of the Arm

This is the list of goals and design specifications that will be met in the 3D printed arm part of this project. There will be two phases on the mechanical design. A very simple low cost arm and a more capable but expensive arm

Low Cost Arm
  1. Aside from screws all structural components must be 3-D printed (using makerbot)
  2. Excluding the microcontroller, component cost must be <$25
  3. Arm must lift 1.5 oz at maximum extension
  4. May only use a single type of servo
  5. Controlled from keyboard (no more than 6 keys)
  6. <5 3D printed parts
Higher Cost Arm
  1. Modular gripper that can hold writing utensil
  2. Excluding the microcontroller, component cost must be <$40
  3. May only use a single type of servo
  4. Controlled by mouse
  5. <8 3D printed parts
Future Expansions
  1. Trainer Pendant Arm
  2. Sense and Follow
  3. Implement with webcam to collect objects and draw picture
  4. More grippers

Arm Demo: Prototype Videos

An initial prototype for the arm was completed recently. Here are a couple of videos.

Operated from Keyboard


Servo Sequence