Introduction: Robotic Arm - DIY
Ever since I was a kid, I always wanted to make something really cool. Unfortunately for the younger me, I didn't have enough knowledge at the time to make anything. But now, I know a bit of electronics and I whipped up this project during my winter break.
Basically I've created a robotic arm using cardboard, servos and other stuff with which fingers could be moved using flex sensors in accordance with the movement of our own fingers.
If you have any suggestions, leave it in the comments.
Step 1: Components Required:
- Servos
- Flex Sensors (5)
- Cardboard
- Tape
- Strings
- Arduino
- Resistor (5 x 1k ohms)
Step 2: Flex Sensors:
What are they?
Flex sensors are sensors which vary the resistance if they are bent from their original state. Basically, it's a variable resistor.
Interfacing with Arduino:
Arduino cannot read resistances, but it can read voltages through its analog pin. So, we create a voltage divider circuit.
One thing to keep in mind is that these sensors are very fragile, so try to keep them safe and don't handle them roughly.
Connect the flex sensor to the Arduino like in the picture above. After connecting them, plug in the Arduino to your laptop and PC and open Arduino IDE. Use the below code to get the Maximum and Minimum value. In its original state, it will give the minimum value. When you bend the sensor to a 90-degree angle, you'll get the maximum value. After uploading the code, open the serial monitor to find these values. Note down these values.
int flexsensor = A0;
int val;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(flexsensor);
Serial.println(val);
delay(50);
}
Courtesy of Images: Google
Step 3: Servos:
I am not going to talk about how servos work in this instructable. There are other tutorials online to help you with that.
Servos have three terminals GND (brown), Vcc (red) and signal (yellow or orange). Connect Vcc to 5V of Arduino and GND of the servo to the ground of the Arduino. The signal goes to PWM pins of the Arduino represented by the ' ~ ' ( tilde ) symbol. Another thing to know is that servos move from 0 to 180 degrees. So the Arduino IDE has a library to send signals which send out degrees to the servos.
The Flex sensor is going to be attached to our fingers, so when we move our fingers the Flex sensors move too and hence the resistance changes. Because of this, Arduino reads different values from its analog pin.
Remember from the last step we got max and min values from the sensor. We'll be using those values to map it to 0 to 180 degrees.
#include
Servo x; //define object
int flexpin=A0;
int val;
int maxval = 870; //redefine the maxval according to your sensor
int minval = 750; //redefine the minval according to your sensor
void setup()
{
x.attach(9); //Servo attache to pin 9
}
void loop()
{
val = analogRead(flexpin);
val = map(val,maxval,minval,180,0); // Map the values from 0 to 180
x.write(val);
delay(10);
}
The above code is for 1 servo and 1 flex sensor.
Step 4: Mechanical Fingers:
https://www.dropbox.com/s/m3jh0iiqwm2vx0e/robotic%...
I got this from Science toymaker
Download the image and take a printout of it and paste it over a thin cardboard sheet.
Cut along the lines(continuous) and make creases along the dotted lines. After doing this you'll get rectangular cuboid which will be very similar to a finger. There are two parts of the image, the left one is the flexible one and the right one is for stability. I didn't use the right one, but you guys can use it if you want.
Repeat the same for the other four fingers. After this, place them on a base to represent the palm. Attach a string from the top of the finger through the hollow inside and finally to the bottom. If everything is done right, the finger should move if you pull the string.
Step 5: Attaching Everything:
Place all the servos on the base. Move the servos initially to 0 degrees. After this, place the attachment you get with the servos. Attach the strings to the servos. Repeat all the connections for the servos, Flex sensors for the other four fingers.
I had only one flex sensor, so I used it to control all 5 servos. Here I've modified it so that each flex sensor control 5 independent servos.
#include
Servo x;
Servo y;
Servo z;
Servo a;
Servo b;
int flexpin=A0;
int val;
int maxval=850;
int minval=700;
void setup()
{
Serial.begin(9600);
x.attach(9);
y.attach(10);
z.attach(11);
a.attach(5);
b.attach(6);
}
void loop()
{
val = analogRead(flexpin);
val = map(val,maxval,minval,180,0);
Serial.println(val);
x.write(val);
y.write(val);
z.write(val);
a.write(val);
b.write(val);
delay(10);
}