controlling 5 servo with values from flex sensor

i want to make an robotic hand that should be controlled by flex sensor.
all servo should be moving
simultaneously... without disturbing movement of other servos....
can anyone help me with code i have just bought an uno dont know much of arduino programming..
i know programming through atmega16 using eclipse...
please help me out this will be highly grateful.... :slight_smile: :slight_smile: :slight_smile: :slight_smile:

The program below uses two analog sensors to control two servos. This does not have all 5 servos you need, but should give you a place to start. Adding in the other sensors/servos should be easy. It's not perfect but It does work…

#include <Servo.h> 


int m1 = .1759530792;  
int s1 = 90;
int s3 = 90;
    
    
Servo base;
Servo arm1;

      

void setup() {
  
  base.attach(3);
  arm1.attach(5);

}

void loop() {
  

   s1 = analogRead(A0); // read the sensor
   s3 = analogRead(A1); // read the sensor
    
   s1 = s1 * .1759530792; // math (180 /1023 )
   s3 = s3 * .3519061584; // math (360 / 1023) 
    
 
arm1.write (s3);
base.write(s1);

delay(10);

}

Best of luck!

What flex sensors are being used? They may need to be setup as part of a voltage divider. Also, a forum search for flex sensor should produce previous discussions on the subject.

thanz drew davis .....
can you suggest me sites that could illustrate programming syntax of arduino....
it would be so nice of you..... :slight_smile: :slight_smile: :slight_smile: :slight_smile:

This might be helpful.

Also, are you going to have one flex sensor per servo or one flex sensor for all the servos? That will change the programming aspic quite a bit.

Best of luck!

i will be using 5 flex sensor.....
but i want to move a servo for a different combination of the sensors..... like nested if.....
and i want to do this with all the servos....
can you please show me how can i do that.....
thanz........ :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Do you know how analog sensors work? They return a value between 0 & 1023. My guess would be the harder you flex the sensor the higher the value goes but you will have to test it.

I need a little more info to help you out. Are you building a robot arm with the servos? Are you going to use a glove with the sensors in it? If you are do you want the robot arm to mimic the position your fingers are in? If not tell us the combinations you will be using. Please clearly describe your project. Tell us everything about it. What exactly are you doing.

yes i know the way flex sensor work.....and you are right harder we bend higher the output....
and yes i am making a robotic arm....but i am not governing it through hand glove with sensors in it like animatronic hand....
my task is to make a robotic hand that function when it find different bending on different points.......
i want that arm to function when specific values in the sensors....
like..

while (1)
{
analog read sensor 1
analog read sensor 2
analog read sensor 3
if(ConditionOne && ConditionTwo && ConditionThree)
{
Code to execute servo
}
delay(15)
}

i want to do this for all five servos where conditions are values from sensors

how to implement above in arduino programming....

thanz.... :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

i want that arm to function when specific values in the sensors....

How are you getting any specific values from the sensors, and what are they? Do you have a link to the sensors? If they are just a variable resistor setup, you will probably have to add some more components.

edit: possible reading material for your project:

https://www.google.com/search?as_q=flex+sensor&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=

hy guyz need your help how could i control 2 servo's positions using one flex sensor i just want that each bend of sensor generated different resistance so i just want if i bend my sensor in 0 degree means linear position servo will go fr straight if i bend my sensor 45 my servo will go fr right direction nd if i bend 90 degree my servo having wheel which go fr left position so plz guide me how could i managed my 2 servos using different bend position of my flex sensor

Try splitting that stream of conciousness into sentences or perhaps bullet points. Capital letters, English words and some punctuation might help. For example what on earth does "go fr right direction nd" or "bend 90 degree my servo having wheel" mean?

I think you start out mentioning 2 servos but after that you only talk about one servo. What happened to the other one?

Anyway first learn to use a servo. The examples in the IDE will help there. Then learn to get data from whatever flex sensor you have. I bet that comes with example programs too. Then put the two things together.

Steve