Jump to content
The simFlight Network Forums

Arduino Interface

Recommended Posts

First, full disclosure, I'm not a programmer.  I am self taught to some degree with C++ (at least the subset of it that Arduino's use), a bit of VB and some basic LUA and VBA.

I've been a long time FSUIPC user but just recently noticed the FSUIPC Client DLL for .NET subforum and it caught my attention.  I need to solve for a problem if I am to make the move to P3DV4 and I'm trying ot figure out of this might be a starting point.

My Cockpit build (A Cessna 172) uses Arduino cards for everyting from my Avionics stack to my wet compass and air speed sensatve vents.  They are at present interfaces to P3D via a discntinued program (Link2FSMulti) that passes many of the P3D offsets to the Arduinos via serial USB as a simple set of text strings (for example air speed might be <T090) that I can read and the Arduino's in return control codes that the app coverts to P3D offsets.  The app allows me to select which offsets I want to pass and to what serial port.  The app is unfortunatley not compatible with the new P3DV4.

As I search for a replacement app I am finding many that allow for some form of I/O between P3D and the Arduino but most do so by loading their own code onto the Arduino that takes over the Arduino and creates an interface that the developer thinks is ideal.  I am finding that most fuction far different or in a few cases fall far short in fuctionality to what I have developed.  As an example they will control the 7 segment displays on radios and allow tuning but they would not allow me to replicate the 32 channel memory that I have coded into my current radios.  So I would have to toss a great deal of my current code in the bit bucket and give up on functionality to use those apps.

To cut to the chase I want to develop a very basic interface that allows me to pass a selected set of offsets (if possiblle in the form of a very basic serial strings as noted above) from P3D to specific USB serial ports and then via those same ports pass serial strings back that interface would pass back to P3D as offsets.  I was pondering writting a big LUA script to do all this but, as I said cae across this forum and I am wondering if this might allow me to write a somewhat more userfriendly VB app that would accomplish what I need.

Any thoughts or advice would be greatly appreciated.  

Link to comment
Share on other sites

It sounds like it's possible using a VB.NET application. VB.NET is similar to VBA in syntax so you should be able work from examples fairly easily.

What I would advise is trying a single offset or instrument and see how you get on with it.

The DLL package (V2.4) has an example application in VB.NET that reads basic offset information in a timer loop and displays it on a form.

You should look at this code to get an idea of how the DLL works and get familiar with VB.NET, forms, timers, error handling etc. Maybe add an offset that you are interested in and display the value on the form to start with.

Then you can add in the code to construct your string and write it to the serial port.

Here's a link to how to write strings to COM ports in VB:


Also in the DLL package is a User Guide which you should read at least the "Getting Started" section.

If you have questions about using the DLL or the COM port code I can help you here in this thread.

Maybe try the same thing in LUA and see which you like the best.


Link to comment
Share on other sites

Paul, Thanks!

My plan is to load up P3DV4 sometime after FlightSimCon.  My PC drives are on sleds and I just ordered another pair of sleds for this.  I'll be setting up an alternate set of drives with P3DV4 so I don't mess up my current P3DV3 rig.  I appreciate your advice and the approach you suggest.  This looks like it may be on the top of my summer project list.

I'm sure I'll have plenty of questions and I'll try to post progress updates as well.

Again, Thanks!

Tom G.

PS: If your interested you can check out my sim pit build at https://www.facebook.com/mycessnasim/ or http://www.mycessnasim.info

Link to comment
Share on other sites

Hello Paul,

I do not know if it is well expressed in English but I will try

In my VB .NET code
I have used up to now only offset like the followings (recovered in examples):
     Dim Compass As Offset (Of Double) = New FSUIPC.Offset (Of Double) (& H2CC)
     Dim pause As Offset (Of Short) = New FSUIPC.Offset (Of Short) (& H262, True)
and all is ok but ...

Now for interfacing with a ARDUINO for my panel deported, I would like to send a request on a macro named "MD530F.MCRO" (which is in my \ Modules folder),
  - I do not know how to declare in the code of my program (.NET) the type of offset '0D70' (ASCIIZ?!)
  - and how to use this type of offset in my program to send to FSUIPC to execute the line 3 of the
Macro file named "MD530F.MCRO"

Contents of the file 'MD530F.MCRO':
1 = L: B407_Eng_Start_Switch = Tog
2 = L: B407_Eng_Start_Switch = Set, 1
3 = L: key_on = Tog
4 = L: onoff = Tog
5 = L: B407_Master_Battery_Switch = Tog
6 = L: B407_Navlight_Switch = Tog
7 = L: Spare_3 = Tog
8 = L: idle eng = Tog
9 = L: CAP10 = Tog
Thank you for your help, because I can not find a single example on this subject since many hours of research

Link to comment
Share on other sites

Hi Didier

To call a macro you need to declare the 0D70 offset as a string like this:

 Private macroName As Offset(Of String) = New Offset(Of String)("macros", &HD70, 40, True)

I've made it "write only" and put it in its own group called "macros". This way you can process this offset on its own.

To call a macro you need to set the value of this offset to a string made up like this:

<Name of .mcro file>:<Name of macro or LVAR>

For your example it will be "MD530F:L: key_on"

 macroName.Value = "MD530F:L: key_on"

In your post you show the contents of the mcro file. All your LVars have a space after the L:. Is that correct? I've included that space in my example above, but I don't think that's correct. You may need to take that space out:

 macroName.Value = "MD530F:L:key_on"


One limitation I can see if that you can't have the same L:VAR in the MCRO file more than once. There doesn't seem to be a way of addressing different functions using the same LVAR. For example there is no way I can see to call line 2 of your file. The string "MD530F: L:B407_Eng_Start_Switch" will always call line 1 because it's the same name.


If you want to use any of the operations that need a parameter you have to declare another offset BEFORE 0D70:

    Private macroParam As Offset(Of Integer) = New Offset(Of Integer)("macros", &HD70, True)
    Private macroName As Offset(Of String) = New Offset(Of String)("macros", &HD70, 40, True)

Then just set the parameter value in your code:

        macroParam.Value = 1
        macroName.Value = "MD530F:L:VarToSet"


Link to comment
Share on other sites

Hello Paul,
It's great what you did for me. This closes long hours of endless brain teasers! I could not get through a lot of tests.
I thank you very much for your explanations very precise and effective because it works very well. It is a BIG thorn of the foot that you take from me.
You were right for the space after the 'L: _'; It does not exist in my mcro file, but it was transcribed by error when copying / pasting in the post.
Thank you and congratulations to Peter (who directed me to you), and to you Paul for your seriousness and for the rapidity with which you react ...
Didier Lamant

Link to comment
Share on other sites

  • 3 years later...


I stumbled on this thread in my search for Arduino/P3D and now MSFS2020. I have a full-size pit using X-Plane and I need to convert 20 microcontrollers over to 2020 from X-Plane.

Has the work in this thread been abandoned or is it still a work in progress?

Curious in Seattle
Ray S.
raysot <at> comcast.net

Link to comment
Share on other sites


Has the work in this thread been abandoned or is it still a work in progress?

Hi Ray,

The other three posters in this thread had written their own software in VB.NET and C#. This talked to the Arduino boards and to the Flight Sim via my FSUIPC Client DLL.  

I can't speak for their work but my DLL is still supported and widely used.

If you're familiar with any of the .NET languages then my DLL is an easy way to get your application to talk to the Flight Sim via FSUIPC. I've no idea how one talks to an Arduino board however.

If you know other programming languages then there are other SDKs available to talk to FSUIPC (e.g. C, C++, Java etc). Or you can bypass FSUIPC and use the SimConnect interface directly. You would really need C++ for that.

Everything you need to know about my .NET DLL is on the website:


If you need any help using the DLL please feel free to start a new thread in the support forum:


Be aware that the SimConnect interface for MSFS2020, as well as FSUIPC7 are still in development. At the moment there will be limitations in terms of the data available compared with P3D and earlier Microsoft flight sims.



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.