Jump to content

Interact with DCS and DCS-BIOS


Fabou78

Recommended Posts

I have run some testing with DCS-BIOS following the example for the A10 warning button and light with my Arduino Uno.

 

I was really amazed to see how quick I got it working (less than an hour) however it feel really much like magic and would like to know how things work.

 

Please correct me if I am wrong with the following assumptions

 

1. The only way to speak with DCS is via export.lua?

2. Instructions between DCS and outside world are done via commands sent/received via IP (TCP or UDP) to/from export.lua, in fact DCS-BIOS make export.lua run a server ‘listening’ on IP?

3. In the case of DCS-BIOS communication with hardware is done via SOCAT which take instruction from the hardware send it to DCS-BIOS (export.lua) which in turn speak to DCS via method explained in 2)?

4. If you have more than one Arduino you will need and instance of SOCAT for each card?

5. If your hardware has an Ethernet port you could use DCS-BIOS without the need of SOCAT?

6. If your hardware has an Ethernet port and you don’t use DCS-BIOS (because of non-Arduino hardware) then you need to write an app that can talk on the network (IP), that APP need to be written in LUA and is effectively launch by or contained in export.lua?

 

 

I am a newbie (as you can see from my questions above) still hesitating to go for building my own cockpit because of lack of skills required for this task (really poor electronic, programming and engineering skills), any help would be much appreciated.

 

I feel like I will not jump into the build until the concept around communicating with DCS (with or without DCS-BIOS) is clear in my mind however there doesn’t seem to have load of document around the subject (certainly not from ED).

 

Lastly one of my friend told me that DCS could export to a file, is there a simple doc somewhere that shows how to do it (just for testing)?

Link to comment
Share on other sites

Please correct me if I am wrong with the following assumptions

 

1. The only way to speak with DCS is via export.lua?

2. Instructions between DCS and outside world are done via commands sent/received via IP (TCP or UDP) to/from export.lua, in fact DCS-BIOS make export.lua run a server ‘listening’ on IP?

3. In the case of DCS-BIOS communication with hardware is done via SOCAT which take instruction from the hardware send it to DCS-BIOS (export.lua) which in turn speak to DCS via method explained in 2)?

4. If you have more than one Arduino you will need and instance of SOCAT for each card?

5. If your hardware has an Ethernet port you could use DCS-BIOS without the need of SOCAT?

6. If your hardware has an Ethernet port and you don’t use DCS-BIOS (because of non-Arduino hardware) then you need to write an app that can talk on the network (IP), that APP need to be written in LUA and is effectively launch by or contained in export.lua?

 

I'll try and answer a few of your questions. First, I started out just like you three years ago. Very little knowledge of electronics, no programming experience what so ever and no idea what an Arduino was. I did a lot of reading on the Arduino as there is SO much info on the internet. It wasn't that hard to get up and running. I did the same with electronics but on a novice level only. Fortunately there isn't any really sophisticated electronics required.

 

Ian's DCS-BIOS made everything incredibly easy to implement even with my limited knowledge base.

 

1. the export.lua file sends (through Socat) the state of every cockpit switch, dial, gauge and display to the Arduino and then the sketch you write based on the control reference docs will select the info you need for whatever panel your building. I'm guessing here but I think that the info from the cockpit is updated every 30fps.

 

2. I would consult the developers guide at http://dcs-bios.a10c.de/

 

3. ??

 

4. Yes you need to run Socat for every board you are using. Each version of socat needs to be edited to provide the correct com port number that the Arduino is connected to. You can buy the Arduino Mega which has 52 pins for under $11.00 from China. Several of these boards will run a huge number of switches for you.

 

5. Unsure but I would stay with the more simple method using Socat and if you need to connect all your boards you can use an RS-485 bus.

 

6. Above my pay grade to be sure.

 

Lastly, if you want to run just one version of socat, you can build an RS-485 bus and daisy chain all of your boards to a single Mega. You can incorporate the RS-487 chip into each panel (Arduino board). The RS-487 IC is very inexpensive and the bus itself is very easy to build. There are even template files (sketches) already written in the examples section of the Arduino IDE to make it extremely easy to create the sketch. Do a search for RS-485 or RS-487 on this forum and you should have plenty of good reading to get you started.

 

http://dcs-bios.a10c.de/ has lots of good info on getting started. Anything else you might need can be answered by doing a search on this forum. There is a huge number of topics related to DCS-BIOS and panel building right here on this forum.

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

Thanks for you answer.

 

I'll try and answer a few of your questions. First, I started out just like you three years ago. Very little knowledge of electronics, no programming experience what so ever and no idea what an Arduino was. I did a lot of reading on the Arduino as there is SO much info on the internet. It wasn't that hard to get up and running. I did the same with electronics but on a novice level only. Fortunately there isn't any really sophisticated electronics required.

 

I am a bit surprised you say that as I have seen your work and assumed you were working in the electronic field. Right now everything seem a mountain to me

 

 

1. If I get it correctly export.lua <=> DCS-BIOS <=> SOCAT <=> Arduino. I am still a bit unclear on how export.lua <=> DCS-BIOS work

 

2. Read it but might need to read again as still fuzzy.

 

 

Unsure but I would stay with the more simple method using Socat and if you need to connect all your boards you can use an RS-485 bus
I see what you mean I have seen a post from Hansolo where he was showing how he did it here. I understood the concept but not his electronic diagram.

 

Lastly, if you want to run just one version of socat, you can build an RS-485 bus and daisy chain all of your boards to a single Mega.
That is exactly what I was worried about i.e. not having to plug 10 USB plug to my PC, so RS-485 would solve that issue. The other idea I had was to use Ethernet hence the question around the network side in the case you have Arduino that has Eth port then export.lua <=> Arduino would be possible or not. All devices including the PC would be connected to a Ethernet switch and communicate this way. This however would be too hard for a novice so I should stick with DCS-BIOS.

 

 

Right now aside going through the Home Cockpit forum I am doing two classes on Coursera, one about introduction to Electronic and the other one about Arduino, hopefully after that I would be able to understand more what people are talking about here on the forum.

 

 

Thanks again for you help and I hope someone else will give some other inputs.

Link to comment
Share on other sites

When you need to figure out how to wire a project, always start by downloading the data sheets on the components you need. For example, get the data sheet for the Max RS-485. I know a lot of the info on that data sheet is way over your head ( and mine for that matter:megalol:) , however there are always wiring diagrams and pinouts that will guide you. I have a rather large collection of data sheets that include LEDS, Max7219 for 7 seg displays, LCD 16X2 displays, hall sensors, stepper motors... and the list goes on.

 

Initially this all looks overwhelming, but after your courses you will have a better understanding of how Arduino mcu's work.

 

One more point I would like to make. Try and buy Chinese components whenever possible. The price of their electronic parts is incredibly low. eBay is where you will want to start. If it wasn’t for low priced Chinese parts, I wouldn't have been able to build my cockpit.

 

Good luck with your project Petardo.

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

One more point I would like to make. Try and buy Chinese components whenever possible. The price of their electronic parts is incredibly low. eBay is where you will want to start. If it wasn’t for low priced Chinese parts, I wouldn't have been able to build my cockpit.
Have you noticed any difference in quality and reliability with Chinese parts? indeed they are cheap but if you have to replace them often then you end up spending more money.

 

Good luck with your project Petardo.

Not 100% percent sure yet but quite obsessed about it already... Actually I am waiting for those guys Open Hornet to release some plans so I can better assess if I would be able to make it. If this project take off it would be a huge help for people like me a bit like DCS-BIOS but more on the hardware side of things.


Edited by Petardo
Link to comment
Share on other sites

1. If I get it correctly export.lua <=> DCS-BIOS <=> SOCAT <=> Arduino. I am still a bit unclear on how export.lua <=> DCS-BIOS work

 

You have this correct. You are unclear on export.lua <=> DCS-BIOS because that is the point of DCS-BIOS - you dont need to know anything about export.lua, because the sole function of DCS-BIOS is to interface with export.lua for you.

 

5. Yes - DCS-BIOS can import and export over the network - in fact that looks to be the native method it uses.

 

http://dcs-bios.a10c.de/docs/v0.7.0/developerguide.html

 

The upshot of that is once DCS-BIOS is installed and running on your DCS machine, DCS-BIOS will export data to 127.0.0.1 (that is a fixed, static internal IP address of your windows PC), and will also listen for data coming in over the network. SOCAT is, I think, is the "glue" between the network import/export data DCS-BIOS does and the serial bus to the Arduino.

 

So if say you were using a Raspberry Pi instead of an Arduino, you'd need the Raspberry Pi to generate a network packet with some plain text which says "TACAN_MODE 3". For that, you can use _any_ programing language. Python would do just fine. That packet gets sent to DCS-BIOS, where it translates it to lua for you.


Edited by Thermal
Link to comment
Share on other sites

Have you noticed any difference in quality and reliability with Chinese parts? indeed they are cheap but if you have to replace them often then you end up spending more money.

 

 

Not 100% percent sure yet but quite obsessed about it already... Actually I am waiting for those guys Open Hornet to release some plans so I can better assess if I would be able to make it. If this project take off it would be a huge help for people like me a bit like DCS-BIOS but more on the hardware side of things.

 

From my own personal experience, Chinese parts have been 99% reliable. The only time I have ever had an issue was with some RS-487 IC's that didn't work. I contacted the seller and they sent replacements immediately.

 

I find that Chinese Ebay sellers are very careful about their reputation on eBay and they will bend over backwards to ensure you are satisfied. I have ordered literally hundreds upon hundreds of parts from china. I have no reason to doubt the quality of what I have received over the past three years.

 

On the other hand, there is always the possibility of running into a bad seller. However you can avoid that by checking their rating on eBay.

 

I should also warn you about this disease called Cockpit Builders Syndrome. Its an obsessive/compulsive disease that occurs at the very start of you deciding to build a cockpit. Its not curable and it can and will take over your life. :( Be careful about what you decide.:smilewink:

 

:D:lol::lol: (maniacal laughter):megalol::megalol:

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

So if say you were using a Raspberry Pi instead of an Arduino, you'd need the Raspberry Pi to generate a network packet with some plain text which says "TACAN_MODE 3". For that, you can use _any_ programing language. Python would do just fine. That packet gets sent to DCS-BIOS, where it translates it to lua for you.

 

This is quite interesting Thermal. The reason I was so obsessed with a network solution at first was because I used to be a network engineer not so long ago (routers, firewalls, switches etc..) and it would have been the one thing I would be comfortable with (TCP/IP, UDP etc..), downside would have been the programming bit.

 

Do you know someone that has successfully tested or implemented a solution that uses RPi with DCS-BIOS?

 

 

I should also warn you about this disease called Cockpit Builders Syndrome. Its an obsessive/compulsive disease that occurs at the very start of you deciding to build a cockpit. Its not curable and it can and will take over your life. :( Be careful about what you decide.:smilewink:
It is not the first time I hear that, some even mentioned that it nearly cost them a divorce. Maybe I should run away before it is too late, or, it is too late already. I better start looking for a good lawyer then...
Link to comment
Share on other sites

This is quite interesting Thermal. The reason I was so obsessed with a network solution at first was because I used to be a network engineer not so long ago (routers, firewalls, switches etc..) and it would have been the one thing I would be comfortable with (TCP/IP, UDP etc..), downside would have been the programming bit.

 

Lol. Guess what I do for a living? :thumbup: I've written some multicast testing tools in perl. Here is a simple, no-error-checking multicast listener for DCS-BIOS:

 

#!/usr/bin/perl
use IO::Socket::Multicast;

# Prime the socket
my $soc = IO::Socket::Multicast->new(Proto=>'udp',PeerAddr=>'239.255.50.10',PeerPort=>'5010');

# Join the multicast group 
$soc->mcast_add('239.255.50.10');

while(1)
    my $payload;
    next unless $soc->recv($payload,1024);
    print "DCS-BIOS sent: $payload\n";
}

Link to comment
Share on other sites

Do you know someone that has successfully tested or implemented a solution that uses RPi with DCS-BIOS?

 

I have implemented an RPi with DCS-BIOS. I use the RPi to connect over Ethernet to the UDP listening socket of DCS-BIOS. I use socat on the RPi to pass the DCS-BIOS messages between the USB-attached Arduinos and the simulation computer. This is similar to what is implemented in the standard direct connection method of DCS-BIOS, except there is an RPi instead of a loopback.

I decided to use the RPi because I hope to have a full simpit someday and I wanted to use Ethernet and RPis to distribute the data rather than either running several USB connections or using RS-485. It seemed simpler.

 

This may not be exactly the implementation you are asking about, since I did not write code for the RPi to implement DCS-BIOS functions directly. I am still relying on Arduinos to interface with the hardware. So far I only have the armament panel implemented.

Link to comment
Share on other sites

@Thermal, thanks for the Perl code. I know a little bit of Python I'll see if I can experiment something.

 

 

For RS485 you can also use existing plug and play solutions (ASBIS or Tekxx), look here
Will have a look to this thanks

 

 

I use socat on the RPi to pass the DCS-BIOS messages between the USB-attached Arduinos and the simulation computer.
I am not clear on the USB bit you seem to be using multiple Arduinos so I guess you have plugged them directly to the RPi i.e. 4 is the max number of Arduino you can have for one RPi? Also I guess you are running multiple instances of SOCAT one for each Arduino (same as explained in my previous post), correct?

 

 

I decided to use the RPi because I wanted to use Ethernet and RPis to distribute the data rather than either running several USB connections or using RS-485. It seemed simpler.
Yes I do agree but reading about RS-485 is now becoming attractive to me as some people (Tekk and other) have some success with it.

 

 

This may not be exactly the implementation you are asking about, since I did not write code for the RPi to implement DCS-BIOS functions directly. I am still relying on Arduinos to interface with the hardware. So far I only have the armament panel implemented.
I think I will experiment with the RPi first before trying out RS-485 later down the line. Do you have pictures or diagrams of your setup with the RPi that you can share?

 

In the case that you could write some code to bypass the use of the Arduinos are not worried that you won't have enough GPIO on the RPi?

 

Lastly I have seen an article on how to connect Arduinos to RPi do you think something like I2C or SPI or other could work for DCS-BIOS?

Link to comment
Share on other sites

Petardo,

 

Thermal had the idea. A network attached USB hub. As I said in the earlier post, this is a slightly different approach to what you asked since I am not controlling any panels directly from the RPi.

 

The Arduino is currently plugged directly into the RpPi, and you are correct there are only four USB portson each RPi. I plan to use multi-port USB hubs on the RPis as required to expand the number of Arduinos each RPi can support.

Each Arduino requires its own instance of socat, so I have a shell script that instantiates them and is called at bootup. I have aliased the Arduino USB ports on the RPi by serial number so they stay constant over power cycles.

 

I have built a small PCB that hosts a Nano and uses a MAX6956 to provide 28 I/O ports using I2C. I have also designed a similar board using an AS1130 for up to 128 LED pins but I have not fabricated it yet. The boards are stackable and use external power, so I can have one Nano control up to four of each board type. The software to interface to DCS-BIOS is still under very slow development.

 

I don't have good diagraming software, however the diagram is simple:

SimPC --Ethernet-> RPi --USB-> Arduino --I2C-> ICs

 

The RPi could absolutely support SPI or I2C directly. Both provide the capability to control multiple devices on one bus. Both will have limitations in terms of supported cable length for reliable communications(<< 1m). I chose I2C for my implementation because it does not require a chip select line for each device like SPI, so I still have most of the pins on the Nano available for direct I/O in addition to the MAX6956 and/or the AS1113.

Link to comment
Share on other sites

If I get it correctly you have designed 2 boards, one that uses MAX6956 and the other AS1130.

 

In the following schematic:

SimPC --Ethernet-> RPi --USB-> Arduino --I2C-> ICs

 

Where are the MAX6956 and AS1130 coming into play? ICs?

Link to comment
Share on other sites

I really like this concept, I am no electronic guru like you but want to give it a try... In fact my RpPi is in the post right now and I have an Arduino at home.

 

I'll see if i can get this working for simple testing setup

 

SimPC(DCS-BIOS) --Ethernet-> RPi(SOCAT) --USB-> Arduino --I/O-> Physical switch

Link to comment
Share on other sites

  • 8 months later...

I would like to use Ethernet easy to manage, being a IP guy. Do you know how to set the DCS-Bios for Ethernet

 

 

Gary

Regards,

 

Snowman_one

 

Gary Argue II

 

“De Oppresso Liber” — "To Free the Oppressed."

 

email: gargue@gmail.com

 

I am a Dyslexic and Disabled. So if you can't read something i wrote email me and write some back explaining and I'll get back to you.

 

So Now I have a lot of time to flight and learn. I fly FA-18c, AV-8a, F-15, A-10C and X-plane 777 and 737.

 

I Can't fly for real any more and can't work :pilotfly:

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...