im using arduino nano to control the HS-311 servo(4.8v-6.0v and 7.4mA- 160mA) but 4 aa batteries(4.8V) to power only the servo and my pc to power the arduino i have tried all the examples but the only thing happending is the servo says a sound without moving
i have tried using other battery holder with other battery and other servo of same kind and i have another servo i cant find infomation on called carson b 13374 but i havent tried it because i couldnt find infomation on it
@david_jacobsen
Please do not add extra information to posts that have already been commented on. If you have new information such as a schematic then post it in a new reply so that it is seen
The Arduino's putting out either 0V or 5V (it varies from time to time) on the servo's signal line to tell the servo where to go. But if there's no ground between the Arduino and the servo, the servo has no way of knowing what voltage is on that signal wire- it needs the ground of 0V to measure it against as a reference.
edit: otherwise it's a bit like trying to measure the voltage of a battery by putting the red probe on the + but not putting the black one on the other end.
extra info
it has worked before and the bread board is only to connect all grounds
grey is D9
black and brown is ground(i didnt have enugh black or yellow)
red is volt
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep
*/
#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
}
}`Preformatted text`