Wiring and configuring a Stepper Motor for PMDG 737 Auto Throttle
STEPPER MOTOR DRIVEN AUTO THROTTLE LEVER with Mobiflight
This tutorial shows how to configure a stepper motor to drive an Auto-Throttle lever in the PMDG 737-600 aircraft. The same technique was tested successfully in the Cessna Longitude, so it is not difficult to apply to any other aircraft with Auto-throttle. Also, this is not the only way of doing an auto-throttle with a stepper motor, but it is the result of my personal tests and I liked it because it doesn't require a clutch system to operate manually, but it does require disengaging the auto-throttle to move the levers manually.
HARDWARE CONSIDERATIONS
The tests were made with custom designed, 3D printed, throttle lever. It is really nothing special: a geared lever with a geared stepper motor attached on one side and a geared potentiometer on the other side.
The gear ratio was designed to be 2.7:1, and it is the same for the stepper and for the potentiometer. This ratio was chosen to have full resolution on the potentiometer scale, which moves about 270 degrees, while the lever was designed to move 100 degrees from idle to full throttle. The gear ratio for the stepper was chosen to be the same as the potentiometer in order to facilitate the scale conversions for input and output, and to allow the 3D model design to be symetrical about the lever gear centerline. This symetry allows the placement of the stepper motor for the second lever (in twin engined aircraft) in the exact position where the potentiometer gear is, making it very easy to mirror image the 3D model when adding additiional levers.
Nonetheless the above considerations for future growth, all the tests described here were made with only one lever.
This is the hardware required for this build:
1x Nema 17 stepper motor rated for 12v and 1A. https://www.amazon.com/STEPPERONLINE-Pancake-Stepper-Bipolar-Extruder/dp/B0B93PNYCP/ref=sr_1_9?keywords=nema+17+stepper+motor&qid=1685057150&sprefix=nema+17%2Caps%2C140&sr=8-9
1x A4988 stepper driver board. https://www.amazon.com/HiLetgo-Stepstick-Stepper-Printer-Compatible/dp/B07BND65C8/ref=sr_1_3?keywords=a4988+stepper+driver&qid=1685057323&sprefix=a4988+driver%2Caps%2C132&sr=8-3
1x Potentiometer, B10K ohm linear resistance
1x Arduino board, any of the supported boards will be fine. A Nano board was used in these tests.
1x Mini-USB to type A usb cable to connect the arduino to the PC.
1x 12V power supply to power the motor (an old 2A adapter I had lying around)
1x 100uf electrolytic capacitor
1x Breadboard
A handful of jumper wires as required
WIRING DIAGRAM FOR THE MOTOR
The stepper motor should include a cable to connect it. The cable connectors were supposed to match the connector in the A4988 2B, 2A, 1B and 1A pins. During the motor first tests it became evident that this was not correctly wired, as the motor vibrated and moved erratically. The correct wiring is as detailed below:
A4988 COILS STEPPER
2B -----> A+ ----> A
2A -----> A- ----> C
1B -----> B+ ----> B
1A -----> B- ----> D
In my case, the two middle wires had to be inverted. I tested for continuity on the stepper pins to ascertain that pins A-C and pins B-D were on the same coil. Further investigation on the stepper motors pinout diagrams has revealed that there are several possible pin arrangements, so you should check your stepper manufacturer datasheet to make sure you have the correct pin order.
THE A4988 DRIVER BOARD
Only two pins need to be connected between the A4988 and the Arduino board to control the stepper. Pin 7 STEP and pin 8 DIR. With each 5v pulse on the STEP pin, the motor will advance one step, in the direction given by pin 8 (1 for CW and 0 for CCW). Connect pin 7 to Arduino pin D3 and pin 8 to Arduino pin D2.
The microstep resolution is controlled by pins MS1, MS2 and MS3, according to this table. In these tests, we used the Eigth step resolution, so apply 5v to each of pins MS1 and MS2, leaving MS3 open. This means the stepper will take 200 x 8 or 1600 microsteps per revolution.
Connect pin 1 (EN) to Arduino pin D4. This is the Enable pin for the board. Default behavior with this pin open is board ACTIVE. If you apply 5v on this pin, the board disables the motor by cutting all power to the motor coils. This leaves the motor free to move with very little resistance.
Connect pin 5 to pin 6 (RST and SLEEP). RST is a floating pin. If you’re not using this pin, connect it to an adjacent SLP/SLEEP pin to make it high and enable the driver.
Connect the power supply to pins 15 and 16 on the A4988 (VMOT and GND). Connect the 100uf capacitor across the 12v and GND lines. Connect the Arduino 5v and GND to pins 10 and 9 respectively on the A4988.
The current to the motor needs to be adjusted with the potentiometer on the lower side of the A4988 board. With power connected to the board, connect your multimeter as shown on the diagram and gently turn the screw of the adjustment potentiometer until you read 0.14 volts. The suggested method is to clamp an aligator clip to a screwdriver so that voltage can be measured as you adjust the screw.
THROTTLE LEVER MECHANICS
The throttle lever is to be geared to both the potentiometer and the stepper motor. The idea being that when auto-throttle is not engaged, the EN pin of the driver board is set HIGH which causes the motor coils to be without power and allow the lever to freely move. When engaged, the EN pin is set LOW and the lever will be under the stepper motor control and cannot be moved by hand, unless the A/T disengage button is pressed first. No clutch system was included in this design, nor is it needed.
The lever potentiometer is connected normally with 5v and GND on the two side terminals and an Arduino analog pin to the middle terminal. In this case, connect to pin A0. You may need to later invert the 5v and GND connections, if you find the potentiometer readings to be inverted.
MOBIFLIGHT CONFIGURATION
In Mobiflight we need to create one analog potentiometer input to monitor the lever position and one button input config for the A/T disengage button. On the output side, an output that reads the current throttle lever position and sends it to the stepper motor. Another output configs reads the status of the A/T system and sets the EN pin of the stepper driver board, so that if the system is disengaged, the stepper motor coils will be without power.
Notice that there is no precondition being set for the stepper motor display config. Mobiflight will continue sending stepper positioning commands to the motor regardless of the status of the A/T being engaged or disengaged. It is the status of the EN pin that determines whether the stepper will actually have power to move or not. Because the stepper continues to receive the lever position data, this allows the sim lever position and stepper motor to remain in sync with each other. The stepper is always in sync with the physical lever because they are mechanically linked together and in this design, no clutch system is used.
When A/T is engaged, the simulator will ignore the analog input commands sent by the physical lever position potentiometer and take control of the virtual throttle lever, updating the throttle sim variable. The stepper will be powered and will move the physical lever accordingly.
When A/T is disengaged, the driver board EN pin is set to HIGH, disabling the stepper motor, the motor coils will be un-powered and the physical lever can be manually moved. The analog input from the physical lever and potentiometer are not ignored by the simulator and the virtual lever is positioned according to the manual movement.
- MobiFlight Connector Installation
- Mobiflight Connector BETA version installation
- Modules
- MobiFlight Connector Files Structure
- MobiFlight Connector Uninstall
- Modules Reset to factory default
- Verifying the WASM module installation and locating the MSFS2020 community folder
- Providing logs from MobiFlight
- MobiFlight Connector How does it work
- Mobiflight Connector Main Window
- Flash module with MobiFlight firmware
- Input and Output devices
- Joysticks
- Midi Boards
- Sim Variables (for Output)
- Input Actions
- Merging configuration files
- Disabling specific COM ports
- Examples Output LEDs
- Examples Input Switch
- Example 7 segment display
- Example Servo motor
- Controlling LEDs with an output shift register
- Adding lots of buttons with an input shift register
- Beginner's guide to input multiplexers
- Key Matrix with standard MobiFlight and Multiplexers
- Tutorial Easy Driver and x.27 or x.40 Stepper Motor
- Tutorial for Airbus VS display via 7-Segment LED Module
- Example Analog Input Potentiometer
- Baron G58 Tutorial Gear, Flaps, Mags, ELT Input Output Programming
- Using Mobiflight to control arduino-based 3rd party panels (RealSimGear GNS530)
- How to use a VNH2SP30 DC motor shield with MobiFlight
- Using 3D printer mainboards
- Playing sounds by sending keystrokes to AutoHotKey
- Using the selector knob on a Honeycomb Bravo
- Using an adjustable 12 position switch as a GA starter
- Brightness of LCD displays with I2C
- Using three-position switches
- Transponder with one Rotary
- MSFS2020 RPN Tips and Tricks
- MSFS2020 Using the Custom Input Code Box
- MSFS2020 Install WASM module and Event List
- MSFS2020 How to Create and Use User Defined Lvars
- MSFS2020 How to Create a Blinking LED configuration
- MSFS2020 User Defined WASM Module Events Best Practices
- MSFS2020 Developer Mode, Model Behavior dialog and Console window
- MSFS2020 PMDG 737‐700 List of Events that require use of FSUIPC7
- MSFS2020 PMDG 737‐700 Calibrate throttle idle and reverse thrust using interpolation (Valkyrie)
- MSFS2020 PMDG 737-700 Chrono unit functions implemented in Mobiflight
- Configuring PMDG 737 Parking Brake Lever Auto-Release with a Servo in Mobiflight
- Using encoder to drive a value back and forth within a given range