Sign in to our website and become an InMoov member. It will allow you to post message, pictures, and share with others InMoov builders. It's just one click away!
Username or Email Address
Password
Remember Me
Marten de Groot posted an update 9 years, 1 month ago
So here a simple test video from the FingerStarterKit: (At this moment, I only use the default servo pulley which is included by the servo)
Here the Arduino code, which has a servo slow function included:
#include
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer int val; // variable to read the value from the analog pin int Pos;
void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object }
void loop() { val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) if (Pos > (val + 1)){Pos = Pos -1;} if (Pos < (val – 1)){Pos = Pos +1;} myservo.write(Pos); // sets the servo position according to the scaled value delay(15); // waits for the servo to get there }
Here a direct link to download the the code: https://copy.com/oAbFa2h1JoIPBVc7
Hi Marten, I always like to see videos, they tell so much more than words! That carbon filament is great looking! I did make a Arduino script when I was testing the carbone foam sensors on the finger starter. I’m wondering if I still can find it in all my data. It could maybe help you or others, as I recall it was a bit of a different approach.
Found the script back in my data base:
const int servoPin = 3; const int sensorPin = A0; int sensorReading;
int pos = 0; // variable to store the servo position
Servo myservo;
void setup(){ Serial.begin(57600); myservo.write(0); // Open finger. pos = 0; myservo.attach(servoPin ); }
void loop(){ sensorReading = analogRead(sensorPin); Serial.print(“Analog reading = “); Serial.print(sensorReading); // the raw analog reading // We’ll have a few threshholds, qualitatively determined if (sensorReading < 57) { Serial.println(" – No pressure"); } else if (sensorReading < 70) { Serial.println(" – Light touch"); } else if (sensorReading < 80) { Serial.println(" – Light squeeze"); } else if (sensorReading < 100) { Serial.println(" – Medium squeeze"); } else if (sensorReading =0; pos-=1){ myservo.write(pos); // Go to open position delay(10); } }
void closeFinger() { for(pos = 0; pos 57) break; } }
Hi Gaël,
Thanks for sharing your code to.
The best way to use this sort sensor, is to include a servo slow (step-based movement) which I have included in my code. The code what I’ve shared isn’t the code what we need right now. It was just to test the reaction from the sensor as I showed you in Eindhoven.
If we use a step-based movement, the Ardiuno can check after each step the position and if the sensor will hit his maximum, it can stop the servo at right position at the right time ! If this step-based check not will happen, the servo can still get burned because you are to late to correct/stop the servo !
A other thing what can help, is to include a sort acceleration by each new movement. This can safe a lot of energy/power use from each servo. I’ve ask this question also at MRL and I hope this can be a default setting or slider like the Max and Min positions. This last option can safe a lot of servo’s before they will burned.
I’m not sure when I can implement the sensor in the Finger Starter Kit. I hope soon. (It’s now a busy time at my work)