Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Hawaii00000 on January 28, 2009, 12:03:09 AM

Title: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Hawaii00000 on January 28, 2009, 12:03:09 AM
I replaced the potentiometer with two 2.2k resistor (I soldered the common ends to the red wire and the other ends to the yellow and green wires) ,but when I run the program the motor just keeps on rotating at the same speed. The program has different values so the servo should rotate at different speeds. What am I doing Wrong!?!?!?
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: cosminprund on January 28, 2009, 12:37:18 AM
I'd first try sending the servo an 1 ms and then an 2 ms pulse. The servo should rotate in opposite directions. If it does then start with the 1ms pulse and increase it until it reverses direction. Before you get to the point where it reverses direction you'll find the spot where the servo is standing still (the new "center" position)! You'll need to do this to compensate for the differences in the two resistors values (they're both 2k2 but they're likely of 5% precision). IF the two resistors would have been perfect (and there's no such thing) your servo center would be at exactly 1.5 ms.

The best way to do what I've described here is to use an "Divide and Conquer" algorithm.
Here's an example:

_delay_ms(1) => makes the servo turn clockwise
_delay_ms(2) => makes the servo turn counter clockwise
(1+2)/2 = 1.5 => I'll next try the 1.5 ms pulse

_delay_ms(1.5) => makes the servo trun clockwise (just an example) => 1.5 takes the place of "1" so now I have:

_delay_ms(1.5) => makes the servo turn clockwise
_delay_ms(2) => makes the servo turn counter clockwise

(1.5 + 2)/2 = 1.75 => I'll next try the 1.75 ms pulse

_delay_ms(1.75) => makes the servo turn counter clockwise => 1.75 takes the place of "2" sonow I have:

_delay_ms(1.5) => makes the servo turn clockwise
_delay_ms(1.75) => makes the servo turn counter clockwise

(1.5 + 1.75)/2 = 1.625; I'll next try the 1.625 ms pulse

As you can see the interval you're looking at gets divided in half with every single test! With a maximum of 7 tests you should find your servo's center point. Once you've got the servo's center point, sending an pulse that's shorter makes the servo turn one way, sanding an longer pulse makes the servo go the other way!
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Hawaii00000 on January 28, 2009, 01:35:59 AM
The code I'm using sends a signal for 0, 180, and 360 degrees and I nknow It works because I tried on the another servo. Another site did say that you need 2.4k resistors and I haven't put the gears back in yet, but It should still work without the gears.
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: cosminprund on January 28, 2009, 05:46:41 AM
You're saying the servo is rotating at the same speed and in the same direction for all 3 signals: 0, 180, 360? I care more about direction then speed: for my servos speed varies very little in a very narrow band around the midpoint: the motor is stopped at 180, moves slowly a 183, faster at 185, full speed at 190 (just an example, I'm using milliseconds, not degrees to set up my servos)

If 0 and 360 make the motor turn in the same direction and you have checked with an other servo and with the other servo it works as expected (makes the servo turn all the way to one side and then all the way to the other side) then it must be related to your soldering.
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Hawaii00000 on January 28, 2009, 10:30:51 AM
I have checked it and there's nothing wrong with the program that I know of. I can't see how I could have gone wrong when soldering its not that hard. Maybe I soldered the resistors to the wrong wires.
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Hawaii00000 on January 28, 2009, 08:18:46 PM
Heres a picture if that helps (http://i487.photobucket.com/albums/rr231/Hawaii00000/Photo7.jpg) the resistors are 2.2k
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Hawaii00000 on January 28, 2009, 08:26:27 PM
The common side goes to the red and the individual sides go to the yellow and green.
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: airman00 on January 28, 2009, 08:39:10 PM
you didnt use precision ( 1% to 2% tolerance) resistors .

You used resistors with a precision band of gold - 5% tolerance
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Hawaii00000 on January 28, 2009, 08:44:31 PM
Is that the only problem? Are the 2.2k resistors and all the rest right, because I don't wanna keep going to radio shack! This project is getting kind of expensive. :-[
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Razor Concepts on January 28, 2009, 09:23:56 PM
Just adjust the values in the code until the servo stops spinning. It's not the best way but it works if you don't want to spend more money.
Title: Re: Still can't get this servo modification thing!!!!!!!!!!!!!!!!
Post by: Admin on February 07, 2009, 07:28:49 AM
What servo did you use?

The resistor value is very important to get exact.