-
-
Notifications
You must be signed in to change notification settings - Fork 106
Baron G58 Using a Real Magneto Switch
In this tutorial we will use a real airplane Bendix magneto switch to operate the ignition of the Beechcraft Baron G58 in MSFS2020 using Mobiflight. This task is not so easy or straight forward because a magneto switch does not operate like a regular circuit switch. Note that there is no direct relationship between a switch positions and a terminal connector such that we can singularly determine the switch state in the traditional way done in Mobiflight (one pin = one switch state).
Here are some photos of how the magneto switch looks like for a real airplane.
This is the wiring diagram of a Bendix magneto switch from the manufacturer:
A magneto rotates with the airplane engine and generates a high current with low voltage in its primary coil. This is transferred to the secondary coil where a low current with high voltage is induced and used to provide the required power to the engine spark plugs. The magneto switch disables the magneto coils by connecting them to ground. The magneto switch has five switch positions: OFF, RIGHT, LEFT, BOTH, and START. Each switch position has a different combination of terminal connections to ground or to the battery. The following table with terminals versus switch positions present this connection scheme shown below. We note that the Start position connects the S terminal with the BAT terminal on a different pole.
With this information, we have prepared the wiring diagram to an Arduino Mega board shown below. Please note we will make five connections to switch terminals: L (left magneto), R (right magneto), S (start engine), BAT (battery) and GND (ground). The first three terminals will be connected each to one Arduino digital pin. We are showing pins 27, 29 and 31, but it really can be any three digital pins available. The last two terminals are jumpered together and connected to the Arduino common ground connection. Please make a map of which switch terminal is connected to what pin number in the Arduino.
The general approach to solve this problem is to connect the magneto switch three key terminals (L, R, and S) to the Arduino. With each switch position, the board will be able to read the state of each of the three terminals and the software will calculate from this information the correct switch position and issue the appropriate instructions to the simulator.
Go to Mobiflight Modules, select the correct module from this window. We are assuming that you have already uploaded the Mobiflight firmware to the Arduino Mega board, and that this board has been recognized by Mobiflight Connector when it started. If you have not done this, please do that before proceeding with this tutorial.
Let's now create three devices as Buttons with the pin numbers where the switch terminals were connected. You can name these three devices as "Mag1_L", "Mag1_R" and "Mag1_S".
When you have completed creating the three devices, save the board configuration pressing the Save button. Upload the configuration to the board by pressing the Upload Config button. Mobiflight will store the new configuration in the board memory and notify you that the operation was successful. Good job. Your board is now configured with the three buttons.
We will now create three input configurations, one for each of the buttons we created in the previous section. You can call these configurations: "Mag1 L pin", "Mag1 R pin" and "Mag1 S pin". Please select the Action type as "MSFS2020-Custom Input". Note from the code presented below that all three variables are set to 1 on press and back to 0 on release, i.e. we are only setting the state of each of the switch terminals (either on or off). There is also a "Mag1_action" variable that is set to 1 on every action either press or release, and it is used as a flag to indicate that a change of state has occurred. Its use will become clearer later on.
Mag1 L pin input configuration
On press: 1 (>L:MF_Mag1_L) 1 (>L:MF_Mag1_action)
On release: 0 (>L:MF_Mag1_L) 1 (>L:MF_Mag1_action)
Mag1 R pin input configuration
On press: 1 (>L:MF_Mag1_R) 1 (>L:MF_Mag1_action)
On release: 0 (>L:MF_Mag1_R) 1 (>L:MF_Mag1_action)
Mag1 S pin input configuration
On press: 1 (>L:MF_Mag1_S) 1 (>L:MF_Mag1_action)
On release: nothing
An output config can be used to execute RPN code repeatedly in the simulator side. We will use this facility to monitor the switch for any changes in the state of the terminals and send the appropriate instructions to the simulator according to the switch position.
Code to be pasted in the "Preset Code box" of the output config wizard. You may need to check the "Show Preset Code" in order to see the code box.
(L:MF_Mag1_action) if{ 0 (>L:MF_Mag1_action)
3 (L:MF_Mag1_R) (L:MF_Mag1_L) 2 * + - 0 max 3 min s0 (>K:MAGNETO1_SET)
(A:GENERAL ENG STARTER:1, Bool) if{ 0 (>K:SET_STARTER1_HELD) }
(L:MF_Mag1_S) if{ 0 (>L:MF_Mag1_S) 3 (>K:MAGNETO1_SET)
(A:GENERAL ENG STARTER:1, Bool) ! if{ 1 (>K:SET_STARTER1_HELD) } } }
Brief description of the code function
The _action variable is used as a flag to indicate that a change of state in the switch terminals has occurred (the switch has moved) and therefore action needs to be taken. If there is no change of state, all the code is skipped without anything done. If there is a change of state, the first action is to reset the _action flag back to 0.
Second action is to calculate the switch position based on the state of the _L and _R variables. Four possible states numbered from 0 to 3 are calculated, representing the switch positions: "OFF", "L", "R", and "BOTH" (3, 2, 1 and 0). Because the logic of the switch states is the inverse to what we would normally consider (remember the switch is connecting to ground the magneto that is to remain off), the scale must be reversed to have zero equal to "off" and so on. To achieve this, we subtract the calculated number from 3.
Third action. The calculated number is used as a parameter to set the simulator ignition switch with the K event MAGNETO1_SET. The engine starter variable is checked and if on, the starter is turned off.
Special case for the starter operation. If the third _S variable is set to 1, i.e. the switch was moved to the Start position, then the state of L and R is ignored and the instruction to activate the engine starter is sent by setting the K:SET_STARTER1_HELD to 1 and the switch is placed in the BOTH position.
GOOD LUCK!
- 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
- Verifying the WASM module installation and locating the MSFS2024 community folder
- Using a Winwing FCU with MobiFlight
- 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
- Workflow for Creating Flight Simulation Panels ‐ Part 1
- 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
- Adding a custom board to MobiFlight
- User guide - Community Board and Custom Devices
- Developing your own custom devices/boards