0

I ordered some cheap servos from Amazon before I noticed that there seemed to be two different kinds (digital & analog).

Mine are Tower Pro SG90 Analog (http://www.towerpro.com.tw/product/sg90-analog/)

I was trying to get mine to work with an extremely simple sample code (below) using the Arduino Servo library (using digital pin 3) and I was experiencing the jitters.

I read over the solutions at : https://electronics.stackexchange.com/questions/77502/is-there-a-way-to-stop-servos-from-shaking

While reading that I learned that there is also a digital flavor of the servo: http://www.towerpro.com.tw/product/sg90-7/

I'm wondering if that is part of the problem I'm seeing with the servo jittering. I haven't seen this addressed elsewhere.

My questions are:

  1. Are those servos even different? Maybe that is just a marketing thing??
  2. Do I need to switch to using an analog pin for the servo data connection?
  3. Is it even possible to use the Arduino Servo library for this purpose or do I need to use some manual code (like analogWrite()) and move the servo to an analog pin?
  4. Or, should it work completely fine and the jittering is just some unrelated problem?

Here's the simple code I'm using:

#include <Servo.h>
Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(3);  // attaches the servo on pin 3 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // 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(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}
5
  • 1
    "Analog" servos are the traditional PWM form which example servo code assumes - in fact the term "analog servo" is rarely used in the hobby context as those are the normal type, while "digital" would designate something supposedly premium, either incorporating a microcontroller inside and/or communicating by some more complex scheme. If you're having a problem, it is something other than the use of a traditional style servo. Commented Jun 4, 2018 at 21:02
  • If you want to put that as an answer I will set as answer. The distinction of analog v digital on that tower pro site confused me. Thanks.
    – raddevus
    Commented Jun 4, 2018 at 21:04
  • Seems like it would be more useful if you edited this to be about your actual problem. Commented Jun 4, 2018 at 21:10
  • That's a good point. I was just thinking of people who have the jitter problem and notice the analog v digital servo and then find this and have an specific answer that it is not the problem. There's a lot of discussion about the servo jitters out there. :)
    – raddevus
    Commented Jun 4, 2018 at 21:13
  • 1
    In general, embedded processor like an Arduino have less jitter problems than processors running an entire OS like a Raspberry Pi. This is because the embedded processor is likely only controlling the servo while the processor running an OS is busy sharing its resources with all the other normally running processes in an OS.
    – st2000
    Commented Jun 5, 2018 at 1:00

2 Answers 2

1

Jitter can be caused by a lack of power, in which case it will be an irregular pattern that leaves the servo in the wrong place or it can be caused by the increment commands not being sent to the servo smoothly enough.

Have you got enough power for the servo? Where is the power coming from, does this output match the datasheet?

This analog servo requires PWM, so is pin 3 of you board PWM capable?

How fast does you servo rotate? At the moment you are saying 1degree every 15ms, I suspect that is too slow and that's why the arm is coming to a stop and then rotating again which is making it jitter.

1

There's a discussion here about the difference. The short answer is they both are commanded by a PWM signal but differ in the internal control circuitry that responds to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.