Recently we purchased servos for use in an Arduino and began testing with servos. It turned out that the uSec for the servos differed from the online documentation and we had to find the min and maxes of the uSecs manually:
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 Serial.print("writing Microseconds: "); Serial.println(n); myServo.writeMicroseconds(n); readString = ""; //empty for next input } The issue is that the servos don't travel the full 180 degree advertised price (more like 135-160) and that lack of angular distance is affecting performance of one of our products. The servos can even mechanically travel a noticeable distance farther than 180, but not "programmatically" farther even when given a larger PWM uSec value that the observed "max" PWM value
What I've found
I looked around and apparently there are "Servo Programmers" to calibrate endpoints and midpoints, but cost an arm and a leg. I find it strange that I would have to "program" my servos. I was part of an First (FTC) robotics team using tetrix/nxt electronic control systems, and never noticed a problem with uSec values or not getting the full range of motion using the same brand of servos I currently am now.
How can I perform a low cost, easy way to simply get the full range of motion I paid for?
void loop() { digitalWrite(pin, HIGH); delayMicroseconds(100); // Approximately 10% duty cycle @ 1KHz digitalWrite(pin, LOW); delayMicroseconds(1000 - 100); }