Please enable JavaScript to use CodeHS

Robotics · Mechanisms

How Do Robot Arms Work? Joints, degrees of freedom, and kinematics

A robot arm is a chain of stiff pieces joined by motors. To grab a box, it has to answer one question many times a second: what angle should every joint be at so the hand lands right here? Learn the parts, the joints, and the math, then steer and program an arm yourself.

Robotics ~25 min 4 hands-on labs
θ1 θ2 L1 L2 (x, y) FIG. 01 ARM, SIDE VIEW 2 JOINTS · SCALE 1:10 AUTO
01 / Anatomy

The parts of a robot arm

Hold your arm out and pick up a pencil. Your shoulder, elbow, and wrist all move together, your muscles pull, and your eyes and nerves tell your brain where your hand is. A robot arm works the same way, with metal and motors in place of bones and muscles.

So how does a robot arm work? It is a chain of stiff pieces connected by joints. A motor turns each joint. A sensor reports where each joint is. A computer decides where every joint should go so the hand ends up at the right spot. Here are the parts, numbered on the drawing:

RUN 01 1 2 3 4 5 6 7
Fig. 02 · Parts of an armSide view
  1. BaseThe heavy foot bolted to the floor or a table. It holds everything steady so the arm does not tip over when it reaches.
  2. JointsThe places where the arm can bend, turn, or slide, like your shoulder and elbow.
  3. LinksThe stiff sections between joints, like the bones in your upper arm and forearm. Their lengths decide how far the arm can reach.
  4. Actuators (motors)An actuator is anything that makes motion. In most arms it is an electric motor with a gearbox at each joint. Gears trade speed for strength, so a small motor can lift a heavy load.
  5. Sensors (encoders)An encoder is a sensor that measures exactly how far a joint has turned. Some arms also have force sensors that feel a bump and stop.
  6. End effectorThe tool at the tip: a gripper, suction cup, welder, or paint sprayer. It is the robot's “hand.”
  7. ControllerThe computer that runs the program. It reads the encoders, does the math, and tells each motor how far to move.

The motor, encoder, and controller form a feedback loop: move, measure, correct, repeat. That is how an arm can stop within a fraction of a millimeter of its goal. Learn how those loops work in How Do Robots Stay Balanced?

02 / Joints

Types of robot arm joints: rotate or slide

Almost every robot joint is one of two simple kinds. Engineers have fancy names for them, but you already know both.

angle
Revolute joint (rotates)Swings around a pin, like a door hinge or your elbow. The controller sets an angle.
distance
Prismatic joint (slides)Moves in a straight line along a rail, like a drawer. The controller sets a distance.

A revolute joint rotates. A prismatic joint slides. Most robot arms use only revolute joints, because they are compact and can reach around things. Prismatic joints show up in gantry robots that move along overhead rails, in 3D printers, and in the up-and-down axis of small assembly robots.

Your own arm has only rotating joints. Some of them are simple hinges, and one is a ball joint that can turn three ways. Here is how your arm compares with a typical factory arm:

Body partWhat kind of jointRobot arm match
ShoulderBall-and-socket: swings forward, swings out, and twists (3 ways)Base spin (J1) and shoulder tilt (J2)
ElbowHinge: bends one way only (1 way)Elbow (J3), a single revolute joint
ForearmTwists, like turning a doorknob (1 way)Wrist roll (J4)
WristBends up and down, waves side to side (2 ways)Wrist pitch (J5) and tool spin (J6)
03 / Degrees of freedom

Degrees of freedom: why 6 joints, and why your arm has 7

Degrees of freedom, or DOF, is the number of separate ways something can move. Each simple joint adds one. A door has 1 DOF: it can only swing. Your arm has 7.

To pick up a cup, a hand needs to control 6 things. Three are where the hand is: left-right, forward-back, and up-down. Three are how it is tilted: roll, pitch, and yaw (think of an airplane rolling, nodding its nose, and turning left or right). Six joints is the smallest number that can set all six, so most factory arms have exactly 6. Engineers call them 6-axis arms.

Lock some joints below to see what each one adds. Then try it on yourself: hold your elbow straight and try to touch your nose.

Lab 1 · DOF counter

Click a joint to lock it

Your arm

7DOF

    6-axis robot

    6DOF

      Workspace: how far can an arm reach?

      The workspace is every spot the hand can reach. For a simple two-link arm, it is a ring. Stretch the arm straight and the hand reaches the outer edge, at a distance of L1 + L2 (the two link lengths added). Fold it all the way back and the hand reaches the inner edge, at L1 − L2. Anything outside the ring is too far. Anything inside the hole is too close. You will see this ring in the next lab.

      An arm with 7 joints, like yours, has one extra. Engineers call it redundant. The extra joint lets you reach the same spot many different ways, so you can reach around an obstacle or keep your elbow out of the way. The robot arm on the International Space Station, Canadarm2, also has 7 joints for the same reason.

      04 / Forward kinematics

      Forward kinematics: given the angles, where is the hand?

      Kinematics is the math of motion without worrying about forces. Forward kinematics answers the easy direction: if I know every joint angle, where does the hand end up?

      Let’s use a flat arm with two links. The upper arm is L1 = 10 units long and the forearm is L2 = 8. The shoulder is at the origin (0, 0). The shoulder angle a is measured from the flat x-axis. The elbow angle b is measured from where the upper arm points, so b = 0 means the arm is straight.

      Here is the trick. Cosine and sine split a slanted line into a sideways part and an upward part. If a stick of length L tilts up at angle θ, its sideways part is L·cos(θ) and its upward part is L·sin(θ). Add up the parts of both links and you have the hand:

      x = L1·cos(a) + L2·cos(a + b)
      y = L1·sin(a) + L2·sin(a + b) The forearm uses a + b because its direction is the shoulder angle plus the elbow bend.

      You do not need to memorize this. Move the sliders and watch the numbers. Turn on Show the math to see the blue and gold pieces on the drawing.

      Lab 2 · Joint sliders

      L1 = 10 · L2 = 8
      Hand x0
      Hand y0
      Reach0
      Targets hit0 / 3

      Notice how hard the target challenge is. You have to guess, look, and adjust. Going from angles to position is easy math. Going from a position back to angles is the hard part, and that is the next section.

      05 / Inverse kinematics

      Inverse kinematics: given a target, what angles?

      A real robot is usually told where to go, not what angles to use. “Put the gripper on that box.” Inverse kinematics (IK) works backward from the target to the joint angles.

      For a two-link arm there is a neat shortcut. The shoulder, the elbow, and the hand form a triangle. You know two sides (L1 and L2) and you can measure the third: the straight-line distance d from the shoulder to the target. A rule from geometry called the law of cosines turns three side lengths into the angles of the triangle. That gives the elbow bend, and then the shoulder angle.

      Three surprises come out of that triangle:

      • Two answers. The triangle can flip. The elbow can point up or down and the hand still lands on the same spot. Engineers call these elbow up and elbow down.
      • No answer. If d is longer than L1 + L2, no triangle exists. The target is out of reach.
      • One answer. Right at the edge of the ring, the arm is perfectly straight, and both answers become the same.

      Lab 3 · Click to reach

      Inverse kinematics solver

      Click or tap anywhere to place the target. Or focus the drawing and use the arrow keys (hold Shift for big steps).

      Distance d0
      Shoulder a0
      Elbow b0
      Answers2

      Save as waypoint copies this pose into the program in Lab 4, the same way teach mode works on a real arm.

      Real arms with 6 or 7 joints have many more possible answers, and no simple triangle. Their controllers often solve IK step by step: nudge every joint a little in the direction that moves the hand closer, and repeat until the hand is on target. The controller also has to skip answers that would crash into the table, bend a joint past its limit, or twist cables.

      06 / Tools and jobs

      End effectors and where robot arms are used

      An arm is only as useful as the tool at its tip. That tool is the end effector. Many factories swap tools automatically, so one arm can weld in the morning and sort parts after lunch.

      • GripperTwo or three fingers that pinch an object. Some have soft rubber fingers that can hold an egg without cracking it.
      • Suction cupA vacuum pump sucks air out of a cup to lift flat things like boxes, glass, and phone screens.
      • Welding torchMelts metal pieces together. Car factories use hundreds of welding robots on each line.
      • Paint sprayerSprays an even coat of paint. Robots do this so workers stay away from the fumes.

      Where you will find robot arms

      • FactoriesWelding car bodies, painting, packing, and assembling electronics. Arms do the same move thousands of times without getting tired or bored.
      • WarehousesPicking items out of bins and packing orders. A camera spots each item and inverse kinematics plans the grab.
      • SurgeryIn robotic surgery, such as with the da Vinci system, a surgeon sits at a console and steers thin robot arms. The arms shrink big hand motions into tiny, steady ones.
      • SpaceCanadarm2 on the International Space Station is about 17.6 meters (58 feet) long with 7 joints. It catches cargo ships and moves astronauts during spacewalks. Both of its ends can grab, so it can “walk” end over end around the station.
      • LabsMoving test tubes and samples day and night, so scientists can run thousands of experiments.
      07 / Programming

      How to program a robot arm

      Most arm programs are a list of waypoints: poses the arm moves through, in order, with actions like “close the gripper” in between. There are two common ways to make that list.

      • Teach mode. A worker steers the arm with a handheld controller called a teach pendant, or simply pushes a friendly “cobot” (collaborative robot) into place by hand. At each good spot, they press a button to save the pose. That is what Save as waypoint did in Lab 3.
      • Code. A programmer writes the waypoints as commands. Many robot languages look a lot like this Python-style example:
      pick_and_place.py
      # Move above the part, grab it, and drop it in the bin
      move_to(x=12, y=4)      # hover above the part
      move_to(x=12, y=-1)     # go down slowly
      grip()
      move_to(x=12, y=4)      # lift straight up
      move_to(x=-10, y=3)     # swing over the bin
      release()
      print("Part placed")
      Output
      Part placed

      When you write move_to(x=12, y=-1), the controller runs inverse kinematics to find the joint angles, then drives each motor there. Hovering above the part first is a classic trick: the arm comes straight down instead of sweeping sideways into the part.

      Now you try. In the lab below, the program uses joint angles directly: move_to(a, b) sets the shoulder to a degrees and the elbow to b degrees. Get the block into the bin without scraping the table.

      Lab 4 · Pick and place

      Program the arm

      Ready. Block at (12, −1). Bin at (−10, 3).

      In Lab 3, click Target the block with Elbow up and save it, then Target the bin and save it. Put grip() after the first move and release() at the end. The angles come out near move_to(37, -97) and move_to(117, 110).

        Did your arm ever drag the block or slam into the table? Real engineers fight that problem too. Moving every joint at once in a straight line from one angle to the next does not move the hand in a straight line. That is why programs add extra waypoints, like “lift first, then swing.”

        08 / FAQ

        Frequently asked questions

        How does a robot arm work?

        A robot arm is a chain of stiff pieces called links connected by joints. A motor at each joint turns or slides that joint, and a sensor called an encoder reports the joint's exact position. A computer called the controller uses math called kinematics to work out which joint positions put the hand, or end effector, where it needs to be, then drives the motors there.

        What are the main parts of a robot arm?

        The main parts are the base that holds the arm in place, the links (the rigid arm sections), the joints that connect the links, the actuators or motors that move each joint, sensors such as encoders that measure each joint's angle, the end effector or tool at the tip, and the controller, the computer that runs the arm's program.

        What are degrees of freedom in a robot arm?

        Degrees of freedom (DOF) are the number of separate ways an arm can move. Each simple joint adds one. Your arm has 7 degrees of freedom: 3 at the shoulder, 1 at the elbow, 1 for twisting the forearm, and 2 at the wrist. Most factory robot arms have 6.

        Why do most industrial robot arms have 6 axes?

        To hold a tool at any spot and any angle, an arm has to control 6 things: where the tool is (left-right, forward-back, up-down) and how it is tilted (roll, pitch, and yaw). Six joints is the smallest number that can do all six, so 6-axis arms are a common choice for welding, painting, and assembly.

        What is the difference between forward and inverse kinematics?

        Forward kinematics starts with the joint angles and calculates where the hand ends up. Inverse kinematics starts with where you want the hand to go and calculates the joint angles that get it there. Forward kinematics always has exactly one answer. Inverse kinematics can have two answers (elbow up or elbow down), many answers, or no answer if the target is out of reach.

        How do you program a robot arm?

        Most robot arms are programmed with waypoints, a list of positions the arm moves through in order. You can type the waypoints as code, such as move_to commands, or record them in teach mode by moving the arm with a handheld teach pendant or by hand and saving each pose. The program then adds actions like closing the gripper between moves.

        What is the end of a robot arm called?

        The tool at the end of a robot arm is called the end effector. It can be a two-finger gripper, a suction cup, a welding torch, a paint sprayer, a screwdriver, or a camera. Factories often swap end effectors so one arm can do many jobs.

        09 / Check yourself

        Quick quiz

        1. A joint that slides in a straight line, like a drawer, is called a…

        2. A factory arm has six rotating joints. How many degrees of freedom does it have?

        3. L1 = 10, L2 = 8, and both angles are 0° (arm pointing straight along the x-axis). What is the hand’s x?

        4. You give the arm a target and it works out the joint angles. What is that called?

        5. Why does a two-joint arm often have two ways to reach the same spot?

        Keep building

        You just used the same ideas that steer factory arms and the arm on the space station. Keep going with more robotics, and the trigonometry that powers it.