Cockpitbuilders.com

Main => General Discussion Board. => Topic started by: RayS on October 22, 2015, 01:32:18 PM

Title: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: RayS on October 22, 2015, 01:32:18 PM
I won't go into the WHY I started down this road (Suffice it to say all the FI radios are connected with a single ribbon cable, backwards. I added an Audio COntrol Panel by adding an in-line IDC connector the RIGHT way so I could add it to the chain. Queue funny burning electronics smell.....)

SO..........
I discovered that for 1/2 (ONE HALF!) the price of a SINGLE COMM/NAV radio from FlightIllusion, I can assemble 6 (SIX!) of these:
(https://www.cockpitbuilders.com/proxy.php?request=http%3A%2F%2Fwww.flightillusion.com%2Fimages%2Fstories%2Fvirtuemart%2Fproduct%2Fctl_comm.jpg&hash=624ddb9395c5bd502f6179aa4ffd0b72b0f2e346)

using a single arduino or teensy, (for all six)

One of these:
(https://www.cockpitbuilders.com/proxy.php?request=http%3A%2F%2Fembedded-lab.com%2Fblog%2Fwp-content%2Fuploads%2F2013%2F04%2FSPI7SEGDISP8.56-2R_Yellow.jpg&hash=2ae00710da82b7a5864fcd712bc56f0f7050005e)

..plus a few switches, some smoked plexiglass and a dual rotary encoder.

Savings: Well over $1600 US.

The included Arduino LED library for the display makes it sooper-simple to program a COMM or NAV radio and send the values to X-Plane.

Parts... Ordered!




 
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: Bob Reed on October 22, 2015, 01:36:46 PM
I can get you the bezels!  ;D
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: RayS on October 22, 2015, 01:57:34 PM
Can you do laser etching so I can backlight them?
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: Bob Reed on October 22, 2015, 07:08:13 PM
Quote from: RayS on October 22, 2015, 01:57:34 PM
Can you do laser etching so I can backlight them?

They can be engraved.
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: Joe Lavery on October 23, 2015, 08:55:43 AM
Ray I'd be interested to see the Arduino code for this, if you don't mind.

And I think you'll need another element to those displays for the radios.

Cheers
Joe.
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: Trevor Hale on October 23, 2015, 10:56:08 AM
I am guessing Ray you would just Hard Solder a #1 in front of those numbers?

Seems to be missing a digit LOL

Trev
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: RayS on October 23, 2015, 12:00:07 PM
I plan on just super-gluing a "+1" single digit to the left of each bar. I have several hundred of any color in the rainbow at my disposal so.. should be easy.

Joe, I worked on the  INC/DEC code last night for the lower 2 digits and got that working to correctly go from a .00 .02 .05 .07 .10 .12 (and reverse)

I should be putting in the rest of the code over the weekend. Pretty easy so far. :-)
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: jr2mey on October 24, 2015, 05:38:26 AM
Ray, that is really slick!!!
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: RayS on October 25, 2015, 08:08:53 PM
Initial proof-of-concept coding is complete for the Arduino Radio stack.

Wasn't too bad... Only programmed myself into a few corners but nothing too tight. As long as I can keep the loop() as clear and clean as possible, I should be able to get the entire radio stack onto one Arduino, or Teensy, as is my final goal for this project.

Next step is to get this to send data to X-Plane.

(The LCD Panel is an interim solution until the 7-seg digits land on my doorstep.)

https://youtu.be/dQuoijSJ4eQ
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: Trevor Hale on October 26, 2015, 03:58:43 AM
Well you got me beat...  I wish I could do something like that.  Great job.
Title: Re: 6 FLightIllusion Radios for the price of 1/2 of a single FI radio
Post by: RayS on October 27, 2015, 07:52:37 PM
// The code so far: (Minus actually sending data to X-Plane...)
// Sending Data to X-Plane with Teensy:
// https://www.pjrc.com/teensy/td_flightsim.html (https://www.pjrc.com/teensy/td_flightsim.html)


/* Encoder Library - TwoKnobs Example
* http://www.pjrc.com/teensy/td_libs_Encoder.html (http://www.pjrc.com/teensy/td_libs_Encoder.html)
*
* This example code is in the public domain.
*/

#include <Wire.h>  // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h>

//#define ENCODER_OPTIMIZE_INTERRUPTS //Nope!

#define ARDUINO 256  //Who are we talking to?

#include <Encoder.h>

// Change these pin numbers to the pins connected to your encoder.
//   Best Performance: both pins have interrupt capability
//   Good Performance: only the first pin has interrupt capability
//   Low Performance:  neither pin has interrupt capability
Encoder knobLeft(30, 31);
Encoder knobRight(48, 49);

//Interim solution until LED Displays arrive
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

/*-----( Declare Variables )-----*/
// COM1 Variables. COM2 to be added
int StandbyLoDigit  = 0;
int StandbyHiDigit  = 118;
int ActiveLoDigit   = 0;
int ActiveHiDigit   = 118;
int _SwapLoDigit    = 0;
int _SwapHiDigit    = 0;

long positionLeft  = -999;
long positionRight = -999;
long newLeft, newRight;

const int btnSWAP         = 52; ACT/STBY XFER Button

int SWAP_STATE = 0;
int btnSWAPState = 0;

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  // SET UP IO PINS

  pinMode(btnSWAP, INPUT);
 

  //----------------------------------------------------
  // Interim Solution until LEDs Arrive
  //----------------------------------------------------
      Serial.begin(9600);  // Used to type in characters
      lcd.begin(20,4);   // initialize the lcd for 16 chars 2 lines, turn on backlight
      lcd.setCursor(2,1); //Start at character 4 on line 0
      lcd.print("Hello, Raymond!");
      delay(2000); 
      lcd.clear();
      lcd.setCursor(6,0); lcd.print("COM 1   COM 2");
      lcd.setCursor(0,2); lcd.print(" Act:");
      lcd.setCursor(0,3); lcd.print("Stby:");
      paintCOM1active();
      paintCOM1standby();
}/*--(end setup )---*/


void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
{
  btnSWAPState   = digitalRead(btnSWAP);
  newLeft        = knobLeft.read()/2;
  newRight       = knobRight.read()/2;
 
  if (newLeft > positionLeft)
  { 
    positionLeft = newLeft;
    StandbyLoDEC();
    paintCOM1standby();
     
  }
 
  if (newLeft < positionLeft)
  { 
    positionLeft = newLeft;
    StandbyLoINC();
    paintCOM1standby();
     
  }

   if (newRight > positionRight)
  { 
    positionRight = newRight;
    StandbyHiDEC();
    paintCOM1standby();
     
  }
 
  if (newRight < positionRight)
  { 
    positionRight = newRight;
    StandbyHiINC();
    paintCOM1standby();
     
  }
 
 
  // Get Button Status

  if(btnSWAPState == LOW)
  {
    Swap();
  }
  else
  {
    SWAP_STATE = 0; // Ensure SWAP routine only runs ONCE when button pressed   
  }
}/* --(end main loop )-- */

//------------------------------------------//
// Helper Routines
//------------------------------------------//

void Swap()
{
      if(SWAP_STATE == 0)
      {
      // Temporarily store Standby Freq
          _SwapLoDigit = StandbyLoDigit;
          _SwapHiDigit = StandbyHiDigit;
     
      // Set Standby Freq to current Active Freq
          StandbyLoDigit = ActiveLoDigit;
          StandbyHiDigit = ActiveHiDigit;
     
      // Set Active to Current Standby
          ActiveLoDigit = _SwapLoDigit;
          ActiveHiDigit = _SwapHiDigit;
      }

      SWAP_STATE = 1; // Ensure SWAP routine only runs ONCE when button pressed

      paintCOM1active();
      paintCOM1standby();
     
}

void StandbyLoINC()
{
        //-------------------------------//
        // Lower Digit INC
        //-------------------------------//
         if(StandbyLoDigit % 5 == 0)
          {
            StandbyLoDigit += 2;
          }
          else
          { 
            StandbyLoDigit += 3;
          }
               
          if(StandbyLoDigit > 97){StandbyLoDigit = 0;}
}       

void StandbyLoDEC()
{
        //-------------------------------//
        // Lower Digit DEC
        //-------------------------------//
         
          if(StandbyLoDigit % 5 == 0)
          {
            StandbyLoDigit -= 3;
          }
          else
          { 
            StandbyLoDigit -= 2;
          }
               
          if(StandbyLoDigit < 00){StandbyLoDigit = 97;}
}

void StandbyHiDEC()
{
        //-------------------------------//
        // High Digit DEC
        //-------------------------------//
            StandbyHiDigit -= 1;
               
          if(StandbyHiDigit < 118){StandbyHiDigit = 134;}
}

void StandbyHiINC()
{
        //-------------------------------//
        // High Digit DEC
        //-------------------------------//
            StandbyHiDigit += 1;
               
          if(StandbyHiDigit > 134){StandbyHiDigit = 118;}
}

void paintCOM1active()
{
    //------------------------------   
    // Paint Active Freq
    //------------------------------   
        lcd.setCursor(6,2); lcd.print(ActiveHiDigit);
        lcd.setCursor(9,2); lcd.print(".");
       
        if(ActiveLoDigit < 10)
        {
          lcd.setCursor(10,2); lcd.print(0); 
          lcd.setCursor(11,2); lcd.print(ActiveLoDigit);
        }
        else
        {
          lcd.setCursor(10,2); lcd.print(ActiveLoDigit); 
        }           
       
}

void paintCOM1standby()
{       
    //------------------------------   
    // Paint Standby Freq
    //------------------------------   
        lcd.setCursor(6,3); lcd.print(StandbyHiDigit);
        lcd.setCursor(9,3); lcd.print(".");
       
        if(StandbyLoDigit < 10)
        {
          lcd.setCursor(10,3); lcd.print(0); 
          lcd.setCursor(11,3); lcd.print(StandbyLoDigit);
        }
        else
        {
          lcd.setCursor(10,3); lcd.print(StandbyLoDigit); 
        }       
       
        //delay(2000);       
}