One of the servos on my uno shield bot rotates ~ 20 degrees on power up then works correctly. I recentered the servo several times. The other servo behave just fine. OIdeas?
Have you swapped the servos to make sure the behavior stays the same? This will help isolate between hardware and software. If it moves with the swap, probably the servo is failing or the electronics on that channel has a problem.
There's a reason for this twitch and Andy explained it to me more than once in the past ten years. Switch your two servo port connections (and code) to P14 and P15. I think the problem will go away.
If I recall correctly, some of the Arduino pins toggle and this is interpreted by the servo as a signal. Specifically, the Arduino has a built-in LED on P13 that toggles on startup.
"Most of my servos twitch on power up. I never stopped to figure out how far, but they all go clockwise" ... If the pins are floating in any way, it could be picking up 50/60Hz mains until the pins are initialized to OUTPUTS. Try a 10k pull-down resistor on the signal line to the servo in question.
I experience this on the BOEBOT kit with the servos plugged into the servo headers on pins the Board of Education or on the servo headers on the PropBOE. I’ve always taken it to mean they were initializing and never thought twice about it.
I’ve never had any issues with the servos (Parallax CR servos).
I have only watched several videos on Arduino code so I'm not an expert by any stretch but from what I've seen the highlighted line looks like a command. I would comment it out to see if that worked.
Sorry for the delay Ken. So I take it there is no appropriate solution for the Arduino? I switched servos and sampe thing with the other servo; it seems to be a board issue rather than the servo.
Greg, I'm not sure you tried my solution in the most recent post I made - did you? You put them on 10/11?
Also, there's another problem that can be introduced by building circuits on the breadboard and using any of the servo pins. Do you have any circuits on P 10/11 - on the breadboard - when you are trying to drive servos?
I did try P 10/11, but there appears to be no power at those ports. I don't have a voltmeter to check at the moment but will next week when I return home. Is there a jumper I need to move?
I did try P 10/11, but there appears to be no power at those ports. I don't have a voltmeter to check at the moment but will next week when I return home. Is there a jumper I need to move?
Thanks and best,
Greg
Is the Power Switch in position 2 ,(board and servos)?
Comments
Can you post your code so it can be reviewed?
#include <Servo.h>
Servo servoLeft;
//Servo servoRight;
void setup()
{
servoLeft.attach(13);
//servoRight.attach(12);
// Clockwise
servoLeft.writeMicroseconds(1300);
//servoRight.writeMicroseconds(1300);
delay(3000);
// Still
servoLeft.writeMicroseconds(1500);
//servoRight.writeMicroseconds(1500);
delay(1000);
// Counter clockwise
servoLeft.writeMicroseconds(1700);
//servoRight.writeMicroseconds(1700);
delay(3000);
// Counter clockwise
servoLeft.writeMicroseconds(1500);
//servoRight.writeMicroseconds(1500);
}
void loop()
{
}
Thanks,
Greg
Say you always center them in your code, before powering down your project. And then try a powercycle- do they stay almost still at the next power up?
If I recall correctly, some of the Arduino pins toggle and this is interpreted by the servo as a signal. Specifically, the Arduino has a built-in LED on P13 that toggles on startup.
Will be interested in the results.
Ken Gracey
I’ve never had any issues with the servos (Parallax CR servos).
* sketch_left_servo_test */
#include <Servo.h>
Servo servoLeft;
//Servo servoRight;
void setup()
There is no server port 14 and 15 on the BOA Shield, only 12 and 13.
Greg
Never mind the reference to DHB-10; I realize you're using the Shield-Bot for Arduino.
Ken Gracey
Thanks,
Greg
Also, there's another problem that can be introduced by building circuits on the breadboard and using any of the servo pins. Do you have any circuits on P 10/11 - on the breadboard - when you are trying to drive servos?
Can you post a picture of your robot, up close?
Ken Gracey
I did try P 10/11, but there appears to be no power at those ports. I don't have a voltmeter to check at the moment but will next week when I return home. Is there a jumper I need to move?
Thanks and best,
Greg
Is the Power Switch in position 2 ,(board and servos)?