I have put servo to work in my project which needs to turn 90 degree and then goes back to 0 degree (which i thought was the resting position of the servo) when it turns to 90 degree i hear sounds coming from servo implementing that servo is constantly running to keep the motor at 90 degree but when it goes back to 0 degree it is suppose to stop but it still keeps running and keeps drawing current too.
what i want to know is that what is the resting positing of a servo where i can move it to make it rest and it won't draw amperes and stop the noise.
me too I'm trying to solve the same problem!
There should be a function that measures that the servo has reached its destination and should stop.
I thought to develop a function that works a finite state machine, that if the servo reached its destination then it should stop sending PWM signals.
But what I want to know now is how to know if the servo has reached its destination?
I've developed these functions to move the servo from any pin of the Arduino uno board. It's not optimum like the Servo library but works basically.
I think if I modified this feature then my functions would work fine.
This is the main function that sends the pwm signals with pwm range from typical 500 to 2000 micro seconds:
void servo_pulse(uint8_t pin, uint16_t pwm){
if(!servo_state && !servo_delay){
digitalWrite(pin,HIGH);
servo_state = 1;
servo_st = micros();
}
if(servo_state && !servo_delay){
servo_cr = micros();
if(servo_cr - servo_st >= pwm){
digitalWrite(pin,LOW);
servo_delay = 1;
servo_st = micros();
}
}
if (servo_delay){
servo_cr = micros();
if(servo_cr - servo_st >= 20000 - pwm){
servo_delay = 0; servo_state = 0;
}
}
}
This is the sweep radar function, but it's not optimal because it stops the execution of the program with the for loops:
void servo_radar(uint8_t pin, uint32_t servo_speed){
for(uint32_t k=0;k<servo_speed;k++)
servo_pulse(pin,servo_left);
for(uint32_t k=0;k<servo_speed;k++)
servo_pulse(pin,servo_right);
}
That's not how servos work. There is no resting position in that sense. Wherever a servo is positioned if there is some load on it trying to move it away from the commanded position it will use power to maintain it's position. If there is no load on the servo then it will use very little power and should make no noise. But that will depend on the mechanical design of system.
Also you can't know when a standard servo has reached the commanded position because there is no external positional feedback available from normal servos. There are a few servos available that provide feedback but you still have the problem that any mechanical load on the servo will be trying to move it so the servo has to "fight" that load in order to maintain the position you sent it to.
Steve
The closest thing I'd consider to be a "resting" position is the position the servo goes to when it's attach()-ed. That by default is 1500 microseconds, nominally 90 degrees. That value can be changed by editing the library or you can issue a write() or writeMicroseconds() before the attach().
But it's not a "resting" position in the sense that it would home to that somehow and not draw current.
The nature of the servo library (which in turn is modeled on how the RC folk use servos, so it's not an Arduino "thing") is that it sends a reminder pulse at 50Hz (also editable in the library) to the attache()-ed servo to keep it in place. So you could stop that pulse with a detach(), but then of course any load will tend to move the servo away from where you sent it, since it wont be reminded to try to stay there.
Yes, but it gets hot at certain positions! What to do then?
wolfrose:
Yes, but it gets hot at certain positions! What to do then?
It gets hot when a large load is placed on the servo that keeps it from reaching its commanded position.
This can quickly lead to failure of the servo.
Which servo are you using?
What are you trying to do with it?
vinceherman:
It gets hot when a large load is placed on the servo that keeps it from reaching its commanded position.
This can quickly lead to failure of the servo.Which servo are you using?
What are you trying to do with it?
I have two models: SG90 and S07NF both are for testing.
I just want to implement one in a project where just it has to pull a gate arm up/down, simple task for the servo
wolfrose:
I have two models: SG90 and S07NF both are for testing.
But whatever the servo, its datasheet will quote the torque it can provide.
(Many datasheets erroneously call torque kg/cm, where it should be kg.cm. (Even that's wrong, since kg is mass not force, but let's let that one go for now.))
So you spec a servo by ensuring that the product of the mass you are lifting and the radius at which that mass (strictly, force) acts from the servo axle, does not exceed that quoted torque. I'd say that if that force is going to be present for a significant time, that is the servo will most likely be "holding" not "resting" (for want of better words) then you should allow a significant margin, since I doubt that servos are designed for continuous loading near their max torque.