Results 1 to 8 of 8
  1. #1
    10+ Posting Member
    Join Date
    Oct 2015
    Location
    United Kingdom
    Posts
    17
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Cessna radio/autopilot/landing gear desktop build

    Hi all

    So, after delving into Jim's coding and successfully creating some coding (with great help from forum members), I realised I'd have to have somewhere to put it all.

    I love flying the 172, mainly cause I suck at heavy metal. I wanted to have something that was user-friendly for a couple of planes so strayed from the vanilla cockpits of cessna, sorry to purists. This was my original sketch,


    So, bought some 2mm perspex and went to work cutting it out from a template.
    Some of the drill holes chipped the perspex, I believe this was because it wasn't clamped well enough and the 2 sheets came apart. To clarify, it's a sandwich of perspex, printout and perspex back. I'd do this again, but with a 6 month old baby, time is rare, so it'll do for now.

    The frame was made from some 6mm mdf offcuts. Measured round and popped into sketchup. Frame and perspex cut using bandsaw and scroll saw.

    Here's the face plate mounted


    Ok, throttle... I'm using sliding pots, some 10mm metal rods I found lying around, and wooden drawer handles, sanded into different shapes.


    Now the fun. I read a post by davemuir who mentioned using syringes to smooth out the throttle movement. I liked this idea so ordered some syringes, much to the confusion of the missus, who I'm sure is losing all sorts of patience now.
    Here you'll see the rod is pushed into a block of wood which is mounted on the pot slider. This had little to no resistance when moved, hence the syringe idea, which works a treat by the way.


    The frame is at an 80 degree angle, so I'll fabricate a way of sloping the pots, I'm thinking door wedges. I came up with the idea of fastening the syringe tip through some wood using a screw, which works wonderfully.








    In hindsight I would have amended the frame to allow wood to mdf joinery but I'll botch something to hold the syringe baton.

    I'll then finish the gear leaver which will switch a toggle switch mounted in the box.

    Everything other than the pots are arduino, pots will be leobonar card.

    I'm happy to send the sketchup file for the box if you want, for some reason it won't upload as an attachment here.

    Please let me know your thoughts, I'll keep updating as I progress (slowly) with the little build.

    Lots of inspiration here, thank you for that peeps. Sliding pots are not via arduino but via a usb interface from Leo Bodnar (much easier!).

    Here is the arduino code, feel free to take it and play:
    Code:
    
    /* Original = Multi_Radiohead_annun from Jim's website
       v.1, amended liquidcrystal display for 20,4
       v.2, deleted pulse leds and unwanted stuff, added dual encoder (8,9,10,11), button = 12
       v.3, tweaked 'Void Keys', with help from MyCockpit
       v.4, Added Servo to pin 13, as per Jims Multi_keys_with_flaps_servo 
       v.5, moved and seperated q and q2
       v.6, VOID keys change to VOID input
       v.7 Completed encoder MASSIVE thanks to BushPilotWannabe for his help and guidance 
       V.7 Getting servo jitter - continious D260/261 outputs from card?? 
           Changed line 677 to (KpinNo > 22 && KpinNo != 26)
           added viod question
       V.1.9 Autopilot screen test LATEST VERSION
       V2. Added lights and starter key switch
     
     */
    
    
    #include "math.h"
    #include "Quadrature.h"
    #include <LiquidCrystal.h>
    #include <Servo.h>
    Servo flapsServo;
    
    
    Quadrature quad1(8,9);
    Quadrature quad2(10,11);
    LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
    
    
    int CodeIn;// used on all serial reads
    int KpinNo; 
    int Koutpin;
    int active; // the mode thats active
    int activeold;
    int mark; // shows where the cursor is in the likes of ADF etc
    long timePrevious;
    long timeNow;
    long timeInterval = 80;//you adjust this for "your" feel of fast
    int fastTurn = 0;//variable for turn-speed state
    
    
    String KoldpinStateSTR, KpinStateSTR, Kstringnewstate,Kstringoldstate, APsp, APspold, stringnewstate,stringoldstate, vertsp, vertspold, hdgset, hdgsetold, com1, com1old, com1sb, com1sbold,com2, com2old, com2sb,com2sbold, airsp, airspold, altit, altitold;
    String nav1, nav1old, nav1sb, nav1sbold, nav2, nav2old, nav2sb, nav2sbold;
    String adf, adfold, xpdr, xpdrold, dme1, dme1old, dme2, dme2old, pitot, pitotold;
    
    
    String gearSimple;
    String flaps;
    char blank = 255;
    
    
    int R;// a variable
    int Rold;// the old reading
    int Rdif;// the difference since last loop
    int R2;// a second test variable
    int R3;// a second test variable
    int Rold2;// a second loop old reading
    int Rdif2; // the second test difference
    int Rold3;// a second loop old reading
    int Rdif3; // the second test difference
    
    
    // make some custom arrows for the LCD:
    byte leftArrow[8] = { // This makes a <-- on lcd
      0b00000,
      0b00100,
      0b01000,
      0b11111,
      0b01000,
      0b00100,
      0b00000,
      0b00000
    };
    
    
    byte rightArrow[8] = { //make a --> on lcd
    
    
      0b00000,
      0b00100,
      0b00010,
      0b11111,
      0b00010,
      0b00100,
      0b00000,
      0b00000
    };
    
    
    void setup() 
    {
      lcd.begin(20, 4); // set up the LCD's number of columns and rows: 
      Kstringoldstate = "111111111111111111111111111111111111111111111111111111111111111111111";
        for (int KoutPin = 12; KoutPin < 53; KoutPin++)// Get all the pins ready for inputs 
      {
        pinMode(KoutPin, INPUT);
        digitalWrite(KoutPin, HIGH);  
      }
      for (int PinNo = 54; PinNo <= 69; PinNo++)// Get all the OUTPUT pins from analog
      {
     pinMode(PinNo, OUTPUT);
    }
    
    
    lcd.createChar(0, leftArrow); // create a new character
    lcd.createChar(1, rightArrow);
     
    mark = 12;
    lcd.clear();
    Serial.begin(115200);   
     //pinMode(26, OUTPUT);// For the servo.
      //flapsServo.attach(26);
    }
    
    
    void loop() {
      timeNow = millis();
     {INPUTPINS();} //Check the "button pressed" section
      {LCDMODE();}  // Sets up the LCD for the mode it's in (From the rotary switch)
      {ENCODER();} //Check the Rotary Encoders
       if (Serial.available()) {// Check if serial data has arrived from PC
        CodeIn = getChar();
        if (CodeIn == '=') {EQUALS();} // The first identifier is "="
        if (CodeIn == '<') {LESSTHAN();}// The first identifier is "<"
        if (CodeIn == '?') {QUESTION();}// The first identifier is "?"
     }//End of serial check
    }//End of Void Loop
    
    
    char getChar()// Get a character from the serial buffer
    {
      while(Serial.available() == 0);// wait for data
      return((char)Serial.read());// Thanks Doug
    }// End of get characters
    
    
      
    void QUESTION(){    // The first identifier was "?"
    CodeIn = getChar(); // Get the second identifier
      switch(CodeIn) {// Now lets find what to do with it
        case 'Y': // found the second identifier (the "Gear simple")
           gearSimple = "";
          gearSimple += getChar();// get first charactor (Nose gear)
          if (gearSimple == "2"){digitalWrite(54, HIGH);}else{digitalWrite(54, LOW);}//Nose gear
          if (gearSimple == "1"){digitalWrite(57, HIGH);}else{digitalWrite(57, LOW);}//nose gear moving
          gearSimple += getChar(); // get the second charactor (gear left)
          if (gearSimple.endsWith("2")){digitalWrite(55, HIGH);}else{digitalWrite(55, LOW);}//left gear
          if (gearSimple.endsWith("1")){digitalWrite(58, HIGH);}else{digitalWrite(58, LOW);}//left gear moving
          gearSimple += getChar(); // get the third charactor  (gear right)
          if (gearSimple.endsWith("2")){digitalWrite(56, HIGH);}else{digitalWrite(56, LOW);}//right gear
          if (gearSimple.endsWith("1")){digitalWrite(59, HIGH);}else{digitalWrite(59, LOW);}//right gear moving
        break;
         }//end of WTDWI
    }// end of question void
    
    
    void LCDMODE(){
    if (active != activeold)
        activeold = active;
      if (digitalRead(14)==0 and active != 14) { // Sets up the LCD when switching to Com1)
        lcd.setCursor(0, 0);
        delay (11);
        lcd.print(com1); 
        lcd.setCursor(8, 0);
        lcd.write(byte(0)); // this is the left arrow
        lcd.setCursor(9, 0);  
        lcd.write((byte) 1); // this is the right arrow
        lcd.setCursor(10, 0);
        lcd.print("  ");
        lcd.setCursor(12, 0);
        delay (11);
        lcd.print(com1sb); 
        lcd.setCursor(19, 0);
        delay (11);
        lcd.print(" ");
        lcd.setCursor(0, 1);
        lcd.print("                  ");
        lcd.setCursor(0, 2);
        delay (11);
        lcd.print("Comm 1      Standby"); 
        active = 14;
      } // End of Comm1 LCD Setup
      
    if (digitalRead(15)==0 and active != 15) {  // Sets up the LCD when switching to Com2)
        lcd.setCursor(0, 0);
        delay (11);
        lcd.print(com2); 
        lcd.setCursor(8, 0);
        lcd.write(byte(0)); // this is the left arrow
        lcd.setCursor(9, 0);  
        lcd.write((byte) 1); // this is the right arrow
        lcd.setCursor(10, 0);
        lcd.print("  ");
        lcd.setCursor(12, 0);
        delay (11);
        lcd.print(com2sb); 
        lcd.setCursor(19, 0);
        delay (11);
        lcd.print(" ");
       lcd.setCursor(0, 1);
        lcd.print("                  ");
        lcd.setCursor(0, 2);
        delay (11);
        lcd.print("Comm 2      Standby"); 
        active = 15;
      } //End of Comm 2
      
        if (digitalRead(16)==0 and active != 16) {  // Sets up the LCD when switching to Nav1)
        lcd.setCursor(0, 0);
        delay (11);
        lcd.print(nav1); 
        lcd.setCursor(8, 0);
        lcd.write(byte(0)); // this is the left arrow
        lcd.setCursor(9, 0);  // this is the right arrow
        lcd.write((byte) 1);
        lcd.setCursor(10, 0);
        lcd.print("  ");
        lcd.setCursor(12, 0);
        delay (11);
        lcd.print(nav1sb); 
        lcd.setCursor(19, 0);
        delay (11);
        lcd.print(" ");
        lcd.setCursor(0, 1);
        lcd.print("                  ");
        lcd.setCursor(0, 2);
        delay (11);
        lcd.print("Nav 1       Standby"); 
        active = 16;
      } //End of Nav 1
      
      if (digitalRead(17)==0 and active != 17) {  // Sets up the LCD when switching to Nav2)
        lcd.setCursor(0, 0);
        delay (11);
        lcd.print(nav2); 
        lcd.setCursor(8, 0);
        lcd.write(byte(0)); // this is the left arrow
        lcd.setCursor(9, 0);  // this is the right arrow
        lcd.write((byte) 1);
        lcd.setCursor(10, 0);
        lcd.print("  ");
        lcd.setCursor(12, 0);
        delay (11);
        lcd.print(nav2sb); 
        lcd.setCursor(19, 0);
        delay (11);
        lcd.print(" ");
        lcd.setCursor(0, 1);
        lcd.print("                  ");
        lcd.setCursor(0, 2);
        delay (11);
        lcd.print("Nav 2       Standby"); 
        active = 17;
      } // End of Nav 2
      
      if (digitalRead(18)==0 and active != 18) {  // Sets up the LCD when switching to ADF)
        lcd.setCursor(0, 0);
        delay (11);
        lcd.print("ADF         ");  
        lcd.setCursor(9, 0);
        delay (11);
        lcd.print(adf); 
         lcd.setCursor(19, 0);
        delay (11);
        lcd.print(" ");
        lcd.setCursor(0, 1);
        lcd.print("                   ");
        lcd.setCursor(0, 2);
        lcd.print("                   "); 
        if (mark == 9 ){mark = 10;}
        lcd.setCursor(mark, 1);
        lcd.print("-");
        active = 18;             
      } // End of ADF
      
      if (digitalRead(19)==0 and active != 19) {  // Sets up the LCD when switching to DME)
        lcd.setCursor(0, 0);
        delay (11);
        lcd.print(dme1); 
        lcd.setCursor(12, 0);
        lcd.print(dme2);
        lcd.setCursor(18, 0);
        lcd.print("  ");
        lcd.setCursor(0, 1);
        delay (11);
        lcd.print("                   ");
        lcd.setCursor(0, 2);
        delay (11);
        lcd.print("DME 1    DME2       ");  
        active = 19;
      } // End of DMEs
             
      if (digitalRead(20)==0 and active != 20) {  // Sets up the LCD when switching to AP)
        lcd.setCursor(0, 0);
        lcd.print(hdgset);
        lcd.setCursor(3, 0);
        lcd.print("  ");
        lcd.setCursor(8, 0);
        lcd.print(altit);
        lcd.setCursor(13, 0);
        lcd.print("   ");
        lcd.setCursor(15, 0);
        lcd.print(vertsp);
        lcd.setCursor(0, 1);
        delay (11);
        lcd.print("HDG     ALT      VS ");  
        lcd.setCursor(0, 2);
        lcd.print("                   ");  
        delay (11);
        active = 20;                   
       } // End of Autopilot screen
    
    
    } // end of LCDmode
      
    void EQUALS(){      // The first identifier was "="
           delay (11);
           CodeIn = getChar(); // Get another character
      switch(CodeIn) {// Now lets find what to do with it
        case 'A'://Found the reading "Com1"
            com1 = "";
            com1 += getChar();
            com1 += getChar();
            com1 += getChar();
            com1 += getChar();
            com1 += getChar();
            com1 += getChar();
            com1 += getChar();
            if (com1 != com1old && digitalRead(14) == LOW) {
              delay (11);
              lcd.setCursor(0, 0);
              delay (11);
              lcd.print(com1);
              com1old = com1;
              }
             break;
          case 'B': // Found the reading "Com1 s/b" 
            com1sb = "";
            com1sb += getChar();
            com1sb += getChar();
            com1sb += getChar();
            com1sb += getChar();
            com1sb += getChar();
            com1sb += getChar();
            com1sb += getChar();
            if (com1sb != com1sbold && digitalRead(14) == LOW ){
              delay (11);
              lcd.setCursor(12, 0);
              delay (11);
              lcd.print(com1sb);
              com1sbold = com1sb;
              }        
             break;
           case  'C': //  Found the reading "Com2"
            com2 = "";
            com2 += getChar();
            com2 += getChar();
            com2 += getChar();
            com2 += getChar();
            com2 += getChar();
            com2 += getChar();
            com2 += getChar();
            if (com2 != com2old && digitalRead(15) == LOW) {
              lcd.setCursor(0, 0);
              delay (11);
              lcd.print(com2);
              com2old = com2;
              }
             break;
           case  'D': //  Found the reading "Com2 s/b"
            com2sb = "";
            com2sb += getChar();
            com2sb += getChar();
            com2sb += getChar();
            com2sb += getChar();
            com2sb += getChar();
            com2sb += getChar();
            com2sb += getChar();
            if (com2sb != com2sbold && digitalRead(15) == LOW) {
              lcd.setCursor(12, 0);
              delay (11);
              lcd.print(com2sb);
              com2sbold = com2sb;
              }
             break;          
           case  'E': //  Found the reading "Nav1"
            delay (11);
            nav1 = "";
            nav1 += getChar();
            nav1 += getChar();
            nav1 += getChar();
            nav1 += getChar();
            nav1 += getChar();
            nav1 += getChar();
            nav1 += (" "); //pads it up to 8 caracters
            if (nav1 != nav1old && digitalRead(16) == LOW) {
              lcd.setCursor(0, 0);
              delay (11);
              lcd.print(nav1);
              nav1old = nav1;
              }
             break;
           case  'F': //  Found the reading "Nav1 s/b"
            nav1sb = "";
            nav1sb += getChar();
            nav1sb += getChar();
            nav1sb += getChar();
            nav1sb += getChar();
            nav1sb += getChar();
            nav1sb += getChar();
            nav1sb += (" "); //pads it up to 8 caracters
            if (nav1sb != nav1sbold && digitalRead(16) == LOW) {
              lcd.setCursor(12, 0);
              delay (11);
              lcd.print(nav1sb);
              nav1sbold = nav1sb;
              }              
             break;
           case  'G': //  Found the reading "Nav2"
            delay (11);
            nav2 = "";
            nav2 += getChar();
            nav2 += getChar();
            nav2 += getChar();
            nav2 += getChar();
            nav2 += getChar();
            nav2 += getChar();
            nav2 += (" "); //pads it up to 8 caracters
            if (nav2 != nav2old && digitalRead(17) == LOW) {
              lcd.setCursor(0, 0);
              delay (11);
              lcd.print(nav2);
              nav2old = nav2;
              }
             break;
           case  'H': //  Found the reading "Nav2 s/b"
            nav2sb = "";
            nav2sb += getChar();
            nav2sb += getChar();
            nav2sb += getChar();
            nav2sb += getChar();
            nav2sb += getChar();
            nav2sb += getChar();
            nav2sb += (" "); //pads it up to 8 caracters
            if (nav2sb != nav2sbold && digitalRead(17) == LOW) {
              lcd.setCursor(12, 0);
              delay (11);
              lcd.print(nav2sb);
              nav2sbold = nav2sb;
              }              
             break;
           case  'I': //  Found the reading "ADF"
            adf = "";
            adf += getChar();
            adf += getChar();
            adf += getChar();
            adf += getChar();
            adf += getChar();
            adf += getChar();
            adf += (" "); //pads it up to 8 caracters
            if (adf != adfold && digitalRead(18) == LOW) {
              lcd.setCursor(9, 0);
              delay (11);
              lcd.print(adf);
              adfold = adf;
              }
             break;   
           case  'J': //  Found the reading "XPDR"
            delay (11);
            xpdr = "";
            xpdr += getChar();
            xpdr += getChar();
            xpdr += getChar();
            xpdr += getChar();
            xpdr += ("    "); //pads it up to 8 caracters
            if (xpdr != xpdrold && digitalRead(20) == LOW) {
              lcd.setCursor(9, 0);
              delay (11);
              lcd.print(xpdr);
              xpdrold = xpdr;
              }               
             break;
           case  'K': //  Found the reading "DME1"
            delay (11);
            dme1 = "";
            dme1 += getChar();
            dme1 += getChar();
            dme1 += getChar();
            dme1 += getChar();
            dme1 += getChar();
            dme1 += ("   "); //pads it up to 8 caracters
            if (dme1 != dme1old && digitalRead(19) == LOW) {
              lcd.setCursor(0, 0);
              delay (11);
              lcd.print(dme1);
              dme1old = dme1;
              }
             break;          
           case  'L': //  Found the reading "DME2"
            delay (11);
            dme2 = "";
            dme2 += getChar();
            dme2 += getChar();
            dme2 += getChar();
            dme2 += getChar();
            dme2 += getChar();
            dme2 += ("   "); //pads it up to 8 caracters
            if (dme2 != dme2old && digitalRead(19) == LOW) {
              lcd.setCursor(9, 0);
              delay (11);
              lcd.print(dme2);
              dme2old = dme2;
            }
            break;
    case 'b': // found AP altitude setting
          delay (11);
          altit = "";
          altit += getChar();
          altit += getChar();
          altit += getChar();
          altit += getChar();
          altit += getChar();
          if (altit != altitold){
            lcd.setCursor(7, 0);
            delay (11);
            lcd.print(altit);
            altitold = altit;
          }        
        break;
       case 'c': // found vertical speed setting
          delay (11);
          vertsp = "";
          vertsp += getChar();
          vertsp += getChar();
          vertsp += getChar();
          vertsp += getChar();
          //vertsp += getChar();
          if (vertsp != vertspold){
            lcd.setCursor(15, 0);
            delay (11);
            lcd.print(vertsp);
            vertspold = vertsp;
           }
          break;
       case 'd': // found AP heading setting
          delay (11);
          hdgset = "";
          hdgset += getChar();
          hdgset += getChar();
          hdgset += getChar();
          if (hdgset != hdgsetold){
            lcd.setCursor(0, 0);
            delay (11);
            lcd.print(hdgset);
            hdgsetold = hdgset;
           }       
       break;
          } // End of what to do with it               
        } //End of Void Equals
    
    
    
    
    
    
    void LESSTHAN(){   
    } //End of Lessthan
    
    
    void ENCODER(){
    R =(quad1.position()); // the /2 was not needed for my dual rotary from Leobodnar 
    
    
    if (R != Rold) { // checks to see if it different
    (Rdif = (R-Rold));// finds out the difference
    
    
       if (active == 14){// Comm1 rotary encoder output
       if (Rdif == 1) Serial.println ("A04");//Comm1 Mhz down
       if (Rdif == -1) Serial.println ("A03"); //Comm1 Mhz up
       } //End of Comm1 Rotary 1
    
    
      if (active == 15){// Comm2 rotary encoder output
      if (Rdif == 1) Serial.println ("A07");
      if (Rdif == -1) Serial.println ("A08"); 
      } //End of Comm2 Rotary 1
      
      if (active == 16){// Nav1 rotary encoder output
      if (Rdif == 1) Serial.println ("13");
      if (Rdif == -1) Serial.println ("A14");
      } //End of Nav1
    
    
      if (active == 17){// Nav2 rotary encoder output
      if (Rdif == 1) Serial.println("A19");
      if (Rdif == -1) Serial.println("A20");
      } // End of Nav 2 Rotary 1
    
    
    if (active == 18){// ADF rotary encoder output
      if (digitalRead(12)==0 ) {
          if (Rdif == 1) { 
          mark = (mark - 1);
          active = 2; 
          if (mark == 13) mark =12;
          }
          if (Rdif == -1){ 
          mark = (mark + 1); 
          active = 2;
           if (mark == 13) mark =14;
           }
           if (mark > 14) mark = 14;
           if (mark < 10) mark = 10;
          }
          else{
            if (Rdif == 1) { 
              if (mark == 10) {
                Serial.println("A29"); 
              }
              if (mark == 11) {
                Serial.println("A30"); 
              }
              if (mark == 12) {
                Serial.println("A31"); 
              }
              if (mark == 14) {
                Serial.println("A32"); 
              }
            }    
            if (Rdif == -1){
              if (mark == 10){
                Serial.println("A25"); 
              }  
              if (mark == 11){
                Serial.println("A26"); 
              }  
              if (mark == 12){
                Serial.println("A27"); 
              }  
              if (mark == 14){
                Serial.println("A28"); 
              }  
            }//End of Rdif -1 
          } //End of else
    }//End of ADF
    
    
    if (active == 20){// Autopilot rotary encoder output
          if(timeNow - timePrevious < timeInterval) {fastTurn = 1;}else{ fastTurn = 0;} //is it being turned fast or not ? 
          if (Rdif == -1) {//knob is going forward
          if (fastTurn == 1){//yes it's being turned fast ,, else ,, it's being turned slow
          for (int accel = 1; accel <= 10; accel++){//loop to send "A57" 5 times ,, use more or less to suit.
          Serial.println ("A58");}// heading increase fast
          }else{//it's turned slow
          Serial.println ("A58");}// heading increase slow (sent once)
        }//end of forward
    
    
        
          if (Rdif == 1) {//knob is going backwards
          if (fastTurn == 1){  //yes it's being turned fast ,, else ,, it's being turned slow
          for (int accel = 1; accel <= 10; accel++){//loop to send "A58" 5 times
          Serial.println ("A57");}// heading decrease fast
          }else{//it's turned slow
          Serial.println ("A57");}// heading decrease slow (sent once)
        }//end of backwards
        } // End of R Autopilot
        
     if (quad1.position() > 1000){ // zero the rotary encoder count if too high or low
          quad1.position(0);
           }
        if (quad1.position() < -1000){
          quad1.position(0);
           } 
    Rold=R; 
    } //End of R
    
    
    
    
    R2 =(quad2.position()); //setting up second rotary
    if (R2 != Rold2) { // checks to see if it different
    (Rdif2 = (R2-Rold2));// finds out the difference
    
    
       if (active == 14){// Comm1 rotary encoder output
       if (Rdif2 == 1) Serial.println ("A02"); // Com1
       if (Rdif2 == -1) Serial.println ("A01");//Com1 
       if (R2 != Rold2);
       } //End of Comm1 second encoder
    
    
       if (active == 15){// Com2 rotary encoder output 
       if (Rdif2 == 1) Serial.println ("A09"); 
       if (Rdif2 == -1) Serial.println ("A10");
       }
      
       if (active == 16){// Nav1 rotary encoder output
       if (Rdif2 == 1) Serial.println ("A15"); 
       if (Rdif2 == -1) Serial.println ("A16");
       }
    
    
       if (active == 17){// Nav2 rotary encoder output
       if (Rdif2 == 1) Serial.println ("A21"); 
       if (Rdif2 == -1) Serial.println ("A22");
       }
    
    
       if (active == 20){// Xponder rotary encoder output
       if (Rdif2 == -1) Serial.println ("B12");//
       if (Rdif2 == 1) Serial.println ("B11");// 
       }
      }//End of checks if different
      Rold2=R2;
    }//End of Dual Rotary (Thank goodness)
    
    
    
    
    void INPUTPINS(){
      Kstringnewstate = "";
      for (int KpinNo = 12; KpinNo < 70; KpinNo++){       //checks all the pins 12 to 69
        KpinStateSTR = String(digitalRead(KpinNo)); 
        KoldpinStateSTR = "";
        KoldpinStateSTR = String(Kstringoldstate.charAt(KpinNo - 12));
        if (KpinStateSTR != KoldpinStateSTR) {            // yes it's different
          if (KpinNo == 22 and KpinStateSTR == "0") {     //Change-over button is pressed
           if (active == 14) Serial.println("A06");       //com1
           if (active == 15) Serial.println("A12");       //com2
           if (active == 16) Serial.println("A18");       //nav1
           if (active == 17) Serial.println("A24");       //nav2
           if ( active == 18){                            //adf
              mark = (mark + 1);
              if (mark == 13){ 
               mark = 14;
              }  // sort out for piont in ADF
              active = 1;
              if (mark > 14)mark = 10;
              }  //end of ADF
            
            if  (active == 20){          //xponder
            mark = (mark + 1);
            if (mark == 13){ 
            mark = 9;
            }   // sort out for length Xponder
          active = 1;
          if (mark > 12)mark = 12;
         } //End of xponder bit
       } //End of pin 12 sortout
    
    
        if (KpinNo == 21 && KpinStateSTR == "0"){Serial.println ("C02");} // Gear UP 
         if (KpinNo == 21 && KpinStateSTR == "1"){Serial.println ("C01");} // Gear DOWN 
      
      
        
        if (KpinNo > 39){                // start of "Keys" bit
        Serial.print ("D"); 
        if (KpinNo < 12) Serial.print ("0");
        Serial.print (KpinNo);
        Serial.println (KpinStateSTR);
        }   //End of keys bit   
        }   //End of yes it's different
           Kstringnewstate += KpinStateSTR;
        } //end of checking keys
           Kstringoldstate = Kstringnewstate;
           delay(11);
    }  // end of void inputpin
    Best wishes
    D
    Attached Images Attached Images
    Last edited by Damo78; 01-12-2016 at 05:46 AM. Reason: Added code

  2. #2
    10+ Posting Member
    Join Date
    Oct 2015
    Location
    United Kingdom
    Posts
    17
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Cessna radio/autopilot/landing gear desktop build

    And here's the (almost) finished product. Needs landing gear lever painted, plus a knob for the end. All sides of the box.

    Thanks for the inspiration and help all.
    https://youtu.be/KcSI07mIPhY

  3. #3
    25+ Posting Member
    Join Date
    Sep 2014
    Location
    United States
    Posts
    49
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Cessna radio/autopilot/landing gear desktop build

    Nice job. I like the clever use of syringes to dampen the push/pulls.

  4. #4
    New Member
    Join Date
    Jan 2016
    Location
    Chicago Metro
    Posts
    1
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Cessna radio/autopilot/landing gear desktop build

    Great job; and very impressive. And with a newborn in the house; explains the posts at 3am.
    Being a newbie here, are there posts/pictures/videos related to the actual radio/autopilot build? Code samples you're willing to share; list of components related to the radios?

  5. #5
    10+ Posting Member
    Join Date
    Oct 2015
    Location
    United Kingdom
    Posts
    17
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Cessna radio/autopilot/landing gear desktop build

    Hi Pingpilot
    Radio build was done following Jim's instructions on his website called multi panel radio project. I used a LCD 20x4 that was bought from ebay.
    After some tinkering and experimentation, I think I wrote the autopilot coding myself, although I can't quite believe that, so maybe I copied and pasted from somebody. The red push button was a simple switch from Maplin, an electrical store in UK, for about 1. Scrolling numbers/frequencies is done with a dual encoder, from Leo Bodnar, just google him and you'll find a host of goodies, including the dual rotary encoder. Switching comm/nav/autopilot is done with a 12 position single pole rotary switch, about 1 again.
    There are some pics in this post http://www.mycockpit.org/forums/show...t=30064&page=2

    I'm at work at the mo, but when I get home I'll copy and paste the whole code here for you. Hopefully it will be (or become) clear how the autopilot works etc.

    Best wishes
    Damo

  6. #6
    Our new friend needs to reach 10 posts to get to the next flight level schillermetall's Avatar
    Join Date
    Sep 2013
    Location
    Berlin
    Posts
    5
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Cessna radio/autopilot/landing gear desktop build

    Hello enthusiasts,
    here I have a suggestion:

    A shock absorber from the modelmaking


    button of furniture





    ready!
    Attached Images Attached Images

  7. #7
    10+ Posting Member
    Join Date
    Oct 2015
    Location
    United Kingdom
    Posts
    17
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Cessna radio/autopilot/landing gear desktop build

    Hi Schellermetall, thanks for that. I did look in to these (ebay/amazon) for the throttle, mix and prop, but found that there was only about 30 mm of travel with them, far less than I wanted with throttle etc.
    Lovely button though!

  8. #8
    25+ Posting Member
    Join Date
    Sep 2014
    Location
    United States
    Posts
    49
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Cessna radio/autopilot/landing gear desktop build

    I think he was suggesting a solution for the fuel shutoff, not the throttle. Notice the contact switch as opposed to a potentiometer. This is actually helpful because I need to build a shutoff.