1

I'm trying to run my DS3218MG Servo Motor with an external power supply and my arduino nano.

I'm using the following code:

#include<Servo.h>
Servo Myservo;
int pos;
void setup()
{
Myservo.attach(3);
}

void loop()
{
  
  
for(pos=0;pos<=180;pos++){
Myservo.write(pos);
delay(15);
}
  delay(1000);
  
  for(pos=180;pos>=0;pos--){
Myservo.write(pos);
delay(15);
}
  delay(1000);

}

According to the datasheet the servo needs a DC 4.8-6.8 voltage. My first attempt was to only use the arduino and no external power supply. So did the following connections:

  • servo's ground to arduino's ground
  • servo's + to arduino's 5V
  • servo's data to arduino's GPIO pin 3

Using this connection works fine and the servo rotatates to the desired positions. However, because the arduino does not supply enough current, i bought a power supply with the following specs:

enter image description here

With that, i did the following connections:

  • connect the ground of the power supply to arduino's ground (and servo)
  • keep the data pin
  • connect + of power supply to servo's +

enter image description here

Unfortunately, the servo does not move with the external power supply. IMO, it should have the right voltage and also supply enough current (at least as much as the Arduino).

Do you see the problem?

8
  • How are you powering the Arduino in the new setup? – StarCat Mar 28 at 19:53
  • regular usb cable for powering arduino – mAI Mar 29 at 8:43
  • I would set the external power supply to 5V (your photo shows 6V) and try to measure the voltage of the servo while the Arduino is attempting to move it. Your servo is a high current device, which is not really suitable for connecting to a breadboard. – StarCat Mar 29 at 10:30
  • but 6 V should be fine since the servo allows DC 4.8-6.8 shouldn't it? However, nothing happens with 5v either - also when i directly connect the power + to the servo + instead of using a breadboard. How do I measure voltage of servo while arduino is attempting to move it? – mAI Mar 30 at 8:05
  • Except you're interfacing a 5V device to it, which might or might not cause problems when running the servo at 6V (probably not, but the servo works at 5V either way). Did you measure the voltage on the servo's pins when you're trying to move it? – StarCat Mar 30 at 8:09
1

@starcat, regular usb cable for powering arduino

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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