Skip to content

Using a servo motor for an elevator trim indicator

Jaime Leon edited this page Sep 18, 2024 · 20 revisions

This tutorial will cover how to configure Mobiflight with a servo motor to control an elevator trim indicator gauge, like in a Cessna C172. We will not go into any details about how the elevator trim gauge internal mechanism should be built. In general, the servo will move a needle in a limited range, controlled by Mobiflight depending on the value of the elevator trim position given by the flight simulator.

image

Wiring connections

A 9g servo can be used for this example. In addition to the 5v and GND wires, only one Arduino digital pin is needed to connect the servo. In this tutorial we show pin 9 being used, but it can be any available pin.

Even small servo motors of the 9 gram type typically use 500 mA to 750 mA. This is a relatively high current for an Arduino, so an external power supply should be used.

servo-motor-with-arduino-uno-wiring-diagram-schematic-circuit-tutorial-featured-image

Mobiflight device configuration

Mobiflight device configuration

Create the device configuration for the servo motor in Mobiflight Modules. Specify the data pin where the servo motor was connected. In this example, it is pin 9.

image

Mobiflight output configuration

Sim variable tab Create an output config in Mobiflight, to display the value of the generic variable using the servo we connected.

(A:ELEVATOR TRIM PCT, percent over 100)

Please note that this variable takes values in the range from -1.0 to +1.0.

image

Because the simulator variable range is -1.0 to +1.0, it is necessary to change this value to a positive integer scale for use in the servo movements. The servo only takes positive integer values.

In this case, we have chosen to use an interpolation modifier that takes as input the -1 and +1 in the left column, as received from the simulator. Here we define the output to be 255 and 0 in the right column. Please note that by specifying 255 first and 0 second, we are setting the movement to be inverted. If this inversion is not required, then specify 0 first and 255 second.

image

image

Installation

User Interface

Examples and tutorials

MSFS2020

X-Plane

Workshops

Community Boards & Devices

Additional Information

Firmware

Clone this wiki locally