Introduction: 3D Printing: ROBOTIC CLAW WITH ARDUINO

About: Do you like technology? Follow my channel on Youtube and my Blog. In them I put videos every week of microcontrollers, arduinos, networks, among other subjects.

Did you ever think about designing a manipulator claw using servos? Today, I’m going to show you how to control a servo robotic claw using an Arduino Uno.

I used two claws to do this. One was made in a 3D printer, and all of its parts were printed on ABS plastic, which I prefer as it’s more flexible and less brittle. The second claw is acrylic and was cut by a laser.

In addition to the claws and the Arduino Uno, we use four micro-servos (3 Tower Pro MG90S and 1 SG90), a 10k potentiometer, as well as a protoboard, wires, and elastics.

Step 1: Assembly

In our project, we implemented an anti-locking system, which I believe makes a great difference. I’ve had experiences with some claws that I bought on the Internet, and they blocked directly. In these situations, the engine was forced and the gear went into the space. My students could only use these claws for two classes, as the server quickly broke. It was at this moment that I decided to make a claw on the 3D printer.

In assembly, we have the claws
and a potentiometer connected in the Arduino Uno. We connected the servo signal in parallel, and now we only have a servo signal that I'm connecting at the base, and also the claws to make them move.

Step 2: Parts

Here I show each piece that we use in the assembly:

A - Right and left fingers

B - Base

C - Servos

D - Right levers

E - Wedge washer

F - Lever levers

G - Gear with elastic bracket

H - Gear

I - Triangle

J - 10 screws M2.5x25

K - 7 nuts (preferably parlock)

L - Servo lever (cut)

25 washers (optional, but advisable)

Step 3: ​Assembly - Step by Step

Step 1

Assemble two left levers (F) and two right levers (D), as shown in the figure.

Use the locking nuts, but don’t over tighten. Leave some slack so the parts can move. The use of washers is strongly recommended to reduce friction and wear and tear between parts.

Step 2

Mount the remaining left lever (F) with the gear (H). Don’t forget to tighten the moving parts.

Step 3

Mount the right and left fingers on the levers as shown.

Step 4

With your fingers closed and centered, fit the gear (G), wedge washer (E), and servo. Gear engagement must occur. We highlight the figure for easy identification.

Screw the assembly.

Note: In printed parts, a variation of dimensions may occur that will prevent the gears from being positioned. In laser cut parts, size variations can occur, mainly due to the slope of the cut in relation to the surface.

The assembly should now look like the figure on the side.

The last bolt (set to gear G) will be longer than the others. You can cut it or replace it with an M2.5x16.

Preparation of the elastic coupling

To prevent the servo from locking by torque exertion on the fingers, an elastic coupling was used. This technique is used to avoid these types of problems in several mechanisms. A spring is also commonly used. To make building easier and more accessible, we will use hair elastics that are easily found in stores.

To assemble the coupling, we will cut a servo lever (there are some that come along with them) so that its length is equal to that of gear G.

Engage the servo lever and, using the screw provided with the servo, attach the lever. Be sure to keep it aligned with the notch.

Using the elastic, attach the lever to the gear G by tying the elastic in a notch and also at the opposite side.

Elastic bands

There are two ways to attach the elastic. Just for demonstration, in the claw of acrylic we tied the elastic in the format of an 8. In the 3D printer, we made two bows at the ends. You are the one who will choose the best way, and this part is important, because this elastic will prevent engine explosion.

Step 5

To install the wrist servo, position it on the opposite side of the gears, so that the three holes are tangent to its edge. Make sure that the servo shaft is in the center.

Using the triangle (I) and three screws, attach the servo wrist.

Note: These three bolts should not require a nut, being that it is screwed directly into the base.

Step 4: Elinetic Scheme

In the assembly I have two claws, so obviously I have two sets of servos here on the electrical schematic. We also have the potentiometer, which varies the position of the servo, and is the input. We still have the way out. In fact, we have two readings in this project, that is, two outputs. Remembering that this is just a demonstration, because you can separate and put two potentiometers, one controlling the handle and another the claw, for example. To do so, simply modify the code that I leave to download as needed.

Step 5: Source Code

Global Declarations

The source code is very simple. I put pinPot = A0 because it has to be analog. The pins for pulse and finger control are the PWM outputs. In the samples I read 1000 times the potentiometer, I make a mean and I command the command. Finally, the float is a read.

#include <Servo.h> //inclusão da biblioteca de SERVOS
Servo pulso; //criando o objeto Servo para o pulso Servo dedos; //criando o objeto SERVO para os dedos const int pinPot = A0; //pino de leitura analógica do potenciômetro const int pinServopulso = 13; //pino para controle do pulso const int pinServoDedos = 12; //pino para controle dos dedos const int amostras = 1000; //quantidade de amostras para cálculo da média float leitura = 0; //variável que armazenará a leitura do potenciômetro

Setup

Here I do the begin of the serial, I define the pinPot that is the Input and connect the pinServopulso and the PinServoDedos. This command is standard when we are moving the servo to connect to pins.

void setup()
{ Serial.begin(9600); //iniciando a comunicação serial pinMode(pinPot, INPUT); //definindo o pino de leitura como entrada pulso.attach(pinServopulso); //conectando o objeto SERVO do pulso ao pino correspandente dedos.attach(pinServoDedos); //conectando o objeto SERVO dos dedos ao pino correspandente

}

Loop

So in the main loop I do the reading and shoot the average, taking the sum and dividing by the total amount of the readings. I do, finally, the map command, which is nothing more than a rule of 3: I map from 0 to 1023 is equivalent to 10 to 170 degrees. We start for pulse.write, which writes the PWM angle and enables pulse control. The finger is the same value / angle, because, remembering, we only have one potentiometer. So we followed with a finger.

To finish, a serial.print just to debug and see the angle stirring.

void loop()
{ int i = 0; //variável para a contagem de amostras de leitura while (i <= amostras) //loop de amostragem { leitura = leitura + analogRead(pinPot); //soma de todas as leituras i++; //contagem das leituras } leitura = (leitura / amostras); //calculando a média das leituras /*ajustando o intervalo das leituras (0 à 1023) ao intervalo de angulos dos servos (0 à 180).*/ int angulo = map(leitura, 0, 1023, 10, 170); /*obs.: utilizaremos de 10 a 170 para evitar que os servos travem em seus pontos finais*/ pulso.write(angulo); //atribuindo o novo angulo ao servo do pulso dedos.write(angulo); //atribuindo o novo angulo ao servo dos dedos Serial.println(angulo); //enviando o valor do angulo para a saída serial }