SG90 servo motor trubble

I'm quite new to Arduino programming but I thought I would experiment a little with a smaller SG90 servo engine. As I understand it will suffice to connect red to + 5v and brown to GND and them orange signal cable to a digital pin in this case 9 and then run example sketch (code) for servo sweep.

But unfortunately nothing happens ... The only movement I get from the motor is a little jerk when + and GND are connected. Have tested with external power to the motor, together with another Arduino UNO card but stil no movement.

I have also tried running the code without using the Servo.h library and instead specified the milliseconds for the pulse accordingly to the specification for the servo motor.

I tried with 3 different kind of SG90 motors with the same result.

Starting to get very frustrated since this shouldent be this hard according to the tutorials i found online.

Some pictures of my setup with external power (6v measured on the motor connector)connected to the motor.

It is not a good idea to draw power for a motor from the Arduino 5v pin as it cannot provide enough current.

Give your servo its own power supply and make sure the servo GND is connected to the Arduino GND.

I made this diagram for another recent Thread - obviously you don't have to use a LiPo battery to power your Arduino.

dindibo4-serv0.jpg

...R

Your circuit looks o.k. and generally a single SG90 will be fine even if you run it from the Arduino 5V pin (though it's not really good practice). And the basic Sweep example code works for thousands of us with no problems. You could try a different digital pin just in case pin 9 is bad.

Otherwise I don't really know what to suggest. Either your connections via the breadboard are bad or you have managed to get several bad servos (are they all from the same supplier?). I notice that they're not genuine TowerPro SG90s but there are plenty of cheap clones around that seem to work o.k.

Steve

Ignore the above advice. You can actually destroy an Arduino by running a servo or motor from the 5V pin, as they sometimes inject high voltage spikes into the leads.

Never attempt to power anything with a coil from the 5V regulated output.

jremington:
Ignore the above advice. You can actually destroy an Arduino by running a servo or motor from the 5V pin, as they sometimes inject high voltage spikes into the leads.

Never attempt to power anything with a coil from the 5V regulated output.

I guess I've just been lucky with the many times I've tested code running a single SG90 servo on several different Arduinos.

Just for interest have you actually seen any Arduinos "destroyed" by an SG90 or similar low-powered micro servo on the 5V pin? I've heard many dire warnings but I don't recall ever hearing of an actual problem.

Steve

I've destroyed quite a number of Arduinos by making faulty connections, but I have yet to make the ill advised mistake of overloading the 5V output by connecting servos or motors to it.

The scope traces showing 20 V spikes on the power leads of one servo were enough to convince me that doing so should NEVER be recommended to anyone.

@OP have you any other servos to try?

Have any friends with an rc control to test the servos?

There was a period here where some of the same type of servo would act like a continuous servo when using the

Sweep example. I like the Knob example to test servos.

jremington:
I've destroyed quite a number of Arduinos by making faulty connections, but I have yet to make the ill advised mistake of overloading the 5V output by connecting servos or motors to it.

So that's a no then?

While "Do not in general power random servos and motors via the 5V pin" (or for that matter via a breadboard) is excellent advice. in the specific case all the experimental evidence seems to suggest that SG90 and similar size servos, as used in just about every Arduino starter kit, are actually reasonably safe.

Steve

are actually reasonably safe.

Well, the beginners would never know what actually killed their Arduino, would they? The kit sellers are more than happy to sell them another one.

It does a disservice to everyone to recommend abusing an Arduino.

I have about 20 pcs of SG90 micro servro motors clones from from china :wink: So there is no problem testing with another motor, but since I already tested with 3 of the china servos and 2 other brands and 2 different ardunio boards and still has the same problem, I don´t think its the hardware fault.

The servo motor is connected to external power 6v.

I also tested switching to another pin instead of 9, but is there any way to troubleshot the pulse signal?

Link to china motor:

Link to the more recent motor I tested:
https://www.kjell.com/se/.mvc/Document/File?id=a813f46f-f16b-4728-a3a5-a93500f9da1d

Can you post your code? Don't forget to use the code tags.

The code is the sweeper exampel code only with som mods to the timing:

#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(13);  // attaches the servo on pin 9 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(30);                       // waits 30ms 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(30);                       // waits 30ms for the servo to reach the position
  }
}

I have set up another ardunio unit the check the pulse signal. I have connected pin 13 on the first unit to pin 3 on the secound one. With the following code running on ardunio nr 2:

#define PWM_SOURCE 3
int pwmin; 

void setup() {
  Serial.begin(9600);
}

void loop() {
  pwmin = pulseIn(PWM_SOURCE, HIGH, 20000);
  Serial.println(pwmin);
}

And I get some values in the serial console around 10 000. Please see attached picture.

serialprint.PNG

Finally got it to work! Sevral of the cables I used for the signal was bad.

Thanks for all the help turned out tog be a beginers misstanke