Servo motors not working?

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

picture not acurate on parts or colour code

Does the Sweep example work ?

Please post a schematic of your circuit. A picture of a hand drawn circuit is good enough

Do the 2 power supplies have a common GND connection ?

Are the grounds all connected? Might be an idea to give a schematic and a copy of your code.

... edit, as previous post suggested too :wink:

sweep does not work

All the more important to show circuit now.

ok I see you snuck the schematic in up above. You don't have a connection to the Arduino ground.

@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

ah thanks, i wil try that when i get home

ok
wil do in future

if i may ask why should there also be ground to the arduino?

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.

ah thank you

yea it didnt work

Let's see a decent photo of the wiring then.

(Is the servo known good?)

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

Couple of suggestions:

  • check the voltages at the battery end and at the servo connector. Occasionally, the Dupont wires can have breaks in them
  • check for continuity between the Arduino GND pin and the battery GND

Could you please post the exact code you are using (in code tags), as well as the pin numbers?

/* 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`

Thanks for posting the code.

Is your servo attached to the correct pin. I can't tell for sure, but in post 1 it looks like it is connected to D7.

And please be sure to check the voltages.

the voltages on the battery is 1.3 volt on all of them and it is on d9
but i have to log of for today, hope you have had a good day