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



    Join Date
    Nov 2010
    Location
    The Netherlands
    Posts
    26
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Autothrottle servos using Microseconds??

    Hi everyone,

    Besides my LCD project using link2fs and Arduino, I also would like to try to motorise my Throttle quadrant.

    So far i have found some code by Davide Forcelline.
    I have modified his example to include a second servo.
    I run into the very old problem of inaccurate servos.
    They move at 1 degree at a time, thus seeming a bit jerky.

    While searsching the web, i came across "writeMicroseconds" . Using a crude/simple sketch, i was able to move a servo very accurately/smoothly.

    Can anyone give me any pointers on how to modify the following sketch to output the microsecconds value in stead of degrees?

    Also, since i focus on the MD-11, i would like to add eng 3!
    In the expert link2fs, i found i could add; GENERAL ENG THROTTLE LEVER POSITION:1 etc.
    (found it in the sim connect library) but it gives an error message after pressing the reset button.
    The raw data is present. Without :1 (the index) there is no error message, but also no raw data.

    I had my hopes in this simconnect extraction, because is has slightly more accurate/precise data compared to the throttle 1 position (in pct)

    Any tips are welcome.
    Kind regards
    Ferry

    p.s. the code

    // By DAVIDE FORCELLINE
    // FSX WORKING - D. Forcellini 2014//
    // Enjoy //


    #include
    Servo autotServo;
    Servo autotServo2;
    int Data;
    String AT;
    int pos = 0; // variable to store the servo position






    void setup() {
    autotServo.attach(9); //attaching servo to pin 9
    autotServo2.attach(10);
    Serial.begin(115200);
    Serial.flush();
    Serial.println("V"); // so I can keep track of what is loaded
    Serial.println("W");
    }

    void loop() {
    if (Serial.available() > 0) {
    Data = Serial.read();
    if (Data == 'V'){
    delay (1);
    AT = "";
    AT += char(Serial.read());
    AT += char(Serial.read());
    AT += char(Serial.read());
    AT += char(Serial.read());
    int ATInt = AT.toInt(); // convert it to an integer
    ATInt = (ATInt + 0);// Manual correction to suit servo zero.
    ATInt = map(ATInt, +0, +100, 55, 155);//map the integer
    // for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
    autotServo.write(ATInt);
    }//end of found "V"

    if (Data == 'W'){
    delay (1);
    AT = "";
    AT += char(Serial.read());
    AT += char(Serial.read());
    AT += char(Serial.read());
    AT += char(Serial.read());
    int ATInt = AT.toInt(); // convert it to an integer
    ATInt = (ATInt + 0);// Manual correction to suit servo zero.
    ATInt = map(ATInt, +0, +100, 55, 155);//map the integer
    for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
    autotServo2.write(ATInt);
    }//end of found "W"


    }//end of serial read
    }//

  2. #2
    25+ Posting Member



    Join Date
    Nov 2010
    Location
    The Netherlands
    Posts
    26
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Autothrottle servos using Microseconds??

    Hi to all,
    Done some exprerimenting, but have not been able to modify the code yet.
    I'm a noob, and just happy to have a working servo from FS.
    Trying to "convert" the data from link2fs into a writeMicroseconds value to the servo is a chalenge.

    cheers

  3. #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: Autothrottle servos using Microseconds??

    Take a look at this page. It is for the SwitecX25 (instrument cluster stepper motor). It uses Millis to set stepper motor speed. You will find examples, .cpp and .h there also.
    https://github.com/clearwater/SwitecX25
    Life was hard, but then came Windows 7.
    Now we can fly! --------
    --------

  4. #4
    150+ Forum Groupie
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    227
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Autothrottle servos using Microseconds??

    Hi all,

    Anybody who has a idea where to buy these steppers in Europe?

    Regards

    Jan

  5. #5
    25+ Posting Member



    Join Date
    Nov 2010
    Location
    The Netherlands
    Posts
    26
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Autothrottle servos using Microseconds??

    Hi BuzziBi,

    Thanks for the info.
    too bad i saw is after my own "reverse engineering"
    Stepper motors might be a future thing.

    I did some succesfull experiments using microseconds in the mean time.

    Also succesfully used the expert settings in link2fs. It turned out i needed to change the decimal sign in the region serttings in Windows.
    I was able to get more accurate throttle data from FSX in the expert mode.
    It presented me with a 4 digit figure, in stead of 3. Than meant i was able to benefit from the greater accracy using microseconds.
    On top of that, i added a 3rd throttle servo!!!
    In the sim variables list, i found the GENERAL ENG THROTTLE LEVER POSITION:1 etc.
    So 4 throttles can also be set using the servos.

    Uploading a youtube video now with a demo.

    Here's the code.
    Also interesting for folks that want to have more accurate servo movement for dials etc.
    Mind you, its crude, its my second sketch...

    Cheers.

    Code:
    // By DAVIDE FORCELLINE, modified by Ferry
    // FSX WORKING - D. Forcellini 2014//
    // Enjoy :)//
    
    
    #include 
    Servo ATServo1;
    Servo ATServo2;
    Servo ATServo3;
    int Data;
    String AT1;
    String AT2;
    String AT3;
    int pos = 0;    // variable to store the servo position
    
    
    
    
    
    
    void setup() {
    ATServo1.attach(9); //attaching servo to pin 9 
    ATServo2.attach(10);
    ATServo3.attach(11);
    Serial.begin(115200); 
    Serial.flush(); 
    Serial.println("A"); // so I can keep track of what is loaded
    Serial.println("B");
    Serial.println("C");
    }
    
    
    char getChar()// Get a character from the serial buffer(Dont touch)
     {
     while(Serial.available() == 0);// wait for data (Dont touch)
     return((char)Serial.read());// (Dont touch) Thanks Doug
     }
    
    
    void loop() {
      if (Serial.available() > 0) {
        Data = Serial.read();
        if (Data == 'A'){    
         delay (1); 
          AT1 = "";
          AT1 += char(Serial.read());
          AT1 += char(Serial.read());
          AT1 += char(Serial.read());
          AT1 += char(Serial.read());
         int AT1Int = AT1.toInt()*1; // convert it to an integer 
          AT1Int = (AT1Int + 1000);// Manual correction to suit servo zero.
          AT1Int = map(AT1Int, +1000, +2000, 1000, 2000);//map the integer
      //   for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
         ATServo1.writeMicroseconds(AT1Int); 
        }//end of found "A"
        
      if (Data == 'B'){    
         delay (1); 
         AT2 = "";
         AT2 += char(Serial.read());
         AT2 += char(Serial.read());
         AT2 += char(Serial.read());
         AT2 += char(Serial.read());
       int AT2Int = AT2.toInt()*1; // convert it to an integer 
         AT2Int = (AT2Int + 1000);// Manual correction to suit servo zero.
         AT2Int = map(AT2Int, +1000, +2000, 1000, 2000);//map the integer
      //   for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
         ATServo2.writeMicroseconds(AT2Int); 
       }//end of found "B"
       
    if (Data == 'C'){    
         delay (1); 
         AT3 = "";
         AT3 += char(Serial.read());
         AT3 += char(Serial.read());
         AT3 += char(Serial.read());
         AT3 += char(Serial.read());
       int AT3Int = AT3.toInt()*1; // convert it to an integer 
         AT3Int = (AT3Int + 1000);// Manual correction to suit servo zero.
         AT3Int = map(AT3Int, +1000, +2000, 1000, 2000);//map the integer
      //   for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
         ATServo3.writeMicroseconds(AT3Int); 
       }//end of found "C"   
       
      }//end of serial read
     }//

  6. #6
    25+ Posting Member
    Join Date
    May 2014
    Location
    Bulgaria and United Kingdom
    Posts
    56
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Autothrottle servos using Microseconds??

    Navajo, take a look at a library called Var Speed Servo, it works a lot smoother compared to standard arduino servo library:
    https://github.com/netlabtoolkit/VarSpeedServo

    Also - make sure your Link2FS Cycle time is set to minimum - 25ms or so and FlightSim frame rate is not locked at 30fps.

    PS - how you deal with servo reduction gears - isn't it difficult to move handle against servo's gear box?

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

    Re: Autothrottle servos using Microseconds??

    Some time ago I had a play with code for a motorized throttle using servos ,, not only that but hacking the servo so the input (when you move the throttle by hand) it actually worked as input ,, so basically no other mechanical system was needed.

    Of course it all depends on what one calls "jumpy" when it comes to descriptions but with the test bed setup (a quick junk thing) I was actually quite surprised with how well it went.

    Have a look here ,,,
    http://youtu.be/aKghrz6407w
    which is just a movie ,, it's of the junk 'test' setup that I made but it gives you an idea of the movement that I got.

    The experiment got stashed (the INO's) with the idea that one day I would go back and continue the experiment ,,, I can't find it at the moment but I will dig deeper if you think it could be of help to you ,, it may not be smooth enough ??

    Cheers ,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  8. Thanks trakon thanked for this post
  9. #8
    10+ Posting Member
    Join Date
    Dec 2011
    Location
    florida
    Posts
    24
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Autothrottle servos using Microseconds??

    Quote Originally Posted by Jim NZ View Post
    Some time ago I had a play with code for a motorized throttle using servos ,, not only that but hacking the servo so the input (when you move the throttle by hand) it actually worked as input ,, so basically no other mechanical system was needed.

    Of course it all depends on what one calls "jumpy" when it comes to descriptions but with the test bed setup (a quick junk thing) I was actually quite surprised with how well it went.

    Have a look here ,,,
    http://youtu.be/aKghrz6407w
    which is just a movie ,, it's of the junk 'test' setup that I made but it gives you an idea of the movement that I got.

    The experiment got stashed (the INO's) with the idea that one day I would go back and continue the experiment ,,, I can't find it at the moment but I will dig deeper if you think it could be of help to you ,, it may not be smooth enough ??

    Cheers ,, Jim
    This would be really helpful if i could use the servos as an output as well instead of adding extra hardware. Is this possible? Are stepper motors ok or would you use a different motor to get an output as well?

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

    Re: Autothrottle servos using Microseconds??

    I just threw that in because the Guys were tossing around about servo's and steppers.

    What I experimented with was just a play and certainly not an option for the likes of yourself in powering a real throttle quadrant.

    It was a possible option for some-one making their own hobby throttle and that's about all.
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  11. #10
    10+ Posting Member
    Join Date
    Dec 2011
    Location
    florida
    Posts
    24
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Autothrottle servos using Microseconds??

    Quote Originally Posted by Jim NZ View Post
    I just threw that in because the Guys were tossing around about servo's and steppers.

    What I experimented with was just a play and certainly not an option for the likes of yourself in powering a real throttle quadrant.

    It was a possible option for some-one making their own hobby throttle and that's about all.
    what would you recommend to use to power the throttles then? A dc motor?

Page 1 of 2 12 LastLast