Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    25+ Posting Member
    Join Date
    Jul 2012
    Location
    pt
    Posts
    66
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    My mcp based on arduino mega and pokeys55

    Hi guys
    i've posted this pic so that you guys can see where i am at my mcp build. It works great with the default boeing but i want to raise the bar and try to make it work with the ifly737. I know it doesnt seem professionaly done but i did it with the cheapest material available mainly bought at ebay. Including the induino mega this mcp has cost about 35 to 40 euros to build... Cheap right? But the fun of building it... Priceless!
    anyway, if anyone knows or have any hint in how to proceed in coding for the ifly please share your ideas.
    thanks guys


    image.jpg

  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: My mcp based on arduino mega and pokeys55

    Very nice. How are you driving the 7-seg LEDs i.e., wiring method and arduino code? The reason I ask is because of similar thread where a person was inquiring the same.

  3. #3
    25+ Posting Member
    Join Date
    Jul 2012
    Location
    pt
    Posts
    66
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: My mcp based on arduino mega and pokeys55

    i'm using two tm1640 boards with 16 digits i bought from fasttech and the code was slightly modified to suit my needs from a earlier post here at the forum, but i'll post it just the same. by the way i'm using the jim's link2fsinout not the multi to drive it.

    Code:
    #include  // required because the way arduino deals with libraries
    #include  //http://code.google.com/p/tm1638-library/
    
    
    // define a module on data pin 3, clock pin 2 and another on data 5, and clock 4, display true, intensity 3 out of 7 to lower ma's on
    // the Arduino voltage regulator
    TM1640 module1(3, 2, true, 2);
    TM1640 module2(5, 4, true, 2);
    
    
    
    
    
    int j1;
    int i;
    
    int pinState;
    int pinNo;
    int doutpin;
    
    const char RATE = 2; // You may need to change this depending on the encoders you have.
    
    
    
    long AltPosition = -999, HdgPosition = -999, CrsPosition = -999, Crs2Position = -999, VsPosition = -999, SpdPosition = -999, NavRadioBigPosition = -999, NavRadioSmallPosition = -999;
    
    String oldpinStateSTR, pinStateSTR, stringnewstate, stringoldstate, aphdgset, aphdgsetold, apcrs, apcrsold, output, outputold, apalt, apaltold, apairspeed, apairspeedold, apmachset, apmachsetold;
    String nav1, nav1old, nav2, nav2old, output2, output2old, apvs, apvsold, apActive, apActiveOld, machIas, machIasOld, altLock, altLockOld, headingLock, headingLockOld, atArmed, atArmedOld;
    String apSpdAct, apSpdActOld, apAprAct, apAprActOld, apNavAct, apNavActOld;
    
    void setup()
    {
    
    
    
      Serial.begin(115200);
      for (int doutPin = 15; doutPin <= 53; doutPin++)
      {
        pinMode(doutPin, INPUT);
        digitalWrite(doutPin, HIGH);
      }
      stringoldstate = "11111111111111111111111111111111111111"; // 53 - 15 = this number of 1's
    
      pinMode(7, OUTPUT);
      digitalWrite(7, LOW);
      pinMode(8, OUTPUT);
      digitalWrite(8, LOW);
      pinMode(9, OUTPUT);
      digitalWrite(9, LOW);
      pinMode(10, OUTPUT);
      digitalWrite(10, LOW);
      pinMode(11, OUTPUT);
      digitalWrite(11, LOW);
      pinMode(12, OUTPUT);
      digitalWrite(12, LOW);
      pinMode(14, OUTPUT);
      digitalWrite(14, LOW);
      pinMode(15, OUTPUT);
      digitalWrite(15, LOW);
      Serial.flush();
    
    }
    
    
    
    void loop() {
      // read the oldest byte in the serial buffer:
      if (Serial.available() > 0) {
        j1 = Serial.read();
        //Serial.println(j1);
        if (j1 == 'r'){ // Found the reading "autopilot heading set"
          delay (11); // It seems to need a delay here
          aphdgset = "";
          aphdgset +=(char)Serial.read();
          aphdgset += (char)Serial.read();
          aphdgset += (char)Serial.read();
    
          if (aphdgset != aphdgsetold){ // checks to see if its different to the "old" reading
    
            aphdgsetold = aphdgset; // Writes the current reading to the "old" string.
          }
        }
    
        if (j1 == 'a'){ // Found the reading "crs"
          delay (11);
          apcrs ="";
          apcrs += (char)Serial.read();
          apcrs += (char)Serial.read();
          apcrs += (char)Serial.read();
    
    
          if (apcrs != apcrsold){
    
            apcrsold = apcrs;
          }
        }
        if(j1 == 'b'){ // Found the first charecter of AP ACTIVE
          delay(11);
          apActive = "";
          apActive += (char)Serial.read();
          if(apActive != apActiveOld){
            if(apActive == "1")
              digitalWrite(7, HIGH);
            if(apActive == "0")
              digitalWrite(7, LOW);
          }
          apActiveOld = apActive;
        }
        if (j1 == 'u'){ // Found the reading "AP airspeed "
          delay (11);
          apairspeed ="";
          apairspeed += (char)Serial.read();
          apairspeed += (char)Serial.read();
          apairspeed += (char)Serial.read();
    
    
          if (apairspeed != apairspeedold){
    
            apairspeedold = apairspeed;
          }
        }
        if (j1 == 'q'){ // Found the reading "AP Vertical Speed set"
          delay (11);
          apvs ="";
          apvs += (char)Serial.read();
          apvs += (char)Serial.read();
          apvs += (char)Serial.read();
          apvs += (char)Serial.read();
          apvs += (char)Serial.read();
    
          if (apvs != apvsold){
    
            apvsold = apvs;
          }
        }
    
        if (j1 == 'p'){ // Found the reading "AP ALT"
          delay (11);
          apalt = "";
          apalt += (char)Serial.read();
          apalt += (char)Serial.read();
          apalt += (char)Serial.read();
          apalt += (char)Serial.read(); // if you want the trailering zero's, uncomment these lines
          apalt += (char)Serial.read();
    
          if (apalt != apaltold){
    
            apaltold = apalt;
          }
        }
       
        if (j1 == 's'){ // Found the reading "altitude lock active"
          delay (11);
          altLock = "";
          altLock += (char)Serial.read();
    
          if (altLock != altLockOld){
            if(altLock == "1")
              digitalWrite(8, HIGH);
            else
              digitalWrite(8, LOW);
    
            altLockOld = altLock;
          }
        }
        if (j1 == 't'){ // Found the reading "heading lock active"
          delay (11);
          headingLock = "";
          headingLock += (char)Serial.read();
    
          if (headingLock != headingLockOld){
            if(headingLock == "1")
              digitalWrite(9, HIGH);
            else
              digitalWrite(9, LOW);
    
            headingLockOld = headingLock;
          }
        }
        if (j1 == 'v'){ // Found the reading "Approach Hold Active"
          delay (11);
          apAprAct = "";
          apAprAct += (char)Serial.read();
    
          if (apAprAct != apAprActOld){
            if(apAprAct == "1")
              digitalWrite(12, HIGH);
            else
              digitalWrite(12, LOW);
    
            apAprActOld = apAprAct;
          }
        }
        if (j1 == 'x'){ // Found the reading "Approach Hold Active"
          delay (11);
          apNavAct = "";
          apNavAct += (char)Serial.read();
    
          if (apNavAct != apNavActOld){
            if(apNavAct == "1")
              digitalWrite(15, HIGH);
            else
              digitalWrite(15, LOW);
    
            apNavActOld = apNavAct;
          }
        }
        if (j1 == '>'){ // Found the first character of a dual input
          //delay (11);
          j1 = Serial.read();
          //Serial.println(j1);
          if(j1 == 'A'){ // Found the first charecter of AP MACH SET 65 is for A
            delay (11);
            apmachset = "";
            apmachset += (char)Serial.read();
            apmachset += (char)Serial.read();
            apmachset += (char)Serial.read();
            apmachset += (char)Serial.read();
    
            apmachset.replace(".","");
            if (apmachset != apmachsetold){
    
              apmachsetold = apmachset;
            }
    
          }
          if(j1 == 'B'){ // Found the first charecter of AP MACH ACTIVE
            delay(11);
            machIas = "";
            machIas += (char)Serial.read();
            if(machIas != machIasOld){
              if(machIas == "1"){
                digitalWrite(14, HIGH);
                i = 1;
              }
              else{
                i = 0;
                digitalWrite(14, LOW);
              }
    
              machIasOld = machIas;
            }
    
          }
          if(j1 == 'D'){ // Found the first charecter of AP Speed Active
            delay(11);
            apSpdAct = "";
            apSpdAct += (char)Serial.read();
            if(apSpdAct != apSpdActOld){
              if(apSpdAct == "1"){
                digitalWrite(11, HIGH);
                //Serial.println("AT ARMED");
              }
              else{
                digitalWrite(11, LOW);
                //Serial.println("AT DISARMED");
              }
              apSpdActOld = apSpdAct;
            }
    
          }
    
          if(j1 == 'E'){ // Found the first charecter of AT Armed 69 is for E
            delay(11);
            atArmed = "";
            atArmed += (char)Serial.read();
            if(atArmed != atArmedOld){
              if(atArmed == "1"){
                digitalWrite(10, HIGH);
                //Serial.println("AT ARMED");
              }
              else{
                digitalWrite(10, LOW);
                //Serial.println("AT DISARMED");
              }
              atArmedOld = atArmed;
            }
    
          }
    
        }
    
    
    
    
        //Display LED Section
        if(i == 1){
    
          output = " ";
          output += apcrsold;
          output += "   ";
          output += apairspeedold;
          output += "  ";
          output += aphdgsetold;
    
          output2 = " ";
          output2 += apaltold;
          output2 += " ";
          output2 += apvsold;
    
    
    
          if (output != outputold || output2 != output2old){
            module1.setDisplayToString(output,0b0000100000000000);
            module2.setDisplayToString(output2, 0b0000000000001000);
            outputold = output;
            output2old = output2;
          }
    
        }
        else{
     
          output = " ";
          output += apcrsold;
          output += "   ";
          output += apairspeedold;
          output += "  ";
          output += aphdgsetold;
    
          output2 = " ";
          output2 += apaltold;
          output2 += "   ";
          output2 += apvsold;
    
    
          if (output != outputold || output2 != output2old){
            module1.setDisplayToString(output);
            module2.setDisplayToString(output2, 0b0000000000001000);
            outputold = output;
            output2old = output2;
          }
    
    
        }
    
    
      }
    
    
    }

  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: My mcp based on arduino mega and pokeys55

    TM1640 boards ... thanks for sharing!

  5. #5
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Jul 2013
    Location
    Greece
    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: My mcp based on arduino mega and pokeys55

    Hello all!
    I am the guy at the other post as JMeller says. Any chance for the diagram? I need the wiring to understand what's going on.

    Regards,
    Antony

  6. Likes MAILLY liked this post
  7. #6
    25+ Posting Member
    Join Date
    Jul 2012
    Location
    pt
    Posts
    66
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: My mcp based on arduino mega and pokeys55

    if you look at the code you'll see that it is self explainatory. in the code i'm not using any inputs for switches or encoders, for that i have a fantastic pokeys55 card. so in terms of wiring i do not have an diagram but it is rather easy to do so.
    here goes a pic of my ongoing home cockpit project


    Attachment 8234DSCF5455.jpgDSCF5454.jpg
    Last edited by Deesystems; 10-29-2013 at 04:43 PM. Reason: images added

  8. #7
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Jul 2013
    Location
    Greece
    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: My mcp based on arduino mega and pokeys55

    The attachment isn't visible.
    Regards

  9. #8
    25+ Posting Member
    Join Date
    Jul 2012
    Location
    pt
    Posts
    66
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: My mcp based on arduino mega and pokeys55

    here it is hope you can see it now



    Attachment 8236

  10. #9
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Jul 2013
    Location
    Greece
    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: My mcp based on arduino mega and pokeys55

    Again the same, it says "Invalid Attachment specified. If you followed a valid link, please notify the administrator"

  11. #10
    25+ Posting Member
    Join Date
    Jul 2012
    Location
    pt
    Posts
    66
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: My mcp based on arduino mega and pokeys55

    it's strange it's working here

Page 1 of 2 12 LastLast