control using a PC via USB. I’ll come
back to the serial communication via
Bluetooth towards the end of the
I defined three different operation
modes to control the robot arm:
• Mode 1: Manually control it
with the rotating knobs of the control
box (Figure 1).
Every robot arm joint and the end
effector “fingers” are controlled
directly with the corresponding
rotating knob (potentiometer).
• Mode 2: Manually control it
with the sliders of a GUI (Graphical
User Interface) from the PC (Figure
2). In a similar way to the control box,
the robot arm joints and the end
effector fingers are controlled with the
• Mode 3: Automatically provide
the end effector space coordinates (X,
Y, Z) with the GUI from the PC
(Figure 2). Here is where inverse
kinematics come into play! Plus, the
end effector fingers are opened or
closed with the END_EFFECTOR slider.
Once the robot arm controller is
turned on, during the first four
seconds it tries to find a device
connected through the serial port. If
there is no device connected, Mode 1
will start. If there is a device
connected, Mode 2 will start. Once in
Mode 2, the user can switch to Mode
3 by clicking on the INV_KIN toggle
button in the GUI.
Maybe you noticed that in Mode
3, I mentioned just “space coordinates” and not “pose”
(space coordinates + orientation). This is because the end
effector orientation will always be horizontal, which is a
restriction that was introduced to make calculations easier.
Inverse Kinematics — Geometric Solution
The main problem we will face while controlling robot
arms will be to bring the end effector to some specific
pose, which means that we will have to work with inverse
kinematics. In other words, a set of joint angles will be
calculated from a given end effector pose. As explained in
the first article last month, different methods can be used
for this: algebraic, numerical, and geometric solutions.
For computing the inverse kinematics of my robot arm,
I chose the geometric solution, defining a simplified model.
We’ll need to refresh some almost forgotten trigonometry
that we learned at school! First, we need to measure the
By Ricardo Caja Calleja
SERVO 07.2017 23
To post comments on this article and find any associated files and/or downloads,
go to www.servomagazine.com/index.php/magazine/issue/2017/07.
Figure 1. Control box.
Figure 2. GUI (Graphical User Interface).
• Pythagorean Theorem (only applicable to right triangles):
The square of the hypotenuse (c) is equal to the sum of the
squares of the other two sides (Xw, Z-p):
• Law of Cosines: Side c can be calculated if the angle
opposite (C) and the two other sides (a, b) are known:
• Law of Sines: Relates the side lengths of a triangle to the
sines of its angles:
a b c = = sinA sinB sinC
c2= a2+ b2–2 • a • b • cos C
c2= X2+(Z– p) 2 w