Hi everyone, in this Instructables, I want to share how I built my Robotic Arm. I know there are many Instructables out there about robotic arms but, while doing my research, I always had some questions left after reading. So, my goal while writing this guide was to make it as complete as possible to help you build your own robotic arm! Also, I made my robotic arm without using 3D printing or laser cutting which make it very easy to build. Finally, the robotic arm is fully programmable. By programmable, I mean that you can, through an android app I coded, save the positions of the arm under a program. After, you can choose, on the app, the program you want to run. The arm will then repeat the sequence over and over.
So, if you want to learn more about how to make a robotic arm, code it, hack a joystick to control your arm, make a bluetooth code to receive the programs and code an android app, you are at the right place!
Just a heads up, English is not my first language. I have done my best to be very clear with all my work, but i do apologize if at any moment you have a hard time understanding. Happy reading :)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Features
The arm has 5 DOF. I am using 6 servos to control it. The arm has two modes: automatic and manual.
In the manual mode, you can control the arm using a joystick. In the automatic mode, the arm will repeat a sequence of movements over and over again.
In an Android application, you can create and save different sequences. You can then select the sequence you want and send it to the arm via bluetooth.
Step 2: Before Starting...
Before you start building and buying everything, it would be a great idea to read a bit about robotic arms. It would be very unfortunate if you built everything just to find out that your servos is too weak for your arm. To avoid this happening to you, I recommend that you read this. Also, do all your calculations before hand to know the torque you'll need for every servo. Keep in mind that all the specs found on the Internet are very generous. While doing your own calculations, it would be safer to reduce the torque of the servos by around 50/75%. If you decide to follow this build, you should be able to lift around 70g.
In this guide, I am giving you the measurements I used. You are free to modify them to suits your own needs.
Also, it's a good idea to have a general understanding of how servomotors works and how to control them before you begin the project.
Step 3: Parts and Materials
Since I am an 19 year old student, I was trying to go for the cheapest build possible. However, I also wanted the arm to have a decent sphere of influence.
Here is a list of the main parts you will need.
To control the arm, we need 6 servos.
- Screws and nuts
- Small wheel x 4
- Servo brackets (the ASB-24 and ASB-05)
- An old joystick with a game port connector
- A bluetooth module
- 2 banana plugs
- 5 x 10k ohms resistors
- 2 x around 350 ohms resistors
- A switch
- A red and a green led
- A dremel can be helpful
Step 4: Prepare the Servos Horn
To attach the servos to your arm you'll need to drill two holes in the servos shaft (figure 1). You need to do this for three horns: the horn for the base, the shoulder and the elbow. You'll also have to find bolts with the appropriate width and length.
To attach the horn to the arm, start by attaching it to the arm (figure 2 & 3). Then, use the middle hole to screw it into the servo (figure 4 & 5).
(Ps: The arm segment and servo in the pictures were not used in my final build)
Step 5: Cut the Base
The base is what holds the weight of the arm. I also used it to hide all the electronics inside of it. I also made one side of it with Plexiglass (figure 1) that I could move to access the electronics.
The base is made with 4 major pieces: the top, two sides and the bottom. The specs for the box are 30x30x10cm. They are illustrated in figure 2. Don't forget to cut out a rectangle in the middle of the top part for the base servo. Make the rectangle so that it will match the specs of the servo you chose. I used a dremel and a rasp to make the hole. As you can see, I made the hole a bit to big so I had to use a piece of wood and tie wraps (figure 3) to secure it in place.
Once all the parts are cut, assemble the box as shown in figure 4. You can then put the base servo in place. For the empty sides, I put a Plexiglass panel over one of them and the other side will be used to put all the connectors.
Step 6: Make the Rotating Disk
The rotating base was tricky to make. First, cut a disk with a radius of 10 cm.
Now, we have to attach the shoulder servo to it. I did this by making a wooden box where I could screw in the servo (figure 1 & 2). Make sure the shaft of the servo is aligned with the middle of the disk, near one of the extremities. Next, you can attach the 4 wheels to the disk (figure 3). Now, make a hole in the back of the disk where you'll be able to fit all the wires.
Lastly comes the the tricky part. You will need to add some wood under the disk so you can attach the rotating disk to the shaft of the base servo (figure 4 & 5). The amount of wood you add needs to be just perfect so the shaft can be attached to the servo horn.
In the middle of the disk, make a hole of about 1 cm in diameter. Attach the servo horn to the the extension using bolts. After that, put the servo horn in the shaft and use the middle hole to screw them together.
Step 7: Make the Segments for the Arm
The arms were hard to make without using laser cutting technology. I had to choose my materials carefully. For the first segment, I used two opposite layers of coroplast that I glued together (figure 1). To glue it, I used cement glue (figure 2). Coroplast is weaker than wood but it is much easier to cut. For the second segment, I used wood. The first segment is 30 cm long and the second one is 20 cm.
For each segment, cut out a rectangle 2 cm from the edge to fit your servo. Next, drill three holes at the bottom of the piece. The middle hole is at 2 cm from the bottom edge. The holes are used to attach the segment to the shaft of the other servo (figure 3 & 4).
Since the the first segment has a bigger load, I decided to attach another piece to support it. To do so, I drilled a few matching holes in two pieces and attached them together with four bolts (figure 6). At the end of the support, I tapped some foam to reduce the wiggling of the second segment of the arm (figure 5).
Step 8: Assemble the Segments
Once your pieces are cut, it's time to assemble them!
Start by attaching the horn of the shoulder servo to the first segment. You can then fix your elbow servo in the rectangle of the first segment. You can easily screw it in the coroplast. Once it's done, attach the first segment to the base. Then, use the middle hole to screw them together.
Now, attach the horn of the elbow servo to the second segment and screw the wrist servo to the second segment. Attach the second segment to the first one by putting the elbow servo horn into its servo. Screw them together using the middle hole.
You can now attach the support segment to the first one.
Your build should now look like an arm!
Step 9: Assemble the Gripper
For the gripper, start by attaching the C bracket and the multi-purpose bracket together. You can then attach the servo that makes the gripper rotate to the bracket. Screw in the gripper to that servo and then fix the last servo to the gripper.
And voilà! Your build is done. Now, time for the electronics and the code.
Step 10: The Electronics
The electronic circuit is pretty basic. It's composed of four major ciruits: one to control the servos, one to control the inputs of the joystick, one for the power (switch and led) and one to rule them all (the Arduino).
You'll need a bluetooth module to connect the arm to the app. The module is connected to RX and TX. However, you can't upload your code if they are connected so you'll have to connect them at the end.
To power the arm, you'll need a power supply that can provide 6 volts and up to 4 amps. I used my homemade bench power supply. If you don't have one, they are pretty easy to make!
Step 11: Circuit for the Servos
This circuit is pretty easy to do. Just wire all of the power inputs of your servos together and wire it to your power input. Do the same thing for ground wires. As for the signals, wire them as follows:
- Base → pin 4
- Shoulder → pin 5
- Elbow → pin 6
- Wrist → pin 7
- Rotation of the gripper → pin 8
- Gripper → pin 9
Step 12: The Joystick
In order to use a joystick to control my robotic arm, I needed to determine which pin of the game port was in charge of doing what. To do so, I used the pinout and a multimeter to determine which button was connected to which pin (figure 1).
Afterwards, I had to connect the pins to my Arduino. I found a lot of helpful information while reading this blog. To connect the joystick to the Arduino, you can use a scavenged female game port and then solder some wires on it.
To connect the buttons (white wires in figure 3), connect them to one of the Arduino digital pins and to 5V using a 10k resistor. To connect the potentiometers (orange wires in figure 3), connect them to one of the Arduino analog pins and to GND using a 10k resistor. They are wired as follows:
- Joystick → Arduino pin
- Top button → 2
- Trigger button → 3
- X pot → A0
- Y pot → A1
- Wheel pot → A2
After this, you can test your circuit using the sketch provided in the blog linked above. To make my circuit more permanent, I decided to solder it on a perfboard (figure 4).
Step 13: The Power Circuit
For this circuit, you'll need to solder a bit. Since I wanted to make my arm as easy to use and transport as possible, I decided to put all the connectors on the front panel that I screwed to the base (remember there were two open sides?).
First, start by cutting a wood panel (it should be around 30 x 10 cm). Then drill the holes for your parts:
- Two holes for the banana plugs
- Two holes for the led
- One for the switch
- One for the female game port adapter
- One for the arduino uno
You can then secure all the parts in their holes with hot glue.
Now, time to solder! Start by soldering a wire to the black banana plug that will go to the GND of your Arduino. Solder everything else as shown in figure 1. The resistors in front of the leds need to be around 350 ohms.
Step 14: Code for the Joystick
Before we start coding, we need to figure out how a joystick works. In a joystick, there are potentiometers. As shown in the link, each pot is attached to an axis. As a result, when you move the arm, you are changing the resistance of the pot and thus the voltage that goes to our Arduino. It's this change of voltage that we can detect with the Arduino. The Arduino will read a value ranging from 0 to 1023.
(The functions in italic are related to what we want the arm to achieve)
Now, we need to decide how we'll control 6 servos with only one joystick. For my arm (this might differ depending on your joystick), I decided that the button you press will change the motors you move. For example:
- If no button is pressed; the X axis controls the base and the Y axis controls the shoulder
- If the top button is pressed; the X axis still controls the base but the Y axis now controls the elbow
- If the trigger button is pressed; the X axis controls the rotation of the gripper and the Y axis controls the wrist
- At any time, moving the wheel on the side will open or close the gripper
However, we don't simply want to map the position of the joystick to the angle of the motors because it would mean that we would have to keep the joystick in the same position to keep the arm still. To fix this problem, we will have to first find the middle values of the pots (calibration). After, our goal is that the angle of the motors will change depending on how much we have moved the joystick. This being said, we will need a function that does a small calculation to determine how much we moved the arm (modificationAngleX et modificationAngleY).
But to do all that, we will also need a function that reads the values of the joystick (getValueJoy).
Step 15: Automatic Code
Now that we can move the arm with the joystick, we want the arm to be able to repeat the same movements again and again.
To do this, I created 6 arrays. Each servo has it's own array. In each array, there can be up to 10 positions. To move the arm, we want the Arduino to move all 6 servos to the first position of their array and then to the 2nd and then 3rd and so on. Once we reach the last position or there are no more positions, we want the arm to restart from the beginning.
However, if we leave it like this, the movement of the arm will be jerky. To fix this, I made it so that the arm will go to the next position by increasing his angle by one until it gets to the desired angle (goToAller and goToRetour).
It's great that we can now repeat the same movements but it could get boring if it's always the same. This is where the Bluetooth code comes into play.
Step 16: Bluetooth Code
Now comes the hard part of the Arduino code. It was my first time programming serial data with Arduino so it took me a while.
First of all, we need a function that sends all the angles to the app (sendJoyAndroid). This function was easy to make but it caused a lot of problems when receiving data. So I had to put a condition to only send the data if we weren't receiving any. We also have to send '#' at the beginning because it's what the app will be looking for.
Next, we need a function to read incoming data. The objective for this function is to take the data sent by the app and put it in our arrays that will be repeated over and over again. To make this function, we first need to know what we are going to receive. The app is going to send the programs under this form: ~programname+0,0,0,0,0,0,0,0,0,0;1,1,1,1,1,1,1,1,1,1;2,2,2,2,2,2,2,2,2,2;3,3,3,3,3,3,3,3,3,3;4,4,4,4,4,4,4,4,4,4;5,5,5,5,5,5,5,5,5,5;
The code I wrote is able to detect each character and if the character is:
- '~' start reading
- '+' store the program name
- ',' increase the index by 1
- ';' change the array and reset the index
- None of these: build the string
I had a few problems while writing this code. For instance, I kept experiencing a serial overflow causing me to lose some data. To fix this, I had to put a lot of delays so that it takes longer to send the code to the Arduino from the app.
My code is far from being pretty but it works! I tried to comment in it as much as I could to make it easy to follow. Originally, my code was written in French and in English, so I put the English version of the variables in comments. So here is the code for the Arduino!
Step 17: The App
The app is the most advanced code I have ever written. It took me a while to do it and I ran into many issues. This might be because it was my first time making an android app and that I had never coded in java before...
In the app, you are able to: connect your phone to the arm, load a saved program to the Arduino, start or stop the arm from running the program and create a new program.
How to control your arm?
- First, choose your robot arm in the device list
- Then, click the "manuel" button at the top to switch to the automatic control
- Once in automatic, select the program you want in the spinner
- Once your program is selected, click on “load" to send it to the Arduino and wait a few seconds
- Once your program is loaded, click on “run" to start running it or “stop" to stop it
- If you want to create a new program, click on "new program"
- Here, you can create a new program that has up to 10 positions
- Move the arm to the first position using the joystick then click on "save position"
- Do this for every position until you have finished your program (pro tip: Smaller movements will make your arm more fluent)
- Once you are satisfied with your positions, give a name to your program and click on “save"!
Here, you can download all the files I used to make the arm. You'll find the apk (to download the app), the sketch up file, the Arduino file and all the Android studio files.
Step 18: Future Improvements
For the future, there are a few improvements I would like to make. Most of them come from my lack of experience with java but a few are related to the Arduino or the build.
- Add some leds to the arm to see what’s happening. For instance, a blue led could blink while the program is loading and a yellow led could indicate when a program is running
- Add visual feedback on the app to know when a program is being sent. For instance, disable the buttons or show a message
- Increase the maximum of steps a program can have
- Make it so when you press stop, the arm stops immediately and doesn’t finish the program
- Decrease the loading time
- Make a support on the rotating disk so the support segment doesn’t wiggle around
If you know how to do any of these things and want to work on the code, feel free to do so! It would be happy to see your work.
Step 19: Conclusion
First of all, thanks for reading through! I hope you found this guide helpful and please feel free to vote for me in the contest if you liked it. If you have any questions, don’t hesitate to ask me. I’ll do my best to answer you as soon as possible. If there’s any problems with my code, let me know and I’ll try to fix it as soon as possible. And more importantly, share your builds in the comments! I would love to see them.