3D Printed Robotic Hand: Part 6 -- More Programming and Debugging


With how I left things the last time, I wasn't getting the full range of motion of the servos. So this wouldn't let me close the hand all the way. Some fingers barely moved at all. So I did some more programming and debugging the programs for the hand and glove. But I still couldn't get the full range. Then I just decided to just rewrite the whole program this time without having the need to use the Adafruit Servo shield to control the servos. I referenced
to the instructable:


I followed the code with also incorporating the wireless part of the other instructable from Gabry295:


So by just simply looking at the two programs I was able to create this program. I had to change some numbers of the program. I had to find the range in which the flex sensors were being read. Each finger had a slightly different range. So I calibrated each finger individually. At first I only choose one range to use for all the fingers, but some of the fingers didn't use the whole range or just probably a small part. So this didn't translate well when I remapped the range to degrees from 0 to 180. So calibrating each finger was the preferred way. Once that was done, I tested it and the results I got were what was shown above.

As you can see in the video, the hand is pretty responsive to the glove's movement. The only thing was that the thumb was pretty sensitive to slight movements of the glove. But this could be fixed with just a simple calibration of the thumb. I believe the range that I used for the thumb was probably to small so it caused it to act pretty jumpy. 

This time with this setup I get the full range of motion of the servos. This is what I was looking for. I'm really happy with the way the hand works now. The only con to this setup is the many wires that are everywhere to connect to the breadboard and the Arduino. But I could probably use a smaller breadboard to take up less space. Also, the fingers don't close all the way but this could be fixed by retightening the strings and by also placing them at the most outer holes of the servo horns. 


Now that I had the hand finally working understanding the programming much better, I decided to look back at the program and try to incorporate the Adafruit Servo shield to get rid of the many wires that connected to the breadboard. I thought I had a better understanding of the PWM servo control concept but I was somewhat wrong. I didn't understand it as much as I thought I did. But I did manage to control the servos with the use of its full range of motion. It took some trail and error with the range of pulse length and frequency. 

I just ended up using the same frequency of the example for the Servo shield with also the same range for the minimum and maximum pulse length. The results I got is what is shown in the second video above. 

The hand follows the glove's movement but there are times where the hand just freezes. I don't know what's causing this behavior but it does work periodically. I think I might just stick to the other way, without the use of the servo shield.

If you have any questions or would like to know anything about the setup, just drop a comment and I'll try to get back to you as soon as possible.


June 18, 2015


  1. This comment has been removed by the author.

  2. Hello Gerardo,I am a Vietnamese student so please forgive me if my English so bad. I have make this DIY robotic hand for a month, i use a arduino uno, a xbee shield like you but i can't find lilypad xbee shieldso i decided to make a glove look like the glove in this image from Gabry295 : http://www.instructables.com/file/FH9EAWDHWVAO99M/
    And i used a 3,7 v,800mA nokia battery for lilypad , is it okay ? .When everything was in the right position, i try to bend a flex sensor but nothing happenned ,the servor did rotate,i dont know what i did wrong, this is video my project : https://www.youtube.com/watch?v=vFUybx5yu_Y
    Can you teach me what i did wrong ? or send me your lastest codes for the hand and the glove so I can try to test them again with mine ? I look foward to hearing from you soon.

    1. Hello Le Nhan,

      I looked over your video and it's pretty hard to tell where you went wrong. I noticed that you have soldered 6 resistors onto the LilyPad instead of 5. But maybe you're planning on controlling an extra servo.

      I'm not sure about the battery. But I don't think using the Nokia battery will do no harm since it looked like it powered your LilyPad and it's in the range of the operating voltage of the LilyPad. So I think that's ok.

      Another thing I noticed was how you wired your flex sensor. It looks like you used one copper wire to connect to the two terminals of the sensor or maybe two separate copper wires that seem to intertwine. If it's in either of those configurations that I have written, then that may cause a problem in the setup.The two terminals on the flex sensor shouldn't be short circuited.

      I will try to upload the last code that I used to control the arm with the glove. But my code still has the issue where the thumb would periodically jump. But I will try to upload it today on a new post. I'll let you know.

      Good luck!

    2. Here is the link to the new post with the codes that I last used:


      I hope it helps.

    3. Thanks you very much for your help and enthusiasm, I will try it right now, i will tell you when ít work