Pages: [1]   Go Down
Author Topic: controlling 5 servo with values from flex sensor  (Read 2257 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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....  smiley smiley smiley smiley
Logged

Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 554
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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…

Code:
#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!
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8918
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 554
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This might be helpful.

http://arduino.cc/en/Reference/HomePage

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!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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........ smiley smiley smiley smiley smiley
Logged

Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 554
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.... smiley smiley smiley smiley smiley
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8918
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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=
« Last Edit: July 17, 2013, 10:42:45 pm by zoomkat » Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: