1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

2DOF Arduino miniature motion platform w 2-servos

Discussion in 'DIY Motion Simulator Projects' started by jamesdio, Oct 13, 2011.

  1. gorch

    gorch New Member

    Joined:
    Dec 2, 2011
    Messages:
    2
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi all, just stumble into x-Sim site by accident very cool stuff.
    I'm newbie with minimal electronic experience,since I have seen DERIY-(SATO)'s wiper motor sim, I want to build one.

    2dof-wiper-motor-car-simulator-by-deriy-sato-t2405.html#p23635

    I am learning Arduino at the moment and have seen jamesdio's 2DOF Arduino miniature motion platform w 2-servos video but with little info, can I ask jamesdio the list of parts and if arduino was used instead of AVR Motion Controller (AMC) by Tronicgr as a controller and then using Tronic's DIY dual Mosfet H-bridge (DSMhb) to connect to the wipermotors.
    sorry for the dumb question if asked previously.
  2. bsft

    bsft

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    well gorch not questions are dumb mate, ask away.
    Ard code is not ready yet theres a couple of us trying to put one together, i have the ard working my diy guages but havent properly moved on to the motor driver, look at the monster motor driver from sparkfun will supply a steady 20amps odd at 12v for two motors, and if ya know ard then should be easy to put together, i do have a basic code for above but wont release until i have tested it personlly by theory and dummy run, it works just awaiting shield, ordered should arrive by the end of the week.
    Bsft suggestions a good one jrks are very easy to setup and get running plus dont underestimate their power because of their size.

    Welcome time to start ya own post mate. :thbup:
  4. gorch

    gorch New Member

    Joined:
    Dec 2, 2011
    Messages:
    2
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Thanks all of you guys,
    can't wait till you release the arduino sketch when you are ready, but curious how you connect the arduino to the PC so it recognised the effects/force feedback.

    http://www.pololu.com/catalog/product/1393
    Pololu Jrk Motor Controllers with Feedback is a bit expensive and its more fun making your own via Dual Mosfet H-Bridge by TronicGr
    http://www.x-simulator.de/wiki/Dual_Mos ... y_Tronicgr

    Also jamesdio's arduino setup is very interesting:
    2dof-arduino-miniature-motion-platform-w-2-servos-t3469.html?hilit=jamesdio
  5. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    good luck on h bridge more likely a hair ripper outer.
    Done what james did a while ago easy but getting it to the next step is a big one.
    Just like the jrk hooks up via usb and talk to it via uso, easy.
  6. gzezelj

    gzezelj Member

    Joined:
    Oct 21, 2010
    Messages:
    30
    Location:
    Sombor, Serbia
    Balance:
    - 84Coins
    Ratings:
    +0 / 0 / -0
    Pozdrav! :hi: Drago mi je da nas ima jos iz Srbije :)
  7. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    this how i debugged my dashboard, only thought the ard uses values of 1-127 ????
  8. timothy

    timothy New Member

    Joined:
    Jun 8, 2011
    Messages:
    5
    Balance:
    - 8Coins
    Ratings:
    +0 / 0 / -0
    hello somebody could put a diagram of the servos to the arduino?? and how to configure the x-sim3 with arduino? thank you
  9. nicko_esx

    nicko_esx Member

    Joined:
    May 28, 2012
    Messages:
    37
    Location:
    argentina
    Balance:
    696Coins
    Ratings:
    +16 / 0 / -0
    My Motion Simulator:
    Arduino
    Hello people.
    I tried to do jamesdio published. code upload it successfully in arduino UNO.
    use the profiles published by jamesdio.
    my arduino board receiving. So check it to see the LED light data.
    but do not move the servo.
    only made ​​some erratic movement to change the configuration parameters in the USO
    could be the error in the configuration of my x-sim?
    please help to set the x-sim
  10. alexandre lopes

    alexandre lopes New Member

    Joined:
    Jul 9, 2013
    Messages:
    1
    Location:
    São José do Rio Preto (São Paulo - Brasil)
    Balance:
    264Coins
    Ratings:
    +0 / 0 / -0
    Hello guys,

    I would like to thank, the herctrap, juiou and jamesdio, for sharing the code for Arduino. :cheers:

    It was of great help, to me three days ago was trying in every way to the arduino work in X-sim. Today finally got it.

    This is my first step into the world of motion simulators, did it to be able to understand and study the software settings.

    The next step is to buy the H bridge, engines, and to upgrade from my cockpit.

    Alexandre

    Brasil

    http://www.youtube.com/watch?v=t0tqYhSx7e8&feature=share&list=UU80j5w--fqiMCZNw2HBTS7Q
    [​IMG]
    [​IMG]
  11. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Sweet nice effort. :thbup:
    I have my bigger model working in new software we are beta testing here.

    http://www.youtube.com/watch?v=X5d9hAXoO4o

    I can provide all info for it and setup. :thbup:
  12. aarondc

    aarondc Member

    Joined:
    Jun 12, 2013
    Messages:
    133
    Location:
    Melbourne, Australia
    Balance:
    191Coins
    Ratings:
    +7 / 0 / -0
    Such a great prototyping platform, Rob!!
  13. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
  14. DERIY

    DERIY Member

    Joined:
    Apr 24, 2010
    Messages:
    64
    Location:
    RUSSIA
    Balance:
    - 52Coins
    Ratings:
    +7 / 1 / -0
    Hello!
    Recently I bought adruino uno and 6 servos.
    I tried to modify the sketch for 2 servos.
    First I modified the sketch for 4 servos and the controller works fine.
    But trying to make a sketch for 6 servos was unsuccessful. ((
    Who can explain what is the problem?

    4DOF Motion Platform with 4 Servos sketch
    Code:
    /*
    * 4DOF Motion Platform with 4 Servos
    * -------------------------------------
    * Thanks to herctrap and his source
    * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1280139142
    *
    * and also thanks to juiou and his source
    * http://www.x-simulator.de/forum/arduino-and-x-sim-t2773-30.html
    *
    * I just combined their sources.
    *
    */
    #include <Servo.h>
    Servo myservo1;
    Servo myservo2;
    Servo myservo3;
    Servo myservo4;
    
    int Degree;
    int Gforce = 0;
    int Gforce1 = 0;
    int Gforce10 = 0;
    int Gforce100 = 0;
    
    char kind_of_data;
    
    void setup() {
    
      //set servo pins
      myservo1.attach(2);
      myservo2.attach(3);
      myservo3.attach(4);
      myservo4.attach(5);
    
      //align servos center postision
      myservo1.write(90);
      myservo2.write(90);
      myservo3.write(90);
      myservo4.write(90);
    
      //open serial connection
      Serial.begin(115200);
    }
    
    void loop() {
    
      // wait for serial input (min 3 bytes in buffer)
      while(Serial.available() > 0) {
    
        kind_of_data = Serial.read(); //string from USO --> L~a01~ R~a02~ F~a03~ B~a04~ 8bit resolution\decimal output
        if(kind_of_data == 'L') {
          Read_Pos(kind_of_data);
        }
        if(kind_of_data == 'R') {
          Read_Pos(kind_of_data);
        }
        if(kind_of_data == 'F') {
          Read_Pos(kind_of_data);
        }
        if(kind_of_data == 'B') {
          Read_Pos(kind_of_data);
        }
      }
    }
    
    void Read_Pos(char which_servo){
      delay(2);
      int Gforce100 = Serial.read()- '0';
      delay(2);
      int Gforce10 = Serial.read()- '0';
      delay(2);
      int Gforce1 = Serial.read()- '0';
    
      //Verifica se e centena dezena ou decimal... =]
      if (Gforce1 < 0) { Gforce = Gforce10 + 10*Gforce100; }
      if (Gforce1 < 0 && Gforce10 < 0) { Gforce = Gforce100; }
      if (Gforce100 < 0) { Gforce = 127; }
      if (Gforce1 >=0 && Gforce10 >= 0 && Gforce100 >= 0) { Gforce = 100 * Gforce100 + 10 * Gforce10 + Gforce1; }
    
      if (which_servo == 'L') {
        Degree = map(Gforce, 0, 255, 180, 0);
      }
        if (which_servo == 'F') {
        Degree = map(Gforce, 0, 255, 180, 0);
      }
      if (which_servo == 'R') {
        Degree = map(Gforce, 0, 255, 0, 180);
      }
        if (which_servo == 'B') {
        Degree = map(Gforce, 0, 255, 0, 180);
      }
    
    
      if (which_servo == 'L') {
        myservo1.write(Degree);
      }
      if (which_servo == 'R' ){
        myservo2.write(Degree);
      }
      if (which_servo == 'F' ){
        myservo3.write(Degree);
      }
      if (which_servo == 'B' ){
        myservo4.write(Degree);
      }
    }
    






    6DOF Motion Platform with 6 Servos sketch
    Code:
    /*
    * 6DOF Motion Platform with 6 Servos
    * -------------------------------------
    * Thanks to herctrap and his source
    * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1280139142
    *
    * and also thanks to juiou and his source
    * http://www.x-simulator.de/forum/arduino-and-x-sim-t2773-30.html
    *
    * I just combined their sources.
    *
    */
    #include <Servo.h>
    Servo myservo1;
    Servo myservo2;
    Servo myservo3;
    Servo myservo4;
    Servo myservo5;
    Servo myservo6;
    
    int Degree;
    int Gforce = 0;
    int Gforce1 = 0;
    int Gforce10 = 0;
    int Gforce100 = 0;
    
    char kind_of_data;
    
    void setup() {
    
      //set servo pins
      myservo1.attach(2);
      myservo2.attach(3);
      myservo3.attach(4);
      myservo4.attach(5);
      myservo5.attach(6);
      myservo6.attach(7);
    
      //align servos center postision
      myservo1.write(90);
      myservo2.write(90);
      myservo3.write(90);
      myservo4.write(90);
      myservo5.write(90);
      myservo6.write(90);
    
      //open serial connection
      Serial.begin(115200);
    }
    
    void loop() {
    
      // wait for serial input (min 3 bytes in buffer)
      while(Serial.available() > 0) {
    
        kind_of_data = Serial.read(); //string from USO --> L~a01~ R~a02~ F~a03~ B~a04~ A~a05~ C~a06~ 8bit resolution\decimal output
        if(kind_of_data == 'L') {
          Read_Pos(kind_of_data);
        }
        if(kind_of_data == 'R') {
          Read_Pos(kind_of_data);
        }
        if(kind_of_data == 'F') {
          Read_Pos(kind_of_data);
        }
        if(kind_of_data == 'B') {
          Read_Pos(kind_of_data);
        }
    
        if(kind_of_data == 'A') {
          Read_Pos(kind_of_data);
        }
    
        if(kind_of_data == 'C') {
          Read_Pos(kind_of_data);
        }
      }
    }
    
    void Read_Pos(char which_servo){
      delay(2);
      int Gforce100 = Serial.read()- '0';
      delay(2);
      int Gforce10 = Serial.read()- '0';
      delay(2);
      int Gforce1 = Serial.read()- '0';
    
      //Verifica se e centena dezena ou decimal... =]
      if (Gforce1 < 0) { Gforce = Gforce10 + 10*Gforce100; }
      if (Gforce1 < 0 && Gforce10 < 0) { Gforce = Gforce100; }
      if (Gforce100 < 0) { Gforce = 127; }
      if (Gforce1 >=0 && Gforce10 >= 0 && Gforce100 >= 0) { Gforce = 100 * Gforce100 + 10 * Gforce10 + Gforce1; }
    
      if (which_servo == 'L') {
        Degree = map(Gforce, 0, 255, 180, 0);
      }
      if (which_servo == 'F') {
        Degree = map(Gforce, 0, 255, 180, 0);
      }
      if (which_servo == 'R') {
        Degree = map(Gforce, 0, 255, 0, 180);
      }
      if (which_servo == 'B') {
        Degree = map(Gforce, 0, 255, 0, 180);
      }
      if (which_servo == 'A') {
        Degree = map(Gforce, 0, 255, 180, 0);
      }
      if (which_servo == 'C') {
        Degree = map(Gforce, 0, 255, 0, 180);
      }
    
    
      if (which_servo == 'L') {
        myservo1.write(Degree);
      }
      if (which_servo == 'R' ) {
        myservo2.write(Degree);
      }
      if (which_servo == 'F' ) {
        myservo3.write(Degree);
      }
      if (which_servo == 'B' ) {
        myservo4.write(Degree);
      }
    
      if (which_servo == 'A' ){
        myservo5.write(Degree);
      }
      if (which_servo == 'C' ) {
        myservo6.write(Degree);
      }
    }
    The 5 and 6 servos does not hold in a neutral position.
    All the while shaking , if I write in the USO settings ( L ~ a01 ~ R ~ a02 ~ F ~ a03 ~ B ~ a04 ~ A ~ a05 ~ C ~ a06 ~ )
    If removed (C ~ a06 ~), the 5 servo start works normally , the 6 servo is disabled.
    • Like Like x 1
    Last edited: Feb 1, 2014
  15. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Servos 1-5 work fine, but servo 6 does not? The code looks fine, so no reason I can see that it would not work. Do you have video?
    How are you testing? actual game output or using the output testing where you move the sliders?
  16. DERIY

    DERIY Member

    Joined:
    Apr 24, 2010
    Messages:
    64
    Location:
    RUSSIA
    Balance:
    - 52Coins
    Ratings:
    +7 / 1 / -0
    Yes,1-5 servos work fine.
    I move the sliders "Calibration affsets of the axis" in x-sim converter.
  17. JBoogie

    JBoogie Member

    Joined:
    Jan 14, 2014
    Messages:
    82
    Occupation:
    Pre-sales Engineer
    Location:
    Northern VA
    Balance:
    1,524Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, SimforceGT
    Can you explain how the servos are wired to the arduino? In the video it looks like you have the 2 servos connected together, and a single pin sending the signal to both? It is hard to see exactly in the video. The crazy servo movement to me looks like the ground connection is not properly shared between arduino and servo. Can you explain or show exactly how you have them wired? As an easy and quick test, maybe try hooking each servo to its own pin on the arduino. Also, if not already, make sure you have a jumper connecting the ground from the arduino to the battery powering the servos.
  18. DERIY

    DERIY Member

    Joined:
    Apr 24, 2010
    Messages:
    64
    Location:
    RUSSIA
    Balance:
    - 52Coins
    Ratings:
    +7 / 1 / -0
    The 5th servo connect to the 6 pin of adruino, 6th servo connect to the 7 pin.
    Ground from the power supply is connected to pin GND of arduino.
    If i write in USO ( L ~ a01 ~ R ~ a02 ~ F ~ a03 ~ B ~ a04 ~ A ~ a05 ~ ), the 5th servo work fine.
    If in USO ( L ~ a01 ~ R ~ a02 ~ F ~ a03 ~ B ~ a04 ~ C ~ a06 ~ ), the 6th servo work fine.
    If I write in the USO settings ( L ~ a01 ~ R ~ a02 ~ F ~ a03 ~ B ~ a04 ~ A ~ a05 ~ C ~ a06 ~ ), the 6 servo begin shaking.
    If I write so .(A ~ a05 ~ C ~ a06 ~ L ~ a01 ~ R ~ a02 ~ F ~ a03 ~ B ~ a04 ~ ) Then starts to shake fourth servo.
    Thus, as she begins to behave servo which is written at the end of line.
    Thank you for trying to help me!
    Last edited: Feb 2, 2014
  19. bsft

    bsft

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    @JBoogie , keep in mind the demo in the video is NOT using Simtools software.
    Good Job @DERIY , several guys have done this already with the Simtools software.
    • Like Like x 1
  20. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Use SimTools mate, way better motion. Ask @Historiker his already modified my Ard code for running 6 servos successfully, and looked to have really good motion too. This old code is way too slow to run several servos in time with the motion, hence I developed a better one and another member made it go even better.
    • Like Like x 1