i just started with Arduino and tried to use the servo sweep from the example.
The servo just won´t move
I checked the servo with a servo tester and even tried 2 other servos.
If i upload the example with the blinking led that works so the arduino should be working which is a Nano connect RP2040 btw.
I´ve also connected the servo to different ports and an external power source but it doesnt move.
At this point i have no idea what im doing wrong I haven´t changed anything in the example code so far exept the port, please help.
It looks like this only that i connected the servo to port 9 on the arduino.
And its a basic 9g Hobbyservo so i think the power supply of the Board should be enough.
#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(9); // 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(15); // waits 15 ms 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 15 ms for the servo to reach the position
}
}
Do not attempt to power servos or motors from the Arduino 5V pin, and ignore any tutorials that recommend doing so (for example, the first one in post #6). You can damage the Arduino by doing so.
Use a separate power supply (4xAA works well for 1 or 2 small servos, like SG90), and don't forget to connect the grounds.
I agree with you that we should not power the servo motor via 5V pin.
But for quick testing servo motor with no load, I think connect to 5V pin temporary is acceptable.
The first link of post #6 clearly states that: "For the sake of simplicity, the above wiring diagram is used for the testing or learning purposes, and for small-torque servo motor. In practice, we highly recommend using the external power supply for the servo motor. The below wiring diagram shows how to connect servo motor to an external power source"
I don't. The damage done can be instantaneous, as servos briefly draw the stall current every time they start moving, and the electrical noise generated in the 5V line can inflict other damage.
thanks for all the tips and help.
I am VERY new to this and just want to build some automation in my rc submarine.
I did connect the servo to pin 9 its just wrong in the schematic i found on the internet.
After the servo didn´t work on the 5V line i tried it with an external power source and also connected the grounds but it still doesn´t even move at all.
Now i have some questions:
Did I maybe destroy something on the board with trying to connect the servo on the 5V?
Why do I have to connect the grounds? (I did it but I don´t really understand why)
In the examples they always use Arduino Uno boards, can the Nano RP2040 even use servos?
For common GND, when two system (Servo and Arduino) communicate to each other, they needs a common potential reference. The common potential reference is GND. In the electronic, we have a concept "potential difference", it meant It needs a point of reference, the reference point is GND.