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);
2 Answers 2
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.
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.
-
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– Juan MP2023年07月12日 23:38:08 +00:00Commented 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– Austin2023年07月13日 00:03:23 +00:00Commented 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– Austin2023年07月13日 00:04:35 +00:00Commented 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– Austin2023年07月13日 00:08:01 +00:00Commented 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– Juan MP2023年07月13日 00:36:19 +00:00Commented Jul 13, 2023 at 0:36
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?