I have a problem with my servo (TowerPro Mg995) as it starts acting randomly(more like crazy all over the place) when connected to Arduino board and power supply. below are the system specs:
Board: Uno
Servo: TowerPro MG995 External power supply: regulated 5V @1A max output
Ground connections are shorted of course.
Code
// Include the Servo library #include <Servo.h>
// Declare the Servo pin
int servoPin = 3;
// Create a servo object
Servo Servo1;
void setup() {
// attach the servo to the used pin number
Servo1.attach(servoPin);
}
void loop(){
// Make servo go to 0 degrees
Servo1.write(150);
ibro191:
Connecting the Arduino to PC and the motor to external power supply yields the same thing.
That suprises me. When you are connected to the PC do you have the servo GND connected to the Arduino GND (you should).
I am assuming, since you have not told me otherwise, that this problem happens all the time the Arduino is running and not just for a few seconds at start-up?
Try a shorter delay() - say 1000 for 1 second - and put some Serial.print commands in your code so you can see if the Arduino is behaving properly. Try this
Robin2:
That suprises me. When you are connected to the PC do you have the servo GND connected to the Arduino GND (you should).
Grounds are connected.
Robin2:
I am assuming, since you have not told me otherwise, that this problem happens all the time the Arduino is running and not just for a few seconds at start-up?
As long as the Arduino is executing the code the servo keeps on swinging back and forth relentlessly.
Robin2:
Try a shorter delay() - say 1000 for 1 second - and put some Serial.print commands in your code so you can see if the Arduino is behaving properly.
I have tried that, same thing. Servo out of control but the board doesn't reset, counter goes on uninterrupted.
Servo Does not stop for one second until I plug it off or disconnect from Arduino PWM pin. Then it holds still.
Could it be a current problem? a 1A current somehow insufficient ?
ibro191:
I have tried that, same thing. Servo out of control but the board doesn't reset, counter goes on uninterrupted.
Then I reckon your servo is faulty.
Servo Does not stop for one second
Just to clarify, the 1 second (or your 100 second) delay will have no impact on a good servo. You only have one instruction telling the servo to go to 150deg and when it gets there it should stay there forever.
If you want to see the effect of the delay() you need to tell the servo to move to a different position and wait there for an interval before moving back to the first position.
I have mentioned before that this happens with two identical servos, and both are new out of package.
Robin2:
Just to clarify, the 1 second (or your 100 second) delay will have no impact on a good servo. You only have one instruction telling the servo to go to 150deg and when it gets there it should stay there forever.
I am aware of that, what I was implying is the continuous motion of the servo even though it has to stop at some position per command.
outsider:
Check this link, looks like you have a dud, dude.
Appears so. Anyway, i''ll do some testing and will post here once this issue is resolved. Thank you all.
ibro191:
I am aware of that, what I was implying is the continuous motion of the servo even though it has to stop at some position per command.
You are still misinterpreting how the Servo library works. The servo library continually sends a signal to the servo regardless of whether or not you have delay()s in your code. The only way to stop is to use Servo.detach().