Greetings,
i'm still a beginner with Arduino coding and i need to do a project involving robotic prosthesis hand. For my project, i need to move the prosthesis hand using flex sensors. I have bought flex sensors online via Amazon and calibrating it following these two Youtube videos.
Youtube video links:
Make a Flex Sensor for Robotic Hand and Arduino | DIY - YouTube (Calibrating flex sensors)
How to Make Arduino DIY Foam Robot Hand - YouTube (Assembling the flex sensors to the servo of the prosthesis hand)
This is an example of flex sensor number 1 that i have modified using my flex sensor specification based on the first youtube video:
#include <Servo.h>
Servo servo1 ;
const int flexpin = 0 ;
void setup()
{
Serial.begin(9600) ;
servo1.attach(9);
}
void loop()
{
int flexposition ;
int servoposition ;
flexposition = analogRead(flexpin) ;
servoposition = map(flexposition, 788, 1023, 0, 90) ;
servoposition = constrain(servoposition, 0, 90) ;
servo1.write (servoposition) ;
Serial.print("sensor: ") ;
Serial.print(flexposition);
Serial.print(" servo: ") ;
Serial.println(servoposition);
delay(1000);
}
Then i continue with the second video with this (i only put the coding for the flex sensor no 1 here):
#include <Servo.h>
Servo servo_1 ;
Servo servo_2 ;
Servo servo_3 ;
Servo servo_4 ;
Servo servo_5 ;
int flex_1 = 0 ;
int flex_2 = 1 ;
int flex_3 = 2 ;
int flex_4 = 3 ;
int flex_5 = 4 ;
void setup()
{
servo_1.attach(5) ;
servo_2.attach(3) ;
servo_3.attach(9) ;
servo_4.attach(10) ;
servo_5.attach(6) ;
}
void loop()
{
int flex_1_pos ;
int servo_1_pos ;
flex_1_pos = analogRead (flex_1) ;
servo_1_pos = map (flex_1_pos, 1020, 1023, 180, 0) ;
servo_1_pos = constrain (servo_1_pos, 0, 180) ;
servo_1.write (servo_1_pos);
}
My problem is after i completed the assembly, it seems that the servo motor does not respond when i bend the flex sensor. I try to connect only 1 flex sensor but the problem still arise. Is there something i did wrong with my assembly, coding or etc?
Your help would be much appreciated. Thanks