Jump to content
Sign in to follow this  
kolaf

Arduino support?

Recommended Posts

Hi,

 

I've been looking into creating some of my own panels using a few arduino controllers (or just one). There exists a good tool (link2fs) that exposes simconnect variables through a simple serial protocol that can easily be handled by an arduino to drive LEDs, servos, et cetera. However, the input interface to give data from switches and such is not as good. It would be much easier, and more powerful, if I could use something like LINDA former input interface from the arduino board. Especially when using toggle switches which seem to be quite well supported in LINDA.

 

Unless anyone else has tried this I see three possible options.

 

1. modern arduino boards can be reprogrammed to act as a joystick USB device, with axis and buttons. Although this is required for certain functionalities such as specific joystick functions, it does not include any options or writing data back to the arduino board so it's not a very good option. Also, debugging and development is difficult since you have to rewrite the boot loader everytime.

 

2. I notice that LINDA already supports a specific module through a com interface. If I figure out what this interface is I could probably replicate the client side on the arduino to allow me to feed back information from it. This probably means a loss of excess programming, and it might not even support the functionality I need. Does anyone know where I can find a specification for the content and format for the vrinsights module?

 

3. This is the preferred option (for me). Is it possible to expand LINDA with a simple serial interface with a well-defined message formats to receive input over a serial link? This will make it very easy to add a number of switches, pushbuttons, Rotary encoders, et cetera through a cheap arduino system to build home-made panels. A simple textbased message formats should be easy to handle at both ends.

 

One of the big problems I foresee and am trying to find a solution to is that of toggle switches. I noted that there are specific command is to switch things on and off for lots of the flight simulator states, but things like the parking brake are more complex. If I have a lever to turn the parking brake on and off connected in some fashion through an arduino, any touching of the breaks in the simulator would force the lever to be out of sync with the in game parking brake. The only way to solve this as foreign as I can see is to capture the change in the parking brake status and then resetting the State if it is different from the state of the physical lever. In other words, if my physical parking brake lever is set, the arduino or the application in between must capture the change of the parking brake state in the simulator, and if this is turned off while the parking brake lever is still set it must be turned on again.

 

This solution can already be implemented using link2fs to read the state of the parking brake and send it to the arduino, and have this sense the state and the parking brake lever position to possibly resend the parking brake command. Trouble is, I would have to do this for everything, even the functions that have decent on functionality since this is missing from link2fs.

 

This quickly became more long-winded and complex than I wanted. The main point is that a simple serial interface to LINDA will make it very easy to develop your own hardware. It is already exists in some form I would be a very happy man if someone could point to it.

 

That's all :-)


Frank Olaf Sem-Jacobsen

Share this post


Link to post
Share on other sites

Hello,

 

unfortunately I don'T understand the half of your technical stuff :blush:

 

I just wanted to beg you to wait for Artem ("crum") answering your question hopefully ...


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Nevermind, since writing this post I have done some research, and I have realised that I think it would be much better off with just writing everything myself in lua. I couldn't figure out what, if anything, I could use LINDA for.


Frank Olaf Sem-Jacobsen

Share this post


Link to post
Share on other sites

Hello,

 

I'll jump in here, as I'm interested in Arduino as well, and ask the question in a different format.

 

If I had a hardware device like the VR panel that communicates over serial, (Arduino instead) that I wanted to add as a supported piece of hardware to LINDA, how hard is it to do?

I would want to read data from it into LINDA and write data to it from LINDA. (bit like the VR panel)

 

Is there any guide to adding serial based hardware to the system?

 

Only discovered LINDA / LUA today, so it's possible my ambitions exceed my talents.

 

Thanks in advance,

Mark.

Share this post


Link to post
Share on other sites

Hi guenseli

 

I am very happy with LINDA, It was about 1 year since I last flow but during the time I am making a cockpit panel with alot of buttons, switches Rotary Encorders & potentiometer!

 

I like to use LINDA for the communication for Arduino Mega2560 R3 (Two cards) direct to FSX and mine PMDG737NGX. I gues I need make the cards to be acting like HID joystick but how?

 

I will post the result if I am quicker than you :)

 

Best Fredrik


__________________________________________________________________

Computer: Windows 10, 64-bit, Intel i9 - 10850K, Asus Rog MAXIMUS XII HERO (WI-FI), 32GB RAM, Asus RTX3070

Game control: Home Cockpit, Keyboard, Saitek Pro Flight X56 Rhino H.O.T.A.S. 

Share this post


Link to post
Share on other sites

Hi all,

 

At 3340 there are 36 words listed in the FSUIPC SDK as:

This area is used for externally signalled ―joystick button‖ control, a set of 288 "virtual buttons". Each DWORD or 32 bits represents one ―joystick‖ with 32 buttons. If an external program sets or clears a bit in any of these 9 DWORDS the ―Buttons‖ page in FSUIPC will register the change as a button operation on one of Joystick numbers 64 to 73 (corresponding to the 9 DWORDs). So, FSUIPC can be used to program whatever actions the user wants.

 

At 3BA8 there are 40 words listed in the FSUIPC SDK as:

Area used by PFCFSX.DLL for axis input, for optional assignment and calibration in FSUIPC.

When the PFC driver is not being used, other programs can make use of these offsets to input axis values directly to FSUIPC, which also can then be assigned in FSUIPC and thence calibrated. Note that by default FSUIPC assumes that the normal input here is in the range 0–127, and scales it accordingly. For applications supplying a greater range, possibly up to the maximum allowed for joysticks (–16383 to +16383) you can either use the ―RAW‖ option, or, better, let FSUIPC adjust its scaling to suit the range being input. It will adjust this automatically upon seeing the extreme values, or you can preset the scaling using a parameter added to the axis assignments line in the INI file.

 

So I'm thinking if it's possible to have LINDA be able to assign these virtual buttons and axis, just as if they were real joysticks, then it's possible to write a small LUA script to open the comport and connect to the Arduino over serial and map some commands from the Arduino (or any other serial type microcontroller device) to these internals in FSUIPC.

 

Then you only have to worry about writing the protocol from the microcontroller to the LUA script, which could be a very simple ACSII string protocol which decodes something like VA1=100 to set virtual axis 1 to 100, then LINDA takes care of mapping virtual axis 1 to the throttle or whatever, and you can re-assign with LINDA without having to re-write the LUA each time.

 

If you want to send data from FSUIPC to the microcontroller you are going to need more function dependant LUA script to read say the radio frequency and format the message that the microcontroller expects and send it. I don't know if there is a way to have the microcontroller dynamically request this stuff and have the LUA script create something that send it the over the serial port on change of state / value. It would be nice if you could.

 

Thoughts?

Share this post


Link to post
Share on other sites

Guys,

 

I just wanted to tell you that this is way over my head.

I hope Artem will join this maybe, but I haven't heard sth from him a while now.

 

Hope you'll find a solution ...

sorry


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Hi All

 

I have follow: http://stavroskcy.blogspot.se/2011/12/connecting-arduino-to-flight-simulator.html

 

For the interfacing fsx --> Arduino and the difficulties was that I have two cards :(

 

After I while I have success to rread my two cards :)

 

The hard work is now to link the diff... values with the correct fsuipc offsett, is quite fun to program :)

 

Best Fredrik


__________________________________________________________________

Computer: Windows 10, 64-bit, Intel i9 - 10850K, Asus Rog MAXIMUS XII HERO (WI-FI), 32GB RAM, Asus RTX3070

Game control: Home Cockpit, Keyboard, Saitek Pro Flight X56 Rhino H.O.T.A.S. 

Share this post


Link to post
Share on other sites

Hi

 

Some news to use the Arduino cards by LINDA?

 

Can I write a lua for it?

 

Best Fredrik


__________________________________________________________________

Computer: Windows 10, 64-bit, Intel i9 - 10850K, Asus Rog MAXIMUS XII HERO (WI-FI), 32GB RAM, Asus RTX3070

Game control: Home Cockpit, Keyboard, Saitek Pro Flight X56 Rhino H.O.T.A.S. 

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...