Haptic Controlled Robot Hand

This project brings together the DIY Haptic Control Glove and the Robotic Hand that I made earlier. The cost of this entire project was less than 25 US$. For details on how they were built and how they work, just follow the link for each.

This video demostrates the complete project.

1. Calibration of the glove
2. Control of the fingers
3. Touching finger tips of little and index fingers to demonstrate
thumb movement
4. Performing a simple task
5. Detail of servo movements

The movement of the fingers and the thumb was realised using two c++ classes called RobotFinger and RobotThumb that I wrote specifically for this project. I wrote these classes because I found that each servo had its own operating limits, that I would have had to keep track of throughout the operation of the hand. Also, because of the way they were fixed onto the hand, some servos flexed clockwise and others flexed anti-clockwise.

With the RobotFinger class, it now became easy to keep track of all these complications in the servos. The same idea was applied to the RobotThumb class.

Now if I needed to flex say, finger number 3 by 45%, I just needed to call the function finger[3].Flex(45)

And irrespective of clockwise/ anti-clockwise movement, a single function call like finger[i].Relax() would command all fingers to relax.

And if I needed the thumb to rotate by 30% and then flex by 70%, I would just call the function thumb.RotateAndFlex(30,70).

Safeties incorporated within the class definitions ensured that no servo would be allowed to flex beyond its limits and damage the control tendons/ burn itself out.

These classes are far from perfect and are just barely functional, but they are available for download here, if anyone would like to use/ improve them. Extract the archive and copy to your arduino /libraries folder.

While reading data from the flex sensors, I found that the values were very jumpy and the finger movement was jerky. I implemented a very rudimentary smoothing method to overcome this by taking about 20 readings and averaging the values before acting on them. This was done using totalAngle[i]/SMOOTH_CONST  in the code that controlled the servo motors. It will be quite clear if you read the code that runs on my Arduino UNO:-

#include "robotfinger.h"
#include "robotthumb.h"
#include <Servo.h>

#define SMOOTH_CONST 20 // smoothing loop size

//output pin allocation on UNO
//thumb rotator pin 3
//thumb flexor pin 5
//index pin 6
//middle pin 9
//ring pin 10
//little pin 11

RobotFinger finger[4];

RobotThumb thumb;

//sensor pins and sensor limits

int sensorPin[6] = {0,1,2,3,4,5};//all sensors on analog pins

int sensorMaxVal[6] = {0,0,0,0,0,0};

int sensorMinVal[6] = {0,0,0,0,0,0};

int finalAngle[6] = {0,0,0,0,0,0};

int totalAngle[6] = {0,0,0,0,0,0};//used for smoothing purposes to reduce jerkiness

//finger variables

int fingerPin[4] = {6,9,10,11};

int maxFlexAngle[4] = {140,180,180,180};

int minFlexAngle[4] = {0,20,20,50};

bool flexesAtMax[4] = {true,false,false,false};//is the finger flexed when servo is at maxFlexAngle?

int t0;

void setup()


t0 = millis();

//set up the thumb



thumb.SetFlexAndOppositionFlags(true, false);//when thumb is fully flexed or fully opposed, are the servos at their maximum angle?

//set up the fingers

for (int i = 0; i < 4; i++)


void loop()
//relax everything


for (int i = 0; i < 4; i++)
// run calibration for 20 seconds


for (int i = 0; i < 6; i++)
sensorMinVal[i] = analogRead(sensorPin[i]);

while (millis() - t0 < 20000) // calibrate for 20 seconds
for (int i = 0; i < 6; i++)
int sensorRawVal = analogRead(sensorPin[i]);

if (sensorRawVal >= sensorMaxVal[i])
sensorMaxVal[i] = sensorRawVal;
else if (sensorRawVal <= sensorMinVal[i])
sensorMinVal[i] = sensorRawVal;


//    Read Continuously

//run a large smoothing loop of ten iterations

for (int h = 0; h < SMOOTH_CONST; h++)

for (int i = 0; i < 6; i++)
//read each of the analog pins

int readVal = analogRead(sensorPin[i]);

//proportionalise the raw reading to within max and min

constrain(readVal, sensorMinVal[i], sensorMaxVal[i]);

//calculate the final GOTO angle for each actuator

finalAngle[i] = abs(1.1*(readVal - sensorMinVal[i]) * 100/ (sensorMaxVal[i] - sensorMinVal[i]));

//make sure the final angle is ok in terms of sign and value

if (finalAngle[i] < 0) finalAngle[i]*=-1;

if (finalAngle[i] > 100) finalAngle[i] = 100;

if (finalAngle[i] < 20) finalAngle[i] = 0;



//move the fingers

thumb.RotateAndFlex(totalAngle[0]/SMOOTH_CONST, totalAngle[1]/SMOOTH_CONST);
//     Serial.print("T Rot:");
//     Serial.print(finalAngle[0]);
//     Serial.print(",T Flex:");
//     Serial.print(finalAngle[1]);

for (int i = 0 ; i < 4; i++)
//       Serial.print("F(");
//       Serial.print(i);
//       Serial.print(") Flex:");
//       Serial.print(finalAngle[i]);

for (int f = 0; f < 6; f++)
totalAngle[f] = 0;




28 thoughts on “Haptic Controlled Robot Hand

  1. WOW!! Next time I visit maybe I will be served tea by the robot! You must name him….even though he is only a baby still.

  2. Hello. The files for the classes are no longer downloadable. Can you please reply soon? I need to build the project for a class.

  3. sorry to kind of repeat my previous comment, but since the files aren’t accessible, could you please email me the classes?

    • Sorry about responding so late. I was out of station on holiday. I uploaded the file again and the download link is working now. If you still have problems, let me know and I will email you the file.

      • Thank you. I was able to download the file, but after uploading the libraries RobotFinger and RobotThumb, I verified the code by copy pasting it in Arduino 1.0.5 and Arduino 0023 (an older version) and got this error message:
        In file included from sketch_jul14a.ino:2:
        /Users/vardaanbhat/Documents/Arduino/libraries/Robot_Thumb/robotthumb.h:6:74: error: /home/vu2aeo/arduino-1.0.5/libraries/RobotFinger/robotfinger.h: No such file or directory

        Do you know what the problem might be? If so, could you please help me?

        Additionally, I was wondering if there was any way to wirelessly control an Arduino compatible board (micro magician V2 by Dagu) with the glove. Do you know of any way?
        Thank you so much.

      • Change this line to conform to the location where you have saved robotfinger.h …….

        /home/vu2aeo/arduino-1.0.5/libraries/RobotFinger/robotfinger.h: No such file or directory

        There are lots of ways to implement wireless control. NRF24L01 is a cheap and reliable way to exchange data over a small distance. All you need to do is to encode finger movements into motor commands. Its quite straightforward. What sort of project are you trying to implement?

      • Thank you. My current project will be involving a tadpole robot kit with a micro magician V2 board(http://letsmakerobots.com/content/new-micro-magician-v2) . I am planning to attach the glove to a separate arduino board, most likely an arduino uno, and then, i will add an ir led to transmit certain commands to my Tadpole according to how much i flex or move my finger. Do you think this would be possible? I have a Sony remote, and the micro magician board on my tadpole robot currently receives signals from that remote, but do not know how to transmit the same specific signals to the tadpole robot using an ir led attached to an arduino uno. Do you think I could do so, and do you know how? Sorry for all the trouble, and thanks.

      • To replicate signals from your Sony remote, you will first need to decode them. I did this with a Nikon remote control quite successfully. Look here…


        If you are looking for a non-invasive way to do this, you could use a TSOP 1738 IR receiver connected to an Arduino to receive and decode signals from your Sony remote. You will need to read the output pin on the 1738 to do this. After that you will need to write the code to replicate these signals from an IR LED. It may be easier to see if someone has already done this for your particular remote control. This is a great library to decode IR signals with an Arduino….


        Everything is possible given enough time….are you doing this for a time bound project at school/ college or do you have plenty of time for this?

      • I just made a quick trip to fry’s and bought all the components for the glove, but bought a pcb without leads (none of the lines).
        I was wondering if to make the glove, I needed to buy a grid style pcb, with all the connection points connected, like the previous link, or one without the lines would work.

      • Well, I am doing this for a robotics merit badge class, and the project will be due in about 4 weeks, on the 10th or 11th of August. Because it’s summer break, I have some days where I will have some hours at a stretch for the project. So I think it will be possible.

    • I would definitely not choose a PCB to begin with. Your project needs plenty of experimentation and using a PCB may become very frustrating. Buy a breadboard to start with…..get everything working correctly…..then invest in a PCB.

      • Yes. I have bought a breadboard, but was just wondering if I would need a lined circuit board, or if something like this would work AFTER i have tested the circuit on a breadboard: file:///Users/vardaanbhat/Library/Containers/com.apple.PhotoBooth/Data/Pictures/Photo%20Booth%20Library/Pictures/Photo%20on%207-16-14%20at%206.43%20PM%20%232.jpg? It’s a standard prototyping pcb board, from twin industries, part #8000-45-LF (just in case you weren’t able to see the picture

      • By lined circuit board i mean one with those copper-looking lines, as is shown in your glove video. Some boards don’t have those lines on them, like the one in my picture, which was why i was wondering. Is it true that those are conductive traces and can be made by connecting two pins on a pcb with solder?

      • If I can find time (I have music and academic classes, campouts, and sports!), I will definitely try to make my own PCB with my dad, which sounds like a good project. Also, could you take a look at the Micro Magician V2 on Google, if you have time, because i was wondering if the IR receiver on that would suffice for encoding the signals from my Sony remote, because that is what i have on hand, and want to test the signals before purchase of an Arduino Uno. Thank you so much!

      • Your micro magician v2 looks ideal for a project like this. There should be no problem with the IR connectivity.

        But to do anything significant with this board, you will need to understand how to use a motor driver, control servos, and maybe have to develop your own IR protocol (maybe with error checking) to issue commands to your robot.

        Its a lot of work. Take it step by step. Do small things first and then integrate them into a larger project. If you try too many things at the same time, it may become terribly frustrating when it doesn’t work and you can’t really determine which component of your project is not working properly.

        Good luck.

      • Also, is there a site you could recommend for learning languages like c, as well as electronics (circuit schematics, how to work circuits and connect wires), since I am a novice in the field, but wish to learn much about it? Thanksk

    • Thank you for your advice. Luckily, my board is compatible with sony remotes, without further tinkering, and I know how to control the motors, so I hope the project will work. I’ll contact you if i need help via comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s