Conveyor + Robotic Arm With Arduino

Conveyor + Robotic Arm With Arduino


A few weeks ago I bought a robotic arm to write a bit about robotics topics. The circumstances in recent days led me to get involved in a project in which I had to program a conveyor belt along with the arm I bought.

The truth with this type of projects I like to write several posts and then unify content. Already last week had published about what is and how a servomotor works. I guess this time what I will do is publish a post about the project and then I will gradually develop the topics of the subsystems that form it.

Conveyor + Robotic Arm With Arduino


The following entry is intended as a practical guide to replicate the results obtained in the development of the system shown in the image. This project was designed to be presented at university level, although it can be used for secondary presentations. It is very instructive for those interested in entering the world of robotics.

Hardware Design Conveyor belt

The design of the conveyor belt is free and is at the discretion of each user. You can build any kind of conveyor belt. At the end it is a structure with some rollers, a belt and a mechanism that attaches the shaft of a motor to some of the rollers. The idea is that when the engine moves, it drags the tape and triggers the movement of the entire system.

What I want to explain in this part is not the construction of the conveyor as such, but the system that controls the movement. In the case of the project in which I worked, the following circuit was used.

Hardware Design Conveyor belt


The concept of using an NPN transistor as a control element has already been explored in this blog. The transistor acts as a switch, alternating between the state of cut and saturation. Although the Arduino delivers 5 volts on any digital pin, it is not recommended to power the motor from the Arduino itself. It is best to use a transistor that handles the heavy load. The Arduino only takes care of saturating or cutting the transistor. This requires much less current than that consumed by an engine.

Because the motor will only move in one direction, it will not be necessary to implement an H-bridge. The conveyor belt can have any design. No matter what type of structure is used, it will always require an engine. This will allow you to control any DC motor of 5 volts. It is important to note that the 2N2222 transistor is suitable for motors with low current consumption. If you are going to use a more current motor, I recommend reading my post about the art of choosing a good transistor.

Detector of objects in the conveyor belt

To detect the objects in the conveyor belt that are passing in front of the robotic arm, we use a little trick that I personally like to use. It involves placing a laser pointing directly at a photoresist.

Some years ago I bought a pair of laser LEDs that have been very useful to me. They can be found on ebay or amazon at a very low cost. They can be searched as "laser diode 5mW 650 nM". Here I bring you an image.

Detector of objects in the conveyor belt


To connect the servomotors, all red wires will go to 5 volts. The ground and orange chocolates will go to the Arduino pins D5, D6, D7 and D8. It's a simple connection, the rest is programming.

Detector of objects in the conveyor belt

Robotic arm

The robotic arm I bought from a guy on ebay. He has a store where he sells lots of models of arms. The model I bought brings 6 servomotors and a lot of pieces that are supposedly made of aluminum, although more like cast iron. They do not look very solid.

For the project of the conveyor belt I have built an arm using 4 of the 6 motors, which reduces 2 degrees of freedom to the system. This was mainly done to reduce the load on the engines.

Robotic arm

Robotic arm


The robotic arm I bought from a guy on ebay. He has a store where he sells lots of models of arms. The model I bought brings 6 servomotors and a lot of pieces that are supposedly made of aluminum, although more like cast iron. They do not look very solid.

Robotic arm c


For the project of the conveyor belt I have built an arm using 4 of the 6 motors, which reduces 2 degrees of freedom to the system. This was mainly done to reduce the load on the engines.

Controller circuit

The control of the proposed system has been made based on an Arduino Nano.

Controller circuit



This model has been chosen primarily for its small size compared to other models. In addition it is necessary to emphasize the facility with which this model of Arduino can be integrated to a circuit board.

The circuit used to control each and every component of this system is as follows.

It is designed based on an Arduino Nano, although could well be used any other model of Arduino. The system is powered from a 5-volt, 2-amp cellular charger. It connects to Terminal Block J1. It is important that the GND of the Arduino and the source of power are connected to each other. Here is a brief description of each and every component of this system.

R1, R2, R3 and R4 are resistors of 220, 220, 10k and 10k, respectively.
D1 is an RGB LED.
M1, M2, M3 and M4 are servomotors.
M5 is the DC motor of 5 volts in charge of moving the conveyor belt
U1 is an Arduino Nano
U3 is a photoresist (LDR)
MOD1 is a laser diode.
S1 is a normally open push button.
T1 is a transistor 2N2222
J1 is a block terminal for the power supply input.
In my case I built the control circuit based on a universal board. We used the Arduino Nano because of the ease with which we can insert it into a socket on a board. Next I present the PCB design of the controller shown in the electronic diagram.

Controller circuit


It is possible to design a smaller plate than the one shown in the image. However, the purpose is not to present a PCB design, but our readers can see how we have interconnected the elements. Everyone is free to design their PCB as they see fit.

The two project diagrams are public and available through our EasyEDA repository.

Construction of the plate

The plate was constructed using female and male headers, so that all the components can be assembled and disassembled in the plate. Tin solder was used to join the components. I must confess that I am not the best welder with tin, but I always try to do my best.

Construction of the plate

Construction of the plate


This plate was screwed to the wooden base on which the conveyor belt was built. The motors and other components were then connected using Dupont type cables.

 Software Design Arduino Programming

The complete and documented programming code is available in our Github repository. This code allows:

Move each of the 4 robotic arm motors from the serial port, when entering the Setting Mode. For this we send through the Monitor series "start set mode". In this operating mode when writing, for example, "1 ENTER 45 ENTER" on the serial monitor, motor 1 will be set to 45 degrees. If "3 ENTER 90 ENTER" is sent, motor 3 will be set to 90 degrees. To exit the set mode, the command "end set mode" is sent.

Outside the Setting Mode the system will operate obeying the button placed on the plate. When the button is pressed, the conveyor starts its movement and will remain so until an object is detected or until the iddleTime passes.

The robotic arm will move whenever something stands between the laser and the photoresist. The movements that execute the arm will be specific for each case, for which the Setting Mode has been implemented. With the instructions that are placed in the armAction () the arm will do what the user needs it to do.

The complete code can be found in this link. It is important to keep in mind that it is necessary to modify the code to fit specific positions, mainly the armAction () method.

They are very simple to use. Just connect them to 5 volts and you'll have your laser. This directed light beam is caused by a photoresist (LDR) connected in the following way.

The circuit shown in the image represents a voltage divider with a similar operation as a potentiometer. However, instead of varying the voltage by moving a knob, it will be the light incident on the photoresist that will cause the voltage to rise or fall. In the case of the divider shown in the picture, when the light level increases, the voltage will drop. If the photoresist is in darkness, the voltage will grow.

This configuration is very simple, but is especially useful in cases where it is necessary to detect an object in front of a specific position. In the case of my project, the photoresist has been placed inside a tube, so that only the light of the laser affects the LDR and that natural light does not cause disturbances in the readings of the Arduino.

It is possible to use this arrangement with a digital pin, but in the experience I have realized that it is better to use an analog pin. Thanks to this we can verify the voltage levels in light or dark and establish an intermediate level for the transition from one state to another. It is a more precise and more efficient control.

Robotic arm

The robotic arm I bought from a guy on ebay. He has a store where he sells lots of models of arms. The model I bought brings 6 servomotors and a lot of pieces that are supposedly made of aluminum, although more like cast iron. They do not look very solid.

For the project of the conveyor belt I have built an arm using 4 of the 6 motors, which reduces 2 degrees of freedom to the system. This was mainly done to reduce the load on the engines.