Regarding the safety aspects, since the projects are based on a very low voltage power supply supplied by the USB port of the PC or by backup batteries or power supplies with a maximum of 9V output, there are no particular risks of an electrical nature. It is however necessary to specify that any short circuits caused during the exercise could cause damage to the PC, to the furnishings and in extreme cases even to burns, for this reason every time a circuit is assembled, or modifications are made on it, it will be necessary to do it in power failure and at the end of the exercise it will be necessary to disconnect the circuit by removing both the USB cable for connection to the PC and any batteries from the appropriate compartments or external power connectors. Furthermore, again for safety reasons, it is strongly recommended to carry out the projects on insulating and heat resistant mats that can be purchased in any electronics store or even on specialized websites.

At the end of the exercises it is advisable to wash your hands, as the electronic components could have processing residues that could cause damage if swallowed or if in contact with eyes, mouth, skin, etc. Although the individual projects have been tested and safe, those who decide to follow what is reported in this document assume full responsibility for what could happen in the execution of the exercises provided for in it. For younger children and / or for their first experiences in the field of electronics, it is advisable to perform the exercises with the help and in the presence of an adult.

Roberto Francavilla


The new course is dedicated to an extraordinary robotic tooling that finds applications in many fields, from the automotive industry, to the pharmaceutical industry, to storage, etc .. and that is to the “Robotic Arm” or also called in English “Robot Arm”. Obviously, for our studies, we will use a “simplified” robotic arm, but this does not mean that its functionality and programming logic are completely identical to industrial robotic arms.

In particular, the course will illustrate the main features of the operation of a robotic arm and its programming to obtain all the movements we need. We will use what we have already learned both in the Basic Course with Arduino and what we have seen in the Artificial Intelligence Course, so I suggest, for a better understanding of the Robotic Arm Course and before continuing (if you have not already done so), to go especially to read Lesson 6 of the Arduino Basic Course. In particular: What are the degrees of freedom, electric drives and give movements to a robot.

We prepare our laboratory

There are several robotic arm models currently on the market, the substantial differences between the various KITS proposed are: the degrees of freedom (DOF) of the arm, the material with which the robotic arms are made and the type of servomotors used to give the movements. to the robotic arm.

Obviously, the features indicated above translate into cost and the cost of a robotic arm KIT can vary from a few tens of euros to a few hundred euros, so before purchasing, keep in mind that the choice must first of all take into account sin where we want to go in the study of the robotic arm.

Since the course aims to provide all those basic tools that you need to know in order to then venture into this fantastic world, for this purpose we will use a robotic arm with an aluminum structure, with 6 degrees of freedom and with servomotors of the MG996R type.

The most delicate part in the choice, as you will see later in the lesson, is the choice of servomotors also because they are very expensive components.

In addition to our robotic arm we will need a stabilized power supply with possibly variable DC output voltage, via potentiometer, between 5V and 12V and current supply of at least 2A-3A. Finally we need our microcontroller, which will initially be an Arduino Uno R3, but we will also see the use of different microcontrollers depending on what we want to do.

A little Physics to start: Strength, Momentum and Couple.

Before venturing to fiddle with our robotic arm, as usual, I would also like to introduce those theoretical aspects deriving from the STEM disciplines that characterize all my courses. In particular, I would like to give some principles of Physics that will be used to better understand what we will see during the study of the robotic arm.

In particular we will focus on Mechanical Physics which consists in the study of the motion of bodies and the causes that determine it. It is divided into three specific sectors:

  • Kinematics; which deals with the study of motion regardless of the causes that generated it;
  • The Dynamics; for the study of motion and the causes that generated it;
  • The Statics; for the study of equilibrium conditions.

Let’s analyze the figure above from a static point of view, we can observe that the man (or even a woman!) Is lifting a weight of 5 kg and holding it suspended in the air.

Let’s analyze this situation by making approximations that simplify the analysis, but which nevertheless help us understand the fundamental concepts we need. Suppose that the entire arm has zero weight, so the only force acting on the arm is the weight force of the object lifted by the hand. From this representation it is easy to understand that to keep the object raised I will have to react with my arm with an equal and opposite force.

But what does it mean to react with an equal and opposite force?

Let’s outline the above by adding the possibility of rotating the arm at shoulder height by adding a rotation joint.

Therefore the weight force tends to make our arm rotate clockwise, creating a “Moment” indicated with “M”, at the center of our joint, equal to the product of the weight force “P” and the arm “b”:

M = P x b

So to keep the weight lifted my muscles have to create, in the rotation joint (also called “hinge”), a moment “Mr” (Moment of Reaction) in the opposite direction.

Now the next question is: and for the robotic arms, who from this moment?

The answer is simple: the Servomotor.

For servomotors, but more generally for electric machines, on the datasheets, we generally do not speak of “Moment of a force”, but of “Torque” (in some rare cases of Torque), in fact the Torque is defined as the action, on an axis of rotation, of two forces that are coplanar and parallel and having opposite directions distant from each other “r”. The Moment generated by the Pair of Forces is given by the product:

Mr = F x r

With these basic notions of Physics it is therefore already possible to make several important considerations, in fact since our robotic arm will have to move weights with the hand (i.e. at the tip of the arm), the longer the robotic arm is or the heavier the object is and the greater the torque that the servomotor must have in order to move the object itself.

In the above analysis we did not consider the weight of the arm, which already by itself, depending on the material that constitutes it, introduces a further force and therefore a moment that must be overcome in order to make it move.

At each rotation joint we must insert a servomotor and having a more performing servomotor also means that the power supply available from Arduino is not sufficient to power the servomotors, for this reason an external power supply will be used with a voltage that must be compatible with the maximum allowed. from the servomotor itself.

The MG996R Servomotor.

We saw the importance of choosing the right servomotor in the previous paragraph, now let’s see its operation in detail, focusing on what is normally used for applications on educational robotic arms, namely the MG996R.

Below, I report an extract of its technical data sheet:

Let’s see what kind of information the servomotor manufacturer gives us. First of all we are provided with information on the dimensions, these are obviously very important especially if we buy the servomotors separately from the robotic arm, in fact it is necessary to check the compatibility between the available slots and the fixing points on the components with the dimensions of the motors.

Then we are told that the supply voltage (operating voltage) can be between 4.8V and 7.2V and the supplier also tells us what is the maximum torque that the servomotor can release, indicating it as stall torque (in English : stall torque).

We are also given an indication of the maximum current, corresponding to the maximum torque, and with the colors of the cables, we are also given an indication on how to connect the servomotor.

It should be borne in mind that all Servomotors are considered Electric Drives as they are made up of an electric motor that transforms electrical energy into mechanical movement, they have a sensor system to return feedback to the control system that corrects and adapts the movements. of the electric motor so that it responds correctly.

We can schematize a drive with the graph below

The sensors normally used to measure and release a feedback to the Servomotor control system are the Potentiometers (in this case there is an analog type control) or the Encoder (in this case a digital type control).

The figure above shows how an analog-controlled Servo with Potentiometer is made, while the figure below shows a typical digitally-controlled Servo Motor with Encoder.

Good! At this point, after this description of the Servomotor, let’s learn how to use it properly.

Already in Lesson 6 of the Arduino Basic Course, we learned how to program the SG90 servomotor, I invite you to go and review the lesson because here we will do more and we will start from a minimum knowledge base anyway.

The importance of testing the Servos and the initial configuration.

Before assembling the robotic arm it is absolutely necessary to test the correct operation of each individual servomotor and above all to establish the initial configuration (i.e. the initial rotation angle) of the rotor. In fact, since the servos have a minimum and a maximum angle of rotation, it is possible that by positioning the rotor incorrectly and fixing it to the arm, it is not possible to obtain the correct rotation because it is prevented by the physical interference that is created between the various parts of the arm. assembled, forcing us to disassemble everything.

To do this we can move in two ways or create a servo test sketch and use Arduino as a tester, or buy a servo tester.

We will see both solutions and the one that best suits us, we will use.

Project 01 - The Servo Tester

The Servo-tester is a small device that can be purchased on most market places for a few euros, has two predefined connection ways and up to three servos can be tested at the same time (but, personally, I don’t recommend it).

It has three operating modes Man = manual, i.e. by turning the potentiometer the rotation of the rotor is generated, Neutral = neutral, i.e. the rotor is positioned at half of its maximum rotation and finally Auto = automatic, the servo rotates by predefined steps going from its minimum value to maximum and with the potentiometer you adjust the speed (which obviously depends on the type of servo). To switch from one mode to another, there is a switch at the bottom left indicated with Select and the chosen mode is indicated by a LED that lights up.

For this project we need:

It is very important to follow the correct connection of the power poles otherwise you risk burning the servo-tester which has no protection in this sense (in fact I have burned one).

The scheme to use is the following:

Video-Project 1 - THE SERVO - TESTER

Project 02 - The Servo Tester with Arduino

The purpose of this project is to reproduce the functionality of the servo-tester seen in the previous project with Arduino and maybe even adding some more functions that don’t hurt.
For this project we need:

The wiring diagram is:

The Assembly scheme:

Video-Project 2 - Servo-Tester with Arduino

Final thoughts on Project 02:

In essence, this project reproduces the functionalities of the servo-tester device seen in the previous project, but using Arduino. Since we have a microcontroller available, of course, we also let our servo-tester do something else, in fact, at start-up an automatic routine starts that establishes the maximum angle of rotation that the servo is able to do. On the basis of this maximum angle, which can be read if the window of the serial port (serial monitor) is opened, the following functions are performed: Man, Neutral and Auto.

The adjustment, by means of a potentiometer, of the speed of execution of the auto function is interesting.

If you found the lesson interesting, make a donation you will help me realize many others.