Arduino Bionic Hand
A bionic hand, made easy(ish)! This project will take you through the steps of constructing a fully functioning bionic hand, made with nothing but some servos, PVC, Arduino and some ingenuity. This is a great intermediate level project for someone who wants a challenge in terms of engineering, along with coding. The project is completely modular as well, meaning you don't have to follow my instructions to a tee, and each hand can be different. I will just be guiding you through the steps of creating the basic structure. The rest is fully modifiable by you!
This hand specifically though will feature an ultrasonic sensor kill switch, and LED that lights up when the kill switch is active, and a joystick that controls all the finger motions.
Supplies
- Servos (min six)
- Arduino Uno
- Large Breadboard
- LED
- Ultrasonic Sensor
- Joystick Module
- Wire
- Popsicle sticks
- Cardboard
- 1/8 -1/4 PVC Piping
- Duct Tape
Creating the Fingers
Under the assumption you are creating three fingers like me, follow the steps below
Before we begin building, lets take a look at the anatomy of a human hand first, so we understand why we're doing what we're doing and how it'll all come together.
This is the bone structure of a human hand, and this is what we'll base our hand and fingers off of. Take a look at the top of the diagram, where they highlight the proximal, middle and distal phalanges. These are the three bones that are responsible for bending your fingers around so you can do motions like clawing and grabbing. We need to recreate this to some degree. The only issue with that is it would be far too complex to create three entire joints for an individual finger, so instead we will be combing the middle and distal phalanges into one, that way we only need two joints. One to move the proximal phalange, and one to move both the middle and distal phalange. Along with cutting down on how many joints we need, we also cut down on how many bone structures we need, taking it from three in one finger to two, due to combing the phalanges. The actual phalange in our models will be made from PVC pipe that we will cut.
Now you might be asking, how do we even move the fingers? It's quite simple. Take a look at the top right of the diagram, where they highlight the interphalangeal joints, these are the ligaments that connect two phalanges together, allowing them to bend and move independently. In place of these joints, we will have servos.
Now you see how this is coming together, we have PVC as our bones/phalanges, and servos as our interphalangeal joints. To actually build it we need to
- Cut the 1/8th - 1/4th PVC pipe into 6 portions, three of them being 6cm (acting as our proximal phalange) and the other three being 11cm (acting as our middle and distal phalange)
- Put a servo arm inside the proximal phalange and secure
- At the top of the proximal phalange attach another servo, then put that servos arm into your middle/distal phalange and secure
It should look like the images above. Repeat this step for as many fingers as you are adding, for us it will be 3 times.
Building the Palm
The palm is simple, as easy as a few sticks of popsicles and some cardboard. First things first
- Cut three pieces of carboard out into a square/palm shape and tape them together
- Attach three popsicle sticks to either side of the palm as shown in the image
- Tape the base of the proximal phalange servo to a popsicle stick, repeat for each finger
It should look something like the image above, though do note that was a version with four fingers, ours only has three.
Building the Base
The base is where the palm of the bionic arm will slide into, holding the whole hand up allowing it to move around freely. To build the base first
- Get a small box, 20cm x 15cm around that range
- Make a cut in the top and center of the box, large enough to fit the palm of the hand into it
Now if you've noticed, this box is way too light to hold up our hand, so we need to add weights to it. This is why I recommend getting two sandwich bags and filling it up with rice or sand and putting one on each side of the cut. This weigh weight is equally balanced out and it keeps the palm from shifting back and forth too much.
Completing the Base
To complete the base we need to
- Add a breadboard to the rear of the arm
- Create space for an Arduino (if you want be fancy you can create a brace/strut for the Arduino so it has its own designated area, like I did above.
- For extra support you can combine popsicle sticks and rubber bands to both the arm and the base to create a suspension bridge effect, holding up the arm via tension
The Code/Electronics
First things first we need to hook everything up, so here's where everything should be plugged in
- Ultrasonic Echo Pin ; 12
- Ultrasonic Trig Pin ; 13
- LED ; 11
- Bottom Index Finger ; 3
- Top Index Finger ; 4
- Bottom Middle Finger ; 5
- Top Middle Finger ; 6
- Bottom Ring Finger ; 7
- Top Ring Finger 8
- Joystick X ; 0
- Joystick Y ; 1
- Joystick Button ; 2
Note regarding Servos -
For the servos to get sufficient power and not suffer from constant servo jitter, I would recommend allocating one rail of the breadboard to 9V power, with all servo ground and power pins being plugged into that. Then have the second breadboard rail get 5V power from the Arduino, that's what all your electronics (joysticks, ultrasonic sensor) should be plugged into.
THE CODE
----------------------------------------------------------------------------------------------------------------------------------
#include <Servo.h>
//Servo objects created to control the servos
Servo myServo1;
Servo myServo2;
Servo myServo3;
Servo myServo4;
Servo myServo5;
Servo myServo6;
int echoPin = 12; // Declare the echo pin for the ultrasonic sensor
int trigPin = 13; // Declare the trigger pin for the ultrasonic sensor
int led = 11; //LED
int servo1 = 3; //bottomindexfinger
int servo2 = 4; //topindexfinger
int servo3 = 5; //bottommiddlefinger
int servo4 = 6;//topmiddlefinger
int servo5 = 7;//bottomringfinger
int servo6 = 8;//topringfinger
int joyX = 0; //Analog pin to which the joystick (X) is connected
int joyY = 1; //Analog pin to which the joystick (Y) is connected
int buttonPin = 2;
int threshold = 20; // Threshold distance for the ultrasonic sensor
int buttonState = 0;
long duration;
int distance;
void setup(){
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
myServo1.attach(servo1);
myServo2.attach(servo2);
myServo3.attach(servo3);
myServo4.attach(servo4);
myServo5.attach(servo5);
myServo6.attach(servo6);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop(){
myServo1.write(90);
myServo2.write(90);
myServo3.write(90);
myServo4.write(90);
myServo5.write(90);
myServo6.write(90);
int valX = analogRead(joyX); //Read the joystick X value (value between 0 and 1023)
int valY = analogRead(joyY); //Read the joystick Y value (value between 0 and 1023)
valX = map(valX, 0, 1023, 10, 170); //Scale the joystick X value to use it with the servo
valY = map(valY, 0, 1023, 10, 170); //Scale the joystick X value to use it with the servo
//Sets the servo position according to the scaled values.
myServo1.write(valY);
myServo2.write(valX);
myServo3.write(valY);
myServo4.write(valX);
myServo5.write(valY);
myServo6.write(valX);
delay(100);
buttonState = digitalRead(buttonPin);
Serial.print(" | Button: ");
Serial.println(buttonState);
delay(100);
//sensor
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration * 0.034 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
if (distance < 10)
{ digitalWrite(led,HIGH);
myServo1.detach(); // Stop the servo from moving
myServo2.detach(); // Stop the servo from moving
myServo3.detach(); // Stop the servo from moving
myServo4.detach(); // Stop the servo from moving
myServo5.detach(); // Stop the servo from moving
myServo6.detach(); // Stop the servo from moving
}
else {
digitalWrite(led,LOW);
myServo1.attach(3); // Attach the first servo
myServo2.attach(4); // Attach the second servo
myServo3.attach(5); // Attach the third servo
myServo4.attach(6); // Attach the fourth servo
myServo5.attach(7); // Attach the third servo
myServo6.attach(8); // Attach the fourth servo
}
Serial.print(distance);
Serial.println(" cm");
delay(500);
}