Shaking Servos

Hi,

I’ve been having a lot of trouble lately with a project of mine. I am making a 4 wheel steering car controlled by some servos and a joystick. The code works but the servos are shaking so much that i just can’t control it. I would love to know you guys’ thoughts and tips.

joystick_servo.ino (566 Bytes)

Dim_van_leeuwen:
I’ve been having a lot of trouble lately with a project of mine.

Installation & Troubleshooting

For problems with Arduino itself, NOT your project

Uncompiled, untested.

#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
const byte joyX = 0;
const byte joyY = 1;

void setup()
{
  servo1.attach(9);
  servo2.attach(3);
  servo3.attach(10);
  Serial.begin(9600);
}

void loop ()
{
  int joyVal = analogRead(joyY);
  Serial.print (F("yRaw: "));
  Serial.print (joyVal);
  joyVal = map (joyVal, 0, 1024, 0, 180);
  Serial.print (F(" yMap: "));
  Serial.println (joyVal);
  servo1.write(joyVal);
  servo2.write(180 - joyVal);

  joyVal = analogRead(joyX);
  Serial.print (F("xRaw: "));
  Serial.print (joyVal);
  joyVal = map (joyVal, 0, 1024, 0, 180);
  Serial.print (F(" xMap: "));
  Serial.println (joyVal);
  servo3.write (joyVal);
  delay (20);
}

Shaking servos are almost always the result of an inadequate servo power supply. The 5V Arduino output will not work.

Post a link to your servos and a hand drawn wiring diagram. Image posting guide