3. Approach
The CAVS Flight Simulator allows users to interact with Microsoft Flight Simulator with realistic aircraft
hardware. It uses physical gauges, switches, yoke, throttle, and other input devices to create the physical
interface. The subsequent sections describe the hardware and software components that make up the
framework of the simulator.
3.1 Hardware Overview
As shown in figure 3.1 the throttle, rudder pedals, switches and the physical gauges are connected to the
microprocessor. The throttle, flaps, and rudder pedals use potentiometers that send a value to the
microprocessor. The switches have a low or high value input to the microprocessor. The microprocessor
takes that information and sends it to the simulation pc. The simulation pc will adjust the values
accordingly in Microsoft Flight Simulator. The microprocessor takes values from the simulation pc and
drives the physical gauges to the correct values. The yoke is directly connected to the simulation PC by
USB. The scenery is displayed by MFS on a projector screen. A LCD screen will be connected to the
simulation pc to display the visual gauges.
Figure 3.1 – System Overview
3.2 Hardware Subsystems
The main hardware components in the CAVS Flight Simulator include microprocessors, stepper motors,
throttle, rudder pedals, flaps, switches, and motor drivers.
3.2.1 Microprocessor
The microprocessors are the core of our project. The PIC24HJ64GP502 is the type of all the
microprocessor used in the CAVS Flight Simulator. The PIC24 is much easier to use and faster than a
PIC18. Each physical gauge being used will have its own microprocessor. The throttle, rudder pedals,
flaps, and switches will be on a separate microprocessor.
3.2.2 Physical Gauge
The Physical Gauges implemented need a motor to turn the gauge dial to the value displayed in MFS.
Figure 3.2 shows a representation of the mechanical gauges that will be built for the simulator.
Line Sensor
Stepper Motor
Needle 270
Faceplate
180
Figure 3.2 – Physical model of an example gauge
There are many types of motors able to accomplish this. Table 3.1 shows the criteria used to decide
which device to use.
Table 3.1 – Servo, Stepper motor comparison
Motor Type Rotation (Degrees) Position Motor Driver
Servos 180 Known Built-in
Stepper Motors 360 Unknown Needed
The first solution evaluated for the physical gauge is the servo. Because servos have the feedback
circuitry built-in, they are much simpler to use and always know the position of the motor. Unfortunately,
it is also this feedback circuitry that limits the servo to 180 degrees of motion. 360 degrees of motion
could be achieved by adding mechanical gears to the servo; however, the gears must be carefully picked
and make the gauges more vulnerable to failure.
Stepper motors provide a second option for operating the physical gauges. These motors use magnets and
windings, and have no limits on the amount that they can turn. Though this simplifies the mechanical
design as opposed to using servos, the external circuitry required to drive the motor is more complicated.
In order to drive the motor, an H-bridge is required if the motor is wired as bipolar, or switching
transistors if wired as unipolar. These circuits allow the motor to be driven by a larger power supply,
since the PIC usually cannot supply the current to drive the motors. This circuitry does not include
feedback, though, and an external switch or sensor is necessary to determine the motor’s home position.
Because of the rotation limitations of the servo, The CAVS Flight Simulator’s physical gauges use
stepper motors with an external sensor and a motor driver.
3.2.3 Throttle, Rudder Pedals, and Flaps
The throttle, rudder pedals, and flaps in the airplane cockpit use potentiometers that are connected to a
PIC24, which is interfaced with MFS. The knob on the potentiometer will have mechanical links that
mimic the non-linear movement of the throttle, rudder pedals, and the flaps. Figure 3.3 shows the throttle
and potentiometer.
Figure 3.3 – Throttle and measuring potentiometer [1]
3.2.4 Motor Driver Circuit
The CAVS Flight Simulator requires an h-bridge motor driver that is able to power and turn a unipolar
stepper motor. An h-bridge is an external circuit, made up of BJT transistors (NPN or PNP) and diodes,
which allows voltage to be applied across the load in either direction. Figure 3.4 shows an example of an
h-bridge for a simple circuit that can control power to a motor from a low power circuit such as the
logical IO from a microcontroller.
Figure 3.4 – Example H-bridge circuit [2]
H-bridges are usually found used with robotics or dc motors which allows the motor to run backwards or
forwards [3]. An h-bridge can be designed from discrete components or purchased in integrated circuit
(IC) form which will mimic what a h-bridge is supposed to do. There were two IC chips that were taken
in consideration, the Texas Instrument SN754410NE and Jameco ULN 2003A. Table 3.2 shows the
difference between the two and which one would be best to use
Table 3.2- Integrated Circuit chip Matrix [4],[5]
Control Delay Time Maximum Maximum Price
Current Voltage
Texas Instrument Bipolar 300 ns 500 mA 36 V $2.97
SN754410NE
Jameco ULN Unipolar 10 us 500 mA 50V $0.22
2003A
(a) (b)
Figure 3.5 Example Circuits (a) Texas Instruments H-bridge, (b) Jameco Darlington Array [6],[7]
The first IC motor driver chip considered was the Texas Instrument SN7554410NE. It is widely used for
a bipolar stepper motor. The SN754410 Quad Half H-Bridge is capable of driving high voltage motors
using TTL 5V logic levels; the SN754410 can drive 4.5V up to 36V at 1A continuous output current.
Since we are using a unipolar stepper motor, an h-bridge is not the only or most popular option.
However, it can be wired as bipolar the four input wires from the motor are connected the chip and the
two center tap wires are grounded. Then, the motor would be driven by a bipolar sequence which is
shown in Figure 3.6.
Figure 3.6 – Bipolar step sequence [6]
When the motor becomes a bipolar it treats it as if there is a single winding per phase. Also because the
windings are better utilized, it would cause the motor to become more powerful than if it was wired as
unipolar. The downside to this, though, is that it causes the motor to become less efficient and it would
not be able to perform a half-step. [6]
The second IC motor driver chip considered was the Jameco ULN 2003A. This chip is widely used for a
unipolar stepper motor. The ULN2003A is monolithic high-voltage, high-current Darlington transistor
arrays. Each consists of seven NPN Darlington pairs that feature high-voltage outputs with common-
cathode clamp diodes for switching inductive loads. The collector-current rating of a single Darlington
pair is 500mA. The Darlington pairs may be paralleled for higher current capability. The ULN2003A
has a 2.7kΩ series base resistor for each Darlington pair for operation directly with TTL or 5-V CMOS
devices. [7] This chip would be best for us since we are using a unipolar stepper motor. With the
ULN2003A it would drive the motor several different ways. The most common ways would be to use
normal sequence, wave drive sequence, and half-step sequence. Figure 3.7 provides clear illustration of
how the coils would be turned on to turn the motor [6].
(a) (b) (c)
Figure 3.7 – Stepper Motor Drive sequences. (a) Normal sequence, (b) Wave Drive Sequence, (c)
Half-Step Sequence [6]
So when the motor is treated as unipolar, it becomes more efficient because of the lower cost in the motor
speed. The downside to the unipolar configuration is that it requires more voltage inputs and loss of
power in the motor [7].
3.3 Software
3.3.1 System Software Overview
The software for the CAVS Flight Simulator can be categorized into three sections, corresponding with
the gauges, inputs (throttle, flaps, switches), and Microsoft Flight Simulator (MSFS) interface. The
hardware was designed with an object-oriented perspective, meaning that there is a microcontroller for
each different type of device in the simulator. Thus, there is a need for the software to be divided into
sections as well. The hardware and software is designed so that each device may be a peer in the network,
instead of the typical master/slave arrangement. The following sections describe each of the different
software products included in the CAVS Flight Simulator.
3.3.2 Gauge Controller Software
The gauge controller software is responsible for updating the gauge display. This software communicates
with the MSFS interface software to obtain the value of each type of gauge in the instrument panel. Once
the value has been converted to the range of the motor, the gauge will be updated.
The microcontroller utilizes 4 digital pins to output the step sequence to the motor controller. It will also
use a digital input pin to read the value of a line sensor, which will determine if the motor is at its home
position. By using a software counter from the home position, the micro can ascertain the location of the
motor.
The following flow chart illustrated in figure 3.8 describes the operation of the gauge controller software.
Power On Counter = 0 Drive Motor
Wait for command
Motor at from CAN bus
home
Yes
position? Increment counter
# of steps
No
Process command
Drive motor
Figure 3.8 Gauge Controller task
3.3.3 Input Device Software
The software running on the input device microcontroller handles the throttle, flaps, rudder pedals, and
various switches. The software will monitor the state of each device, and communicate with the MSFS
interface software when a device changes state.
This controller will use the internal analog-to-digital converter (ADC) to read the values of the throttle,
flap, and rudder pedal potentiometers. These values will be converted to the ranges desired by Microsoft
Flight Simulator and sent to the interface software. Digital input pins display the state of the switches and
communicate with the interface software when the state changes.
The subsequent diagram in figure 3.9 shows the operation of the input device software.
Power On Scan inputs
Inputs Send value via
Read state of all Changed? CAN bus
inputs
No
Delay 10mS
Set defaults
Figure 3.9 Input Device software task
3.3.4 MSFS Interface Software
The Microsoft Flight Simulator Interface software serves many purposes in interfacing the
microcontrollers with MSFS. Using a predefined packet protocol, the software reads the packets from the
communication interface, and decodes them to get the value and the message id, which tells the software
what device sent the message. The software places these commands into a queue, which is processed by
another thread. The interface software uses the same message id protocol as the microcontrollers to
determine which value in Microsoft Flight Simulator to change. Most importantly, it communicates with
FSUIPC, an inter-process communication software that handles the inputs and outputs from Microsoft
Flight Simulator.
Figure 3.10 shows the functional diagram of the interface software.
Wait for data
Is queue
empty?
Disassemble
packet
Remove
Process
command
command
Add command to Check if value is
queue valid
(a) (b)
Figure 3.10 Interface Software tasks. (a) Communication Thread, (b) Main thread.
3.3.5 Usage Cases
Figure 3.11 displays an interaction between the user and the simulator. For this case, the user
uses the switches, throttle, and yoke to operate the simulator. The software and hardware
communicates successfully and the gauges are updated correctly.
USER SYSTEM
User powers on system
Simulator waits for user input to start flight
User starts the flight simulator game
User moves throttle
Simulator software receives these inputs
FSUPIC receives the inputs from the simulator software
Simulator gauges are updated to reflect the software
User moves yoke
Simulator software receives these inputs
FSUPIC receives the inputs from the simulator software
Simulator gauges are updated to reflect the software
User toggles switches
Simulator software receives these inputs
FSUPIC receives the inputs from the simulator software
Simulator gauges are updated to reflect the software
User ends game
Figure 3.11 – User Interaction Sunny Day
Figure 3.12 displays a situation when the interface software and FSUPIC do not communicate
correctly.
FSUPIC INTERFACE SOFTWARE USER
Software attempts to connect to
MFS through FSUPIC
FSUPIC is unable to connect Software sends error message to user
Figure 3.12 – User Interaction Rainy Day (Software Error)
Figure 3.13 displays an example of when the gauges do not function properly.
USER SYSTEM
User powers on system
Gauges reset
Gauges rotate without finding home position
Micro sends error message to interface software because of
malfunctioned gauges
Figure 3.13 – User Interaction Rainy Day (Hardware Error)
Appendix
References
[1] Throttle control mechanism with haptic feedback, [Online] Available:
http://www.freepatentsonline.com/7112107.html
[2] [Online] Available: http://www.blogcadre.com/files/rccar-h-bridge.jpg
[3] H-Bridge, [Online], Available: http://en.wikipedia.org/wiki/H-bridge
[4] High Voltage, High Current Darlington Arrays, [Online] Available:
http://www.jameco.com/Jameco/Products/ProdDS/34278.pdf
[5] Quadruple Half-H Driver, [Online] Available: http://focus.ti.com/lit/ds/symlink/sn754410.pdf
[6] Controlling Stepper Motors – With Forth, [Online] Available: http://www.forth.org/fd/Step.html
[7] [Online] Available:
http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/ComputerControlledStepperMotor_DE
FE/clip_image002%5B16%5D.jpg
[8][Online] Available: http://reviews.ebay.com/Stepper-Motor-Testing-and-
Implimentation_W0QQugidZ10000000001227707?ssPageName=BUYGD:CAT:-1:LISTINGS:2
[9][Online] Available: http://www.docstoc.com/docs/19687160/uln2003a-high-voltage-high-current-
darlington-transistor-array