Micro Servo Position

Hey everyone, so I made a prototype robotic arm today with micro servos.

I got it working and everything after several hours of cutting, wiring, and hot gluing.

I still have one question, on which was probably the hardest thing I encountered today. How can you tell the range of motion of the servo?

My servos (SG 90 micro servo) have a range of 180 degrees, so I thought it would be simple. I attached the servo horn, mounted it temporarily to its location with mounting tape and used that as a guide to determine its range of motion for when I mount the acrylic pieces that I cut.

Anyways, I got a good range estimate of how far the servos could turn by doing this, but is there any other way to determine how far servos can rotate? Do I have to attach some object to the top and determine its rotation from 0 to 180?

180 degrees is fairly standard, but there should be a datasheet that provides the specifications.

I haven't played with servos yet. I hear the start up position can vary by individual servo. They might jiggle a little at power up if you command them to the same spot you left them when you removed their power.

Do I have to attach some object to the top and determine its rotation from 0 to 180?

Many servos will do a bit more than 180o, some up to 240o, you just have to try it and see.

CrossRoads:
I haven’t played with servos yet. I hear the start up position can vary by individual servo. They might jiggle a little at power up if you command them to the same spot you left them when you removed their power.

Yeah, that’s a problem I was having with them. I also noticed that even when I did not have any code for a specific servo, simply providing power to the circuit made the aforementioned servo jolt up to a specific position.

In the end, I ended up commenting out the code for each of my servos and worked with them one by one to make sure their range of motion was within the boundaries that I needed them to be and it worked out fine. Just not sure what I can make the thing do though lol. I made a simple demo style program so that it cycles through each of the servos range of motions but other than that I don’t know what to do with it.

I’m thinking I should probably start making a goal for my projects before I actually make them, it’s a bad habit I have where when I am bored I will sit down and start messing around with these things.

Thanks for the tips.

Grumpy_Mike:
Many servos will do a bit more than 180o, some up to 240o, you just have to try it and see.

Yeah, think I will do that as it worked fine for me when I was messing with the servos in this project.

Thanks

Here’s a little test sketch that may be helpful, you can set the initial angle with line 16:

/*
 Try this test sketch with the Servo library to see how your
 servo responds to different settings, type a position
 (0 to 180) or if you type a number greater than 200 it will be
 interpreted as microseconds(544 to 2400), in the top of serial
 monitor and hit [ENTER], start at 90 (or 1472) and work your
 way toward zero (544) 5 degrees (or 50 micros) at a time, then
 toward 180 (2400). 
*/
#include <Servo.h>
Servo servo;

void setup() {
  // initialize serial:
  Serial.begin(9600); //set serial monitor baud rate to match
  servo.write(90);      // set initial position here
  servo.attach(9);
  prntIt();
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int pos = Serial.parseInt();
    //pos = constrain(pos, 0, 2400);
    servo.write(pos);
    prntIt();
  }
}
void prntIt()
{
  Serial.print("  degrees = "); 
  Serial.print(servo.read());
  Serial.print("\t");
  Serial.print("microseconds =  ");
  Serial.println(servo.readMicroseconds());
}