Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    75+ Posting Member



    Join Date
    Sep 2013
    Location
    California, USA
    Posts
    109
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Cessna Gyro Compass converted to FSX

    Hi guys, It's remarkable what can be made with L2FSX and an Arduino. Iíve made a little progress with my instruments, the gyro based gauges are now fully operational. Hereís a description of my modifications to an old aircraft gyro compass, which now can display aircraft heading from FSX.

    Parts needed:

    Arduino Mega
    Used mechanical gyro compass
    Hitec continuous rotation servo HSR-1425CR (Servocity)
    ALPS potentiometer RDC803001A (Amazon)
    96 & 18 tooth spur gears (Servocity)
    Wire, epoxy, CA glue.

    This is the compass:
    Compass1.jpg

    Step1.
    Remove the gyroscope, and its support bracket:
    Compass2.jpg
    Compass3.jpg

    Once these parts have been removed it is easier to see how the compass operates. There are two 200+ tooth bevel gears set at right angles. The lower one is on a dual ball bearing axis supporting the gyroscope. As it rotates, it turns the front gear which is connected to the instrument face, allowing the compass to rotate with the gyro. The gears are not the same, the lower gear has 1 extra tooth to compensate for friction losses in the gyroscope, the approximate gear ratio is 210:209. The front gear is sandwiched between two plastic discs so that it makes a friction coupling to the supporting shaft, allowing the compass heading to be manually adjusted in flight.
    Compass4.jpg

    In this side view you can see that one of the plastic discs holding the front gear is itself a gear. When you press the adjustment knob two actions result; 1) the small gear engages the larger gear, and 2) a physical brake is applied to the underside of the gyroscope platform, preventing it from rotating. This allows the adjustment knob to rotate the instrument face, while the two aluminum gears remain stationary. I removed the brake, allowing the gear and spring to remain.

    Step2.
    Attach a 96 tooth gear onto the lower platform and an 18 tooth gear to the servo shaft. The servo is attached to the rear wall of the compass, enabling the servo to drive the compass through a 5.3:1 gear reduction.
    Compass5.jpg
    compass6.jpg

    Step3.
    Mount the potentiometer wiper to the center of the front gear. I used a spring wire to hold the potentiometer body stationary without putting stress on the shaft mounting.
    ALPS-potentiometer.jpg

    Here you can see the servo drive and potentiometer attached to the compass.
    compass9.jpg

    The potentiometer is a standard resistive film potentiometer, but with two ganged wipers, yielding a continuous reading over 360 degrees. Here is a plot of output voltages for both wipers vs. compass rotation.
    Potentiometer-output.jpg

    Interesting programming needs were to come up with a method to switch reading between the two potentiometer wipers over the course of a full revolution, and to scale the potentiometer voltages so that it could be directly compared with FSX's 3 digit compass heading.

    Here is my sketch to operate it. There is probably a better way to write this, but it works.
    Code:
      //  GYRO COMPASS 
    //  Aircraft gyro compass modified to display compass information from FSX.
    //  Arduino MEGA
    //  Uses a continuous rotation servo to drive the gyro compass indicator.  
    //  Position feedback is provided by an ALPS RDC803001A potentiometer with twin wipers.
    //  Terminal 1 of the ALPS is connected to +5v
    //  Terminal 3 of the ALPS is connected to ground
    //  Terminal 2 of the ALPS is connected to A0
    //  Terminal 4 of the ALPS is connected to A1
    //  Servo is connected to pin 9
    //  Measured compass position is averaged for 8 readings to reduce noise
    ////////////////////////////////////////////////////////////////////////
    
    #include 
    #include 
    Servo compassServo;      // the compass servo is a continuous rotation servo 
    
    int long compassPot1;         // potentiometer wiper #2 on pin A0 
    int long Pot1a;         // data sample 1a 
    int long Pot1b;         // data sample 1b
    int long Pot1c;         // data sample 1c 
    int long Pot1d;         // data sample 1d 
    int long Pot1e;         // data sample 1e
    int long Pot1f;         // data sample 1f 
    int long Pot1g;         // data sample 1g 
    int long Pot1h;         // data sample 1h
    int long compassPot2;         // potentiometer wiper #4 on pin A1 
    int long Pot2a;         // data sample 2a
    int long Pot2b;         // data sample 2b 
    int long Pot2c;         // data sample 2c 
    int long Pot2d;         // data sample 2d 
    int long Pot2e;         // data sample 2e 
    int long Pot2f;         // data sample 2f
    int long Pot2g;         // data sample 2g 
    int long Pot2h;         // data sample 2h 
    
    boolean pot1_inRange;   // potentiometer wiper #1 is in reading range
    boolean pot2_inRange;   // potentiometer wiper #2 is in reading range
    int long compassPot;    // variable to store compass position feedback
    int compassPotScaled;   // Position feedback, scaled 0-360 degrees
    int long compassSpeed;  // servo PWM speed setting
    String heading;         // compass position from FSX (string)
    int compassHdg;         // compass position from FSX (integer)
    int CodeIn;
    ////////////////////////////////////////////////////////////////////
    
    void setup() 
    { 
      Serial.begin(115200);
      compassServo.attach(9);  // attach the compass servo to pin 9 
      compassHdg = 300;        // startup compass position
    }//end of void.setup
    ////////////////////////////////////////////////////////////////////
    
    void loop() 
    { 
    //**** Read position sensor, take average over 8 readings ****
      Pot1a = Pot1b;
      Pot1b = Pot1c;
      Pot1c = Pot1d;
      Pot1d = Pot1e;
      Pot1e = Pot1f;
      Pot1f = Pot1g;
      Pot1g = Pot1h;
      Pot1h = analogRead(A0) + 519;
      compassPot1 = (Pot1a + Pot1b + Pot1c + Pot1d + Pot1e + Pot1f + Pot1g + Pot1h) / 8;
      Pot2a = Pot2b;
      Pot2b = Pot2c;
      Pot2c = Pot2d;
      Pot2d = Pot2e;
      Pot2e = Pot2f;
      Pot2f = Pot2g;
      Pot2g = Pot2h;
      Pot2h = analogRead(A1);  
      compassPot2 = (Pot2a + Pot2b + Pot2c + Pot2d + Pot2e + Pot2f + Pot2g + Pot2h) / 8;
    
    //**** Determine which potentiometer wiper to use ****
      if((compassPot1 >= 1000)&&(compassPot1 <= 1450))  pot1_inRange = 1;
      else pot1_inRange = 0;                 
      if(compassPot2>=490 && compassPot2<= 615) pot2_inRange=0;                          // use Pot1
      else pot2_inRange=1;  
      if((pot1_inRange==1 && pot2_inRange==1)||(compassPot1>=1038 && compassPot1<=1054)) compassPot = compassPot1;
      else compassPot = compassPot2;
      
    //**** Scale potentiometer reading to compass 0-360degrees ****
      compassPotScaled=(compassPot/2.93)-18;
      if (compassPotScaled>=360) compassPotScaled=compassPotScaled-360;
    
    //**** Check for data from L2FSX ****
      if (Serial.available() > 0) {  //if there is a charactor in the serial receive buffer then ,,,,
        CodeIn = getChar();// read it via the "char getChar" routine
        if (CodeIn == '<') {
          LESSTHAN();
        }// The first identifier is "<" goto LESSTHAN void
      }//end of serial.available
    
    //**** Compare measured compass position with FSX and set servo direction and speed ****
       if (compassPotScaled>=compassHdg-1 && compassPotScaled<=compassHdg+1) compassSpeed=1550;  //center null
       if (compassPotScaled>=compassHdg-5 && compassPotScaled<=compassHdg-2) compassSpeed=1606;  //down slow
       if (compassPotScaled>=compassHdg-20 && compassPotScaled<=compassHdg-6) compassSpeed=1608; //down medium
       if (compassPotScaled<=compassHdg-21) compassSpeed=1615;                                   //down fast
       if (compassPotScaled>=compassHdg+2 && compassPotScaled<=compassHdg+5) compassSpeed=1482;  //up slow
       if (compassPotScaled>=compassHdg+6 && compassPotScaled<=compassHdg+20) compassSpeed=1480; //up medium
       if (compassPotScaled>=compassHdg+21) compassSpeed=1475;                                   //up fast
       compassServo.writeMicroseconds(compassSpeed);                                             // servo control signal 
    }//end of void.loop
    /////////////////////////////////////////////////////////////////////////////////////
    
    char getChar()// The serial buffer routine to get a character
    {
      while(Serial.available() == 0);// wait for data
      return((char)Serial.read());// Thanks Doug
    }// end of getchar Routine. 
    ////////////////////////////////////////////////////////////////////////////////////
    
    void LESSTHAN() {//the first identifier was a '<'
      CodeIn = getChar();//get another charactor from serial port
      if (CodeIn == 'J'){//found the identifier "J"
        delay (11);    // It seems to need a delay here
        heading = ""; // Empty gearnose string
        heading += char(Serial.read());    //Read the first data charactor sent
        heading += char(Serial.read());   //Read the second data charactor sent and add it to the first
        heading += char(Serial.read());   //Read the third data charactor sent and add it to the other two.)   
        compassHdg = heading.toInt();
      } //end of "found the identifier "J"
    }  // end of LESSTHAN loop 
    /////////////////////////////////////////////////////////////////////////////////////


    As always, I express my gratitude to Jim. This project would not have been started without the FSX communication you have given us.
    Attached Images Attached Images

  2. Thanks iwik, Jim NZ thanked for this post
    Likes nax228, BuzziBi liked this post
  3. #2
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    275
    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 Gyro Compass converted to FSX

    This one deserves (in my opinion) a placement within the Notable threads Jim
    I need it later in the year when I'm embarking on the simulator again. Currently useing all my energy on finishing and repair of two boats!
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  4. #3
    150+ Forum Groupie BuzziBi's Avatar
    Join Date
    Mar 2013
    Location
    Norway
    Posts
    275
    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 Gyro Compass converted to FSX

    This one deserves (in my opinion) a placement within the Notable threads Jim
    I need it later in the year when I'm embarking on the simulator again. Currently useing all my energy on finishing and repair of two boats!

    Oh, dear! I forgot to thank you for uploading this great project Steve! Sorry
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  5. #4
    75+ Posting Member



    Join Date
    Sep 2013
    Location
    California, USA
    Posts
    109
    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 Gyro Compass converted to FSX

    Thanks for the encouragement, Buzzi. Iím having more fun with L2FSX and the Arduinos than Iíve had in a long time. If you want, I can post some more of these mini-projects, I have a whole set of GA instruments from a couple of trashed aircraft which I intend to convert. So far I have finished the gyroscope compass and horizon, and am now moving on to the altimeter. This oneís going to be challenging because the bellows travel is extremely small, 50ft of elevation change is just .002mm at the coupling.


    Oh, after some further testing I found a flaw in my sketch for the compass. I needed to add this additional statement at line 98 to prevent generating a negative displacement when crossing due north:
    if (((compassPotScaled-compassHdg)>=180)||((compassHdg-compassPotScaled)>=180)) compassHdg=(compassHdg+360);

  6. #5
    500+ This must be a daytime job



    Join Date
    Jan 2007
    Location
    NEW ZEALAND
    Posts
    867
    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 Gyro Compass converted to FSX

    Thanks Steve,
    Very generous to share your build. Really helps a lot of us when it comes to building instruments like this.
    Please keep up the Great work and continue to share as I for one really like all the neat ways people have for
    making this hobby as real as it can get.
    Do You have Servocity Part numbers for the Gears?.
    Cheers
    les
    P.S Here is what someone else did to a Cessna Altimeter.
    http://www.cockpitbuilders.com/commu...73.0;topicseen

  7. #6
    500+ This must be a daytime job



    Join Date
    Jan 2007
    Location
    NEW ZEALAND
    Posts
    867
    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 Gyro Compass converted to FSX

    Hi Steve,
    Tried to compile the above code but get errors regarding #include and servo compass. I see two include statements and only one has definition. Not up with Arduino but just dipping my toes cause the Compass construction interested me.
    Have a compass here that's just begging to be modified. If I can use your code it could be just the push I need to go
    down this track.
    Thanks
    Les

  8. #7
    75+ Posting Member



    Join Date
    Sep 2013
    Location
    California, USA
    Posts
    109
    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 Gyro Compass converted to FSX

    Hi Les,
    I didn't catch that the forum editor dropped of the last portion of the include statements. Also I made a sketch update to fix a bug which occurred with large direction discrepancies. Let us know when you get it working. Enjoy.

    The gears I used were RSA48-2HS-18 (Hitec servo) and SPBD48-24-96 (compass)

    Code:
    // 
    /
    // GYRO COMPASS // Aircraft gyro compass modified to display compass information from FSX. // Arduino MEGA // Uses a continuous rotation servo to drive the gyro compass indicator. // Position feedback is provided by an ALPS RDC803001A potentiometer with twin wipers. // Terminal 1 of the ALPS is connected to +5v // Terminal 3 of the ALPS is connected to ground // Terminal 2 of the ALPS is connected to A0 // Terminal 4 of the ALPS is connected to A1 // Servo is connected to pin 9 // Measured compass position is averaged for 8 readings to reduce noise //////////////////////////////////////////////////////////////////////// #include <Wire.h> #include <Servo.h> Servo compassServo; // the compass servo is a continuous rotation servo int long compassPot1; // potentiometer wiper #2 on pin A0 int long Pot1a; // data sample 1a int long Pot1b; // data sample 1b int long Pot1c; // data sample 1c int long Pot1d; // data sample 1d int long Pot1e; // data sample 1e int long Pot1f; // data sample 1f int long Pot1g; // data sample 1g int long Pot1h; // data sample 1h int long compassPot2; // potentiometer wiper #4 on pin A1 int long Pot2a; // data sample 2a int long Pot2b; // data sample 2b int long Pot2c; // data sample 2c int long Pot2d; // data sample 2d int long Pot2e; // data sample 2e int long Pot2f; // data sample 2f int long Pot2g; // data sample 2g int long Pot2h; // data sample 2h boolean pot1_inRange; // potentiometer wiper #1 is in reading range boolean pot2_inRange; // potentiometer wiper #2 is in reading range int long compassPot; // variable to store compass position feedback int compassPotScaled; // Position feedback, scaled 0-360 degrees int long compassSpeed; // servo PWM speed setting String heading; // compass position from FSX (string) int compassHdg; // compass position from FSX (integer) int CodeIn; //////////////////////////////////////////////////////////////////// void setup() { Serial.begin(115200); compassServo.attach(9); // attach the compass servo to pin 9 compassHdg = 300; // startup compass position }//end of void.setup //////////////////////////////////////////////////////////////////// void loop() { //**** Read position sensor, take average over 8 readings **** Pot1a = Pot1b; Pot1b = Pot1c; Pot1c = Pot1d; Pot1d = Pot1e; Pot1e = Pot1f; Pot1f = Pot1g; Pot1g = Pot1h; Pot1h = analogRead(A0) + 519; compassPot1 = (Pot1a + Pot1b + Pot1c + Pot1d + Pot1e + Pot1f + Pot1g + Pot1h) / 8; Pot2a = Pot2b; Pot2b = Pot2c; Pot2c = Pot2d; Pot2d = Pot2e; Pot2e = Pot2f; Pot2f = Pot2g; Pot2g = Pot2h; Pot2h = analogRead(A1); compassPot2 = (Pot2a + Pot2b + Pot2c + Pot2d + Pot2e + Pot2f + Pot2g + Pot2h) / 8; //**** Determine which potentiometer wiper to use **** if((compassPot1 >= 1000)&&(compassPot1 <= 1450)) pot1_inRange = 1; else pot1_inRange = 0; if(compassPot2>=490 && compassPot2<= 615) pot2_inRange=0; // use Pot1 else pot2_inRange=1; if((pot1_inRange==1 && pot2_inRange==1)||(compassPot1>=1038 && compassPot1<=1054)) compassPot = compassPot1; else compassPot = compassPot2; //**** Scale potentiometer reading to compass 0-360degrees **** compassPotScaled=(compassPot/2.93)-18; if (compassPotScaled>=360) compassPotScaled=compassPotScaled-360; //**** Check for data from L2FSX **** if (Serial.available() > 0) { //if there is a charactor in the serial receive buffer then ,,,, CodeIn = getChar();// read it via the "char getChar" routine if (CodeIn == '<') { LESSTHAN(); }// The first identifier is "<" goto LESSTHAN void }//end of serial.available //**** Compare measured compass position with FSX and set servo direction and speed **** if (((compassPotScaled-compassHdg)>=180)||((compassHdg-compassPotScaled)>=180)) compassHdg=(compassHdg+360); //don't allow requested change // to exceed 180 degrees if (compassPotScaled>=compassHdg-1 && compassPotScaled<=compassHdg+1) compassSpeed=1550; //center null if (compassPotScaled>=compassHdg-5 && compassPotScaled<=compassHdg-2) compassSpeed=1606; //down slow if (compassPotScaled>=compassHdg-20 && compassPotScaled<=compassHdg-6) compassSpeed=1608; //down medium if (compassPotScaled<=compassHdg-21) compassSpeed=1615; //down fast if (compassPotScaled>=compassHdg+2 && compassPotScaled<=compassHdg+5) compassSpeed=1482; //up slow if (compassPotScaled>=compassHdg+6 && compassPotScaled<=compassHdg+20) compassSpeed=1480; //up medium if (compassPotScaled>=compassHdg+21) compassSpeed=1475; //up fast compassServo.writeMicroseconds(compassSpeed); // servo control signal }//end of void.loop ///////////////////////////////////////////////////////////////////////////////////// char getChar()// The serial buffer routine to get a character { while(Serial.available() == 0);// wait for data return((char)Serial.read());// Thanks Doug }// end of getchar Routine. //////////////////////////////////////////////////////////////////////////////////// void LESSTHAN() {//the first identifier was a '<' CodeIn = getChar();//get another charactor from serial port if (CodeIn == 'J'){//found the identifier "J" delay (11); // It seems to need a delay here heading = ""; // Empty gearnose string heading += char(Serial.read()); //Read the first data charactor sent heading += char(Serial.read()); //Read the second data charactor sent and add it to the first heading += char(Serial.read()); //Read the third data charactor sent and add it to the other two.) compassHdg = heading.toInt(); } //end of "found the identifier "J" } // end of LESSTHAN loop /////////////////////////////////////////////////////////////////////////////////////
    Last edited by SteveL; 06-20-2014 at 06:19 PM. Reason: added gear information

  9. #8
    500+ This must be a daytime job



    Join Date
    Jan 2007
    Location
    NEW ZEALAND
    Posts
    867
    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 Gyro Compass converted to FSX

    Steve,
    Much appreciated, as I normally struggle with code. I really do like the way you have gone about modifying real gauges.
    I have a bunch of them here also. Most are dc operated.
    Thanks again.
    Kindest Regards
    Les

  10. #9
    75+ Posting Member



    Join Date
    Sep 2013
    Location
    California, USA
    Posts
    109
    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 Gyro Compass converted to FSX

    Hi Les,
    I had a look at that altimeter you referenced, heís driving the gauge with a dc motor and potentiometer feedback. I think itís a servo altimeter rather than a Kollsman unit. I made my altimeter conversion a bit simpler; I retained the original gearing and used a 90ļ high resolution servo in place of the Kollsman bellows. Works well, resolution is about 30í elevation due to servo limitations.

    Iíve completed my flight instruments (left panel) except for painting and am working on the right side panel now. My engine instruments are done but the GPS installation still has a ways to go before Iím ready to assemble the right side panel. Also havenít made the lower left panel with the gear switch and trim wheels yet. Hereís what Iíve got so far, let me know if you want any specifics. Iím planning to prepare a complete construction write-up once I get it finished, but thatís still a bit off in the future.
    Left-panel-during-assembly.jpg

  11. Likes bizjet999 liked this post
  12. #10
    500+ This must be a daytime job



    Join Date
    Jan 2007
    Location
    NEW ZEALAND
    Posts
    867
    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 Gyro Compass converted to FSX

    Steve,
    It looks great, I like it another GA builder. Have you interfaced your VOR's yet?. Love to know how you did it.
    Are you making it Plane specific?.
    Les

Page 1 of 2 12 LastLast