Servo2 Library and programming Servo speed control

Hello

i have an extensive project that im working on and the one servo i have is constantly twitching.

What i have found is that the servo2 library might work to help on the problem but i need to adjust the speed because it is going to open and close a small door.

I dont know how to code in the speed of the servo however and a prerequesite is that it cant use commands such as delay since the program is supposed to work seamlessly.

Anyone got a bit of code to help me out ?

Hi

First of all it is important to know witch libary it is exactly.

Is it the standard Arduino Servo libary witch is normaly in the standart IDE included

If tis is not true pleas sent us were you have downloaded the libary

Hi, how are you powering the servo, this can be very important.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Tom.... :relaxed:

The library would be this one

And as for the curcuit i have not drawn it fully but i did isolate the servo with a battery pack meaning that gnd is common ofc but + is separate, the pin for the servo is 9.

As faar as i can tell this fault comes from within the arduino board, i have also tried filtering the pin but with no luck.

Are you using the technique from the servo sweep example to control the speed of the servo?

...R

The delay on the servo sweep does not control the speed of the servo, it just waits to make sure the servo hits the designated mark.

Thinkerion:
The delay on the servo sweep does not control the speed of the servo, it just waits to make sure the servo hits the designated mark.

Short of taking the servo to pieces that is all you can do - move it in little steps towards the final position with a "wait" between the steps.

...R

What i have found is that the servo2 library might work to help on the problem but i need to adjust the speed because it is going to open and close a small door.

Robin2 has posted servo code using millis delay to slow servo movement, and the below link might also be of use'

http://forum.arduino.cc/index.php/topic,61586.30.html

Here are my current libraries in the full program code:

// Libraries included in design
  #include <Wire.h>
  #include <LCD.h>
  #include <LiquidCrystal_I2C.h>
  #include <OneWire.h>
  #include <DallasTemperature.h>
  #include <DS3232RTC.h>    
  #include <Time.h>  
  #include "DHT.h"
  #include <IRremote.h>
  #include <VarSpeedServo.h>

There is a great risk of Arduino libraries interfering with each other. There are no guidelines to prevent that. Most library developers only work on their own library. And the Arduino has limited resources which may not be capable of being shared across several libraries.

...R

i have an extensive project that im working on and the one servo i have is constantly twitching.

Below is some very basic servo control code. If the servo still twitches using this code, then you might have an inadequate power supply (don't power servos from the arduino). Otherwise your libraries/code probably has some timing issues. You may need to drop back to basic code and then start adding features until the twitching starts.

//zoomkat 7-30-10 serial servo test
//type servo position 0 to 180 in serial monitor

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.attach(9);
  Serial.println("servo-test"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the String readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured String 
    int n = readString.toInt();  //convert readString into a number
    myservo.write(n);
    readString="";
  } 
}