Go Down

Topic: Servo moving erratically from external power source (Read 129 times) previous topic - next topic

Claire_Redfield

I created my own external 7v power source (tested stable using a multimeter). When I connect the servo to the 5v Arduino power pin, everything works, but when I connect it to my custom 7v power source, the servo moves erratically, which doesn't make any sense to me... The code is nothing special:
Code: [Select]
#include <Servo.h>
const int servo_pin=9;

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

void loop() {
  Serial.println("hello");
  servo.write(90);
  delay(1000);
  Serial.println(servo.read());
  servo.write(180);
  delay(1000);
  Serial.println(servo.read());
}

I am using the Adafruit Metro 328 board


slipstick

Is the servo intended to run on 7V? Most small servos are only rated for 6V.

What exactly is your "7V power source"? A multimeter smooths out readings so it won't tell you if it is truly stable. It could have terrible ripple or spiking and a multimeter would never notice.

Steve

Claire_Redfield

Did you connect the ground together ? If not, see https://forum.arduino.cc/index.php?topic=645712.0
I did not connect my 7v power supply to the arduino. I powered my arduino board using an usb connection to my pc. Only the signal pin of the servo is connected to the arduino.

slipstick

I did not connect my 7v power supply to the arduino. I powered my arduino board using an usb connection to my pc. Only the signal pin of the servo is connected to the arduino.
Then you need to connect the negative of your "power source" to the Arduino GND. Without that it doesn't have a reference for the signal.

Steve

Claire_Redfield

Then you need to connect the negative of your "power source" to the Arduino GND. Without that it doesn't have a reference for the signal.

Steve
Thanks! It works now

Go Up