Introduction: SCARA Robot: Learning About Foward and Inverse Kinematics!!! (Plot Twist Learn How to Make a Real Time Interface in ARDUINO Using PROCESSING !!!!)

An SCARA robot is a very popular machine in the industry world. The name stands for both Selective Compliant Assembly Robot Arm or Selective Compliant Articulated Robot Arm. It is basically a three degrees of freedom robot, being the first two displacements rotational ones in the XY plane and the last movement is performed by a slider in the Z axis in the end of the arm. The two degrees of freedom were planned to offer more precision; nevertheless, due to the quality of the servos that are available for us to use, the built arm did not have as much mobility as one would expect because of its two degrees of freedom.The electronic part is easy to understand. It is tough to build, though. As the arm needs three actuators, we have three channels. Instead of programming with the common Arduino interface, we decided to use Processing, which is a very similar software to the Arduino one.


Bills of materials:
In order to build the prototyping several material were used, in the follow list there are mentioned all of those materials:

  • 3 Servo Motors MG 996R
  • 1 Arduino Uno
  • MDF (3 mm thickness)
  • Timing Belts GT2 profile (6 mm pitch)
  • Epoxy
  • Nuts and bolts
  • 3 Bearings

Step 1: The Prototype

The first step was making the model in a CAD Software in this case Solid works is a pretty good software for it, other option can be Fusion 360 or other CAD software of your preference. The pictures attach in the Step 1 was the first prototype due to a various error we must modify, and we end up with the Model Show in the video and introduction.

Laser Cut was used in order to make the prototype, I don’t have any video of the manufacturing process, but I have the files that I used. The must important part of this project is the Coding of the Interface so you can make your own model and used our code into your own SCARA Robot

Step 2: Motors Conections

The electronics are simple as cookin cereal. Just connect everything as is show on the picture (In the main code the signal send to the servos comes from the pins (11,10 and 11))

Step 3: Undestand Foward and Inverts Kinematics

Forward Kinematics

The way in which the code works for the trajectories is the following: After selecting this mode, you must select a shape to draw. You can choose between Line, Triangle, Square and Ellipse. Depending on the selection, a variable is changed which then functions as a 'case' argument for a select type programmed later in the sequence. Thanks to the flexibility of Processing, we can interact with the interface with commands known by Windows and other operating systems, which allows assigning the position of the cursor (mouse) to a variable within the program, which through the connection to Arduino commands the servomotors what angles to drive in what sequence.

The algorithm for drawing can be reduced in the pseudocode: assign value to x1, y1 assign value to x2, y2 calculate difference between x1 and x2 calculate difference between y1 and y2 calculate points through which the down will pass (triangle, square, circle) (geometry is used with these two points) if (botondibujar == true) complete sequence in the case of recording, the variables sent to the servomotor are saved in an array of 60 units, which by pressing the 'record' button allow us to save the data obtained with any mode (Manual, Forward, Inverse, Trajectories) and then be replicated when you press the start button with a simple change of variable.

Inverse Kinematics

The inverse kinematics problem consists on finding the necessary inputs for the robot to reach a point on its workspace. Given the mechanism, the amount of possible solutions for a desired position may be an infinite number. The robot we have built is a serial mechanism with two degrees of freedom. After a geometrical analysis, two solutions have been found for this particular mechanism. Figure 13. Inverse Kinematics example Where: θ1 and θ2 are the input angles of the two DoF serial mechanism robot and X1 and X2 are the position in the plane of the tool in the final arm. From the picture above:

It also exists and elbow UP configuration, but for the purpose of the program that was written, it was only used the elbow DOWN configuration. Once the input angles are found, that information runs on the direct kinematics program and the desired position is reached with an error of less than a centimeter due to the servos and the belts.

Step 4: Manual, Trajectory and Learning Mode


For this mode you only need to move the mause in the interface and the robot will follow the pointer of the interface, you can program this in programing that is an awsome plataform

For this model we use the resources of the inverse kinematics and make the figures request by the client that was a: Straight Line Square triangle Circle The figures can be drawn on the interface with the shapes that you want. The trajectory use the inverse mode to calculate each point of the lines of each one of the figures so it makes easy to follow the figures when you click play after you draw the figure that you put as input in the interface

Learning mode

The learning mode consider all other modes that are the manual, forward, inverse and trajectories, so you can made any move that you want into the interface and then replace with the same movement as before but slow as it reproduce and try to do it more exactly.

Step 5: The Code

Actually the code is kind of hard to explian so I left the code so you can read ir If you have any doubts about it, you can ask in the comments and I will explian to you (I will update this step with a full explanation of the code be patient) for the moment you can email me for any doubt:

STEM Contest

Participated in the
STEM Contest