Jump to content

Major Announcement: New software to to connect panels to DCS


FSFIan

Recommended Posts

Help

 

To anyone who can help.

 

Following the hard work put in by others I am converting my pit from strictly Helios to DCS Bios because I am able to make arduino boards at work for projects. I had a pro mini laying around and decided to give this a try. Following the instructions at appears that the switches work when looking at the scrolling cmd file but I get no feedback from DCS.

 

I have modified the cmd file for the com port my arduino is on (com 7) and I placed the DCS BIOS folder into my DCS Scripts folder as seen in the 2nd picture. I have my own Export.lua file and I have tried using just the original one supplied to me by IAN. Neither seem to work.

 

Picture 3 is of my device manager showing there are no issues with COM 7. I also just loaded the blinking light example on the arduino IDE just to make sure everything was OK. Which it was. Then loaded my electrical panel sketch based on the instructions given on the web page.

 

The last image is what I get when I don't have DCS running but go through the 6 switches from the electrical panel. Everytime I toggle a switch I get a result back but nothing that tells me if it is on or off. But it appears that there is a response when I flip the toggle.

 

Here is the sketch:

 

#include <DcsBios.h>

#include <Servo.h>

 

/**** Make your changes after this line ****/

DcsBios::Switch2Pos eppEmerFlood("EPP_EMER_FLOOD", 4);

DcsBios::Switch3Pos eppInverter("EPP_INVERTER", 3, 12);

DcsBios::Switch2Pos eppApuGenPwr("EPP_APU_GEN_PWR", 2);

 

DcsBios::Switch2Pos eppBatteryPwr("EPP_BATTERY_PWR", 5);

DcsBios::Switch2Pos eppAcGenPwrL("EPP_AC_GEN_PWR_L", 7);

DcsBios::Switch2Pos eppAcGenPwrR("EPP_AC_GEN_PWR_R", 6);

 

/**** In most cases, you do not have to change anything below this line ****/

 

/* Instantiate a ProtocolParser object to parse the DCS-BIOS export stream */

DcsBios::ProtocolParser parser;

 

void setup() {

Serial.begin(500000);

}

 

/*

Your main loop needs to pass data from the DCS-BIOS export

stream to the parser object you instantiated above.

 

It also needs to call DcsBios::PollingInput::pollInputs()

to detect changes in the state of connected controls and

pass them on to DCS.

*/

void loop() {

// feed incoming data to the parser

while (Serial.available()) {

parser.processChar(Serial.read());

}

 

// poll inputs

DcsBios::PollingInput::pollInputs();

}

 

/*

You need to define

void sendDcsBiosMessage(const char* msg, const char* arg)

so that the string msg, followed by a space, the string arg

and a newline gets sent to the DCS-BIOS import stream.

 

In this example we send it to the serial port, so you need to

run socat to read the data from the serial port and send it

over UDP to DCS-BIOS.

 

If you are using an Ethernet Shield, you would probably want

to send a UDP packet from this subroutine.

*/

void sendDcsBiosMessage(const char* msg, const char* arg) {

Serial.write(msg);

Serial.write(' ');

Serial.write(arg);

Serial.write('\n');

}

 

/*

This subroutine gets called every time a message is received

from the export stream (you need to define it even if it

does nothing).

 

Use this to handle outputs which are not covered by the

DcsBios Arduino library (e.g. displays).

*/

void onDcsBiosWrite(unsigned int address, unsigned int value) {

 

}

 

 

}

 

PS ignore the smiley faces. That resulted from the : P in the code when I copied it.

Capture.thumb.PNG.f9957709ee2ef4582e190accd7e31801.PNG

Capture2.thumb.PNG.b844728d3e252cc9de099820f32e55da.PNG

Capture3.PNG.0d201758300e3279fb3f555331e63807.PNG

Capture4.PNG.9d179a024f718f5694f1b1cce0700f90.PNG


Edited by Kaiser78
Link to comment
Share on other sites

  • Replies 398
  • Created
  • Last Reply

Top Posters In This Topic

Try reducing the serial speed from 500000 bps to 250000 bps.

You need to change it both in the .cmd file (replace "BAUD=500000" with "BAUD=250000") and in your sketch ("Serial.begin(500000)" -> "Serial.begin(250000)").

 

If that does not solve the problem, please tell us which version of the Arduino library you are using.

 

In your last picture, you should actually see human-readable strings, e.g. switching the emergency flood lights switch to on should send "EPP_EMER_FLOOD 1".

 

250000 bps will become the standard speed in future versions of the library. 500k was picked not because it was a good idea, but because I had to pick something so I just went for the fastest speed supported by the ATMega328 found on most Arduino boards.

Link to comment
Share on other sites

No luck.

 

I tried 250000 and also 125000. Both my export.lua and the one provided. I am going to try using an Uno without it being soldered and see what happens. Maybe there is something with the pro mini that is an issue. I also shared a common ground with all the switches. Just going to hook up one switch and ground and see what happens.

 

DCS BIOS 0.3.0

 

UPDATE:

 

Hooked up one switch on an Uno and it worked flawlessly. It also went from Com 7 to Com 4. Tried another mini pro no luck. When loading the software on the mini pro's compared to the Uno it was a lot longer. Also with the Uno the TX/RX lights were blinking all the time while the MiniPro. Starting to wonder if its the USB adapter that was stopping the correct communication. Either way, thanks IAN. Looks like I'm off to buy some Uno's.

Capture.PNG.72c6b33faaf0acdc50f9baa2433ede08.PNG

Capture2.PNG.b591ae8c0bb8dfa1cf4f7896492ecffd.PNG


Edited by Kaiser78
Link to comment
Share on other sites

I suspect you may just have a bad USB-to-serial converter (or connection from the converter to the Pro Mini board).

 

You can try using the Uno board as an USB-to-serial converter for the Pro Mini:

  • remove the ATMega328 chip from the socket on your Uno board.
  • Between the Uno board and the Pro Mini, make the following connections: GND to GND, Pin RX to RX, TX to TX
  • Now try uploading the sketch to your Pro Mini board and test it with DCS-BIOS. If that works, order another USB-to-serial converter.

 

PS: Please create a new thread for each question in the future. If your question results in answers that are useful for someone else in the future, it can be a lot of work to find them again if they are buried on page 38 of a thread that deals with lots of other things as well.

Link to comment
Share on other sites

  • 2 weeks later...

Is it possible to show how you can take an Arduino (the large one) and make it handle say every AA-10 gauge by expanding it?

 

I saw like your third post, these are about 8 inputs right which is not enough for even the ACHP?

 

Thanks

Link to comment
Share on other sites

  • 1 month later...

Hi I'm trying to build a sim pit based on DCS , and I have read the DCS BIOS documentation , but couldn't quite understand how to get simple row data from DCS like pitch and roll.

Below is a standard arduino DCS code. I just want to know what to write in the dotted space in front of the pitch and roll to get their values from DCS. Thank you

 

#include <DcsBios.h>

#include <Servo.h>

 

DcsBios:: ProtocolParser parser;

 

void setup() {

Serial.begin(9600);

}

 

void loop() {

// feed incoming data to the parser

while (Serial.available()) {

parser.processChar(Serial.read());

}

 

double roll = ................... ;

double pitch = ................... ;

 

// poll inputs

DcsBios:: PollingInput::pollInputs();

}

 

void onDcsBiosWrite(unsigned int address, unsigned int value) {

 

}


Edited by hossamzayed
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
Ian asked me to make a GUI for handling serialports <--> DCS-BIOS communication.

I've posted DcsBiosCOMHandler for anyone interested to test.

As I haven't got Arduino boards and such I have not been able to test it. Hopefully someone here can give me some feedback.

Once it seems to shape up I think it will end up on Github (DCS-BIOS). Waiting for Ian's input.

Anywhoo if you are interested give it a shot. Attaching screenshot.

 

 

  • Lists all SerialPorts by default
  • You can "remove"/hide the SerialPorts not applicable (telephones etc)
  • Settings kept in a text file
  • Right click on a SerialPort opens up SerialPort comm parameters
  • Will show bytes sent in either direction (actually remembered I am using wrong int type for that :music_whistling:)
  • Rotating gear --> Data is being received from DCS-BIOS

 

:pilotfly:

 

How do I run the program? :cry:

 

I get the same error message and have tried to disable the TCP line in BIOSconfig.lua, I've also changed the port to 7770 on UDP. Still no joy on my setup. BTW i'm running WIN10, and this problem started when I upgraded...


Edited by triise

Regards,

Tore

 

- Newbie simpit builder and electronics geek -

Link to comment
Share on other sites

Ian;2495178']Open the "bin" folder and run DcsBiosCOMHandler.exe.

If that does not work, install the .NET Framework (but I assume Windows 10 will already ship with a recent version of that).

 

Yep, figured it out now. Thanks!

Also I did revert back to Windows 7 - and behold... DCS-Bios now works again! :megalol:

Regards,

Tore

 

- Newbie simpit builder and electronics geek -

Link to comment
Share on other sites

  • 5 months later...

DCS-bios communication problem

 

Hey! I have a problem running the connect-serial-port of the DCS-bios.

Displays an error message FAST_CWD. Does anyone have an idea how to solve it? I tried the solutions I found on this forum - but to no avail.

Extension for Chrome DCS-Control Reference BIOS Live Preview - it does not work. So it's probably a communication problem?

344689c0c342.jpg

 

Windows 10

Link to comment
Share on other sites

That's normal on Windows 10, it's a warning and not an error, and that message does not prevent it from working.

 

Could be a number of things:

  • Firewall or Antivirus issue
  • DCS-BIOS not set up correctly
  • Some other add-on which uses Export.lua does not play nice with DCS-BIOS

 

Check your dcs.log for any error messages.

And try updating DCS-BIOS and the DCS-BIOS Arduino Library to the most recent versions (although I doubt that will solve this particular issue, it's a good idea in general).

Link to comment
Share on other sites

I'm wondering if I can use DCS BIOS to help me with this: http://forums.eagle.ru/showthread.php?t=163205

 

"I am looking to capture DCS UDP output via an .exe coded in c++. Specifically, I'm interested in capturing Mi-8 Doppler radar output. For now, all I want to do is display that output (in a human readable format). I have further plans for the data later."

 

The export.lua from DCS BIOS outputs to port 7778 by default. Can I capture this using my own .exe? Sorry if this is too far off topic.

Link to comment
Share on other sites

Through it all works. No information that you need to have run the module before running the connect-serial-port.:thumbup:

 

...because you don't have to. You will have to start a mission, enter an aircraft and unpause it before you can see anything on your physical panel or in the interactive reference documentation, but you can start the connect-serial-port script and DCS in any order you like.

 

The export.lua from DCS BIOS outputs to port 7778 by default. Can I capture this using my own .exe? Sorry if this is too far off topic.

 

Yes, you can capture this data with your own program. See the developer guide for details. Note that DCS-BIOS does not have Mi-8 support at this time.

And yes, it's off-topic here, a new thread would have been more appropriate (see below, or the "What to post where" section in the DCS-BIOS Overview thread).

 

@Everyone: Please stop posting in this thread.

Open a new thread for any question. Yes, I know that you have to come up with a meaningful subject line for that, and that takes an extra ten seconds of effort. But it will make it a lot easier to find that thread in the future, so the answer to your question can help someone else.

Posting everything into one thread also gets really confusing when there are two (or even more) conversations going on at the same time!

 

If you think the thing you want to post is not "noteworthy" enough for its own thread, and no one will have a need to find it again in the future, you can use the DCS-BIOS Discussion Thread.

Link to comment
Share on other sites

Ian;2727452']

Yes, you can capture this data with your own program. See the developer guide for details. Note that DCS-BIOS does not have Mi-8 support at this time.

And yes, it's off-topic here, a new thread would have been more appropriate (see below, or the "What to post where" section in the DCS-BIOS Overview thread).

 

 

Thank you for you kind reply. I'll make sure to update my thread with this information and the results.


Edited by Slazi
Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

First Ian, thank you very much for this excellent work done with DCS_Bios

 

Second, I wanted to ask why I can not run this code:

 

// include AccelStepper library

#include <AccelStepper.h>

#include <DcsBios.h>

#include <Servo.h>

 

// DcsBios-related declarations

DcsBios :: ProtocolParser parser;

 

#define STEPS_PER_REVOLUTION 200

#define ZERO_OFFSET 0

 

AccelStepper stepper;

int currentStepperPosition = 0; // current stepper position (in steps, from 0 to STEPS_PER_REVOLUTION + 1)

signed long lastAccelStepperPosition;

 

 

void setup ()

{

stepper.setMaxSpeed ​​(15000);

stepper.setAcceleration (500.0);

stepper.runToNewPosition (740); // backwards sweep to find hard stop

stepper.setCurrentPosition (0); // establishes the zero position

stepper.setSpeed ​​(1000);

 

Serial.begin (250000);

 

 

// tell the AccelStepper library that we are at position zero

 

lastAccelStepperPosition = 0;

// set stepper acceleration in steps per second per second

// (default is zero)

// not necessary, you already set that before

 

}

 

int targetposLRPM = 0;

int posADIBank = 0;

 

void loop ()

{

// handle DcsBios communication

while (Serial.available ()) {

parser.processChar (Serial.read ());

}

DcsBios :: PollingInput :: pollInputs ();

 

 

stepper.runSpeedToPosition (); // move stepper motors (constant speed)

 

// more stepper motors, or use the multistepper class

// ...

}

 

void onDcsBiosWrite (unsigned int address, unsigned int value) {

// unsigned int ADIBank = (value & 0xffff) >> 0;

if (address == 0x1034) {

int targetposADIBank = map (value, 0, 65535, 0, 740);

 

stepper.moveTo (targetposADIBank); // set an absolute target

}

}

 

 

 

I am trying to move my Pololu stepper motor with the A8834 driver to make it move the ADI Bank of the A-10. The compilation does not give an error but absolutely nothing happens, there is no movement.

Link to comment
Share on other sites

  • 1 year later...

how to use DCS-BIOS with an Arduino Ethernet shield

 

Hello

 

how to use DCS-BIOS with an Arduino Ethernet shield.

 

What in Dcs-bios do i change to have DCS-bios look multiple arduinos. looking to one Arduino per switch panel..

 

Regards,

Gary

 

 

 

 

 

 

Ian;2274395']DCS-BIOS allows anyone to connect a switch panel to DCS using an Arduino board -- no programming experience required.

The software already knows about every switch and gauge in your cockpit. You simply copy and paste the supplied code if you wish to use any of the following components:

  • push buttons
  • two- and three-position toggle switches
  • potentiometers
  • rotary switches
  • rotary encoders
  • LED indicator lights

 

This video demonstrates how easy it is:

 

8vI_W0j_3uY

 

 

 

Some highlights:

  • The commands are sent directly to DCS; you do not have to map any buttons in the DCS options.
  • Full A-10C support including export of the CDU display (no OCR required!)
  • UH-1H support (mostly complete, waiting for the bug reports to roll in)
  • Comprehensive documentation
  • Supports switching aircrafts in multiplayer
  • Open-source -- if at some point in the future I cannot maintain the project anymore (I might get hit by a bus...) any other programmer can pick it up
  • By writing a few lines of code yourself, you can use any existing Arduino library to control different types of displays, servos and stepper motors (DCS-BIOS does export this data).

 

The goal of DCS-BIOS is to become a community-maintained Export.lua file that covers everything related to controlling your virtual cockpit.

We would like to support every single DCS module, but to do that, we need your help!

If you want to add support for another aircraft module, please contact me.

I cannot add and maintain aircraft modules that I do not know and fly myself.

 

This project started back in July when I wanted to introduce WarHog to Arduino boards.

Five months later, we have an easy-to-use, stable platform that can export the complete A-10C cockpit over a serial connection or an Arduino Ethernet shield.

I'd like to thank WarHog for being my guinea pig and for his great work on the User Guide. Without him, most people would give up after reading the first sentence!

 

To learn more, visit the DCS-BIOS website: dcs-bios.a10c.de

There you will find links to downloads, documentation, the DCS-BIOS YouTube channel and GitHub.

 

If you have questions, please open a new issue on GitHub if you can.

It will be easier to follow separate discussions there and if your question is related to a bug, your question can instantly be used as a bug report.

 

I plan to improve the documentation and work on additional tutorial videos.

Some topics I want to cover in a video:

  • how to set up the interactive reference documentation (view live data from your cockpit and manipulate switches with Google Chrome); this feature currently has no documentation at all
  • how to use DCS-BIOS with an Arduino Ethernet shield
  • how to connect a character display
  • how to connect a servo motor
  • how to connect a rotary encoder
  • how to connect three-position toggle switches and rotary switches
  • a 10 to 15-minute walkthrough that covers the entire set-up process
  • a guide on what Arduino board and USB to serial converter to buy (and which tools you need)

 

I will prioritize these (and cover additional topics) based on the feedback we receive.

 

Try DCS-BIOS and send us your comments, where you were confused and which areas of the documentation you think we need to improve (if any).

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

Hello

 

how to use DCS-BIOS with an Arduino Ethernet shield.

 

What in Dcs-bios do i change to have DCS-bios look multiple arduinos. looking to one Arduino per switch panel..

 

Regards,

Gary

 

Hi Gary

 

I can't answer 1 for you, not sure but I assume and Arduino is an Arduino.

 

2, it is possible to have a Master Arduino and then connect multiple other Arduinos to it. Normally the guys setup a Mega as the Master, it will not be able to connect switches to, and then they connect Nanos to it. Each panel runs on a Nano that talk back to the Mega.

 

As an idea of how this works, check out this thread for interesting ideas... https://forums.eagle.ru/showthread.php?t=219982

Link to comment
Share on other sites

  • Recently Browsing   0 members

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