Pages: [1] 2   Go Down
Author Topic: servo motor problem  (Read 4142 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all!

I'm quite new to the arduino UNO board, but i've already experimented the basic stuff (leds and so on). Now i'm tryin to use a servo motor (the blue bird bms-371), following various tutorial and using the example provided with arduino itself (the sweep example).
  I'm writing here 'cause i cannot get it working... Wired the red to the +5V on arduino, the brown to the GND e the orange to pin 9. Nothing appens. The same if the arduino board is powered via regulated dc wall adaptor. The only "movement" that i've been able to get appens when i disconnect and reconnect the +5V. In this case there is a little movement (say 5°).

What i'm doing wrong?

Thanks!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31431
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What i'm doing wrong?
I don't know as you haven't given anything to go on like a photo of what your setup is, or the code that you are trying to use. (use the # icon when posting).

Appen then something will happen.
« Last Edit: January 14, 2011, 06:40:06 am by Grumpy_Mike » Logged

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

Quote
Wired the red to the +5V on arduino

This is probably your problem. You generally can not power a servo or motor directly from an arduino. You need to use an external power supply.
« Last Edit: January 14, 2011, 10:39:48 am by zoomkat » Logged

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 I've gone not too deep in details because i've followed the tutorial proposed in the arduino servo library reference. This one: http://arduino.cc/en/Tutorial/Sweep to be precise.
Same code and same circuit.
Logged

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

Quote
Same code and same circuit.

Is it working for you? The below from the tutorial is generally bad info on powering a servo. Servos can use more power than can be supplied from a USB port.

Quote
The power wire is typically red, and should be connected to the 5V pin on the Arduino board.
Logged

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

0
Offline Offline
Full Member
***
Karma: 0
Posts: 186
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This is probably your problem. You generally can not power a servo or motor directly from an arduino. You need to use an external power supply.

To do much meaningful work with a decent sized servo or run multiples I agree. But to run the sweep example I disagree. I have run steering servos while the Arduino was powered by USB many times out of convenience to adjust trim. I looked up that servo and it is 4.8v analog and should work fine unloaded. As far as wires go, I see some odd color choices in pictures.  The +5 is always the center wire (except Airtronics!) and the darker of the two outside wires should be ground.

Do you have a servo tester?
« Last Edit: January 14, 2011, 12:32:07 pm by arbarnhart » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is it working for you?
No, it's not working. That's why i'm posting here...
Quote
Servos can use more power than can be supplied from a USB port.
Yes, i know. So i've tried powering the arduino board from a wall adapter, suppling 6 volts and up to 1amp (from his specs).
So, for what i know, it should'n be a powering problem.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do you have a servo tester?
No, i don't have one. But i've tried with two different servos, one of which as been reported to me as working (was used in a car model).
Logged

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

Quote
Yes, i know. So i've tried powering the arduino board from a wall adapter, suppling 6 volts and up to 1amp (from his specs).
So, for what i know, it should'n be a powering problem.

If you are powering the arduino from the wallwart via the arduino external power connector, this could be an issue, as the external connector usually requires something like 7v minimum for the power regulator chip to supply 5v to the board. You need to connect the servo red wire directly to the wallwart 6v, and have a common ground between the wallwart and the arduino board. If that doesn't work, then there are probably other issues that are in play.
Logged

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

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 5519
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Really - your answer will come a lot quicker if you post your code, post pictures of your setup, perhaps an image of your schematic.

You can tell us all you want that you are using the example - but that ultimately tells us nothing, because we don't know for certain whether you hooked it up properly, etc. For all we know, your breadboard may be the culprit!

Please - show us the circuit and the code!

 smiley
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 186
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try a different pin in the PWM range that you haven't used in any other tutorials. Just change the pin number in the code to match.

EDIT - Just saw the kat's catch on your 6v wall wart. He is right; you need to go to something higher.
« Last Edit: January 14, 2011, 12:37:05 pm by arbarnhart » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
if you post your code, post pictures of your setup, perhaps an image of your schematic.
Ok. Here's the code:
Code:
#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
int pos = 0;    // variable to store the servo position
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
 
void loop()
{
  for(pos = 0; pos < 180; pos += 10)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(50);                       // waits 15ms for the servo to reach the position
  }
  for(pos = 180; pos>=1; pos-=10)     // goes from 180 degrees to 0 degrees
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(50);                       // waits 15ms for the servo to reach the position
  }
}
Two little changes from the base example:
incremented delay (from 15 to 50 ms) and modified step size from 1 to 10 in for loop (obviously i've tried with the values in the example too)
And here's a picture of the whole:
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 186
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried it powered by USB?
No it isn't good practice in general, but it should have 5v on the 5v line that way (with 6v wall wart going through a VR, it's a different story).
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Have you tried it powered by USB?
Yes, i've tried with both: via USB and via wallwart
Logged

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

If the below is your servo, then its small size should allow it to possibly do some unloaded movement using the arduino 5v source (it is speced for 4.8v and I saw a post saying to not use 6v). Below is some simple servo test code I use that might be of use looking for your problem.

http://www.hobbycity.com/hobbycity/store/uh_viewItem.asp?idProduct=9444

Code:
// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);
  myservo.attach(7);  //the pin for the servo control
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(10);  
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    }
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray);
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  }
}
Logged

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

Pages: [1] 2   Go Up
Jump to: