PDA

View Full Version : How do you set a speed limit on the servo


Fares
12-31-2002, 09:33 AM
hey guys , we are pretty new to this and we are trying to gear down one of our servos . We are not pretty sure how to do that , and i have been trying to use Robogui to do it but it doesn't seem to do anything or i guess i am not doing the right thing
what is the code to gear down the servo , we 've been looking around and we don't know what the maximum number is and the lowest number etc... if you guys are able to help that will be great.

kmcclary
12-31-2002, 07:45 PM
Originally posted by Fares
hey guys , we are pretty new to this and we are trying to gear down one of our servos . We are not pretty sure how to do that , and i have been trying to use Robogui to do it but it doesn't seem to do anything or i guess i am not doing the right thing what is the code to gear down the servo, we 've been looking around and we don't know what the maximum number is and the lowest number etc... if you guys are able to help that will be great. Servos are a controlled by specifying a "target position", and sending a series of PWM pulses to "jerk" it toward that position. As the actual PWM signals to the servo are generated by separate circuitry in the RC and are NOT under your control, you CAN'T simply reduce the number of PWM pulses to slow it down.

There are still two primary ways I can think of off the top of my head to slow down servo travel:

1) GEAR IT DOWN (for real) on the servo output with gears! :D For every 2:1 geardown, you get 1/2 the speed. The disadvantage is that you also reduce the total end to end travel by the same amount.

2) "Walk" the servo slowly in software, by gradually incrementing and sending a new "target position value" over MANY loops.

Example: Assume the servo is at position 100 now (range is 0-255) and wish to end up at position 200. If you increment the output position value by ONE each loop it will take you 100 loops, or roughly 2.5 seconds to get there. If you wish faster travel simply increment by a larger amount per loop. For slower travel, take several loops to increment the output by one with an additional "factor counter" variable.

Fractional increments can also be done this way... For example: For every three loops, increment the desired target position by two.

In all cases, once done you keep resending the final target position value for each loop thereafter.

Does this make sense to you?

- Keith

sanddrag
12-31-2002, 07:50 PM
Fares,
Do you mean servos or the EduRobot motors?

Adam Y.
12-31-2002, 08:51 PM
As the actual PWM signals to the servo are generated by separate circuitry in the RC and are NOT under your control, you CAN'T simply reduce the number of PWM pulses to slow it down.
Errr just a little note there not known as PWM signals there known as PPM. PWM is what speed controllers use to modify speed of a motor while PPM is the pulses used by radio controlled units to give servo's their position commands.

Fares
12-31-2002, 09:39 PM
hey guys thanks for the input , well what i am getting from u is that there is no easy way of coding the speed of the motors. Am i right? i have been trying to reduce the speed , there is no way to gear it down , and i don't think i can reduce the speed of the relays can i ? i am talking about the EDU motors , we are not sure what to do as the servo we have is just too fast and uncontrollable

sanddrag
12-31-2002, 09:44 PM
Originally posted by Fares
hey guys thanks for the input , well what i am getting from u is that there is no easy way of coding the speed of the motors. Am i right? i have been trying to reduce the speed , there is no way to gear it down , and i don't think i can reduce the speed of the relays can i ? i am talking about the EDU motors , we are not sure what to do as the servo we have is just too fast and uncontrollable

Okay, this changes things a bunch. The EduRobot motors are not servos at all. Servos have potentiometers and mechanical stops. The Edu Motors do not. You should be plugging the motors into the PWM outputs on the controller, not the relay outputs. Then, the default code will run them at variable speed according to how you move the joystick. Treat the Edu Motors just as you would a normal DC motor hooked up to a PWM speed control. The only difference is that the speed control is internal in the Edu Motors.

<edit>It is okay to plug the motors into the relay outputs but you will only get the maximum speed like you described</edit>

kmcclary
01-01-2003, 03:04 PM
Originally posted by wysiswyg
Errr just a little note [they're] not known as PWM signals [they're] known as PPM. PWM is what speed controllers use to modify speed of a motor while PPM is the pulses used by radio controlled units to give servo's their position commands. Sorry, but that is NOT correct for our purposes. Pulse Position Modulation is where the TIMING of pulses carry the information. IOW, exactly WHEN a pulse comes through is important.

Yes, a standard model radio control system's CARRIER ENCODING uses PPM, but that is NOT true of the servos themselves. In fact, we do not use PPM at ALL in this contest because the Ewave radios used here are packet radios, not standard radio control model radios.

A servo uses PWM, or Pulse WIDTH Modulation, where "how WIDE the pulse is" carries the information. A positive going 5V pulse WIDTH represents where you wish the servo to end up. A 1ms pulse represents full one way, and a 2ms pulse means full the other way. A 1.5ms pulse represents the center position.

The decoder in a standard radio control receiver converts the transmitted PPM signals into PWM for the servo, often with a very cheap and simple SIPO shift register chip. The Robot Controller uses a dedicated PIC micro (which we can't see) to decode packet data, which are then shipped into STAMP variables for us by the SERIN command.

Originally posted by sanddrag
Okay, this changes things a bunch. The EduRobot motors are not servos at all. Servos have potentiometers and mechanical stops. The Edu Motors do not. [...] It's OK to plug them into the relay outputs Actually, they ARE still "modified servos". They did the old modeler's standard trick of cutting out the limit tab and replacing the pot with a pair of fixed resistors. This makes it BELIEVE you are AT the center position at all times, AND converts the servo into a gearmotor. Now when you send it anything OTHER than a 1.5ms pulse (a 127 value), the motor desperately tries to "fix a bad position", running forever one way or another. The "panic level" (motor speed) is proportional to how far "wrong" it thinks it is. This old trick is also what a Victor emulates, with the addition (to prevent stall currents) that it won't move at all unless you're at least asking for 10% motor power.

You are right that you MAY plug the EduRobot multi-speed motors into the Relay Outputs as well, only getting full on one way or the other. IFI did a special additional circuit in the multi-speed motors to emulate a Spike. It automatically recognizes WHICH kind of signal it's getting (PWM/Victor, or Voltage/Spike) and "does the right thing". VERY cute... :D You can't do that with a servo you modified yourself. They'd only respond to the PWM signals, and might burn out if attached to the Relay Output connector. Similarly (in reverse) if you made a Spike emulator circuit for a gearmotor.

BTW, that is also why they have four pins on their motor connectors instead of three. To emulate a Spike, you need FOUR wires (logic/motor power, forward, reverse, and ground). See the Edubot documentation (EDU_Robot_Controller_Reference_Guide.pdf) on the IFI site for more information.

- Keith