Introduction: Homemade Robotic Arm Using Standard Parts Using Arduino and a Processing GUI

I recently retired and one of things I promised myself was that when I did retire I was going to complete all those projects I had running around inside my head since I was a teenager. That's about 50 years or so of projects. In those days there were no microprocessors and you needed your own machine shop to make the mechanical parts.

One of the projects was building a robot arm from the ground up. Kits are nice, but its all done for you and you never quite learn all the in's and out's of the project. Besides, I always wind up tinkering with them anyway to make them work the way I what them to work.

Among those things that I learned and was needed for the project was to overcome the mechanical challenges of designing and building the arm, forward and inverse kinematics to control the positioning of the arm, and developing the software to control the arm. Thankfully, there is a lot of information out there on the web to help with all these topics.

In this Instructable I want to show you what I came up with using pretty much all off the shelf parts from ServoCity (great source of supply) as well as sharing the information I used for this build to help you in your own projects. Unfortunately, I did not think of doing an Instructable until after the arm was completed so the only thing missing will be the length of the screws used in the build.

P.S. This is my first attempt at an Instructable so be kind.

Special Thanks

I want to thank the following tinkers and builders for their efforts that aided me developing the software for this project:

Travis Wolf for his blog on Inverse Kinematics, Operational space control of 6DOF robot arm with spiking cameras part 2: Deriving the Jacobian and for taking time to answer several questions.

Quark for his excellent G4P library for Processing 3.0 and for resolving several challenges at the Processing Forum as well as GoToLoop.

bboner's Robotic Arm with Arduino driver controlled by Leap Motion at letmakerobots for the the base code and ideas for the Processing GUI and Arduino sketch.

Step 1: Do Your Homework

Yes folks, it's still all about doing your homework before you start one of these projects. For me I started with the basics and a good summary on robot arms is the Robot Arm Tutorial at the Society of Robotics web site. To quote the author:

"The robot arm is probably the most mathematically complex robot you could ever build."

Believe me I found this out when I had to develop the equations for forward and inverse kinematics - but with that said I did find a few easy ways to get this done as will let you know as we go along. I will also you all the additional resources/references at the end of this tutorial that I used.

Step 2: Gather Your Parts

ServoCity:

    • (2) SPG785A1-5 Servo Gearbox(7:1 gear ratio for the shoulder, and 3.8:1 for the elbow)
    • (1) SPG785A-BM Bottom Mount, HS-785HB (3.8:1 ratio) - Unassembled
    • (1) 1" Hollow Aluminum Tubing - 3”, 635104
    • (1) 1" Hollow Aluminum Tubing - 5”, 635108
    • (2) 1"90° Bore Tube Clamp (545464)
    • (1) Hub Spacers, 1” (1.00) - 545386
    • (1) 1" Bore Clamping Hub A (545352)
    • (1) 1" Bore Tube Clamp D (545620)
    • (1) 1" Bore Clamping Hub A (545352) – Better off using 1" Bore Clamping Hub B (545354)
    • (1) 1.50" x 0.770" Hub Adaptor
    • (1) 90° Quad Hub Mount F (545448)
    • (1) 90° Hub Mount Bracket A (585494)
    • (2) 1/4-20 RoundScrew Plate (545468)
    • (2) Flat Dual Channel Bracket (585422)
    • (2) Standard Hitec ServoBlocks
    • (4) Beam Attachment Blocks (585403)
    • Hitec HS-422 Servo
    • Hitec HS-5645MG digital servo, programmed to 180 Deg
    • 6-32 Truss Head Phillip Machine Screws - 1/2 in , 1/4 in, 5/16 in, 3/16 in (about 20 each),
    • 4-40 Truss Head Phillip Machine Screws - 1/4 in (8)
    • Socket Head Machine Cap Screw hex about 10 each of 1/2 and 1/4 in

    Pololu.com

    • Mini Maestro 18-channel USB Servo Controller
    • Premium Jumper Wire 10-Pack M-F 6" Red
    • Premium Jumper Wire 10-Pack M-F 6" Black
    • Premium Jumper Wire 50-Piece Rainbow Assortment M-F 6"
    • Premium Jumper Wire 50-Piece Rainbow Assortment M-M 6"
    • 4 standoffs 4-40 male female - 1 in
    • 4 standoffs 4-40 male-female - 1/4 in
    • 4 standoffs 4-40 male-female - 1/2 in

    Amazon.com

    • Neiko Steel Spring Shop Assortment - 200 Springs in 20 Sizes/Styles
    • VIMVIP 30cm Male to Female Servo Extension Lead Wire Cable for KK MWC Eagle Control Board (Pack of 10pcs)
    • Triangle Bulbs (Pack Of 10) 5 Male Jack DC Power Adapter & 5 Female Jack DC Power Adapter Connector
    • Silicone Wire - Fine Strand - 12 Gauge - 5 ft. Black, 5 ft. Red
    • Perf board

    Robotshop.com

    • 5V 1A Switching Voltage Regulator, RB-Dim-20
    • 25W Adjustable Switching Regulator, RB-Dim-28 adjusted to 8v
    • (2) Voltage Regulator Breakout Board, RB-Dim-25

    Step 3: Tools

    This is rather simple:

    • 7/64 hex wrench
    • Screwdriver - multiple head that i picked up at home depot
    • iFix Screwdriver set - you don't really need this particular kit but you will need a set of small screwdrivers for the DC plugs and the power connectors.
    • A good pair of wire cutters/strippers
    • Multimeter

    Step 4: Software for Maestro, GUI and Arduino

    Down and Install the following Software if you don't already have it on your computer

    1. Maestro Control Center
    2. Maestro Arduino Library
    3. For the GUI you will need Processing 3 .
    4. Arduino and Processing Code

    I am going to assume here that the reader knows how to install applications in their respective OS's as well as installing Arduino libraries.

    Instructions for using the Maestro Control Center is provided by Pololu, strongly suggest that read it before setting up your servos: 4. Using the Maestro Control Center.

    Step 5: Assembling the Servocity SPG785A-BM Servo Power Gearbox (Arm Base)

    The SPG785A-BM Servo comes with detailed instructions for assembly, however, we will need to make a minor change to accommodate the 1" Hub Spacer.

    What you will have to do is to assemble the Hub Gear with the smooth side up with 3/4 or 1 inch truss head 6-32 screws. First step will be to grab the tube clamp that comes with the Gearbox, the Hub Spacer and one of the screws to start with. Line up the screw holes in the spacer, tube clamp and gear tightly together and attach the three pieces the screw. If you don't hold the three parts tightly you will wind up with a gap which you don't want. It is easy enough to fix by backing off on the screw and then re-tighten again after you get a better grip. You will have to do this in three other places. This is shown in the first photo in this step.

    Once you have this assembled attach the base servo with one of the 12 in servo extension cables to channel 0 of the mini-Maestro and connect it with a mini-USB cable to the computer. Double click on the Maestro Control Center Icon and it should automatically connect to your mini-Maestro Controller. On the control panel "Status" tab enable channel 0 and center the servo at 1500 (by the way this is in micro seconds). With the servo still connected insert the gear assembly onto the hub with the alignment line pointing forward and push down in accordance with the supplied instructions. Now the fun begins.

    Move the slider on the "Status" tab up to adjust the max value of the servo so that the line moves 180 degrees. Determine what the max value at 180 degrees is on the status tab and adjust that value on the "Channel Settings" tab. If moving the slider does not move the servo 180 degrees increase the value of the max setting on the "Channel Settings" tab and click on the save button. Go back to the Status tab and continue moving the slider until the servo moves 180 degrees. Then go back to the Channel Setting tab, change the max value to what you have on the status tab and click save.

    Follow this same procedure for finding min value for 180 degrees in the opposite direction. Don't forget to click the save button. When finishing you should name the channel to "Base".

    While on the Channel Setting tab set the "On Startup Error" to 'GoTo' so that the servo defaults to 0 degrees. The settings for my servos are shown in the Channel Setting photo.

    On the "Serial Settings" tab your settings should be the same as shown in the photo above.

    Now, would be a good time to mount the Arm Base to a piece of ABS, HDPE or your material of choice that is about 8" W by 15" L and about 1/8" thick. Use the holes in the Arm Base as your guide and mark the base plate appropriately. I used a piece of ABS and drilled four holes with a ?? drill and used 1/4" long 6-32 screws.

    Step 6: Assembling the SPG785A1-5 Servo Gearbox (Shoulder Assembly)

    For this step you will need the SPG785A1-5 Servo Gearbox (7:1), the 90 degree 1" bore tube clamp and a 12 in servo extension cable..

    First attach the Gearbox servo to channel 1 of the Mini-Maestro and configure the servo settings.

    1. Connect the Mini-Maestro to the computer and open the Maestro Control Center.
    2. Enable Channel 1 on the Control Center
    3. Move the Channel 1 slider to 1500 and place a mark on the hub gear. For the elbow assembly 0 degrees points forward. See the servo orientation photo in the step.
    4. Follow the same steps for determining your min and max values at +/- 180 degrees as you did in step 5.
    5. Name the channel "Shoulder" on the Channel Settings tab.
    6. Set the acceleration to 40 - this controls the speed of the servo. NOTE: You can change this setting latter through the Arduino Mini-Maestro library prior to loading the Arduino sketch.
    7. Set "GoTo" to a setting that is about +135 degrees (line should be about 45 from vertical pointing up.

    Next move the servo to center (neutral) or 0 degrees, approximately 1500 on the Control Center and attach the 1" bore tube clamp so that it is aligned with 0 degrees and tighten the hex screw with the 7/64 in. hex wrench.

    Step 7: Attach the Shoulder Assy to the Base Assy

    This part can be a little trick. Take two 1/4" pan head screws and fit in the bottom holes of the Shoulder gearbox at 0 deg and 180 deg. If the 1/4" long screws use a shorter screw. Align the holes with the 0/180 deg holes on the 1" hub space on the Base gearbox. Tighten the screws with a philips head screwdriver. I used the iFIx screwdriver for this - fit nicely in tight quarters. You will have to angle the screwdriver to make this work. NOTE: If I had to do this over i would have got the unassembled version.

    Step 8: Assembly the SPG785A1-5 Servo Gearbox (Elbow Assembly)

    This step follows the exact same procedure as the Shoulder Assembly (Gearbox) as in Step 5 with the exception that the servo is connected to channel 3 of the Mini-Maestro, the name on the "Channel Settings" tab should be "Elbow", Speed should be set at 10 and "GoTo" should be at about -135 degrees. Don't forget to attach the 1" 90° Bore Tube Clamp (545464) and tighten the socket screw.

    Step 9: Attaching the Elbow to the Shoulder

    For this step you will need the following:

    • 1" Hollow Aluminum Tubing - 3”, 635104
    • 1" Bore Clamping Hub B (545354). This is the thru hole version of Clamping Hub A
    • 90° Quad Hub Mount F (545448)
    • 1.50" x 0.770" Hub Adapter
    • (4) 6-32Single Screw Plate
    • (8) 6-32 socket head screws - 1/2" long
    • (4) 6-32 truss head screws - 3/8" long
    • (2) 9/32" x 2-13/16" Extension Springs

    First step in the assembling the sub-assembly is to mate the Hub Adapter with the 1" Bore Clamping Hub A. Align the holes of the Adapter and Clamping Hub. Take the 1/2" socket head screws (4) and screw the two parts together with 7/64" hex wrench.

    Next step is a little tricky as you will not be able to tighten nut on the truss head screw directly. First take one of the 3/8" truss head screws and slide it through the thru hole in the upper left corner of the Quad Hub Mount as shown in the figure. Slide the Hub Adapter onto the screw and align the clamping hub as show in the sub-assembly figure. Once you have done this back off on the screw until it is flush with Hub Adapter and place the screw plate over the screw - now tighten the screw.

    Now take the tubing and place it in the Clamping Hub and tighten down on the socket head screw to lock the tubing in place. Make sure it is as tight as you can get it.

    Next take the sub-assembly and insert it into the bottom of the servo gearbox. Lock the sub-assembly in place with the (4) remaining socket head screws.

    Next take the two extensions springs and link them together. Take one end of a spring and slip it between the tabs of the 90 degree bore clamp. Slide the tightening screw through the holes and loosely tighten the socket head screw prior to attaching the elbow assembly. See the attached photo.

    Final step is to mate the elbow with the shoulder. Take the elbow assembly and slide the tube into the 90 deg Clamping Hub of the Shoulder Assembly. The distance between the Shoulder Clamping Hub and Elbow Clamping Hub is approximately 1.25" Tighten down on the socket head screw in the clamp.Double check the distance between the centers so that is as shown in the figure.

    Be careful when you let it go as at this point the arm is not balanced so once you let it go it will drop like a rock.

    Step 10: Assembling the Forearm

    For this step you will need the following:

    • (12) 1/2" 6-32 truss head screws
    • (1) 1" Hollow Aluminum Tubing - 5" length
    • (1) 1" 90 deg Hub Bracket A
    • (1) 1" Bore Clamping Hub A
    • (2) Flat Dual Channel Bracket
    • (2) 1/4-20 Round Screw Plate (545658)

    Assembly is pretty straight forward for this assembly:

    1. First mount the 1" bore clamping hub A and using the (4) 1/2" 6-32 screws attach it to one side of the flat dual channel bracket oriented as shown in the figure.
    2. Next take 90 degree hub bracket A and mount it on the dual channel bracket with one of the screw plates with (4) 1/2" truss head screws. Make sure you use the shorter side of the bracket when attaching the dual channel bracket.
    3. Take second flat dual channel bracket and mount it to the 90 degree bracket with the second screw plate and (4) 1/2" 6-32 truss head screws.
    4. Last step is to slide the aluminum tube into the clamping hub and tighten the socket head screw.

    Step 11: Attach the Forearm to the Elbow

    Additional parts needed for this step:

    • 1" Bore Tube Clamp D (545620)

    Slide the forearm assembly into the elbow right angle bracket. The distance between the center line of the elbow joint and the right angle bracket should be 3.75". Once you have the correct distance tighten the tube clamp screw so the forearm does not move. Make sure that the bracket is level.

    Take the Bore Tube Clamp D and attach the end of the spring as shown in picture. Loosely tighten the screw. Slip the clamp onto the end of the forearm aluminum tube and tighten the screw on the clamp.

    Step 12: Assembling the Wrist and Gripper

    Parts you will need for this step:

    • (2) HiTec Standard ServoBlocks
    • (1) HiTec HS-5645MG Servo (order pre-programmed to 180 degrees rotation)
    • (1) HiTec HS-422 Servo (180 degree rotation)
    • (2) 3/4" 6-32 Socket Head Screws
    • (2) 3/8" 6-32 Socket Head Screws
    • (1) Standard Gripper Kit A (637094)
    • (4) Beam Blocks B (585600)

    Servoblock assembly instructions are provided by ServoCity as a YouTube video, however, a better set of instructions can be found on YouTube: First Look at ServoBlocks (from servocity.com).

    1. Pitch Assembly: Follow the instructions for assembling the Servoblock using the Hitec HS-5645MG servo, however, I would recommend that prior to attaching the Servo Spline Shaft Hub that you attach the servo to the Mini-Maestro. Determine neutral, min/max settings and set your GoTo position. For the pitch servo attach it to Channel 3 of the Mini-Maestro and name it Wrist_Pitch. I have mine pointing down (-90 degrees). Return the servo to the neutral position and then attach the Spline Shaft to the servo. Make sure you orient one of the holes in the shaft towards the neutral position as shown in the figure and as you can see in the photo.
    2. Roll Assembly: Follow the same steps for the roll servoblock except you will be using the HS-422 servo as you did for the pitch servoblock.Attach the roll servo to channel 6 and name it Wrist_Rotate.
    3. Assembling the two servoblocks to create the wrist:
      • Now that you have the roll servoblock setup remove the left hub plate of servoblock. Hold the servobloc with the spline shaft facing you and back end of the servo pointing up.
      • Take the hub plate and attach it with the (4) 1/2" 6-32 truss head screws.
      • Reattach the roll servoblock to the hub plate.
    4. Attaching the Gripper to the Roll Servoblock:
      • Follow the ServoCity YouTube Video for assembling the Gripper
      • Take two Beam Blocks B, hold them together and connect them with the 3/4" Socket Head Screw to the hole to the left of the top center spline hub
      • Repeat for the right side. Use the photo as reference.
      • Attach the gripper to the Beam Blocks with the 3/8" socket head screws.

    Step 13: Attach the Wrist Assembly to the Forearm

    Parts needed for this step:

    • (4) 1/2" 6-32 truss head screws

    Attach the pitch hub plate to the flat dual channel `channel bracket on the forearm with the (4) truss head screws. The roll servoblock should be just about over the center line of the base gearbox

    Slide the servo cables through the aluminum tubing and use the servo cable servo extensions to connect the three servos to the Mini-Maestro. You should now have a working robot arm that can be controlled through the mini-maestro.

    Next set of steps is setting up the electronics for the Arm.

    Step 14: Wiring Up the Electronics

    Parts needed for this step:

    • 6"x4.5" Perf Board
    • (4) 1" Male-Female 4-40 standoffs
    • (4) 1/4" Male-Female 4-40 standoffs
    • (4) 1/2" Male-Female 4-40 standoffs
    • (12) 1/4" 4-40 screws
    • Mini-Maestro 18 channel controller
    • Ardunio Uno
    • (2) RB-Dim-xx Breakout Boards
    • (1) RB-Dim-14 10W switching regulator set to 9v
    • (1) RB-Dim-20 5v 1A switching regulator
    • 20 Gauge Silicon wire (Black and White)
    • Male-Male jumper wires
      • (3) Black jumpers
      • (2) Red jumpers
    • (4) Male-Female jumper wires

    Perf Board:

    • Drill holes for the 4 corner 4-40 standoffs
    • Use the Arduino Uno, Breakout Borads, and mini-Maestro as your template for drilling. Layout your components on the perf board and mark with the hole pattern wher you want to place them.
    • Use the perf board as your template to mark the base plate for drilling

    Place your components:

    • Use the (4) 1/4" 4-40 standoffs and screw them into the perf board. Take (4) 4-40 screws and regulator breakout boards and attach them to the standoffs
    • Take the (4) 1/2" standoffs and mount the Arduino Uno to the perf board
    • You will need 2 small screws for the mini-Maestro. I had them in my junk box and not sure what size they were.

    Wiring the electronics:

    • Cut (2) lengths of the 20 gauge wire (red) to 5" and strip off about 1/2" at each end. Do the same for the black wires.
    • Take the two red wires and slip them into the female DC jack and tighten the screw so the wire do not move. These are the power (+) wires so attach them to the (+) side of the jack. Do the same for the blacattak wires (Ground) but attach them to the (-) side of the DC jack.
    • Now attach the other end of the black wires and attach them to the (-) side of each of the breakout boards. Do the same for the red wires. Remember to tighten the screws on the screw terminal.
    • Take a black male-male jumper and slip it into the ground pin on the Uno and slip the other end into the (-) terminal of the variable voltage breakout board.
    • Now take a black (or color of your choosing) male-male jumper and slip it into the (-) screw terminal of the 5v regulator breakout board (output side) and tighten the screw. The other end should be slipped into the (-) side of the screw terminal on the mini-Maestro. Now take a red male-male and attach one end to the 5v Output screw terminal. (+) side and the other end to the (+) screw terminal of the mini-Maestro.
    • Remove the supplied jumper on the mini-Maestro.
    • Take a male-male jumper wire for the common ground to the Arduino attach it to the output of the variable regulator (-) screw terminal and insert it into the ground pin of the Arduino
    • Take a male-female jumper and connect the connect it to the output (+) of the variable regulator breakout board and the other end to the Gnd pin of the mini-Maestro.
    • Take a male-female jumper and connect the connect it to the output (-) of the variable regulator breakout board and the other end to the Vin pin of the mini-Maestro.

    • Take a male-female jumper and connect the connect it to the Rx pin of the mini-Maestro and the other end to pin 11 of the Arduino

    • Take a male-female jumper and connect the connect it to the Tx pin of the mini-Maestro and the other end to pin 10 of the Arduino.

    • Reconnect the arm servo wires to the mini-Maestro.

    Step 15: Arduino Code

    Lets look at some of the elements of the Arduino sketch before you start trying to use it to move the arm.

    The first is the how we tell the sketch the parameters for the servos, since we are using the mini-Maestro library. I did this by setting up a array of structures, each setting the parameters for the arm servo (lines 31-43 of the sketch

    struct maestro_parameters {
         // servo_channel, name, min, max, home, speed, accel, and neutral come 
         // directly from the min-maestro channel settings tab so it is a good 
         // idea to take a screen shot and print it out.
         int servo_channel;
         char servo_name[20];
         int servo_min;
         int servo_max;
         int servo_home;
         int servo_speed;
         int servo_accel;
         int servo_neutral;
         // The next two variables are required for Arduino mapping function. We will be mapping degrees to
         // microseconds. fromLow corresponds to the servo_min and and fromHigh corresponds to
         // servo_max.
         // If we use the shoulder as an example if your servo_min value is 672 microseconds, 
         // which would correspond to +180 degrees and your servo_max value is 2248 microseconds 
         // which corresponds to -180 degrees the fromLow and fromHigh values would be +180 
         // and -180 degrees respectively
         int servo_fromLow;
         int servo_fromHigh;
         // The next two variables are used to set the servo constraints. In, other 
         //words the max allowable travel for each of servos
         int servo_constLow;
         int servo_constHigh;
    } servo[6];

    Specific values for the servos are set at lines 66-71. For my arm these would be:

      servo[0] = (maestro_parameters) {0, "Base", 1064, 1663, 1366, 0, 0, 1504, -90, 90, -80, 80};
      servo[1] = (maestro_parameters) {1, "Shoulder", 672, 2248, 2040, 40, 0, 2040, -180, 180, -10, 180};
      servo[2] = (maestro_parameters) {2, "Elbow", 928, 1872, 1738, 10, 0, 1505, 180, -180, -160, 45};
      servo[3] = (maestro_parameters) {3, "Wrist_Pitch", 928, 2128, 928, 10, 0, 1500, 0, 180, 0, 180};
      servo[4] = (maestro_parameters) {6, "Wrist_Rotate", 608, 2448, 1500, 40, 0, 1500, 90, -90, -90, 90};
      servo[5] = (maestro_parameters) {7, "Gripper", 1312, 1792, 1358, 7, 0, 1500, 0, 10, 0, 10};
    

    Let's talk about the mapping function for a few seconds. In general the mapping functions is of the following form:

    servoPosMs = 4*map(servoPosDeg, servo[servoNum].servo_fromLow, servo[servoNum].servo_fromHigh,
               servo[servoNum].servo_min, servo[servoNum].servo_max);

    For reference we have to multiply the resulting mapping value by 4 since the mini-Maestro library works is expecting values in 1/4 microsecond increments. What i found was that the mapping function was inaccurate for the shoulder and elbow servo gearboxes, it was off by a couple of degrees which caused inaccuracies in positioning the servo arm. What I wound up doing is creating my own linear regression curves for these servos and embedding them in the curve. This was done in sketches moveServo() function.

    Let's take a look at this function:

    void moveServo() {
      // The Constrain function limits the servo movement so you do not overdrive the arm into positions you
      // do not want
      servoPosDeg = constrain(servoPosDeg, servo[servoNum].servo_constLow, servo[servoNum].servo_constHigh);
      
      //Mini Maestro values given in 1/4 ms so you have to multiply by 4.
      if(servoNum == 1) {
        servoPosMs = 4*(4.4406*servoPosDeg+1491.1);
      } else if(servoNum == 2) {
        servoPosMs = 4*(-2.4208*servoPosDeg+1436.2);
      } else {
        servoPosMs = 4*map(servoPosDeg, servo[servoNum].servo_fromLow, servo[servoNum].servo_fromHigh,
                   servo[servoNum].servo_min, servo[servoNum].servo_max);
      }
      
      //Serial.println(servoPosDeg);
      
      // setSpeed tells the servo how fast you want the servo to move,
      // set Target tells the servo where to move
      maestro.setSpeed((uint8_t) servo[servoNum].servo_channel, (uint16_t) servo[servoNum].servo_speed);
      maestro.setTarget((uint8_t) servo[servoNum].servo_channel, (uint16_t) servoPosMs);
    
      // The while loop is here to tell the sketch to wait till the servo has finished moving before
      // sending a done message
      while(maestro.getMovingState() == 1) {
        //Serial.println("Moving Servo");
        };
      
      //Serial.print ("Position is: "); 
      //Serial.println (maestro.getPosition(servo[servoNum].servo_channel));
      
      Serial.println ("Done");
    
    }<p>  Serial.println ("Done");</p><p>}</p>

    In the posted sketch I have commented out the lines for linear regression. You will have to determine whether you need this or not. Basically tell the servo to move to the +90 or -90 (depending on the servo) and see if it really is at 90 degrees. If you feel as if this is not satisfactory use the Maestro Control center to move the servo to 0, 90 180 degrees (see figure), copy the microsecond values and use MS Excel to do a linear trend line (make sure you tell it to show the equation.

    To test the sketch, load the sketch into the Arduino. When finished loading open up the Serial command window and send commands to arm in following form:

    servoNum, Target Degrees

    Example,

    0, 25 then hit return key

    This moves the base servo to the left by 25 degrees.

    By way of summary:

    Servo NumServo
    0Base
    1Shoulder
    2Elbow
    3Wrist Pitch
    4Wrist Rotate
    6Gripper

    Step 16: Processing GUI

    Ok now the fun can begin.

    Open Processing and load the Robot Arm.ino file. Click on the run button and you should see the GUI pop up.

    First thing you will have to do is to select the Com port that the Arduino Uno is attached to which is done in the drop list in the upper left hand corner of the corner.

    Second, click on the Toggle button to enable the arm - this was a fail safe i built in. Now their are two ways to make the arm move. The first is with the sliders. Moving the sliders will move the respective joint in the arm The second way is to move the 2d Inverse kinematic slider on the left middle of the GUI. This will tell the arm to move x distance away from the base and tell it how high off the ground it should be.

    If you enable the Forward Kinematic toggle you will see that the two distances match.

    If you enable the Fixed Axis toggle you will have the option to set a fixed position for the gripper. "Normal" makes the gripper align with the vertical, "Parallel" makes it stay parallel to the ground, and "Parallel to Arm" makes it stay at the same angle as the forearm. To use this feature you have to have the Forward Kinematic toggle enabled.

    A couple of other features:

    Reset Arm Button: Sends commands to the arm to move it back to the default (startup) position

    Record: Logs your movements to the default file created when you start the sketch. To use what you will have to do is to use the Close button when you finish whatever it is you wanted to record, then use the Open button and select the file you want to play back. To play back your movements use the Play Back button.

    Some suggestions:

    1. When you first start move the sliders to make sure you hooked everything up correctly. Learned by experience.
    2. When you finish playing with your new toy make sure do a reset to send it back to the home position.

    Step 17: References