Blog / News ArdSimX Articles/Guides Project Archive SimVim Panel Baron-58 sim

Servo control

Using small hobby (RC) servos you can create some mechanical instruments for your home cockpit. The drawback is that servos have fixed range of shaft rotation (typical 180°, but you can increase it to 360° by adding a 2:1 step-up gear). So the servo-driven gauges can have only non-continuous rotation (the instrument arrow rotates in range of one circle)

A typical servo has a small DC motor with metal or nylon drive gears to reduce rotation speed and increase torque. The output shaft can be rotated to a specific angle (or moved to a specific position for the linear servo) according to the pulse signal width.

The potentiometer on the shaft and a control circuit allow to monitor the angle of the shaft and turn the motor in the correct direction until the angle is correlated with the pulse width.
Control pulses width

The control pulses width for the servo can be in range of 0,5-2,5 ms (500-2500 mcs) and this range differs for various brands (!). Even if you have several servos of one manufacturer all of them may have slightly different control ranges.

So, before using a servo in your gauges you should test each of them to find out their minimum and maximum control pulse width in microseconds and put a sticker with these values on every servo.

  • Use external stabilized DC power supply for servo powering (not USB!)
  • Typically most servos have Operating Voltage Range of 4.2 - 6 Volts
  • Ensure you are using the optimal Voltage for your servo (+5v mostly is good)
  • Be sure to connect the grounds of Arduino and servo external power supply together.
  • Servo has three wires: power, ground, and signal.
    The power wire is typically red, the ground wire is typically black or brown

Testing the pulses width
For this test you can use the "Servo_range_LCD" or "Servo_range_Serial" test sketches:

Servo_range Test

The setup for the "Servo_range_LCD" code is shown in the video below.

Before turning power on set the potentiometer shaft in the central position to prevent out-of-range servo movement. After Arduino has initialized, the servo will turn into some position and the text "Servo microseconds:" will apear on the LCD, with the number of microseconds corresponding to this servo position. Start rotating the potentiometer controlling the servo, and watch when the servo reaches the limit of it's rotation. Stop rotating at the moment it reaches the limits, and write down the minimum and maximum microseconds numbers for this servo.

When using the "Servo_range_Serial" test sketch, the microseconds will be displayed in the serial terminal instead.
Calibrating the servo for specific instrument dial

Typically, a servo has 180° rotation range. If your gauge has lesser angle range (as some fuel gauges or some engine parameters gauges), just use a part of full servo shaft rotation. Print the dial for chosen instrument on the paper, place it on your servo, attach an arrow. Then determine the minimum and maximum microseconds number for the full scale of this gauge, using the procedure described earlier.

Keep in mind that the minimum and maximum number of microseconds can be correlated with the leftmost and rightmost positions of the servo arrow, or vice-versa. It depends on the particular servo model. You should know this for the correct mapping for the servo control in ArdSimX Interface .

If your instrument has a dial scale larger than 180° you can increase the angle range using 3 options:

1. Adding a step-up gear

Adding external step-up gear (e.g., 1.5:1 or 2:1 ), this method doesn't require to disassemble the servo, you need to find a couple of suitable gearwheels and make a support constuction for gear. Gear ratio can be from 1.1 to 2:1 to extend the servo rotation angle by 10-180°. Do not make the rotation angle of more than 360°.

2. Replace internal potentiometer

Replace the internal potentiometer with another one with a large rotation angle (270-280°). You will need to remove the limiter for the output gear. The potentiometer can be placed outside of servo casing. Make sure that the potentiometer's resistance change is linear, and that it has the same max resistance value as the original one. This is a very good method to use, especially when using a high-precision potentiometer.

3. Using internal gearwheel axis

You can try to extend the shaft of the penultimate gearwheel, to use it as the new output shaft to provide larger rotation angle. However, it is likely that using this gearwheel will make the arrow rotation angle much larger than 360°, depending on the last gears ratio.

svimg svimg svimg svimg svimg

svimg svimg svimg svimg svimg

Video below

Video showing a modified servo, with an output shaft placed on the penultimate gear. This video not represents X-Plane dataref output, the servo is controlled with test program using potentiometer.

Note that the ratio of the final gears in this servo was more than 3:1 and with skipping the last gear the rotation angle was increased from 180° to 580°. So, using this modified servo for a gauge having less than 360° dial scale not a full range of the servo is used ( in this case 500-1600 microsecond instead of original 500-2200).

Calibrating the servo for non-linear instrument dial
Some instrument has non-lineary scaled dials (divided into several linear segments). In this case you should determine the microsecond numbers for each segment and write them down for use in the library function for servo control.

ArdSimX Interface allow you to configure output for segmented non-linear instruments.

Different servos with range labels:


Example of the servo gauge controlled by RPM dataref from ARDref plugin:

Example: Rudder trim position indicator for Baron 58
This example uses one encoder attached to the trim wheel and a servo that rotates the disk with the scale.

Video on youtube

© Copyright 2012 - Vlad Sychev