Start of the viggen panels, tips, tricks and alot of help is welcome

@outbaxx did a CK37 panel with a display…

1 Like

Checked his channel. Cool stuff :smiley: really wondering if i should do, when i get to doing it, to do a throttle like him, or like the real where it was direct connected with a long rod, to the… fuelthingy xD

Yes, DCS-BIOS can directly interface with your hardware, it has arduino commands. Or if you are running it on a standalone machine you can send packets back and forth.

1 Like

I’ve put 100ohm resistors between the pins on the rotary switch and read the resistance on one pin on the Nano.
I have one Nano for the button and switches and one Nano for the display.

2 Likes

@outbaxx how did you code the part where it reads the, i guess voltageread.
I tried it but dont know enough about dcs bios to troubleshoot it.

Think i dont have the part where it knows which value it is but cant send the correct value to dcs bios.

Thanks, thats exactly what i needed! You can access the value of the data panel, and i bet i can get it to output the value of the destination display too

2 Likes
    //#define DCSBIOS_IRQ_SERIAL
//#define DCSBIOS_DEFAULT_SERIAL
#define DCSBIOS_RS485_SLAVE 21
#define TXENABLE_PIN 2

#include "DcsBios.h"

DcsBios::Switch2Pos datapanelKey1("DATAPANEL_KEY_1", 12);

DcsBios::Switch2Pos datapanelKey2("DATAPANEL_KEY_2", 11);

DcsBios::Switch2Pos datapanelKey3("DATAPANEL_KEY_3", 10);

DcsBios::Switch2Pos datapanelKey4("DATAPANEL_KEY_4", 9);

DcsBios::Switch2Pos datapanelKey5("DATAPANEL_KEY_5", 8);

DcsBios::Switch2Pos datapanelKey6("DATAPANEL_KEY_6", 7);

DcsBios::Switch2Pos datapanelKey7("DATAPANEL_KEY_7", 6);

// PIN 5 for PWM LED
int PanelLight_pin = 5;
int PanelLed_Value;

DcsBios::Switch2Pos datapanelKey8("DATAPANEL_KEY_8", 4);

DcsBios::Switch2Pos datapanelKey9("DATAPANEL_KEY_9", 3);

DcsBios::Switch2Pos ck37RensaClear("CK37_RENSA_CLEAR", A0);

DcsBios::Switch2Pos datapanelKey0("DATAPANEL_KEY_0", A1);

DcsBios::Switch2Pos dataInOut("DATA_IN_OUT", A2);

//DcsBios::Switch2Pos rensaButtonCover("RENSA_BUTTON_COVER", A3);

DcsBios::AnalogMultiPos datapanelSelector("DATAPANEL_SELECTOR", A7, 6, (1023/6));


void setup() {
  
  DcsBios::setup();
 //  pinMode(PanelLight_pin, OUTPUT);
}

void onMainElectricPowerChange(unsigned int newValue) {
    if (newValue==0){
      PanelLed_Value = 0; }
}
DcsBios::IntegerBuffer mainElectricPowerBuffer(0x460e, 0x4000, 14, onMainElectricPowerChange);
  
void onPanelLightsChange(unsigned int newValue) {
      PanelLed_Value = map(newValue, 0, 65535, 0, 200);
     analogWrite(PanelLight_pin, PanelLed_Value);
}
DcsBios::IntegerBuffer panelLightsBuffer(0x460a, 0xffff, 0, onPanelLightsChange);



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

So this row:

DcsBios::AnalogMultiPos datapanelSelector(“DATAPANEL_SELECTOR”, A7, 6, (1023/6));

Reads the value and divide it into the six positions.
Edit: 7 positions

2 Likes

Wow thanks @outbaxx. Could hug you but it is corona. So a elbowbump has to suffice.

Even got to se how you did the led code you talked about on youtube :smiley: gonna read up on what a uln2003 is :smiley: for now my leds are on or off ^^

1 Like


I made these,(red & blue) they make the rotary switches into voltage dividers and i only use one pin in the Nano for each. I think I use 100Ohm resistors and a capacitor, the capacitor is there so it won’t read zero between switches.
Here is another picture of my project, left side start to actually look like a cockpit :wink:

5 Likes

Very nice, very nice indeed!

A small progress update:
https://imgur.com/a/cfGjehs

2 Likes

Aaaah! starburst LED segments! I love those things ridiculously much!

2 Likes

Both the data and the destination display are working now. It was harder than expected, since the displays need different libraries that dont work well together

1 Like

Nice a TM chip! I have a few TM 1638 chips that function as a input for a CIVA-IV. Lovely little chips with what you can do with them .

1 Like

It’s done :partying_face:

https://imgur.com/SsVCQMY
I’m pretty happy how it turned out, everything works (albeit the data display has a small delay) and setting up the buttons in DCS has been very easy. It shows up as a generic joystick, so it can be used in other games as well.

https://imgur.com/wJIN14r
20 cent for scale (lol), it really feels big

https://imgur.com/UKRwKeH
The panel itself

https://imgur.com/RF2hp3j
Some wiring, turned into a rat’s nest in the end…

In action:
https://imgur.com/LzLAj5Q

4 Likes

Very nice, @NukaBoy!
Well done!
I wish I could fit a full size Viggen pit… Would be so much fun to build it!

1 Like

Nice job @NukaBoy Was it hard doing coding for the leds? Did u get the boards for the led displays or did u custom made for them.

Update on my part is that i gave up on the analog value rotaryknob. I was having trouble finding the reason for it not working.
I found that it was not just to add that line from @outbaxx . i also had to edit the main dcs bios library.

Again i looked to the forums and found this which i guess is the same thing.

tekadept’s post was very helpful

Which tells that the DcsBios::AnalogMultiPos is not in the library and goes on to tell how to do it.

BUT! it kept on not working for me i kept looking in to it. testing the hardware maybe was wrong…
Went on “vaycay” xD … now i went back again to check and found out that the rotaryswitch had just gotten a loose pad on the center pin. But i also decided to just go with DCS.bios tip and do a Read low value on pin to know which is selected. So now i have 2 pins left on the micro :stuck_out_tongue: ^
Gonna get a new one and start work on the navpanel with the waypointselectors, and also the ledscreens will be connected to that micro.

I have been thinking on moving to the Leobodnar card for the rotaryswitch part, but gonna try the arduino way first to see than if it is too much of a hassle ill move too leobodnar for those.

So i tried the datapanel and it is working fine with this code :slight_smile:

#define DCSBIOS_DEFAULT_SERIAL

#include <Keypad.h>
#include “DcsBios.h”

/* paste code snippets from the reference documentation here */

DcsBios::Switch2Pos dataInOut(“DATA_IN_OUT”, A5, true); //set a pin for the in out switch

const byte datapanelSelectorPins[13] = {6, 7, 8, 9, 10, 11, 12};
DcsBios::SwitchMultiPos datapanelSelector(“DATAPANEL_SELECTOR”, datapanelSelectorPins, 13);

const byte ROWS = 3; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{‘7’,‘4’,‘1’,‘0’},
{‘8’,‘5’,‘2’,‘A’},
{‘9’,‘6’,‘3’},

};
byte rowPins[ROWS] = {A3, A2, A4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {2, 3, 4, 5}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() {
DcsBios::setup();
keypad.addEventListener(keypadEvent); // Add an event listener.
keypad.setHoldTime(100); // Default is 1000mS
keypad.setDebounceTime(50); // Default is 50mS
Serial.begin(9600);
}

void loop() {
DcsBios::loop();
char key = keypad.getKey();
}

void keypadEvent(KeypadEvent KEY){
switch (keypad.getState()) { // gives PRESSED, HOLD or RELEASED
case PRESSED: // If someone finds a better solution as switch - case: Let me know, please :slight_smile:
switch(KEY) { // following commands are fired unique if PRESSED
//CDU
case ‘1’: sendDcsBiosMessage(“DATAPANEL_KEY_1”, “1”); break;
case ‘2’: sendDcsBiosMessage(“DATAPANEL_KEY_2”, “1”); break;
case ‘3’: sendDcsBiosMessage(“DATAPANEL_KEY_3”, “1”); break;
case ‘4’: sendDcsBiosMessage(“DATAPANEL_KEY_4”, “1”); break;
case ‘5’: sendDcsBiosMessage(“DATAPANEL_KEY_5”, “1”); break;
case ‘6’: sendDcsBiosMessage(“DATAPANEL_KEY_6”, “1”); break;
case ‘7’: sendDcsBiosMessage(“DATAPANEL_KEY_7”, “1”); break;
case ‘8’: sendDcsBiosMessage(“DATAPANEL_KEY_8”, “1”); break;
case ‘9’: sendDcsBiosMessage(“DATAPANEL_KEY_9”, “1”); break;
case ‘0’: sendDcsBiosMessage(“DATAPANEL_KEY_0”, “1”); break;
case ‘A’: sendDcsBiosMessage(“CK37_RENSA_CLEAR”, “1”); break;

}}

switch (keypad.getState()){  // gives PRESSED, HOLD or RELEASED

case RELEASED:
switch(KEY) { // Released KEYs or Neutral Rockers signal is sent
//CDU
case ‘1’: sendDcsBiosMessage(“DATAPANEL_KEY_1”, “0”); break;
case ‘2’: sendDcsBiosMessage(“DATAPANEL_KEY_2”, “0”); break;
case ‘3’: sendDcsBiosMessage(“DATAPANEL_KEY_3”, “0”); break;
case ‘4’: sendDcsBiosMessage(“DATAPANEL_KEY_4”, “0”); break;
case ‘5’: sendDcsBiosMessage(“DATAPANEL_KEY_5”, “0”); break;
case ‘6’: sendDcsBiosMessage(“DATAPANEL_KEY_6”, “0”); break;
case ‘7’: sendDcsBiosMessage(“DATAPANEL_KEY_7”, “0”); break;
case ‘8’: sendDcsBiosMessage(“DATAPANEL_KEY_8”, “0”); break;
case ‘9’: sendDcsBiosMessage(“DATAPANEL_KEY_9”, “0”); break;
case ‘0’: sendDcsBiosMessage(“DATAPANEL_KEY_0”, “0”); break;
case ‘A’: sendDcsBiosMessage(“CK37_RENSA_CLEAR”, “0”); break;

}}
}

2 Likes

I looked for ready-made LEDs with boards since i didnt need any special size or form

Really nice! How did you make that throttle?

2 Likes

How did you guys manage to make those well-looking buttons and switch?