Powering servo with a load on it

Hello to all...

I have a 100% working system that remotely (IR) controls the volume pot on a vintage Luxman amplifier. A futaba micro servo drives a belt that rotates the shaft. It makes no noise unless requested to move the servo.
When I try to convert my working system (basic stamp) to an Arduino Uno I get servo noise & chatter after a command unless I manually help the servo find it's neutral position.
Now before we question the power supply, note that it is rock solid at 5 volts and the servo is fed seperately.
No load on the servo shows no problem. In this application, there is a sizeable load on this servo due to the belt tension.
The software I'm using is based on the standard Arduino servo stuff freely available. The physical circuit is also the simple servo circuit as seen on the Arduino site...no mystery there.

if (key == 146) myservo.write (pos+= 4); //volume up (+)
if (key == 147) myservo.write (pos-= 4); //volume down (-)
if (key == 144) myservo.write (pos+= 1); //minor volume up (+)
if (key == 145) myservo.write (pos-= 1); //minor volume down (-)

Simplyfing the software to go to only go to one position does not rectify the problem either.

My question is this...

I cannot convert my Parallax stamp project to Arduino, why not? On a scope would the microcontroller servo outputs be identical?

Rocinman

Parallax stamp uses pulsout() 500-1000 from left to right, arduino's servo.write() 0-180. Is that ok with your code?

When I try to convert my working system (basic stamp) to an Arduino Uno I get servo noise & chatter after a command unless I manually help the servo find it's neutral position.
....
No load on the servo shows no problem. In this application, there is a sizeable load on this servo due to the belt tension.

I assume you're using a servo modified for continuous rotation. Yes, no, don't know?

A regular servo will chatter if the load torque is more than the torque the servo can
provide. A servo modified for continuous rotation will chatter when you send a
1500-usec pulse to it, and it's not perfectly adjusted to stop turning with that signal.

When I try to convert my working system (basic stamp) to an Arduino Uno I get servo noise & chatter after a command unless I manually help the servo find it's neutral position.

Could be stripped/slipping gears due to the load on the servo. Got a link to "The physical circuit is also the simple servo circuit as seen on the Arduino site...no mystery there." There has been a schematic showing a servo powered from a arduino 5v pin which may cause issues. Servos work better at 6v than 5v. Below is some simple code for testing a servo using the serial monitor.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 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.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7, 500, 2500);  //the pin for the servo control, and range if desired
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}

Thank you for your quick responses...

Pito: The parallax stamp is using a pulseout range of 250 to 1090 & the servo is staying away from the end points (150 degrees total travel). This means that I can specify 2/10 of a degree with each unit of pulseout. Seems more precise than the Arduino. With the Arduino servo library I'm using I can only specify degrees which are 5X more coarse than the Stamp. Does anyone know how to modify the Arduino to allow 2/10 of a degree of granularity?

oric_dan: The resisting torque is within the servo capabilities (.6kg-cm) and recall the servo works perfectly with a Stamp driving it. The servo is a Futaba S3111 unmodified so no continuous rotation.

Zoom_cat:
When powered by the Stamp it goes to setpoint & stops - with no chatter, the gears are therefore OK. With the Uno, the audible noise is a big problem when listening to music. For this particular servo (it's small) use of 6.0 volts is not recommended. But hey,I'm going to try it anyway! Last note...The link in your post appears as a "cut/paste buffer output"

Final thoughts...Is there a servo program that can do more precise servo movements? It seems like I'm not nulling the servo position after a command. I could likely fix it in the software by going past setpoint & them returning 1 or 2 degrees. I think the Arduino is exceptional at many applications I just can't understand why the Stamp BS2 does this so easily however.

Rocinman

Seems more precise than the Arduino

Have you tried the Servo method "writeMicroseconds"?

Arduino(noisy servo) vs basic stamp 2 (silent servo)

Here are the latest test results...

-Dedicated 6.0 volts at the servo still allowed noisy servo chatter in fact it even seemed louder!. It was a good try. 6.09 V Open circuit, drops to 5.9 V during rotation then back to 6.03Volts while buzzing.

-Using the writemicroseconds program (thks,zoom_cat) and even with a simple example resulted in the same servo buzzing. I tried adding various delays with no luck.

The servo moves very nicely, even quickly and a manual adjustment by hand I can null the error & stop the loud buzz completely. Kinda defeats the purpose of a remote.

Does the Basic Stamp 2 use more bits? What's the update frequency of pulses out in the Arduino? There was no delay included in the writemicroseconds Arduino example, whereas the Stamp uses 20 ms as the repetition pulse period.

Again, this is a tricky one for me as I have 3X more experience with the Parallax Stamp and I really would like to understand the differences. Thanks AWOL for the writemicroseconds option.

Rocinman

With the Uno, the audible noise is a big problem when listening to music.

Your problem may well be that the arduino servo lib keeps on sending positioning signals to the servo even after the servo must have got to that position .. so you keep hearing a click click sort of noise. As AWOL said use writeMicroseconds to construct your own servo control code.

You can base the code on the servo lib or (as I do) the "blink without delay" example.

Mark

The parallax stamp is using a pulseout range of 250 to 1090

This makes no sense to me, as servos use pulsewidths between 1000 and 2000 usec
for typical 90-deg movements [ie, +/-45 deg around the 1500-usec center position],
and roughly 750 - 2250 usec for maximum rotation.

Also, from my experience, the Arduino servo library does not produce buzzy servos,
if everything is proper.

If everything else is ok, ie servo power = steady 5-6V and torque overload = not,
then the 2 problems that present themselves are (a) your actual s.w. [which you've
not shown] is faulty, or possibly given the quote above, (b) you have the servo horn
positioned off-center, and your pulses are driving it to over to one of the mechanical
stops. That always buzzes.

holmes4:
As AWOL said use writeMicroseconds to construct your own servo control code.

I don't think that's what AWOL said - and I doubt that the Stamp stops sending the pwm signal when the servo reaches the right position.

It seems to me that the problem is the servo is not quite reaching the target position and it is not a good enough servo to get there without some external help. Whether it gets there or not would depend on the electrical and mechanical properties of the servo, and the precise timing of the servo signal (which should be the same between the two platforms, but might be fractionally different) and also whether the servo movements are commanded as step changes or with accel and decel phases. It may be that relatively small changes to the servo movement might be enough to cause and cure the problem.

-Using the writemicroseconds program (thks,zoom_cat) and even with a simple example resulted in the same servo buzzing. I tried adding various delays with no luck.

Did you set the serial monitor to 9600 baud rate when you tried my code? Also, a poor ground between the servo power ground and arduino ground can cause erratic behavior.

Problem resolved & a big thanks to all who contributed.

The Arduino is able to control a servo in the background while working on other tasks. It has to be detached to stop this process. The BS2 cannot do this multitask role so that's the reason there was no chatter with the BS2 since it would go to position & the program would not call the pulseout until needed. No pulses supplied & no torque to work against (volume control pot) so no noise.

I corrected the software to this...which works perfectly (original s/w at top of post)
if (key == 146) {myservo.attach(6);myservo.write (pos+= 4);delay (22);} //volume up (+)
if (key == 147) {myservo.attach(6);myservo.write (pos-= 4);delay (22);} //volume down (-)
if (key == 144) {myservo.attach(6);myservo.write (pos+= 1);delay (22);} //minor volume up (+)
if (key == 145) {myservo.attach(6);myservo.write (pos-= 1);delay (22);} //minor volume down (-)
if (key == 148) {myservo.attach(6);myservo.write(0);delay (500);pos=0;} //mute (+)
if (pos <=0) {pos=0;}
if (pos >=160) {pos=160;}

Zoomkat- your servo files were helpful.
PeterH-your answer explained it all! Top Marks for you.
Oric _dan - The BS2 works on 2 microsecond pulses so pulseout is done with half the values. Any platform can produce a buzzy servo if the load is preventing full nulling, in addition, the sound is amplified by having the servo bolted to a chassis.
Summary - The Arduino is better than I thought for servos. The servo can be controlled in the background while the program does other stuff. This was always a challenge with the BS2 & made programming "loop time sensitive".

Score = Uno for Arduino, 0 for BS2.

Rocinman

The Arduino is able to control a servo in the background while working on other tasks. It has to be detached to stop this process.

As others haven't really had the issue you describe, I suspect that there is something in your code causing the problem, maybe use of interrupts and such.