Automated Robotic Arm That Learns | Ft. Tinkercad, Arduino Mega, EEZYbotARM
by Aarav G in Circuits > Arduino
26278 Views, 230 Favorites, 0 Comments
Automated Robotic Arm That Learns | Ft. Tinkercad, Arduino Mega, EEZYbotARM
Hi, in this Instructable, you will learn how to build a Robotic Arm that can learn to do any task and can be taught any task. It has two joysticks and also features a colorful 2.4" TFT display which acts as both a touch control panel and also a display to visualise what's going on.
The robotic arm can either be operated directly through the Manual Mode or the robotic arm can be taught new tasks through the Automated Mode and then the robot then goes over those tasks forever in a loop, until you stop it :)
The robotic arm has three Degrees of Freedom (DOF) and also a cute little gripper, including which, there are a total of four servo motors that we will be using in this project. I have used the MG90S metal gear servo motors for better performance and quality!
I have used an Arduino Mega for the Robotic Arm as it has a huge number of I/O pins which I quite needed because with the display, it is impossible to plug in any other I/O devices to the Arduino UNO board and as a result, I chose the Arduino Mega board. I also designed a custom PCB for the project to prevent a mess of wires.
This is a really good project for learning about the various processes carried out by any robot and in particular, this is a great demonstration of the capabilities of the Arduino board at a higher and more complex level!
Sounds Interesting? Let's dive right into the I'ble.
History and Evolution
The image you see on the left is a picture of the control panel of a 2-year-old iteration of this Robotic Arm. It never worked properly but yes, I did make it, so I felt it would be worth putting in some past details of the project.
1.1 Problems I Faced with the V1.0 😕:
- The first problem that I faced was a frequent jittering of the SG90 plastic gears that I had previously used in my arm. The arm would frequently start vibrating and sometimes violently shaking as the motors were highly incapable of managing the weight of the arm (which I later realised).
- Another problem was with the control panel and that was that the 16 x 2 alphanumeric display was not good enough for my application. It had very less viewing space and could not display all the required information.
- The button panel also was bad because I had used a salvaged button panel from an old laptop which did not work that great.
- I know that it was not a well-planned project back then but I have made many changes and have got a considerable satisfying result now!
1.2 What Has Changed ✅:
- I first changed the servo motors from plastic gear to metal gear (or) from SG90 to MG90S. This surely improved a lot of stability and performance. Metal gear motors do not jitter and the gears in these do not break in adverse conditions, whereas their plastic counterparts do!
- Then one of the major changes I did was to eliminate the button panel and replace the display with a bigger touchscreen display which would act as both the input and the output for controlling the arm!
- Also previously I used a prototype PCB board and created a circuit on that on my own in the form of an Arduino Mega shield and this caused the use of a lot of wires which is looking quite messy as you can see in the above image! I have now replaced it with a custom-designed PCB from JLCPCB!
- The control panel box as you can see in the image on the left is made of cardboard. This time, to improve the quality of my project I have gone for a 3D printed control panel box instead! I designed it in Tinkercad and got it printed from IAmRapid!
These were pretty much all the major changes I had to pull off while transitioning from the first version to the second one! It was a pretty tedious job figuring out the mistakes and I made sure that I resolved them in the best possible manner!
The Working Algorithm
The robotic arm has two modes: Manual Mode; Automated Mode
In the manual mode, the arm can directly be controlled using the two joysticks present on the control panel.
In the automated mode, you have two suboptions - you can either record a sequence of actions of a task that you want the robotic arm to perform or you can play an already recorded sequence. When you hit the record button you can manoeuvre the arm using the joysticks and save checkpoints or savepoints which the arm will later repeat when it is in the play mode.
The navigation will take place through the TFT touch display and I have made a neat looking responsive GUI for the smooth functioning of the robotic arm!
Gather the Required Material
These are the components, tools and software you will require for this project:
3.1 Components Required:
- Arduino Mega
- 2 x Joystick Module
- 2.4" TFT Touchscreen Display
- 4 x MG90S Metal Gear Servo Motors
- Jumper Wires
- Male and Female Header Pins (for PCB)
- 2 x LEDs - Any Color (for PCB)
3.2 Tools (Optional):
3.3 Software:
- Arduino IDE
- Autodesk Tinkercad (or) any other 3D CAD software
- Autodesk Eagle (or) any other schematic and PCB CAD software
I always prefer Quartz Components for buying any electronic component!
Gather all the required stuff and move on further to the next step!
Building the Robotic Arm
Now, we come to the part where we build the arm itself.
4.1 Why the EEZYbotARM?
In this project, we are solely concerned with the functioning and the logic behind the functioning of the arm! Our aim is to get the robotic arm to learn tasks and then repeat them, in a human-like manner! The shape and design of the arm do not really matter much so to save a bit of time on this part, I just decided to go with an already available open-source robotic arm, the EEZYbotARM. It has a pretty decent design and is perfect for our project.
4.2 Building the Arm:
The .stl files of the EEZYbotARM are available on Thingiverse and there is also a detailed Instructable for building the arm! These are pretty good resources to get the arm printed and assemble it!
After building the arm, proceed to the next step!
Custom PCB
There is no big schematic involved in our project as we just need to connect the servos, the joysticks, and the display to the Arduino Mega board.
5.1 Why Custom PCB:
The display can be directly plugged in but the other two cannot. Also, Arduino originally has only 2 to 3 GND and VCC ports and with multiple I/O devices being used in our project, designing a custom PCB saved a huge mess of wires and makes the project a lot easier to build and a lot better on the look!
5.2 How Custom PCB:
So, I designed a PCB in Eagle and then uploaded the Gerber files to JLCPCB. They offer $2/5pcs 2Layer & $5/5pcs 4Layer PCBs: https://jlcpcb.com. The PCBs arrived at my place in around 5 days which is pretty amazing and the quality of the PCB was also fabulous.
5.3 Which Custom PCB:
I ordered white PCBs as this costed nothing extra and I felt that this is a pretty neat change to make by deviating from the common green PCBs that we always use. The PCB has a place where all the servo motors will be directly plugged in and also a place where the jumper wire ribbon coming from the joysticks can be directly plugged in.
The PCB has been designed to be an Arduino Mega Shield and can be directly plugged onto the Arduino Mega board using some bottom male header pins and connects to the I/O devices using the male header pins on the top. I have also added two LEDs where one is the power LED and one is a simple output LED that can be controlled as per the need (the PCB will be inside the main control panel box so it does not really matter much).
5.4 Custom PCB Conclusions:
It is not a mandate to design the PCB in this project and the wires can be directly connected which might be fine for most people. I just wanted to go a level higher and came up with all of this. You can directly connect the motors, the joystick and the display to the Arduino Mega too! Though it might take more wires, a little more time and comparatively more effort, it is possible!
The Control Panel Box
This is the part where we need to design and print the control panel box of our robotic arm.
6.1 The Design:
I designed the control panel box in Tinkercad which is an amazing 3D CAD software and is always my preferred choice!
If you saw the image from the History and Revolution part in my instructable you might have seen how the control panel needs to be. The control panel has a cutout for the display and two round cutouts for the joysticks. It also has a place at the extreme front where the robotic arm will be placed. For some reason, I was feeling very artistic that day, when I designed this, so you can clearly see what that resulted in! 😜
6.2 Printing the Control Panel:
After designing the control panel, I downloaded the .stl files and then uploaded them to IAmRapid and got an instant quote which was quite affordable! Then I ordered the parts and they were delivered to my doorstep within 2 days (in India). As you can see in the above images, the quality of the prints is pretty satisfying.
After designing and printing the control panel box, let's move on further!
Placing the Components (In Enclosure)
Now we need to place the components of our project into the Control Panel Box.
7.1 Placing the Joystick Module:
I haven't used two individual joysticks and used a single module with two of them instead. I have made an elevated pedestal with four screw holes in the enclosure. We just need to screw the joystick module using fours screws onto the pedestals with holes!
7.2 Placing the Arduino Mega + Custom Shield PCB Attached:
I have made two cutouts for the two ports of the Arduino Mega. The robotic arm will be powered using a DC adapter so one port is for that and the other is the USB port to upload to and change the code on the Arduino Mega! Also attach the custom PCB shield, if you have made one, onto the Arduino board!
7.3 Attaching the Display to the Top Lid:
Now, we need to attach the display to the bottom of the top lid. You can use anything to do that. I have used some hot glue for the same :)
7.4 Placing the Robotic Arm at the Front:
I have made a small impression in the shape of the base of the robotic arm at the front of the control panel where there is an extended base plate coming out from the control panel box and is attached to the box. We need to place the robotic arm on that impression.
After completing all these, move on to the next step!
Control Panel Wiring
Now, we need to wire the components that we earlier placed in our control panel. This can be done in a few very easy steps. As I have designed the custom PCB, this step was fairly easier for me as I just had to plug in the components such as the joystick modules and motors into their respective ports on the PCB.
There are three components that we need to connect to the PCB:
- The Servo Motors (Robotic Arm)
- The Joystick Modules
- The Touch Display
If you choose not to go with the PCB, then follow the instructions below for connecting the various components (listed above) to the PCB (Arduino Mega Shield).
Joystick:
X1: A8 of Arduino Mega
Y1: A9 of Arduino Mega
X2: A10 of Arduino Mega
Y2: A11 of Arduino Mega
GND: GND of Arduino Mega
VCC: +5V of Arduino Mega
Touch Display:
Plug it into the Arduino board (or) Connect all pins as you would plug them into the board respectively.
Servo Motors:
S1 OUT: 22 of Arduino Mega
S2 OUT: 24 of Arduino Mega
S3 OUT: 26 of Arduino Mega
S4 OUT: 28 of Arduino Mega
GND: GND of Arduino Mega
VCC: +5V of Arduino Mega
Note: There is a small rectangular opening at the front of the control panel box so that the wires coming from the servo motors of the robotic arm can go inside.
After completing the wiring, close the top lid of the control panel box using some screws. Then move ahead to the next step!
Coding Showdown
Now comes the most essential part of the project- writing the code for the robotic arm to actually work! I have attached the code below for you to use/refer to at any point in time.
The code spanned a few thousand lines and would become too complex to comprehend if you just went through it. So, I have added comments, wherever necessary, to provide adequate context and help you in understanding the code way better.
After completing the step, move ahead!
Code for the Robotic Arm:
https://github.com/aaravgarg/Automated-Robotic-Arm-That-Learns
P. S. Leave a star on github if you like the project :)
Troubleshooting
If you are here, then I assume that you have built the project and it either worked which is great or it didn't which is also great because you not only will know how you build something but also how you do not build it and this kind of learning is very useful.
12.1 It Did Not Work 😲:
- 10.1.1 Display Blank: You have either burnt out your display or there might be an error in your code (for example, you might have forgotten to initialise the display). If everything seems alright, there might even be a possibility of wiring the display to the Arduino Board/PCB in the wrong way (in case you haven't connected it directly into the Arduino board) as there are a huge number of pins to be correspondingly connected.
- 10.1.2 Manual Mode Error: There is probably an issue either in the wiring of the servo motors of the robotic arm or the servo motors themselves have an internal error/issue which would call for a replacement of the concerned servo motor entirely.
- 10.1.3 Joystick Opposite Directions: This is just happening due to a reverse polarity in the respective joystick module and can be fixed by just reversing and correcting the polarity.
- 10.1.4 Automated Mode Error: If the servo motors are working just fine, any kind of discrepancy in the working of the automated mode will only be a result of an error in the code of the robotic arm.
12.2 It Worked 🎉🎊:
Great job mate. You overcame all the obstacles and are finally here, touching victory yourself and that is amazing. There is also a section down here called- "I Made It". Meet me there.
Thank You :)