Jump to content

Recommended Posts

Posted (edited)

I've connetced a potentiometer to set MiG-21bis' "TGT_SIZE"-parameter.

It crashes the serial transfer between DCS-Arduino.

 

The polarity seems right, and its connected to GND, 5V and A0 on my arduino Uno.

 

Original posted HERE --> http://forums.eagle.ru/showpost.php?p=2508806&postcount=125

 

Sorry for a possible cross post :noexpression:

All tips appreciated.

Edited by pappavis
SOLVED

met vriendelijke groet,

Михель

 

"умный, спортсмен, комсомолетс"

 

[sIGPIC]159th_pappavis.jpg[/sIGPIC]

 

[TABLE]SPECS: i9-9900K 32gigs RAM, Geforce 2070RTX, Creative XFi Fata1ity, TIR5, Valve Index & HP Reverb, HOTAS Warthog, Logitech G933 Headset, 10Tb storage.[/TABLE]

Posted

Hmmm i have fix there somewhere orginal dcs-bios spam com message if pot jitter , i have rethink that pot library and paste that here.

hhmmm not sure if this was the final version but test that if not work i try look my laptop if there is final version. you need replace:

C:\Users\XXX\Documents\Arduino\libraries\dcs-bios-arduino-library-master/Potentiometers.cpp

to this code:

#include "Arduino.h"
#include "Potentiometers.h"
int lastsensorValue = 0;
int sensorValue = 0;
int jitter = 3; // Adjust this number to match your pot jitter , i use blank arduino sketch to see how much my analogread jump allover place and see that was 1-2 depend where my pot is so i put there 3 which eliminate pot spam to dcs game
namespace DcsBios {
   
   Potentiometer::Potentiometer(char* msg, char pin) {
       msg_ = msg;
       pin_ = pin;
       pinMode(pin_, INPUT);
       lastState_ = map(analogRead(pin_), 0, 1023, 0, 65535);
   }
   void Potentiometer::pollInput() {
    sensorValue = analogRead(pin_);
     if(sensorValue< lastsensorValue-jitter || sensorValue> lastsensorValue+jitter )
 {
       unsigned int state = map(analogRead(pin_), 0, 1023, 0, 65535);
       if (state != lastState_) {
           char buf[6];
           utoa(state, buf, 10);
           sendDcsBiosMessage(msg_, buf);
       }
       lastState_ = state;
   lastsensorValue = sensorValue;
   }}

}

Posted (edited)

oh well that was my earlier test , laptop i have diferent files in dcs-bios folder, maybe newer install so there is pot fix what i was running , there is no issue if you have install more than 1 pot. fixed library here:

https://www.dropbox.com/s/9jf695eszcj3t3k/dcs-bios_potFix_Nasty.rar?dl=0

if that crash even that my fixed library check , if you have wiring pot correct , i have some weird pot where is pin 1 is 5v , pin 2 ground , and pin 3 output, that give weird values when moving pot :D. if you have multimeter you can check pins where resist value moving lineary to 10k-> and 0->10k or what ever you pot resist is.

if you wiring that weird multimeter show weird numbers example u turn little pot that show 8kohm move little more value drop 2k ohm then u know u wiring is wrong. Best way is check wiring order to manufactur datasheet.

Edited by Nasty76
  • Like 1
Posted (edited)

 

YES :) this solved it.

 

I did this;

1. Quit Arduino IDE

2. Opened Windows explorer, then into directory C:\Users\XXX\Documents\

3. Deleted C:\Users\XXX\Documents\Ardiono directory.

4. Started Ardiono IDE, it complains about missing library. CLick OK, and quit close the IDE.

5. Downloaded the latest Arduino lib.. https://github.com/dcs-bios/dcs-bios-arduino-library/releases/download/v0.1.3/dcs-bios-arduino-library-v0.1.3.zip

6. Downloaded the fixversion from nasty76' dropbox --> https://www.dropbox.com/s/9jf695eszcj3t3k/dcs-bios_potFix_Nasty.rar?dl=0

7. Opened the zip-file using 7zip, unpacked it.

8. Opened dcs-bios-arduino-library-v0.1.3.zip using 7zip.

9. Replaced the files from Nasty76' fix into dcs-bios-arduino-library-v0.1.3.zip.

10. Started Ardiuno IDE, used menu Schetsch --> manage library --> add zip-library.

12. Recompiled & uploaded to my Arduino Uno R3.

13. Started DCS: Ka-50.. and VOILA!! it works :thumbup::pilotfly:

 

Suggestions;

* @nasty76, perhaps you should submit your Poteniometer fix to the DCS-bios github?

 

Now.. only (small) thing is, that the pot isnt synced to DCS.

For example in Ka-50 misison start;

* pot knob is totally to the left = 0

* the ABRIS Brightness = <>70% (at mission start).

 

What can i do, so the DCS controls are synced to the external potentiometer/servo etc?

Edited by pappavis

met vriendelijke groet,

Михель

 

"умный, спортсмен, комсомолетс"

 

[sIGPIC]159th_pappavis.jpg[/sIGPIC]

 

[TABLE]SPECS: i9-9900K 32gigs RAM, Geforce 2070RTX, Creative XFi Fata1ity, TIR5, Valve Index & HP Reverb, HOTAS Warthog, Logitech G933 Headset, 10Tb storage.[/TABLE]

Posted (edited)

Well i m litte noob :D i cant use github right , that pot issue i have ask dcs-bios creator some help and make my own code which seem work a10c cockpit , well i dont never see that issue pots not update when mission start , i only use radio volumes and there fore pots are max alltime. Idont know what idea put pots cockpit if never rotate them :D. but when we get working ts3 plugin via dcs radio then i need pots are nice to have..

I think you can try this idea to get pot status when start game.

when i look that web page where is all possible values , i mean control-reference.html page , there is metadata start gategory , so:


ad this after setup() or loop:
void onAcftNameChange(char* newValue) {
DcsBios::PollingInput::pollInputs();
}
[/Code]

then use this where u set arduino skectch buttons , leds etc.

 

DcsBios::StringBuffer<16> AcftNameBuffer(0x0000, onAcftNameChange);

 

Still need say big thanks for dcs-bios creator , that software is just awesome and easy to use.

 

Not tested this that name say name change so maybe that only work when u start new game , not sure if u crash and jump again plane , but test this , can work or then not:D. i can look some other idea to poll button states when u jump plane.

i hope when u go specate then that value change example ka-50 to spectate , and whenu jump again ka-50 then that change again and that code run and poll inputs when mission start.

btw that my files can direct replace correct arduino folder after install zip library , so not need unzip change files and zip back.

Install orginal dcs-bios library , locate file names which come my fix packet , replace them and recompile and upload to arduino :D

Edited by Nasty76
Posted (edited)

Small update, this is my MiG-21bis work-in-progress prototyping.

 

Some note;

* The tilt-switch powers the SRZO-IFF decoder

* The knob sets TRGT_SIZE parameter

* Push button, is for ENG_START

 

just cant get the LCD to display text yet, i'm using a I2C-interface. Probably mis-soldered something?

 

 

aanhCMs.jpg

Edited by pappavis

met vriendelijke groet,

Михель

 

"умный, спортсмен, комсомолетс"

 

[sIGPIC]159th_pappavis.jpg[/sIGPIC]

 

[TABLE]SPECS: i9-9900K 32gigs RAM, Geforce 2070RTX, Creative XFi Fata1ity, TIR5, Valve Index & HP Reverb, HOTAS Warthog, Logitech G933 Headset, 10Tb storage.[/TABLE]

Posted

Sorry offtopic , but do you have correct initiliaze i2c communication , and you use correct i2c address , and not sure if other than arduino mega , has correct i2c pullup restors.

I have use i2c screens in arduino mega so if you put your i2c code i can tell is that all ok.

Btw , is that trick work and dcs read pots when game start?

Posted (edited)

yes, the POT-meter works, thanx to the fix on your dropbox.

 

PROBLEM: The screen goes on, but not showing anything.

 

I use an I2C-scanner code from internet.

I2C scanner. Scanning ...

Found address: 39 (0x27)

Done.

Found 1 device(s).

 

The I2C was soldered onto the back of 16x2 LCD. It was my first attempt at soldering >20rys. :noexpression:

 

Wire connections;

I2C SCL pink --> Ardiuno SCL (analog port=A5)

I2C SDA yellow --> Ardiuno SDA (analog port=A4)

I2C VCC red --> Ardiuno +5v

I2C GND Gray jumper jumper --> Arduino GND

 

and this is my LCD-test code. text is NOT appearing :doh:

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

 

// All of the backpacks like the one shown are at 0x27.

#define I2C_ADDR 0x27 // <--Change to match your display

#define BACKLIGHT_PIN 3

#define En_pin 2

#define Rw_pin 1

#define Rs_pin 0

#define D4_pin 4

#define D5_pin 5

#define D6_pin 6

#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,3,POSITIVE);

int lcd_teller1 = 1;

 

// start the thing

void setup() {

Serial.begin(500000);

sendDcsBiosMessage("","---------------------------------------");

sendDcsBiosMessage("DCS-BIOS","opgestart.");

sendDcsBiosMessage("DCS-BIOS","Setup start.");

 

lcd_setup();

 

sendDcsBiosMessage("DCS-BIOS","Setup afgerond.");

sendDcsBiosMessage("DCS-BIOS","loop() start");

}

 

 

void loop()

{

// Backlight on/off every 3 seconds

lcd.setCursor (0,1); // go to start of 2nd line

lcd.print(lcd_teller1++,DEC);

lcd.setBacklight(LOW); // Backlight off

delay(1000);

lcd.setBacklight(HIGH); // Backlight on

lcd.print("Hello 159th_pappavis");

delay(1000);

}

 

// initialize the LCD for use.

void lcd_setup()

{

sendDcsBiosMessage("DCS-BIOS:","LCD Skerm wordt ingesteld");

lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);

lcd.setBacklight(LOW);

delay(150);

 

lcd.begin (16,2); // <<----- My LCD was 16x2

// Switch on the backlight

lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);

lcd.setBacklight(HIGH);

lcd.home (); // go home

lcd.print("DCS World");

lcd.setCursor (0,1); // go to start of 2nd line

lcd.print("Michiel Erasmus");

sendDcsBiosMessage("DCS-BIOS:","LCD Skerm gereed");

}

 

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

Serial.write(msg);

Serial.write(' ');

Serial.write(arg);

Serial.write('\n');

}

 

 

 

This is how it was soldered/connected to my Arduino UNO.

mdfICAYh.jpg

Edited by pappavis

met vriendelijke groet,

Михель

 

"умный, спортсмен, комсомолетс"

 

[sIGPIC]159th_pappavis.jpg[/sIGPIC]

 

[TABLE]SPECS: i9-9900K 32gigs RAM, Geforce 2070RTX, Creative XFi Fata1ity, TIR5, Valve Index & HP Reverb, HOTAS Warthog, Logitech G933 Headset, 10Tb storage.[/TABLE]

Posted

I bought my Arduino as 'experimentation kit' from China. Included was LCD-screen, unknown manufacture. Its something like this:

 

155957569.jpg

met vriendelijke groet,

Михель

 

"умный, спортсмен, комсомолетс"

 

[sIGPIC]159th_pappavis.jpg[/sIGPIC]

 

[TABLE]SPECS: i9-9900K 32gigs RAM, Geforce 2070RTX, Creative XFi Fata1ity, TIR5, Valve Index & HP Reverb, HOTAS Warthog, Logitech G933 Headset, 10Tb storage.[/TABLE]

Posted

hhmm maybe thats not i2c screen is there any example sketch to that screen?. If that is i2c screen is there somewhere jumper which mode screen use. My i2c screen need solder to use i2c default was serial mode.

  • 6 months later...
Posted
YES :) this solved it.

 

I did this;

1. Quit Arduino IDE

2. Opened Windows explorer, then into directory C:\Users\XXX\Documents\

3. Deleted C:\Users\XXX\Documents\Ardiono directory.

4. Started Ardiono IDE, it complains about missing library. CLick OK, and quit close the IDE.

5. Downloaded the latest Arduino lib.. https://github.com/dcs-bios/dcs-bios-arduino-library/releases/download/v0.1.3/dcs-bios-arduino-library-v0.1.3.zip

6. Downloaded the fixversion from nasty76' dropbox --> https://www.dropbox.com/s/9jf695eszcj3t3k/dcs-bios_potFix_Nasty.rar?dl=0

7. Opened the zip-file using 7zip, unpacked it.

8. Opened dcs-bios-arduino-library-v0.1.3.zip using 7zip.

9. Replaced the files from Nasty76' fix into dcs-bios-arduino-library-v0.1.3.zip.

10. Started Ardiuno IDE, used menu Schetsch --> manage library --> add zip-library.

12. Recompiled & uploaded to my Arduino Uno R3.

13. Started DCS: Ka-50.. and VOILA!! it works :thumbup::pilotfly:

 

Suggestions;

* @nasty76, perhaps you should submit your Poteniometer fix to the DCS-bios github?

 

Now.. only (small) thing is, that the pot isnt synced to DCS.

For example in Ka-50 misison start;

* pot knob is totally to the left = 0

* the ABRIS Brightness = <>70% (at mission start).

 

What can i do, so the DCS controls are synced to the external potentiometer/servo etc?

 

I tried all this witht the 0.2.3 download of the library and when I did all of the steps above I got an error. Any ideas? It was 'setup is not a member of dcs...'

 

Thanks!

 

Pete

Posted

Why don't you start by removing the I2C backpack, then re-connect to Arduino and run the 'Hello World' sketch to check that it is functioning properly. Then use DCS-BIOS library but rewrite your sketch without the I2C. I have always had problems with those backpacks. As soon as I got rid of it, everything worked as it should. :thumbup:

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

Posted
Why don't you start by removing the I2C backpack, then re-connect to Arduino and run the 'Hello World' sketch to check that it is functioning properly. Then use DCS-BIOS library but rewrite your sketch without the I2C. I have always had problems with those backpacks. As soon as I got rid of it, everything worked as it should. :thumbup:

 

Thanks for the response. I don't have an I2C backpack (if I know what you are talking about!). I just have an arduino uno board (also Leonardo) without any other boards connected to it. In fact, I just have the potentiometer connected to it.

 

Am I understanding you right? Thanks again for your help here.

  • Recently Browsing   0 members

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