Pages: 1 2 3 [4] 5 6 ... 9   Go Down
Author Topic: Need some help for a science project.  (Read 8530 times)
0 Members and 1 Guest are viewing this topic.
Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

[highfive/]
Logged

What is man's best friend? The breadboard!

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 91
Posts: 4227
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you need help programming the Arduino?
Logged

What is man's best friend? The breadboard!

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need all the help I can get.
Logged

Robots are cool.

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 91
Posts: 4227
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?  smiley-sad
Logged

Robots are cool.

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49046
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 91
Posts: 4227
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Servo myservo;

myservo.attach(9);

myservo.write(pos);

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

Code:
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
« Last Edit: January 20, 2013, 10:17:25 pm by JimboZA » Logged

Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Robots are cool.

NE PA
Offline Offline
Full Member
***
Karma: 5
Posts: 156
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

// 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);
  }
}


* photo-1.jpeg (358.18 KB, 1280x960 - viewed 28 times.)
Logged

Robots are cool.

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 91
Posts: 4227
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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-wink smiley. That formats the code like mine in this post.
« Last Edit: January 21, 2013, 10:11:08 pm by JimboZA » Logged

Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here a close up.


* photo-1.JPG (340.36 KB, 1280x960 - viewed 24 times.)
Logged

Robots are cool.

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 91
Posts: 4227
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm downloading it right now. Sorry for the late replies.
« Last Edit: January 22, 2013, 12:19:10 am by Falchion » Logged

Robots are cool.

Pages: 1 2 3 [4] 5 6 ... 9   Go Up
Jump to: