3D Printed Prosthetic Arm
The main goal of the project was to minimize the use of the wires, and creating a fully functional arm that can replicate the gestures of the person controlling it. Using a hacked mind flexed, the user can send brain waves to to create a gesture for the hand.
Engineer
Koshiq H
Area of Interest
Medicine
School
Bard High School Early College
Grade
Incoming Senior
Final Milestone
Final Code
#include
/*
Analog input, analog output, serial output
Reads an analog input pin, maps the result to a range from 0 to 255 and uses
the result to set the pulse width modulation (PWM) of an output pin.
Also prints the results to the Serial Monitor.
The circuit:
– potentiometer connected to analog pin 0.
Center pin of the potentiometer goes to the analog pin.
side pins of the potentiometer go to +5V and ground
– LED connected from digital pin 9 to ground
created 29 Dec. 2008
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/AnalogInOutSerial
*/
// These constants won’t change. They’re used to give names to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
servo1.attach(10);
servo2.attach(6);
servo3.attach(9);
servo4.attach(11);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
Serial.println(sensorValue);
// map it to the range of the analog out:
outputValue = map(sensorValue, 700, 300, 20, 260);
// change the analog out value:
// analogWrite(analogOutPin, outputValue);
// print the results to the Serial Monitor:
Serial.print(“sensor = “);
Serial.print(sensorValue);
Serial.print(“\t output = “);
Serial.println(outputValue);
servo1.write(outputValue);
servo2.write(outputValue);
servo3.write(outputValue);
servo4.write(outputValue);
// wait 2 milliseconds before the next loop for the analog-to-digital
// converter to settle after the last reading:
delay(200);
}
Third Milestone
Code for Hand
#include
Servo thumb;
Servo index;
Servo middle;
Servo ring;
Servo pinky;
int flex[] = {0, 0, 0, 0, 0};
int angle[]= {180, 180, 180, 180, 180};
void setup() {
Serial.begin(9600);
thumb.attach(9);
index.attach(8);
middle.attach(7);
ring.attach(6);
pinky.attach(5);
}
void loop() {
for(int i = 0; i < 5; i++){
flex[i] = analogRead(i);
}
for(int finger = 0; finger < 5; finger++){ angle[finger] = (flex[finger]); angle[finger] = (angle[finger]*18)/30; if(angle[finger]>179){
angle[finger] = 179;
} else if(angle[finger]<0){
angle[finger] = 0;}
}
//thumb.write(180);
angle[3]=map(angle[3], 90,200,180,0);
Serial.println(angle[3]);
thumb.write(angle[3]);
Serial.println(angle[3]);
index.write(angle[1]);;
middle.write(angle[2]);
ring.write(angle[3]);
pinky.write(angle[4]);
delay(100);
}
Koshiq, this is so cool! I’m excited to watch your project progress.