Go Down

Topic: Need some help for a science project. (Read 10 times) previous topic - next topic

arduinohabib

What is man's best friend? The breadboard!

JimboZA

Excellent....

Word of caution with servos: even tiny ones are quite strong and they move quite quickly.

Here's what I'd do: build a dummy "test" finger that you can afford to destroy if the servo goes wild... That way you won't rip your whole hand to pieces. Then set up a test rig with that finger and a servo mounted on a wooden frame or something, and or rope some folk in to hold stuff for you. Position the servo and its horn so that it looks like it will pull smoothly, then turn the servo motor by hand to test it, ie not under power! Note that where you push the horn onto the servo- called a spline- you can position the horn on the teeth to get the best angle.

You've used the sweep program you said?- so modify that just to sweep from say 0 to 10 and back. Increase the delay to much longer one just to be safe, and then make it smaller again once you check nothing is snagging. If you get a snag I think the servo might tear stuff, so be careful.

Well done so far... you're doing great and you get 10/10 for persistence!
No PMs for help please. Not active on this forum any more.

arduinohabib

Do you need help programming the Arduino?
What is man's best friend? The breadboard!

Falchion

Robots are cool.

JimboZA


I need all the help I can get.


Yeah but not to the extent where you don't learn anything.....

Get one servo working, clenching a finger using sweep as I suggested, with suitable changes for the range of movement and the delay.

Then tie another string to another servo.... change the program to have more than on servo attached and double up the part that does the movement of say myservo1 and myservo2 (or finger1 and thumb or whatever) and get two fingers or knuckles or whatever clenching.

Get each piece working as you go, and save old versions of sketches so you can backtrack to the last version that worked if you make a screwup
No PMs for help please. Not active on this forum any more.

Falchion

I don't understand how to add multiple servos to the breadboard... I read this tutorial (http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html),and I don't get how he added the last 4(?) servos towards the end. I did Sweep on the Arduino UNO, but I don't think there are enough ports on it to support many servos at once. Can I get some help?  :(
Robots are cool.

PaulS

Quote
I did Sweep on the Arduino UNO, but I don't think there are enough ports on it to support many servos at once.

A port consists of 8 pins. It only takes one pin to drive a servo. The UNO has more than enough pins to drive 4 servos.

JimboZA

#52
Jan 21, 2013, 04:15 am Last Edit: Jan 21, 2013, 04:17 am by JimboZA Reason: 1
Quote
I don't get how he added the last 4(?) servos


Well you only need one pin per servo for control remember, the power being taken care of off the Arduino. Let's say you have the following lines in your code (extract from sweep):

Code: [Select]
Servo myservo;

myservo.attach(9);

myservo.write(pos);


You could have this (incomplete code!) for three servos:

Code: [Select]
Servo myservo;
Servo myotherservo;  // <<<< note new names; you would call these "thumb", "middlefinger" maybe
Servo yetanotherservo;

myservo.attach(9)
myotherservo.attach(10)  // <<<<<<< note the new pin numbers for the yellow / orange control wire
yetanotherservo.attach(11)

myservo.write(pos);

myotherservo.write(pos);

yetanotherservo.write(pos);


So how did you get on yesterday?- Did you get one finger clenching and unclenching?

Quote
What is that cord on the battery holder called? I really need one.


No idea
No PMs for help please. Not active on this forum any more.

Falchion

I'm on step 3 of this tutorial (http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html) and the servo doesn't move when I upload the sketch. Can I get some help?
Robots are cool.

Quick5pnt0


I'm on step 3 of this tutorial (http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html) and the servo doesn't move when I upload the sketch. Can I get some help?


Post your sketch and a picture of your wiring.

Falchion

// Multi Sweep, Duane B
// Using the servo library created by Michael Margolis
// to control 12 Servos with one Arduino Uno

#include <Servo.h>
// Sample sketch for driving 12 Servos from an Arduino UNO, servos are attached to digital pins 2,3,4,5,6,7,8,9,10,11,12,13

#define CONNECTED_SERVOS 12

// macro just adds two - the first servo is attached to digital pin 2, this gives us upto 12 servos - digital 2 to 13
#define SERVO_TO_PIN(x) (x+2)

Servo myServos[CONNECTED_SERVOS];

#define COUNT_DOWN -1
#define COUNT_UP +1
#define INCREMENT 10 // move in steps of 10 milliseconds

int nPulseWidth = DEFAULT_PULSE_WIDTH ; // 1500, defined in servo.h
int nDirection = COUNT_UP;

volatile unsigned long ulStart = 0;
volatile unsigned long ulStartToEnd = 0;

void setup()
{
  // attach the servos
  for(int nServo = 0;nServo < CONNECTED_SERVOS;nServo++)
  {
    myServos[nServo].attach(SERVO_TO_PIN(nServo));
  }
 
  // the library sets all servos to 1500 ms pulse width by default, this is center for a steering servo
  Serial.begin(9600);
  Serial.println("Completed setup"); 
}

void loop()
{
  delay(10);  // give the servos time to move after each update
 
  if(ulStartToEnd)
  {
    Serial.println(ulStartToEnd);
    ulStartToEnd = 0;
  }
 
  nPulseWidth += nDirection * INCREMENT;
 
  if(nPulseWidth >= 2000)
  {
    nPulseWidth = 2000;
    nDirection = COUNT_DOWN;
  }
 
  if(nPulseWidth <= 1000)
  {
    nPulseWidth = 1000;
    nDirection = COUNT_UP;
  }
 
  for(int nServo = 0;nServo < CONNECTED_SERVOS;nServo++)
  {
    myServos[nServo].writeMicroseconds(nPulseWidth);
  }
}
Robots are cool.

JimboZA

#56
Jan 22, 2013, 04:09 am Last Edit: Jan 22, 2013, 04:11 am by JimboZA Reason: 1
Hi-

I can't figure that circuit out from that pic. What's that mishmash of wires on the breadboard?

You need to take a clearer pic- maybe straight down from above?- and also draw a circuit on paper and post that as well.

Here's a test you should do: with the circuit like it is, use the SWEEP sketch. If necessary change the pin number in sweep to match the pin you used for the servo control- looks round about pin 10 or so from that photo?- and compile and upload to Uno.

Code: [Select]
myservo.attach(9); <<<<<<<<<< make sure this number is correct in sweep

Assuming sweep works, you'll at least know that the servo and the circuit are good. If servo doesn't sweep, and we know the sweep sketch is good, then you can try see what's wrong with the circuit.

Edit.... To make your sketch easier to read, when you post code you should select it all and hit the # button above the  ;) smiley. That formats the code like mine in this post.
No PMs for help please. Not active on this forum any more.

Falchion

Here a close up.
Robots are cool.

JimboZA

Quote
Here a close up.


Still can't make it out, it's very fuzzy and the angle's crap. We're trying to help, but you're not making it easy for us.

Draw the circuit neatly and take a clear pic of that.... You could also use Fritzing to make a pic: advantage of that is that as you do the Fritzing pic it kinda forces you to think about the circuit.
No PMs for help please. Not active on this forum any more.

Falchion

#59
Jan 22, 2013, 06:17 am Last Edit: Jan 22, 2013, 06:19 am by Falchion Reason: 1
I'm downloading it right now. Sorry for the late replies.
Robots are cool.

Go Up