Jump to content
The simFlight Network Forums

microcontroller ethernet client?


Recommended Posts

Hi,

At the beginning I'd like to mention that I'm new in this area.
Recently I've built a 737 wet compass.

wetCompass.jpg

I used wemos D1 mini board and a stepper motor.
I use SIOC server (running on my PC) and SIOC client (wifi SIOC client on wemos) to get all data I need.

I'm working now on more sophisticated project.
I need to get more data from the simulator this time.

SIOC works fine however it has a limited number of variables/parameters to get from PROSIM.
I use this tool to assign all necessary parameters:

sioc.jpg



What other method would you suggest to extract more data form PROSIM?
I need to get aileron and elevator deflection this time.
I'd like to send this data over ethernet to any microcontroller.

 


Best regards,
MM

Link to comment
Share on other sites

3 hours ago, mmmmm said:

What other method would you suggest to extract more data form PROSIM?
I need to get aileron and elevator deflection this time.

Sorry, I don't know SIOC or how to 'get data' from ProSim. Those are questions forProSim support.

You can get aileron and elevator deflection from FSUIPC offsets -- just search for 'deflection' in the supplied Offsets Status document.

3 hours ago, mmmmm said:

I'd like to send this data over ethernet to any microcontroller.

Do you have software to do that? FSUIPC doesn't 'send' offsets, it is up to applications to read them using the defined software interface (in the SDK).

Pete

 

Link to comment
Share on other sites

 

Thx for reply 🙂

I was hopping that FSUIPC can send offsets over the ethernet 😕

Quote

defined software interface (in the SDK).

U mean SDK from PROSIM?

 

There are literally few lines in ARDUINO that can gather data from SIOC (IOCP) server running in PROSIM:

//SOLENOID:
//8-AIR/GND SENSOR

#include <ESP8266WiFi.h>

const char* ssid = "SSSID";
const char* password = "PASSWD";

const char* host = "192.168.1.231";

byte AIR_GND=0; //0-GND, 1-AIR

byte SOLENOID=12; //D6
String line="";

WiFiClient client;
void setup()
{
   
   pinMode(LED_BUILTIN, OUTPUT);
   pinMode(SOLENOID, OUTPUT);
   digitalWrite(SOLENOID, LOW);

   
   
  Serial.begin(115200);
  delay(100);
  Serial.println();
  Serial.println("Serial OK");

  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" connected");
  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP());
}




void loop()
{
  
  Serial.printf("\n[Connecting to %s ... ", host);

        if (client.connect(host, 8092))
        {
                Serial.println("connected]");
                client.println("Arn.Inicio:8"); //looking for iocp variable no. 8
                Serial.println("[Response:]");
                
                      while (client.connected() || client.available())
                      {
                        if (client.available())
                        {
                          line = client.readStringUntil('\n');
                          //Serial.println(line);
                          line=line.substring(11,line.length()-2);
                          Serial.println(line);
                        }
                        //////////
                      if (line=="0"){ digitalWrite(SOLENOID, LOW);}
                      if (line=="1"){ digitalWrite(SOLENOID, HIGH);}
                      line="";
                          
                        
                      }
                client.stop();
                Serial.println("Disconnected");
                
        }
        else
        {
          Serial.println("connection failed!");
          client.stop();
        }
  delay(5000);
}







  

You sing up for variable (here nr. 8 ) and once it is updated SIOC server sends it to you :

 

client.println("Arn.Inicio:8");

 

 

Would be amazing if FSUIPC could do something similar.

Edited by mmmmm
Link to comment
Share on other sites

59 minutes ago, mmmmm said:

I was hopping that FSUIPC can send offsets over the ethernet 😕

WideFS is the program used to allow networked clients to access FSUIPC offset data.
Any FSUIPC client that connects to FSUIPC on the main PC can be moved to a client PC and used there using WideFS (composing WideServer, built into FSUIPC since FSUIPC4, and WideClient, the component that is ran on the client PC).
You would still need an FSUIPC client to read the data though..

Link to comment
Share on other sites

so,

I have FSUIPC running on the same PC as PROSIM,
FSUIPC has WideServer built in,

so now I would need a WideClient code for ARDUINO. Is that correct? If more or less yes,  is there any piece of code for arduino (or similar) to start with?

 

Link to comment
Share on other sites

1 hour ago, mmmmm said:

so now I would need a WideClient code for ARDUINO. Is that correct? If more or less yes,  is there any piece of code for arduino (or similar) to start with?

How does your arduino talk to FSUIPC? And what is it connected to? If it talks to FSUIPC when connected to the PC which FSUIPC (and PROSIM) is running on, then it can talk to FSUIPC via WideFS when connected to a client PC running WideClient. Thats is what WideFS does/is, i.e. it allows FSUIPC clients to run on a networked PC separate to that of FSUIPC and the FS.
 

Link to comment
Share on other sites

Quote

How does your arduino talk to FSUIPC? 

It doesn't 🙂 (so far). That's the question. How can I make my arduino talk to FSUIPC?

I don't want to use usb. I want to connect my arduino (ethernet shield) via switch to the PC (where PROSIM+FSUIPC are installed).

Link to comment
Share on other sites

1 minute ago, mmmmm said:

I want to connect my arduino (ethernet shield) via switch to the PC (where PROSIM+FSUIPC are installed).

Ok, then if its connecting to the PC running FSUIPC, you don't need WideFS.
 

Sorry, but I don't know how you would use an arduino connected via ethernet to the main FS PC. You probably need to write an FSUIPC client (using the SDK) to read the data you need from FSUIPC and then send that to your Arduino yourself.
 

Link to comment
Share on other sites

I want to get some data (over ethernet; aileron and elevator position) to move my control wheel. That's the goal.
(I'm pretty sure It's been already done somehow).

I thought, maybe there is a similar piece of code (like the one above) to do this.

So I need to use PROSIM SDK to achieve this?

 

Link to comment
Share on other sites

17 hours ago, mmmmm said:

U mean SDK from PROSIM?

No. The method of extracting FSUIPC offsets are described in the FSUIPC SDK. FSUIPC is a different product to ProSim!!

17 hours ago, mmmmm said:

Would be amazing if FSUIPC could do something similar.

You need to ask the SIOC folks. They probably already have an FSUIPC interface. We cannot undertake to support every possible piece of hardware out there. FSUIPC is the interface many hardware makers use to interface to the flight sims, and they provide their own drivers for that purpose.

In your exchange with John you talked about an Arduino. Is SIOC supporting Arduino too? I use an Arduino to operate the magnetic latches on my 737 starter switches, but I had to write the Arduino code and an FSUIPC plug-in 9in Lua) to interface to it. It uses a serial COM port, not Ethernet.

Pete

 

Link to comment
Share on other sites

In Prosim I attach a parameter to a variable (see pic below):
Parameter: Gear handle release solenoid 
Variable number: 8 (whatever)

and I use the above arduino code to get It (Gear handle release solenoid status) on my microcontroller.

Very simple. I don't have to write any additional piece of soft.

The only limitation is number of parameters I can chose from 😕

Quote

but I had to write the Arduino code and an FSUIPC plug-in 9in Lua) to interface to it. It uses a serial COM port, not Ethernet.

is it possible to write similar piece of code (lua script) for ethernet?
I'm looking for something that could link arduino via ethernet with Prepar3d (or Prosim; not sure if FSUIPC takes data from P3d or Prosim) - ailerons and elevator deflection.

sioc2.thumb.jpg.65be9425cc790ffd10ce698b34a5baf3.jpg

Link to comment
Share on other sites

52 minutes ago, mmmmm said:

is it possible to write similar piece of code (lua script) for ethernet?

Yes, but it isn't easy. Check the Lua documents provided. Are you familiar with the protocols etc?

If ProSim has a SIOC driver which is working for you, can't you use that?

I assume it's a different sort of Arduino if it has an Ethernet interface -- or is that an add-on board for it? I ask because serial port support is built into the FSUIPC Lua libraries, whereas the ethernet stuff has extra files and a folder structure you need to follow. There's an example of the use of those provided in the Examples ZIP file. It uses an ethernet LAN connection to link to copies of Flight Sim on different PCs -- "MasterClient.lua" and "SlaveServer.lua".

Please don't bother posting those pictures in your messages. They are barely readable and I don't see the point of them in any case. Sorry.

I think really you are more likely to get help with hardware interfacing for ProSim on the ProSim forums. There's one there entitled "cockpit building questions". We support FSUIPC and WideFS but we are far from being hardware experts. For my cockpit I rely on others.

Pete

 

 

Link to comment
Share on other sites

1 hour ago, mmmmm said:

limited number of parameters to use (only those listed in Combined config tab, as far as I know).

Maybe ProSim doesn't need to know the deflections? If it isn't reading them then your only options are either to obtain them from FSUIPC offsets, or interface to SimConnect directly. Either would need programming.

Have you tried asking these questions on the ProSim forum? Presumably your needs aren't unique?

Pete

 

Link to comment
Share on other sites

I was expecting that somebody has already wrote some kind of FSUPIC arduino client (or something similar; SimConnect arduino client?).
Some kind of server publishing FSUIPC offsets via ethernet. 

 

Quote

Have you tried asking these questions on the ProSim forum? Presumably your needs aren't unique?

Yes. I've tried. No answer so far.

 

Link to comment
Share on other sites

36 minutes ago, mmmmm said:

I was expecting that somebody has already wrote some kind of FSUPIC arduino client (or something similar; SimConnect arduino client?).
Some kind of server publishing FSUIPC offsets via ethernet. 

I don't know of one, sorry. (Aren't all Arduino's serial port COM devices by default, not Ethernet, or is that just mine?)

Perhaps it's a project you can undertake.

Pete

 

Link to comment
Share on other sites

by default - yes. 
On my wetcompass I used wemos D1 mini (ESP8266 WIFI) with some arduino code (arduino IDE) -its nice because the only cable coming into the enclosure is +5V power.
On the second project I used mega2560 with ethernet shield.
(not a big change between both codes)

 

Quote

Perhaps it's a project you can undertake.

to many of them already 😉 trying to avoid new ones

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.