Results 1 to 9 of 9
  1. #1
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Lightbulb Transponder XPNDR

    Hi there

    I'm working on a new project. A Squawk kode transponder (XPNDR). I've been googling around a bit for ideas, and maby som of you have some.
    The closest I came was a LUA script for FSUIPC.
    Tuning the FSX radios with the numpad of your keyboard - Utilities - The AVSIM Community
    But then I thought: I've got GA panel installed on the computer running instruments.
    This program have Keystroke for: Reset on all 4 digits, and Setting new code. (The LUA script actually did'nt have more functions than this for the xpndr. And you had to start/stopp the script form viewing it self on the FSX)
    So the easyest thing might be useing keystrokes instead. Running the keystrokes from the instrument computer and the LCD from FSX on my main computer.

    The FSX only provides me with these options, as I understand it:
    XPNDR 1000_INC Increments first digit of transponder Shared Cockpit
    XPNDR 100_INC Increments second digit of transponder Shared Cockpit
    XPNDR 10_INC Increments third digit of transponder Shared Cockpit
    XPNDR 1_INC Increments fourth digit of transponder Shared Cockpit
    Do I need more?
    There are quite a few more functions on the panel and I have made action button for them, but should I ignore the rest of the features?

    I hav not tryed, but can I use a arduino on a second computer, using Fink2fs for programming the keys?
    Will it still work, sending the keystrokes via Widefs on the network?

    pictures of the build:

    20130406_155714.jpg 20130406_155643.jpg 20130406_223840.jpg


    Inputs vould be appreciated
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  2. #2
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    232
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    Roy,
    Very nice replication of AlliedSignal'sKT76C!!

    I performed some research on the unit's functions and I see no reason you cannot have your panel emulate the real thing with all of the features I read it would do- button for button, knob for knob. Unless I am missing something, I see no reason why you couldn't run the LCD, buttons and rotary switch off of a single arduino connected to your main computer running FSX.

    My guess is that when you press the button "5" the arduino will use the command xpdrLCD.setCharAt(2,'5') to set the changed xpdr code and will send the appropriate key command until the xpdr read from LinkFS reads the correct code ie., XPNDR 10_INC for "XX5X" until xpdrLCD==xpdrFSX? A different, but similar, approach will be needed for the VFR button("1200"), i.e., match "1XXX" before moving to the next digit for "12XX" if(xpdrFSX.charAt(0)=='1'){}else{XPNDR 1000_INC}

    At any rate, that would be my approach. I'm not sure if I was of any help, but again - nice panel!
    -James

  3. #3
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    Just a question to that JMeller. Doesn't one nead a keystroke to get FSX to change focus to the Transponder, before you can change the digits or change other settings?
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  4. #4
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    232
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    The transponder (i.e. radio stack) doesn't need to have focus, however FSX must. This applies for all of the 'Keys' inputs.
    That said, I believe Jim's Multi has strings for some default commands piped directly into SimConnect instead of emulating the keyboard. He will have to correct me if I'm mistaken.

  5. #5
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    763
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    Hi Roy ,, There's a couple of ways to look at this and I've seperated them out because what happens with my link2fs "keys" is quite different to what might happen with using your keyboard emulator.

    With Link2fs "keys" ,,,
    The keystroke will go to FSX weather it is in focus or not. i.e. you can be using (say) a flight planner and that is in focus but FSX is behind it in the screen ,, well the keystroke will still go to FSX.
    All my programs need to be in the same computer as flight sim ,,, they don't work over widefs.
    Controlling the transponder can only be done with incrementing a digit up or down ,, at the moment there is no direct input of the digit.
    Incrementing the digits up or down is by using the codes in the list in the "keys" section ,, ie NTT1- and NTT1= etc etc


    Now, using your keyboard emulator ,,,,
    When the switch is "flicked" the keystroke will only go to the program that is in focus.
    The one thing I don't know is if going thru a Lua/FSUIPC setup then will FSUIPC (if FSX is not in focus) catch it instead ,, I don't know ,,, try it and see ??

    Yep ,, I agree with James (JMeller) you've made a great job of the radio unit Roy ,,, Nice.

    Good luck in sorting things out ,,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  6. #6
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    Hey Jim.
    Having done some thoroughly research today, in terms of how the transponder works in FSX.
    (Maby I should done that first )
    What I have found, is that you can not use other functions than setting the 4 digit code, you kan use the "CLR" to undo a digit input, and you can set the code 1200 when hitting the VFR button. The selector switch does'nt work in FSX, but I can program the arduino card to make it look like it works, viewing the selected mode on the LCD.
    The IDT button is not working in the FSX and the ALT mode only shows the first 3 digits of the current altitude.
    (I'm not sure, but I assume it calculates flight level in relation to QNH)
    i.e. if the altitude is 12500 feet, the display will show 125 as a flight level. Inc. or dec. as the altitude changes.

    Have been loocking at the Link2fs Multi today (Very good program by the way, I spesially liked the monitor! Good job guys!)
    I am anxious how it will be programming the card to use buttons instead of rotary encoders to change the code.
    I guess it all lies in the sketch.
    Have some ideas that I will try when I finish soldering of the switches. I'll be back with info when I have tried me a bit.
    That said, I have bought an Arduino Mega which I will try to program it all on. So I do not know if there is any difference in terms of programming the Uno cards. It will be exciting!
    I also found an old laptops that I shall try the programming on. I got so much weird results on the laptop computer I use everyday, so I gave up using that one.
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  7. #7
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    I think I've found a way to attack the problem.

    Lot of failing but suddenly it loosend.
    It was imposible to (for me! ) to make a sketch, to push buttons for printing 1, 2, 3, and so on with buttons, to set the code. This I blame FSX!
    I gave up on LUA, this is Greek for me! And I'm to stupid to understand what JMeller tried to make me understand
    I came across something interesting yesterday. I have flash'd the arduino card with new firmware, this way I can use it as a HID keyboard.
    Interesting stuff here: Arduino USB HID Keyboard | MitchTech ,
    and her: Arduino - DFUProgramming8U2
    By using the arduino card on the computer running the instruments: GA Panel and GA Radio stack from Peix Software , I can now use inputs on the arduino, to send keystrokes, 0,1,2,3 and so on, to the radio stack. And IT WORKS
    The Radio stack is now the link between FSX and Arduino, instead of Link2fs (sorry Jim)!
    It was quite difficult to understand what drivers to be installed and when to load the sketch, the guids I found was a bit messy, but I succeeded at the end.
    By figuring this out, I have opened new opportunities
    Now it will be interesting to see what things you can combine in the Sketch.

    No way I could find the right keyboard ID's on the internet but I managed to read it from the HID Usage Tables
    By using the ID's that I wanted from the HID Usage table (I have edited a list her on my homepage) i managed to make a working sketch.


    /* Arduino USB Keyboard HID
    * X,1,2,3,4,5,6,7 keys
    */

    uint8_t buf[8] = {
    0 }; /* Keyboard report buffer */

    #define PIN_X 8 // Input X for calling the Radio Stack
    #define PIN_0 9 // Input The zero digit to the 7 digit
    #define PIN_1 10
    #define PIN_2 11
    #define PIN_3 12
    #define PIN_4 13
    #define PIN_5 14
    #define PIN_6 15
    #define PIN_7 16

    int state = 1;

    void setup()
    {
    Serial.begin(9600);
    pinMode(PIN_X, INPUT);
    pinMode(PIN_0, INPUT);
    pinMode(PIN_1, INPUT);
    pinMode(PIN_2, INPUT);
    pinMode(PIN_3, INPUT);
    pinMode(PIN_4, INPUT);
    pinMode(PIN_5, INPUT);
    pinMode(PIN_6, INPUT);
    pinMode(PIN_7, INPUT);
    // enable internal pull-ups
    digitalWrite(PIN_X, 1);
    digitalWrite(PIN_0, 1);
    digitalWrite(PIN_1, 1);
    digitalWrite(PIN_2, 1);
    digitalWrite(PIN_3, 1);
    digitalWrite(PIN_4, 1);
    digitalWrite(PIN_5, 1);
    digitalWrite(PIN_6, 1);
    digitalWrite(PIN_7, 1);

    delay(200);
    }

    void loop()
    {
    state = digitalRead(PIN_X);
    if (state != 1) {
    buf[2] = 27; // X key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_0);
    if (state != 1) {
    buf[2] = 39; // 0( Zero) key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_1);
    if (state != 1) {
    buf[2] = 30; // 1 key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_2);
    if (state != 1) {
    buf[2] = 31; // 2 key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_3);
    if (state != 1) {
    buf[2] = 32; // 3 key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_4);
    if (state != 1) {
    buf[2] = 33; // 4 key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_5);
    if (state != 1) {
    buf[2] = 34; // 5 key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_6);
    if (state != 1) {
    buf[2] = 35; // 6 key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }

    state = digitalRead(PIN_7);
    if (state != 1) {
    buf[2] = 36; // 7 key
    Serial.write(buf, ; // Send keypress
    releaseKey();
    delay (1000);
    }
    }

    void releaseKey()
    {
    buf[0] = 0;
    buf[2] = 0;
    Serial.write(buf, ; // Release key
    }
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  8. #8
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    The code shows up like this Serial.write(buf, ; // Send keypress
    It
    should be: Serial.write(buf, 8 ) ; // Send keypress without the spaces
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  9. #9
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    274
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Transponder XPNDR

    The Mind Game Continues!

    Ok, so I got a result! The problem would be, that I do not understand why!
    I have determined: FSX has only 1, 10, 100 and 1,000 Inc / Dec.
    With the use of external software (GA Radio Stack), I can enter the code (eg. VFR 1200) directly, using the: 1, 2, 0, and 0 keys.

    I tried to log Simconnect traffic, but got so much data that I failed to understand the results.
    If I use the logging feature in Fsuipc I can see what happens, when I enter the code in GA Radio Stack:


    < on every input code > < code at the end (ie 1200) >
    //EVENT: Cntrl= 65715 (0x000100b3), Param= 0 (0x00001200) XPNRD_SET;

    (I tried to serialprint the //EVENT:......... through the arduino, but nothing happened! )

    The result is not logged until all four digits are entered. Only then the code is sent to FSX and will be logged.

    Does anyone have comments / suggestions on how this can be used to make anyting reasonable on the arduino card?

    By the way, has anyone tried to control a 16x2 LCD with two different arduino cards?
    I'm thinking: one can control eg "lcd.setCursor(0, 0);" with one card, and "lcd.setCursor(4, 0);" with the next card?
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------