Step 6: CODE!!!

The Very first thing you want to do is make sure your shield or xbee's are unplugged from the arduino. Or make sure the correct jumpers are the in the right place (in my case). I have written this code and if you do use it want credit.

This is the code for the sending Arduino:

int Finger1 = 0;
int Finger2 = 1;
int Finger3 = 2;
int Finger4 = 3;
int Finger5 = 4;

void setup()

void loop()
byte servoValue1;
byte servoValue2;
byte servoValue3;
byte servoValue4;
byte servoValue5;

int FingerV1 = analogRead(Finger1);
int FingerV2 = analogRead(Finger2);
int FingerV3 = analogRead(Finger3);
int FingerV4 = analogRead(Finger4);
int FingerV5 = analogRead(Finger5);

if (FingerV1 < 200) FingerV1 = 200;
else if (FingerV1 > 460) FingerV1 = 460;
if (FingerV2 < 200) FingerV2 = 200;
else if (FingerV2 > 460) FingerV2 = 460;
if (FingerV3 < 200) FingerV3 = 200;
else if (FingerV3 > 460) FingerV3 = 460;
if (FingerV4 < 200) FingerV4 = 200;
else if (FingerV4 > 460) FingerV4 = 460;
if (FingerV5 < 200) FingerV5 = 200;
else if (FingerV5 > 460) FingerV5 = 460;

byte servoVal1 = map(FingerV1,460, 200, 255, 0);
byte servoVal2 = map(FingerV2,460, 200, 255, 0);
byte servoVal3 = map(FingerV3,460, 200, 255, 0);
byte servoVal4 = map(FingerV4,460, 200, 255, 0);
byte servoVal5 = map(FingerV5,460, 200, 255, 0);



Here is the receiving:


Servo myservo1; // create servo object to control a servo
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;

void setup()

myservo1.attach(2); // attaches the servo on pin 9 to the servo object

void loop()
if(Serial.available() >=5)
byte servoAng1 = Serial.read();
byte servoAng2 = Serial.read();
byte servoAng3 = Serial.read();
byte servoAng4 = Serial.read();
byte servoAng5 = Serial.read();

// Send the servo to the position read...  (note: you get to make this happen)

<p>Does this animatronic hand glove has any practical use ?</p>
<p>Yeah, Prosthetics, Space, Robotics... There are so many!</p>
<p>could you please send the wiring configuration for the pcb and arduino?</p><p>Mikeymirabella@aol.com</p><p>Thanks</p>
<p>Hey this is amazing!</p><p>Can you please send me to pcb diagrams, my email is ggalatis122@gmail.com</p><p>thanks!!</p>
<p>Awesome project</p><p>very impressive.</p><p>Manoj</p><p><a href="http://www.nrdcentre.com" rel="nofollow">www.nrdcentre.com</a></p>
Hello....could u please send me the PCB and interfacing details along with the code...it will be very helpful for me.... I will appreciate your help<br>My mail is abhishekdwivedi56@yahoo.com <br>
Can you please tell me the detailed making of this project or kindly send the wiring and pcb connection to prabha280796@gmail.com..
<p>awesome project!!!!!!</p>
<p>cool project... can you make a glove that mimics sign language so non-ASL users can talk with hearing impaired people, one that is voice activated? you speak, it &quot;spells&quot;? </p>
<p>can you please send me a clearer picture of the bread board at zaccymax@gmail.com</p>
<p>on your hand pcb shield what is number 1 for the servos going to</p>
Is it possible to make a full-scale human body with the same principle as your Instructable?
Theoretically, yes, but I think overall you'd have to find some super strong servo's, some super strong yet flexible piping and alot of time to do it. but overall NO, you'd have to create a biped platform for it to move as a human, costing thousands.
<p>For strong servos you can look into using an H-Bridge to connect to a couple of DC motors and attach a Potentiometer to track its position by reading the Potentiometer and external power source. You can go as strong as you want.</p>
<p>I think that the best thing to use for a robotic leg is Pneumatics or Hydraulics.</p>
<p>The biped platform wouldn't cost thousands. I have seen biped robots that were human sized and only cost around 500 usd.</p>
Oh, thanks for the answer.
Check out a video on you tube. <br>Search for 3d Printed humanoid. <br>The man has done amazing work building a humanoid robot with fantastic working hands and arms. His 3d files are free to download. He is also using Arduinos.
<p>Its called InMoov</p>
<p>I think a moving hand is a simple process compared to legs/feet and walking.</p>
hi! :) I made a model with help of this instructable and I won a competition......Thanks a lot NJKL44
<p>can u send me circuit diagram at sagar.nasac@gmail.com...</p><p>thank you</p>
<p>here is my prototype I made before</p>
Please mail me the circuit diagram at sunny.thesis@gmail.com
<p>Can someone please help me with the arduino code. I'm messing it up everytime :(</p>
<p>wow! i just loved this instructable :) can you please mail me the design and the circuit diagram :)</p><p>mizfitz511@gmail.com</p><p>thank u :)</p>
<p>It's possible with arduino UNO? I can't read more two signal in the serial port, why?</p>
Love this project! It has inspired me to build my own with a different design--a nice challenge for me. I'd like to know, though, how much did you purchase the flex sensors for? I'm broke and looking for something that I don't have to spend a fortune on. Most of what I've found online has been around $13.
<p>you can make your own. I have seen some people on here who have done so, but I am unsure of how well they work</p>
this projet can help disabled man?that's great!
<p>It actually can't. There are certain things a real hand has that this one is lacking.</p>
<p>So, In theory, if I were to rig this up in such a way to mimic my body, I could have a robot that would do exactly what I did?</p>
<p>Actually I am working on a project right now to do so. But you wouldn't want this hand, as its biology is very different from any humans, and it would be a piece of shit if you wanted to actually pick something up. I would recommend you use a 3d printed hand (such as the one from inmoov) if you wanted to do something like that, Also you would need a rotational sensor to detect certain movements (such as the forearm turn).</p>
<p>hi :) could you email the coding and circuit diagram please djalex2134@gmail.com </p><p>very interested in this and want to make it ! </p><p>i appreciate it if you can ! :) </p>
<p>Hi! .... Can you please give me a more detailed scheme for connecting the wires on the animatronic hand and on the glove on this email adress: jorgenkonini@gmail.com</p><p>i would appreciate it a lot !!</p>
<p>we also making this kind of hand.can you tell me is wrist movement and elbow movement are also possible.please answer</p>
<p>at first i'd like to congratulate you for ur efforts......</p><p>i'm interested in working on this module</p><p>so can u please send codes and circuit diagrams </p><p>itll be very helpful</p><p>mail it to abhishekpadmashali@gmail.com</p><p>thank you</p>
<p>Can u please explain the wiring and PCB properly or mail it on franknwamu@yahoo.com I will be greatful if you can </p>
<p>Can u please explain the wiring and PCB properly or mail it on tanishqjain340@yahoo.com</p>
<p>Can u please explain the wiring and PCB properly or mail it on tanishqjain340@yahoo.com</p>
<p>Hello,</p><p>Please can you tell me a measurement soft for the bend sensors values.</p><p>Thank you!</p>
<p>hey man... this looks cool i wanna build it too for my college project .</p><p>if u can give me the codes ands schematics i'll be highly obliged . my mail id utkarsh.1626@gmail.com . I'll be waiting for your reply . Thanks :)</p>
<p>..Hey great work.. I loved this post..Thanks for sharing <br>this information. &lt;a href=&rdquo; http://www.pcmofnc.com/&rdquo;&gt; Trailblazer SS <br>parts &lt;/a&gt;</p>
<p>..Hey great work.. I loved this post..Thanks for sharing <br>this information. &lt;a href=&rdquo; http://www.pcmofnc.com/&rdquo;&gt; Trailblazer SS <br>parts &lt;/a&gt;</p>
Hey! Is there anyway you can take a clear picture of all the bread board wiring, and the printed pcb? I'm having trouble reading your schematic. Thanks!
<p>How much would this cost?</p>
<p>i program my xbee in transparent mode but, i only can control one servo with one flex sensor , is necesary change the configuration of the xbee ?? or is the code of arduino?</p>
<p>Can you do this with an arduino mega cause i see that you say you have to remove the atmega328 chip, but you can't remove the arduino megas chip cause it is surface mount? </p>
<p>Really cool! I can't find where to buy flex sensors for cheap though, any suggestions?</p>

About This Instructable


589 favorites


More by njkl44: Hacking a Powerglove Arduino Wireless Animatronic Hand
Add instructable to: