Simple robot finger

I've done a robot finger with a few servos and arduino.

check video here: http://www.youtube.com/watch?v=qb_tp7guSes

can you post some more info about this it looks really cool

can you post some more info about this it looks really cool

the magic is done by a flexible sensor i bought on sparkfun.com

the code is very simple, read the sensor output, and encode to 0-180 degrees.

code and wiring diagram? :)

Ok here is the code:

#include <Servo.h>

int smoothAnalog(byte pin, int samples) {
  unsigned long result = 0;
  int tmp;
  
  for(tmp = 0; tmp < samples; tmp++)
    result += analogRead(pin);
  
  return result/samples;
}

float get_range_size(float min, float max) {
  if (max < 0.0)
    return -min + max;
  else
    return max - min;
}

float value_to_range(int value, float input_min, float input_max, float output_min, float output_max) {
  int tmp;
  float input_range_size, output_range_size;
  
  input_range_size = get_range_size(input_min, input_max);
  output_range_size = get_range_size(output_min, output_max);
  
  if (value < input_min)
    value = input_min;
  if (value > input_max)
    value = input_max;
    
  return (((float)(value-input_min)*output_range_size)/input_range_size) + output_min;
}

Servo servo;

void setup() {
  servo.attach(2);
}

void loop() {
  int value;
  
  value = smoothAnalog(0, 20);
  servo.write((int)value_to_range(value, 700, 850, -90, 90));  // empiric values
  Servo::refresh();
  delay(10);
}

and the diagram:

thnx :)

ops, i forgot to say, that i connected 2 servos at the same control pin, and the video is the result.

u need to add 2 flex sensors that control each part of the finger knuckle.. i hope u know what i mean :)

cool idea!

I was just wondering what kind of servo brackets those were and where you got them. thx!