0

enter image description hereI'm new with arduino (nano). I am having problems with Servo MG90S, I cant make it move. Im doing the easiest test, Servo cables connected:

Brown -> gnd
Red -> 5v
Orange -> pin 9

my arduino code is:

#include <Servo.h>
Servo servo;

const int servoPin = 9;

void setup()
{
  servo.attach(servoPin);
  Serial.begin(9600);
}

void loop()
{ 
  servo.write(40);
  delay(2000);
  servo.write(0);
  delay(2000);
}

As you see its a super simple example, but the result is the servo vibrating slightly.

Extra data: the servo start vibrating with the servo.attach(servoPin); it doesnt matters if I set the servo.write(40);

15
  • 1
    The parameter of Servo.write() is a value between 0 and 180, so -40 is not valid. Does is change something if you use 50 and 130 instead?
    – chrisl
    Commented Jul 9, 2023 at 14:59
  • No, the same result. Even if I only set the attach without the servo.write the servo is vibrating with no stop. I don't know if that is a normal behavior
    – Juan MP
    Commented Jul 9, 2023 at 16:39
  • 1
    Arduino power source is one of the most common problems. For example a 9 Volt battery may run an Arduino but is unlikely to have enough power to run a motor. What are you using as a power source?
    – st2000
    Commented Jul 10, 2023 at 22:45
  • Also, if you change your code please edit the question to reflect the change.
    – st2000
    Commented Jul 10, 2023 at 22:46
  • 1
    Wait, so... what is the USB connected to? The servo? May you, please, provide more detail? I could give an answer, but I am not sure what the EXACT problem is.
    – Austin
    Commented Jul 12, 2023 at 2:22

2 Answers 2

0

Okay, so here is the deal: I have looked up the datasheet for the Arduino Nano and the MG90S. The problem is: you may have killed your Arduino Nano. As the datasheet for the Arduino Nano says, "Max DC Current per I/O Pin... 40 mA." (The Datasheet for Arduino Nano). I am not sure if that's 100% of the issue, so, then I looked up the MG90S and it says "Current (typical during movement)... 120-250mA" (Also, another datasheet). Basically, all that means is that you MAY have to buy another Arduino because you may have used a servo that requires to much (for lack of a better term) "power." Using some math we see that you went approximately: 210 milli-amps over. Sorry.

0

Okay, so my first answer is WRONG. The reason being is because the MG90S and the SG90 (which are very similar servos, except the gearing and some others) CAN run off that Arduino. As this article shows: How to control the MG90S with the Nano. However, it IS best to run that servo off a separate power supply (5V). The issue lies within your wiring. Somehow, there is some miscommunication between us, you, and the Arduino.

6
  • I have tested the output voltage 5v pin -> 4.6v pin 9 with servo.write(0) -> 0.13v pin 9 with servo.write(180) -> 0.56v I don't know if these are acceptable values.
    – Juan MP
    Commented Jul 12, 2023 at 23:38
  • Do you know what I mean by "separate power supply?" I think you need some time to reflect. You seem to steadily NOT want to use another source for your servo. Why? I told you the answer, gave you an article, and even asked, kindly, for more details. What more do you want from me?
    – Austin
    Commented Jul 13, 2023 at 0:03
  • That article gives the EXACT instructions. *Edit - please edit your response with more detail, as I still can't seem to help you (which I really do).
    – Austin
    Commented Jul 13, 2023 at 0:04
  • Honestly, I think I am starting to second guess myself on my first answer. I will post it for your sake. I think you BURNT your Arduino. Outputting those results, they seem terrible. So, yeah, I think you BURNT your Arduino.
    – Austin
    Commented Jul 13, 2023 at 0:08
  • Sorry, I didn't realize there were two answers cause they appeared together and I only saw one. I think the other one is okey. Thank you for taking your time to help.
    – Juan MP
    Commented Jul 13, 2023 at 0:36

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.