Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: AKnickolai on February 19, 2009, 11:36:46 PM
-
I am building a $50 robot in conjunction with someone else, and we are both having similar issues. We decided to save the hassle of modifying servos and bought some continuous rotation servos at the local hobby store instead of models with fixed limits. Construction of the robot went fine, passed the smoke test. But when powered up the robot pretty much spins in circles.
I checked the wiring (used a bread board) and it is all ok. I modified the code that comes with the tutorial, so that all it does is turn the LED on/off at a certain interval and pulse the left/right servos. The LED pulses, and duration of the left/right servo motions are fine. But the speeds the servos turn at are very different, one servo spins very slow. The strange thing is that if I swap the signal wires from the chip to opposite servos, the servos spin at the same speeds they did before the swap. So, the signal from the chip has no effect on the speed the servos spin.
This lead me to believe my servos where bad. I have since tried new servos and my friend's chip all with the same results. I made a suicide cord out of a 5V 1A AC adapter. Total current draw is never an issue, but the "slow" spinning servo always draws more current. Any thoughts on why I can't get my servos to spin the same speeds?
-
Hi,
Check for mechanical friction on the slow side.
-
Have you made sure that the servos are flipped correctly according to the tutorial
-
The servos are flipped and there doesn't seem to be any added friction with on servo vs. the other. I currently have a "test" set up that has two brand new (not the ones already fixed to my robot body) and am experiencing the same difference in rotational speed.
Given that I have 2 sets of servos that exhibit the same problems, I'm pretty sure it can't be a problem with them. I've checked the voltage output from the pins of the controller and it is the same, so I don't think its a problem with the chip.
-
Maybe the servos you bought havent being centered consistantly. try loading the servo centering code from the $50 robot onto your microcontroller and see if they both stand still or not
-
When you say it 'spins' - is one servo going forward and the other backwards, or are they both turning the same way but at different speeds?
-
@ Webbot:
Both rotate clockwise, the only difference is the speed.
@ paulstreats:
I'll try the centering code, but would that be applicable to a servo that is made for continuous rotation?
Going to try and play with it again tonight if I have time. I'll let you know if the centering code helps.
-
Try changing it in code(I know programming-eeek). See which wheel is going forward and which wheel is going backward. Then open up Photovore_v1.c. In there you should see lines of code like this:
//detects more light on left side of robot
if(sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
{//go left
servo_left(44);
servo_right(44);
}
//detects more light on right side of robot
else if(sensor_right > sensor_left && (sensor_right - sensor_left) > threshold)
{//go right
servo_left(25);
servo_right(25);
}
//light is about equal on both sides
else
{//go straight
servo_left(25);
servo_right(44);
}If the left wheel is going backwards when the light is even on both sides then reverse the values of the left wheel in the code. i.e.
//detects more light on left side of robot
if(sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
{//go left
servo_left(25);
servo_right(44);
}
//detects more light on right side of robot
else if(sensor_right > sensor_left && (sensor_right - sensor_left) > threshold)
{//go right
servo_left(44);
servo_right(25);
}
//light is about equal on both sides
else
{//go straight
servo_left(44);
servo_right(44);
}
If the right wheel is going backwards then do the opposite. i.e.
//detects more light on left side of robot
if(sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
{//go left
servo_left(44);
servo_right(25);
}
//detects more light on right side of robot
else if(sensor_right > sensor_left && (sensor_right - sensor_left) > threshold)
{//go right
servo_left(25);
servo_right(44);
}
//light is about equal on both sides
else
{//go straight
servo_left(25);
servo_right(25);
}
-
Maybe the servos you bought havent being centered consistantly. try loading the servo centering code from the $50 robot onto your microcontroller and see if they both stand still or not
I agree. They didn't center the servos as specified in the $50 Robot tutorial ;D
So you either do what Jdog said by changing it in code, or you remodify the servos.