Servo pulsing

Hi, I have a simple setup here I think but have 2 problems.

  1. at rest the servo pulses, consistently every second or so
  2. as soon as the button is pushed I want the led to light, but it first lights when the servo is moving, then goes out then flashes a couple times as the servo gets to its final position, and then goes steady on.

final setup is for zone control on a base board heat system, I will have six servos controlling the valves on the zones, input will be from thermostats. Pin 14 tells the circulating pump to turn on through a relay.

I am using an uno and tower pro mg995 servos from ebay

Any advice would be great,

Thanks, tom

#include <Servo.h>

Servo servo_pin_5;
Servo servo_pin_6;
Servo servo_pin_11;
Servo servo_pin_10;
Servo servo_pin_9;
Servo servo_pin_3;

void setup()
{
pinMode( 14 , OUTPUT);
servo_pin_6.attach(6);
pinMode( 2 , INPUT);
servo_pin_9.attach(9);
servo_pin_3.attach(3);
servo_pin_11.attach(11);
pinMode( 8 , INPUT);
pinMode( 12 , INPUT);
servo_pin_10.attach(10);
pinMode( 13 , INPUT);
servo_pin_5.attach(5);
pinMode( 7 , INPUT);
pinMode( 4 , INPUT);
}

void loop()
{
if (digitalRead( 2))
{
servo_pin_3.write( 90 );
}
else
{
servo_pin_3.write( 0 );
}
if (digitalRead( 4))
{
servo_pin_5.write( 90 );
}
else
{
servo_pin_5.write( 0 );
}
if (digitalRead( 7))
{
servo_pin_6.write( 90 );
}
else
{
servo_pin_6.write( 0 );
}
if (digitalRead( 8))
{
servo_pin_9.write( 90 );
}
else
{
servo_pin_9.write( 0 );
}
if (digitalRead( 12))
{
servo_pin_10.write( 90 );
}
else
{
servo_pin_10.write( 0 );
}
if (digitalRead( 13))
{
servo_pin_11.write( 90 );
}
else
{
servo_pin_11.write( 0 );
}
if (( digitalRead( 2) || ( digitalRead( 4) || ( digitalRead( 7) || ( digitalRead( 8 ) || ( digitalRead( 12) || digitalRead( 13) ) ) ) ) ))
{
digitalWrite( 14 , HIGH );
}
else
{
digitalWrite( 14 , LOW );
}
}

OK, I just put a 100uF cap. between the hot and ground at the servo and that seems to have solved it.

Tom

You seem to be powering the servo from the Arduino. Don't. Give the servo its own power supply and connect the servo GND with the Arduino GND. If you don't the problem you have experienced will probably be much worse when the servo is loaded and it draws more current.

...R