Because R/C controllers take as an input the hobby industry "standard" servo pulse, you cannot just communicate with it using a 3-wire potentiometer. A signal conversion must take place, and it can either be done in hardware or in software.
The lead image is a graphic of a typical "servo command" pulse-width pulse: 1500 microseconds is a neutral or zero speed signal, 1000 microseconds usually full power one way, and 2000 full power the other. While servos and robot controllers respond to the pulse durations as indicated, a typical airplane controller is unidirectional. The most common "default" is 1000uS as zero speed and 2000uS as full speed, or something resembling that range. Of course, the ESCs can be recalibrated to accept different endpoints at will, so this distinction is mostly inconsequential.A Simple "Servo Tester" is Your Friend
A vehicle throttle is basically a knob you turn to generate a signal to something which controls how fast the vehicle goes. In gas engined vehicles, this knob might literally have pulled on the engine's throttle body, but generally these days it's an electronic signal to the engine computer.
In the hobby world, there exists a small device that is sold commercially which does precisely the task of converting a knob motion to "servo" pulses, and it's called a servo tester
. An example is shown in picture 2; this one in particular
. They are used in lieu of setting up a whole radio and receiver just to make sure your servos work. Notice that one (and most cheap ones sold today) have three outputs - this lets you test all 3 servos in a helicopter main rotor simultaneously. You only need to use one.
The cool part about most servo testers is that you can directly drop a 0-5v source, such as a 3-wire potentiometer or commercial vehicle throttle, into the place of the knob (which itself is a potentiometer). The 3rd image shows a conversion I have done to that particular servo tester model - the 3 pin connector goes to a commercial hand throttle (more on those parts in a bit). After this stage is complete, you have a direct analog voltage to servo pulse converter that can be installed in a vehicle.
Note that these come with different modes available such as "neutral", useful for keeping your servo centered while you adjust linkages, and "sweep", which automatically does a full 1000-2000uS sweep. These modes are not useful, and if accidentally selected during operation, can result in bad
. It is recommend to remove the button which selects the modes.Full hardware method
If you love
torturing yourself, you can build a 100% hardware (i.e. resistors, linear integrated circuits, caps) timing circuit that will convert a 0-5v reference to the appropriate servo pulse. I link to a few
in the older edition, but these days, you have no excuse to use a full hardware servo tester given that they cost like 5 cents. Hardware component values change with temperature and even humidity, and there are more parts, leaving them more prone to failure.Throttle ramping
Because sensorless R/C controllers can't really control how much current they send to the motor (and current is directly proportional to torque output), and low-speed starting can be erratic and hard to control, it is useful to have a "ramp" somewhere in the throttle chain. Without ramping or some other kind of control input damping, sudden jerk motions of your hand or foot can result in the vehicle responding unexpectedly such as a sudden application of power. This is not only hard to operate, but it can be outright dangerous if you are in traffic or around other people.
Ramping can be accomplished either in hardware or in software.Hardware resistor-capacitor filter
In the fourth image is a "RC filter" type circuit, where RC is resistor-capacitor
, which smooths out sharp transients in the control input. The general form of the circuit is known as a low pass filter, and its technical details will not be discussed (Wikipedia can provide a better treatment than I ever can). The values of your choice of R and C determine the damping "time constant", and that's just given by Trise = R * C
No, really, that's it. So in the example, a 100K resistor and a 10uF capacitor together form a filter which has a rise time of 1 second - meaning if you floor it from standstill (like you shouldn't be doing anyway, right?
) the control signal takes 1 second to reach 63% (the defined standard threshold for this circuit). True settling time
is defined as the time it takes for the output to reach over 90% of the final value, and is generally accepted to be 3 time constants (3 * T). You may adjust the R and C values to achieve however fast a filter you want.
It is important that the resistor is of significantly higher (at least 10 times) value than the throttle potentiometer, and should be at least 10K ohms. The reason is that if the resistor is too close to the pot's total resistance, the potentiometer affects the filter's time constant strongly. I put 100K as an example, but with most vehicle throttles being 5K ohm resistors, try to use at least a 47K resistor. The capacitor can be any polarized or nonpolarized type, but if it's polarized, please put it in straight. The whole circuit can be soldered inline with a throttle harness.
The second variant of this circuit adds a one-way bypass to the system such that throttling down is unramped - meaning if you let go from full throttle, it doesn't take a full second for the throttle signal to slowly come back down, it will do so almost instantly
. The diode conducts if the input voltage on the potentiometer side is lower than the capacitor's voltage (which is the output), so it effectively shunts input to output for those positions.In software using a microcontroller
Ramping is also achievable in software if you're making your own servo tester-like device anyway. For instance, the following Arduino code implements ramping by taking a R/C pulse in on one digital pin and spitting it back out on another. This was written by Arduino and motor control master Shane Colton
#define THR_MIN 178
#define THR_MAX 870
#define PWM_MIN 1000
#define PWM_MAX 2000
#define SPEED_LIMIT 0.33 // fraction of full speed
#define RAMP_LIMIT 0.13 // fraction of full speed per second
float pwm_f = (float) PWM_MIN;
signed int thr = THR_MIN;
float thr_f = (float) thr;
float pwm_target = (float) PWM_MIN;
unsigned int pwm_i = PWM_MIN;;
thr = analogRead(7);
thr_f = (float)(thr - THR_MIN) / (float)(THR_MAX - THR_MIN);
pwm_target = thr_f * SPEED_LIMIT * (float)(PWM_MAX - PWM_MIN) + (float) PWM_MIN;
if(pwm_target > pwm_f)
pwm_f += RAMP_LIMIT * (float)(PWM_MAX - PWM_MIN) * 0.05;
pwm_f = pwm_target;
pwm_i = (unsigned int) pwm_f;