Skip to content

Baron G58 Using a Real Magneto Switch

Jaime Leon edited this page Sep 27, 2023 · 54 revisions

How to Interface a Real Bendix Magneto Switch for the Baron G58

General Information

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.

image bendix magneto switch back

This is the wiring diagram of a Bendix magneto switch from the manufacturer:

image

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.

image

Wiring the Hardware side

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.

image

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.

Create the device configuration for your Mobiflight module

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".

image

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.

Create three input configurations for these 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

image image

Create an Output config for monitoring the action

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!

Installation

User Interface

Examples and tutorials

MSFS2020

X-Plane

Workshops

Community Boards & Devices

Additional Information

Firmware

Clone this wiki locally