Jump to content

DCS-BIOS Discussion Thread


FSFIan

Recommended Posts

I think when Ian gets you that test sketch for the chip, that will remove one major possibility. As he mentioned, I had a batch of some 30 MAX487 chips and every single chip was bad. That sketch let me test a bunch of them quickly and with no doubt about what was good and what was bad.

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

Found it.

 

As mentioned in the comments at the top, the sketch is meant to be connected to two MAX487 chips and will put them through a basic test cycle (i.e. send a logic 0 and a logic 1 in both directions). It won't catch all errors and it will transmit data slower than the 250000 bps that is used by DCS-BIOS, so passing the test does not mean everything is perfect, but failing the test is a pretty clear indication of a broken and/or fake chip.

 

The pin numbers are laid out in such a way that the sketch is convenient to build on a breadboard (assuming you are using an Arduino Nano) as shown in the image below. Instead of jumper wires, I used resistors (anything between 150 ohm and 10k should work) to limit the possible current with the intent of protecting the Arduino board in the event that a broken chip tries to apply a voltage to one of the Arduino's outputs.

 

Maxim Integrated write in the datashet, these Chips are very stable and reliable (robust) ... but I've seen tons of them gone by just little mistakes. They die fast and silent.

 

To be fair, when ordering them from China for $1.50 per lot of 10, there is a chance of getting fake chips, chips from a production run that failed internal quality control, or old chips that were (improperly) stored for a while.

 

// Basic test sketch for MAX487 transceiver chips
// Connect to two MAX487 chips.

// If the test fails, the LED will start to do a double flash
// once a second.

// As long as the test runs correctly, the LED will be on
// and turn off briefly every 200 completed test cycles,
// causing the LED to flicker.

// pin numbers of first MAX487:
#define RO1 12
#define RE1 11
#define DE1 10
#define DI1 9

// pin numbers of second MAX487:
#define RO2 5
#define RE2 4
#define DE2 3
#define DI2 2

void setup() {
 pinMode(RO1, INPUT_PULLUP);
 pinMode(RE1, OUTPUT);
 pinMode(DE1, OUTPUT);
 pinMode(DI1, OUTPUT);

 pinMode(RO2, INPUT_PULLUP);
 pinMode(RE2, OUTPUT);
 pinMode(DE2, OUTPUT);
 pinMode(DI2, OUTPUT);

 pinMode(13, OUTPUT);
 digitalWrite(13, 1);
}

void fail() {
 while(1) {
   digitalWrite(13, 1);
   delay(50);
   digitalWrite(13, 0);
   delay(100);
   digitalWrite(13, 1);
   delay(50);
   digitalWrite(13, 0);
   delay(800);
 }
}

void check_pin(unsigned char pin, unsigned char state) {
 if (digitalRead(pin) != state) fail();
}

void loop() {
 unsigned int test_cycles = 200;
 while (test_cycles > 0) {
     test_cycles--;
   
   // turn off all outputs
   digitalWrite(RE1, 1);
   digitalWrite(DE1, 0);
   digitalWrite(RE2, 1);
   digitalWrite(DE2, 0);
 
   digitalWrite(DI1, 0);
   digitalWrite(DI2, 0);
 
   // send from 1 to 2
   digitalWrite(RE2, 0);
   check_pin(RO2, 1); // test internal bias resistor
 
   digitalWrite(DE1, 1);
   digitalWrite(DI1, 0);
   check_pin(RO2, 0);
   digitalWrite(DI1, 1);
   check_pin(RO2, 1);
   
   digitalWrite(DI1, 0);
   digitalWrite(RE2, 1);
   digitalWrite(DE1, 0);
 
   // send from 2 to 1
   digitalWrite(RE1, 0);
   check_pin(RO1, 1); // test internal bias resistor
 
   digitalWrite(DE2, 1);
   digitalWrite(DI2, 0);
   check_pin(RO1, 0);
   digitalWrite(DI2, 1);
   check_pin(RO1, 1);
   
   digitalWrite(DI2, 0);
   digitalWrite(RE1, 1);
   digitalWrite(DE2, 0);
 }
 
 // toggle LED
 digitalWrite(13, 0);
 delay(20);
 digitalWrite(13, 1);

}

 

5FDQ5lV.jpg


Edited by [FSF]Ian
Link to comment
Share on other sites

thank you very much :thumbup::thumbup:

 

I will equip myself and test this.

 

My chips come from china, little price :D and probably counterfeit or bad quality.

 

Where do you buy your chips? I see several types of MAX-487 (CSA-ESA-CPA-EPA,...) what is the best for DCS-BIOS??

 

Thank you again for your help

Link to comment
Share on other sites

I also buy from China. I had no problems with bad chips, but I only bought two lots, so my sample size is pretty small. That said, buying from a big distributor is about ten times as expensive, so it's still cheaper to buy from China until you get working chips.

 

The test sketch was written while on Skype with Warhog. My theories were getting increasingly paranoid because we both had the same circuit and code, which worked for me, but didn't behave for him. Could there be some stupid bug in the code that depended on the exact timing the USB driver used to send the data? After at least an hour or so of Warhog swapping out every single component (different MAX487 chips, different Arduino Mega, different Arduino Pro Mini, ...) I wrote the sketch to verify basic functionality in a context that did not involve DCS-BIOS code at all.

 

I recommend the MAX487 for use with DCS-BIOS.

Page 15 in the datasheet lists the differences between the CSA, ESA, etc. variants.

The first letter is either 'C' or 'E' and specifies the temperature range that the device is guaranteed to work in (consumer = +0 to +70 C, extended = -40 to +85 C, military = -55 to +125 C). The last two letters specify the package, You probably want 'PA' for the through-hole DIP-8 package. If you make your own circuit boards, you may also be interested in the 'SA' variant for the SO-8 surface mount package. The other packages (except 'JA', which is the ceramic DIP-8 package designed to handle the military temperature range) are inconvenient (uMax) to impossible (bare die) to solder by hand.

 

To make a long story short, all you care about is that the last two letters are 'PA' if you want the DIP-8 package to use with a breadboard or prototype board, and 'SA' if you make a custom circuit board and want the advantages of the surface mount package (uses less space, no need to drill holes).

Link to comment
Share on other sites

  • 2 weeks later...

mary christmas everybody...

 

hello guys, i ve finished all the gauges that don t need more than "180°" with servos, and now i m trying to interface all the others with stepper like the RSBN,AGD,RKL, ...

 

 

i m geting very stuck in how to sketch that, any help is wellcome

 

 

:pilotfly:

With respect

_________________

Kadda

_________________

My works

TL-39 (NewGen) project (Ру)/(EN)

Link to comment
Share on other sites

If I might make a suggestion, if you need your servos to swing greater than 180 degrees you can achieve this simply by adding some gears. They are readily available on eBay and AliExpress for very reasonable prices. They also have experimenters packs that have a variety of sizes. You can try out different gears until your happy with the gear ratio that works best for you.

 

My hydraulic gauges were set up that way as you can see below.

 

15905108182_4a96d95765_b.jpgIMG_0274 by John Wall, on Flickr

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

If I might make a suggestion, if you need your servos to swing greater than 180 degrees you can achieve this simply by adding some gears. They are readily available on eBay and AliExpress for very reasonable prices. They also have experimenters packs that have a variety of sizes. You can try out different gears until your happy with the gear ratio that works best for you.

 

My hydraulic gauges were set up that way as you can see below.

 

15905108182_4a96d95765_b.jpgIMG_0274 by John Wall, on Flickr

 

thanks Warhog for the quick answer, and for the suggestion, in fact i used something similar to that, in the gauges where more than 180° is needed like in the temperature gauge, but now i need to make the instruments where i need free turning in the two directions, like the altimeter or the AGD... and i think i can do it only with steppers and and a detector for zeroing.

 

So step one for me is controling the stepper WITH DCS BIOS, then adding the optical detector for zeroing.

 

 

in reality i didn't had to buy gears for the moment because in the orriginal intruments i found the orriginal metal gears and they are standart (fully metal) maked :music_whistling: ...

 

 

and a noob question, can i know what is the best mirco controler for me to use? for the moment i m programming the intruments one by one with an arduino uno but i m probably gona change for better one for the real thing, if i use USB.

 

 

PS: it s always a pleasure to see photos of your impressive work :)

With respect

_________________

Kadda

_________________

My works

TL-39 (NewGen) project (Ру)/(EN)

Link to comment
Share on other sites

I, personally, have used just three board types throughout my entire cockpit.

 

The Mega, for RS485 bus as master. Also for very high pin count applications such as CDU. I buy them for $11.45 each from China.

 

The Pro Mini. This is the most used board in the cockpit. Cost is approximately $1.95 but you need a USB to serial converter to program them. I bought three converters for $2.75 each.

 

Nano. Less cost than ProMini ($1.80) they eliminate need for USB converter and are more convenient to use. I started with using ProMini and developed standard PCB for its pin pattern and MAX487 IC. I didn't want several different sizes in the cockpit for replacement purposes if one were to fall and need replacing. That said, both will do the job easily and cost is a non issue.

 

Also, I recommend you do a search through the home cockpits section of the forum and read all there is on the RS485 bus that we are starting to use. It will allow all of the boards to talk to DCSBIOS and the sim. Ian has made example template sketches for both the master and the slaves. We have also written a tutorial that will be released later in January. It will explain how to incorporate the RS485 bus into your cockpit.

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

...We have also written a tutorial that will be released later in January. It will explain how to incorporate the RS485 bus into your cockpit.

Can't wait for it!

My rig specs:

Intel Core i7 4770 @3.4Ghz // Corsair 16GB DDR3 // MoBo Asus Z87K // HDD 1TB 7200RPM // eVGA Nvidia GTX 760GT 2GB DDR5 // LG 3D 47" 1920x1080 // Thrustmaster Warthog HOTAS // Saitek Combat Pro Pedals // Thrustmaster MFD Cougar pack // PS3 Eye + FTNOIR

Link to comment
Share on other sites

RS485

 

I'm looking forward to seeing the RS485 tutorial. :)

 

I, personally, have used just three board types throughout my entire cockpit.

 

The Mega, for RS485 bus as master. Also for very high pin count applications such as CDU. I buy them for $11.45 each from China.

 

The Pro Mini. This is the most used board in the cockpit. Cost is approximately $1.95 but you need a USB to serial converter to program them. I bought three converters for $2.75 each.

 

Nano. Less cost than ProMini ($1.80) they eliminate need for USB converter and are more convenient to use. I started with using ProMini and developed standard PCB for its pin pattern and MAX487 IC. I didn't want several different sizes in the cockpit for replacement purposes if one were to fall and need replacing. That said, both will do the job easily and cost is a non issue.

 

Also, I recommend you do a search through the home cockpits section of the forum and read all there is on the RS485 bus that we are starting to use. It will allow all of the boards to talk to DCSBIOS and the sim. Ian has made example template sketches for both the master and the slaves. We have also written a tutorial that will be released later in January. It will explain how to incorporate the RS485 bus into your cockpit.

Link to comment
Share on other sites

  • 2 weeks later...

Hi!

 

I have a problem with the function of the DCS-BIOS (A-10C):

 

DcsBios::Potentiometer cmscRwrVol("CMSC_RWR_VOL", PIN);

 

Doesn't works - potentiometer is OK.

 

if anyone met this problem?

 

Arduino Uno

DCS-BIOS 0.5.0

DCS Arduino library 0.2.3


Edited by Marcin_B
Link to comment
Share on other sites

I assigned pin...

 

...which pin? A potentiometer requires an analog pin.

 

Assuming the cause is not a bug in DCS-BIOS, there is only one answer I can give to a problem description that only consists of "It doesn't work!": "Yes, it does!" Like the problem description, that answer is short, correct, and lacks useful information.

 

Of course, bugs in DCS-BIOS do happen (and have happened in the past); either because I missed something during development or because an update to DCS included a change that broke something (I think that only happened once, the Export.lua API is pretty stable). But even if it is a bug in DCS-BIOS, I have to reproduce it on my machine, and most bugs only happen under specific circumstances (those that happen all the time are likely to be caught during initial development), so I need to match your setup as close as possible.

 

Include your complete sketch and a schematic of your circuit. You also need to describe what happens. "It does not work" only tells me that something that you expect to happen did not happen. I need to know what you did (including your code and schematic), what you expected to happen (though this is often obvious from the context of the question, or from a sentence like "I turned the physical potentiometer but the knob in the virtual cockpit did not turn"), and what happened instead!

 

Did the socat script connect or was there an error message? Do any other inputs or outputs that are connected to the same Arduino board work (assuming there are any)? Every detail can be important. In general, more information is better, but any first post should include the sketch and a description of the circuit.

Link to comment
Share on other sites

Example below:

 

#define DCSBIOS_IRQ_SERIAL

#include <DcsBios.h>
 
DcsBios::Potentiometer cmscBrt("CMSC_BRT", A0); //example 1
DcsBios::Potentiometer cmscRwrVol("CMSC_RWR_VOL", A2); //example 2

void setup() {
 DcsBios::setup();
}

void loop() {
 DcsBios::loop();
}  

 

Example 1 - works fine

Example 2 - no reaction (I turned the physical potentiometer but the knob in the virtual cockpit did not turn)

 

My connection (example 2)

 

49cf9f9e7501.jpg

 

Did the socat script connect or was there an error message? - The script attached correctly and no error message

 

Arduino Uno

DCS-BIOS 0.5.0

DCS Arduino library 0.2.3

Link to comment
Share on other sites

There are two bugs here. One is in DCS-BIOS: the first potentiometer will always get the chance to fill the transmit buffer first, and because there isn't any rate limiting or hysteresis in the DcsBios::Potentiometer class yet, it will always queue up a message to send. The second potentiometer will never get to send a message, because the TX buffer is already full when it is polled.

 

The second bug is in my brain, because I was aware of that problem, devised a solution which would make sure that every defined input would get a chance to transmit, and was convinced I had already implemented that. Turns out I haven't.

 

I'll grab a few pots and get to work. Expect a new release of the Arduino library within the next day or two.

Link to comment
Share on other sites

Ian;3007039']... Expect a new release of the Arduino library within the next day or two.

This is much better than what is to expect of a (notable) commercial software developer/seller :thumbup:

More interesting: That looks like no one has connected two pots before...

 

OffTopic: I'm still on the 3.5" mysterium. Approaching (keep your fingers crossed) a solution.

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Link to comment
Share on other sites

I have around 4 pots connected,,just never used them so don't know if they work, from what Ian said they don't LOL. I am in the middle of a pit rebuild as her in doors got the hump with a cockpit in the living room. Gets in the way.

AMD A8-5600K @ 4GHz, Radeon 7970 6Gig, 16 Gig Ram, Win 10 , 250 gig SSD, 40" Screen + 22 inch below, Track Ir, TMWH, Saitek combat pedals & a loose nut behind the stick :thumbup:

Link to comment
Share on other sites

Ian;3007039']I'll grab a few pots and get to work. Expect a new release of the Arduino library within the next day or two.

 

Excellent news Ian :thumbup: Just about to get the lightning control panel up and running so very much appreciated.

Do you think there will there be some kind of filtering/averaging code included in the next release? I mean for the majority of the pots they remain stationary for longs periods of time so it may be possible to have the code look at the inputs, send value and store it. If next time the input is read and it deviates from last sent value by less than e.g. 5% then no new update is transmitted or perhaps last value re-transmitted.

 

Cheers

Hans

Link to comment
Share on other sites

@Marcin_B: While looking at the code again I noticed that your problem is not caused by what I thought it was. The behavior I described can only happen in RS-485 mode, because the transmit code in IRQ_SERIAL mode is still blocking.

 

I recreated your setup as close as I could (same sketch, went back to Arduino library v0.2.3, had to use a Nano instead of an Uno) and it worked for me.

 

Does the same potentiometer connected to the same pin (A2) work if you only define a single pot in the sketch like this?

 

#define DCSBIOS_IRQ_SERIAL

#include <DcsBios.h>
 
DcsBios::Potentiometer cmscRwrVol("CMSC_RWR_VOL", A2); //example 2

void setup() {
 DcsBios::setup();
}

void loop() {
 DcsBios::loop();
}

 

You could also try the AnalogInOutSerial example that comes with the Arduino IDE (File -> Examples -> Analog) for a test that works independently of DCS-BIOS.

 

I suspect that your physical connections may be at fault here. Sticking solid core wire into a female header (which is designed for square pins) as shown on your photo does not make a reliable contact. Try soldering those wires to square pin headers or use jumper wires (with square pins) and a solderless breadboard (those spring contacts make a good connection to almost anything). You could also try using a different analog pin.

Link to comment
Share on other sites

Ian;3008418']

 

Does the same potentiometer connected to the same pin (A2) work if you only define a single pot in the sketch like this?

 

Also doesn't work. Physical connections are correct.

 

I tried to use Uno and Mega2560 - with no effect.

 

Arduino Uno

DCS-BIOS 0.5.0

DCS Arduino library 0.2.3

Link to comment
Share on other sites

DCS Bios - LED connected to Nano?

 

Hi

 

can anyone advise on how many LED can be connected to an Arduino Nano? I am looking at how to wire:

 

Nose wheel steering indicator }

Gun arm indicator } 1 x Arduino

Marker }

Canopy light }

Landing gear panel - Wheel locked indicators

 

I am looking at 2 LED for each indicator, soldered together so they are wired as one. With the landing gear the LED will all be lit together, so total of 6.

 

I was wondering if there may be a power issue, which may mean that I have to wire them through a Max 7219 chip.

 

Any advice greatly received.

 

Neal

Desktop PC:

Intel i7 14700K, MSI Z790 MAG Tomahawk MOBO, 64Gb RAM , GPU Nvidia RTX 3080ti

Windows 11, VPC joystick, Crosswind rudder peddles, HP Reverb G2, VPC Collective, DOF Reality H2, Gametrix seat, WinWing panels.

Link to comment
Share on other sites

Hi

 

can anyone advise on how many LED can be connected to an Arduino Nano? I am looking at how to wire:

...

 

Althow this is an Arduino matter (look here) here is a short answer:

 

20 mA per Output Pin

400 mA total (!!!)

 

That means, you'll get with two LEDs per Pin close (to close) to the edge.

 

I wouldn't recommend. Look for a solution with a Transistor inside of a special electronics forum. I made good experiences with MOSFETs (others too). Also I think you'll need for the cabin light some more power than a single 20mA-LED :)


Edited by Tekkx

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Link to comment
Share on other sites

This is how I dealt dealt with multiple or high powered LEDS.

 

http://bildr.org/2012/03/rfp30n06le-arduino/

 

It is definitely over kill for a couple of LEDS but when you look at the cost of 30n06LE Mosfets, it was cheaper and easier to buy a couple dozen of these little guys and use them everywhere whenever the current requirements exceeded the Arduino specs.

 

One chip for all is my mantra...:music_whistling: :thumbup:

 

 

This is a bank of mosfets that I built for the exact same purpose as the OP. Nosewheel, Gun, Canopy Beacon, Fire L Eng, R Eng, APU, and a couple others I can't remember at the moment.

 

IMG_0460.jpg

 

This is the board with the Arduino Pro Mini removed.

 

IMG_0459.jpg


Edited by Warhog
added photos

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

  • Recently Browsing   0 members

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