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

My project (guide me)

Discussion in 'DIY Motion Simulator Projects' started by CalSim, Aug 2, 2014.

?

Best set to "heave" a total of 300kg??

  1. Stepper motor ie. NEMA 23-34 (x6)

    5 vote(s)
    33.3%
  2. Huge homemade actuator (x4, x6??)

    9 vote(s)
    60.0%
  3. Worm DC motor > 50W ( x6)

    3 vote(s)
    20.0%
Multiple votes are allowed.
  1. Tino

    Tino Member

    Joined:
    Mar 25, 2014
    Messages:
    100
    Balance:
    1,289Coins
    Ratings:
    +46 / 3 / -1
  2. CalSim

    CalSim building things

    Joined:
    Jul 24, 2014
    Messages:
    89
    Occupation:
    bacteriology analist
    Location:
    Spain
    Balance:
    1,310Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, JRK
    @Tino , there is a con for that motor: read carefully:

    • Holding torque : Low Holding torque, we've found these are quite easy to back drive, so if you need a worm drive with holding power this is not suitable.
    An0other con for me is that they sell from Australia which is the antipodes for spain and south europe, where I am. And import taxes for countries outside the UE are high here.

    Thata a powerfull motor, but its 16Amps at 12volts, we can have a better one, at least 30A can be easy handled. Think about the other i found, its 2500rpm, 16Amps at 24v (which is double). Now we add an external worm gear and set the final speed to 100 rpm. (25:1). The motor itself has an output of 12.5Newtons. imagine what after the worm gear.

    About the 3:1 relation gear. I'll build my actuators with heavy duty - non maintenance- threaded belts, because of noise.

    Anyway, im not expert with this, i'm going to try this configuration but I still need an easy way to control it. ( I dont know what kind of H-bridge i have to buy), please suggest me some.

    Thanks
  3. adgun

    adgun Active Member

    Joined:
    Jan 28, 2008
    Messages:
    519
    Occupation:
    mechanic
    Location:
    Netherlands
    Balance:
    5,690Coins
    Ratings:
    +131 / 4 / -0
    Hi
    Those wormgear motors are sold in europe, by motion control products @ there ebay store. (€80.00)
    if you need a holding wormgearbox you need a bigger I,they become fully locking between I 50/I 60
    regards AD
    • Informative Informative x 1
  4. Tino

    Tino Member

    Joined:
    Mar 25, 2014
    Messages:
    100
    Balance:
    1,289Coins
    Ratings:
    +46 / 3 / -1
    Hi Miguel,

    Your motor which does 16Amps at 24v sounds more powerful, but it seems to have lower torque - 12.5N vs 20N from motiondynamics.
    I am not too worried about motor efficiency as I will be using cheap and powerful (147A on 12v) server PSU:
    http://www.ebay.co.uk/itm/IBM-Blade...=US_Disk_Array_Components&hash=item5afdd59381

    or, if you need 24V you can use two 12V server PSU:
    http://www.tjinguytech.com/my-projects/diy-24v-47a

    Perhaps someone with more experience can correct me, but 3 to 1 sprocket system would bump the torque to 60N and I think that it would be unlikely that these motors would backdrive then.

    Also, additional gears and building the actuators would make this build really complicated (at least for me).
    Personally I'd rather buy SCN5 than try to build my own actuators.

    Unfortunately I haven't delved deep enough into simulator design to recommend H-bridge or other electronics.
    merchan-e recommended these H-bridges in this post: http://www.ebay.es/itm/BTS7960-43A-...181?pt=LH_DefaultDomain_0&hash=item2c7b59af55
    http://www.xsimulator.net/community/threads/6dof-motion-platform-‘lite’.5481/page-2#post-55836

    For my 1st simulator I will most likely be using Thanos 6dof electronics.

    Thanks, Tino.
  5. CalSim

    CalSim building things

    Joined:
    Jul 24, 2014
    Messages:
    89
    Occupation:
    bacteriology analist
    Location:
    Spain
    Balance:
    1,310Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, JRK
    I've been some days out, i bought some tools and next week i'll start building the actuator itself, I have drawn my own design, without strings and with my own knowledge. If the first actuator works, it'll be easy to go on with others.

    I'll post photos soon.
    • Like Like x 1
  6. Tino

    Tino Member

    Joined:
    Mar 25, 2014
    Messages:
    100
    Balance:
    1,289Coins
    Ratings:
    +46 / 3 / -1
    Hi adgun,

    Do you know if these motors are available in europe?
    http://www.motiondynamics.com.au/worm-drive-motor-12v-24v-200w-180-rpm-20nm-torque.html

    On motion control products ebay store I could only find 15Nm 65rpm motor (not enough umph)
    http://www.ebay.co.uk/itm/12V-DC-Ge...al_Components_Supplies_ET&hash=item19f0dd7b66

    billo2404 mentioned these motors from Canada
    http://www.ebay.it/itm/GEAR-MOTOR-1...483?pt=LH_DefaultDomain_0&hash=item51bed470a3
    Apparently this motor has 50-60Nm "load"
    Is that 50-60 Nm torque?
    Has anyone tried these motors?
    They also sell 160RPM version with 30-40Nm "load"
    http://www.ebay.it/itm/GEAR-MOTOR-1...384?pt=LH_DefaultDomain_0&hash=item51bd392f00
    Presuming that load means torque, doesn't that seem a little too good to be true?

    Regards,
    Tino.
  7. adgun

    adgun Active Member

    Joined:
    Jan 28, 2008
    Messages:
    519
    Occupation:
    mechanic
    Location:
    Netherlands
    Balance:
    5,690Coins
    Ratings:
    +131 / 4 / -0
    Hi Tino
    Look for there 12v motor compactible with mcp4 gearbox and mcp4 gearbox 25;1
    And yes,the motor seams to good to be true
    • Like Like x 1
  8. CalSim

    CalSim building things

    Joined:
    Jul 24, 2014
    Messages:
    89
    Occupation:
    bacteriology analist
    Location:
    Spain
    Balance:
    1,310Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, JRK
    Hey Tino motiondinamics motor has 20N outside the gearbox, right?

    The 300w motor i showed is 12.5 N without gearbox. What about an universal 25:1 worm gearbox to have about 100rpm?
  9. Tino

    Tino Member

    Joined:
    Mar 25, 2014
    Messages:
    100
    Balance:
    1,289Coins
    Ratings:
    +46 / 3 / -1
    Hi Miguel,

    12.5Nm @ 2500 RPM sounds a bit optimistic for 300W motor, but I could be wrong.
    Since the motor is quite cheap (~€56.4) I suggest you purchase one and let us know if it works as advertised.
    I'm a bit worried that gearbox might cost much more than this motor...
    I thought you were building actuators?
  10. CalSim

    CalSim building things

    Joined:
    Jul 24, 2014
    Messages:
    89
    Occupation:
    bacteriology analist
    Location:
    Spain
    Balance:
    1,310Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, JRK
    Yes i'm building actuators with my own design. have a mindbraker with the motor im going to buy

    I'll spend about 150€ max on motor/wormgear. a 100€ universal wormgear would be great to use with this motor.

    That motor is used to power electric skates.
    • Like Like x 1
  11. CalSim

    CalSim building things

    Joined:
    Jul 24, 2014
    Messages:
    89
    Occupation:
    bacteriology analist
    Location:
    Spain
    Balance:
    1,310Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, JRK
    Well since i've been out these days, i want to update this with a new thread, where i'll update the build of my actuator.

    http://www.xsimulator.net/community/threads/dc-actuator-design.5762/

    Right now i've been building my workstation and buying some tools, to cut shafts, etc, etc.

    This is my garage actually without trash :p

    IMG_20140903_151614.jpg

    So I will left this to the "big rig" with 6 actuators and follow what i'm working on now
    • Like Like x 2
  12. Malik10

    Malik10 Member

    Joined:
    Mar 3, 2016
    Messages:
    68
    Location:
    MALAYSIA
    Balance:
    657Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino, SimforceGT, Motion platform
    how about around 100kg? can use the same coding? the coding that i used like that..

    Code:
    #include <SoftwareSerial.h>
    
    
    
    const int RedLedPin =  2;
    const int YelLedPin =  3;
    const int GreenLedPin =  4;
    const int Actuator1_Fwd_Pin=6;
    const int Actuator1_Rvs_Pin=5;
    const int Actuator2_Fwd_Pin=8;
    const int Actuator2_Rvs_Pin=7;
    const int Actuator3_Fwd_Pin=10;
    const int Actuator3_Rvs_Pin=9;
    const int Limit_Switch1_Pin=11;
    const int Rx_Pin=12;
    const int Tx_Pin=13;
    int Red_LED_State = LOW;
    int Yel_LED_State = LOW;
    int Green_LED_State = LOW;
    
    unsigned long Red_LED_previousMillis = 0;
    unsigned long Yel_LED_previousMillis = 0;
    unsigned long Green_LED_previousMillis = 0;
    unsigned long Actuator1Fwd_previousMillis=0;
    unsigned long Actuator1Rvs_previousMillis=0;
    unsigned long Actuator2Fwd_previousMillis=0;
    unsigned long Actuator2Rvs_previousMillis=0;
    unsigned long Actuator3Fwd_previousMillis=0;
    unsigned long Actuator3Rvs_previousMillis=0;
    
    char numStr[16];      // the number characters and null
    String X_axis[]="";
    long data_X;          // the number stored as a long integer
    long data_Y;          // the number stored as a long integer
    long data_Z;          // the number stored as a long integer
    int position_X;
    int position_Y;
    int position_Z;
    char data_serial[3];
    char X_axis_data[3];
    
    SoftwareSerial mySerial(12, 13); // RX, TX
    void setup()
    {
    pinMode(RedLedPin, OUTPUT);
    pinMode(YelLedPin, OUTPUT);
    pinMode(GreenLedPin, OUTPUT);
    pinMode(Actuator1_Fwd_Pin, OUTPUT);
    pinMode(Actuator1_Rvs_Pin, OUTPUT);
    pinMode(Actuator2_Fwd_Pin, OUTPUT);
    pinMode(Actuator2_Rvs_Pin, OUTPUT);
    pinMode(Actuator3_Fwd_Pin, OUTPUT);
    pinMode(Actuator3_Rvs_Pin, OUTPUT);
    pinMode(Limit_Switch1_Pin, INPUT);
    
    
    Serial.begin(9600);
    mySerial.begin(9600);
    
    }
    
    void Red_LED_Blink(const long interval_Red)
    {
      unsigned long Red_LED_currentMillis = millis();
    
      if(Red_LED_currentMillis - Red_LED_previousMillis >= interval_Red) {
        // save the last time you blinked the LED
        Red_LED_previousMillis = Red_LED_currentMillis;
    
        // if the LED is off turn it on and vice-versa:
        if (Red_LED_State == LOW)
          Red_LED_State = HIGH;
        else
          Red_LED_State = LOW;
    
        // set the LED with the ledState of the variable:
        digitalWrite(RedLedPin, Red_LED_State);
      }
    }
    
    
    void Yel_LED_Blink(const long interval_Yel)
    {
      unsigned long Yel_LED_currentMillis = millis();
    
      if(Yel_LED_currentMillis - Yel_LED_previousMillis >= interval_Yel) {
        // save the last time you blinked the LED
        Yel_LED_previousMillis = Yel_LED_currentMillis;
    
        // if the LED is off turn it on and vice-versa:
        if (Yel_LED_State == LOW)
          Yel_LED_State = HIGH;
        else
          Yel_LED_State = LOW;
    
        // set the LED with the ledState of the variable:
        digitalWrite(YelLedPin, Yel_LED_State);
      }
    }
    
    void Green_LED_Blink(const long interval_Green)
    {
      unsigned long Green_LED_currentMillis = millis();
    
      if(Green_LED_currentMillis - Green_LED_previousMillis >= interval_Green) {
        // save the last time you blinked the LED
        Green_LED_previousMillis = Green_LED_currentMillis;
    
        // if the LED is off turn it on and vice-versa:
        if (Green_LED_State == LOW)
          Green_LED_State = HIGH;
        else
          Green_LED_State = LOW;
    
        // set the LED with the ledState of the variable:
        digitalWrite(GreenLedPin, Green_LED_State);
      }
    }
    
    void move_actuator1_fwd(const long interval_actuator1)
    {
      unsigned long Actuator1Fwd_currentMillis = millis();
      digitalWrite(Actuator1_Fwd_Pin,HIGH);
      digitalWrite(Actuator1_Rvs_Pin,LOW);
      if(Actuator1Fwd_currentMillis - Actuator1Fwd_previousMillis >= interval_actuator1) {
    Actuator1Fwd_previousMillis = Actuator1Fwd_currentMillis;
        digitalWrite(Actuator1_Fwd_Pin,LOW);
        digitalWrite(Actuator1_Rvs_Pin,LOW);
      }
    delay(50);
    }
    
    
    void move_actuator1_rvs(const long interval_actuator1)
    {
      unsigned long Actuator1Rvs_currentMillis = millis();
      digitalWrite(Actuator1_Rvs_Pin,HIGH);
      digitalWrite(Actuator1_Fwd_Pin,LOW);
    if(Actuator1Rvs_currentMillis - Actuator1Rvs_previousMillis >= interval_actuator1) {
      Actuator1Rvs_previousMillis = Actuator1Rvs_currentMillis;
      digitalWrite(Actuator1_Fwd_Pin,LOW);
      digitalWrite(Actuator1_Rvs_Pin,LOW);
      }
    delay(50);
    }
    
    
    
    
    void move_actuator2_fwd(const long interval_actuator2)
    {
      unsigned long Actuator2Fwd_currentMillis = millis();
      digitalWrite(Actuator2_Fwd_Pin,HIGH);
      digitalWrite(Actuator2_Rvs_Pin,LOW);
      if(Actuator2Fwd_currentMillis - Actuator2Fwd_previousMillis >= interval_actuator2) {
    Actuator2Fwd_previousMillis = Actuator2Fwd_currentMillis;
        digitalWrite(Actuator2_Fwd_Pin,LOW);
        digitalWrite(Actuator2_Rvs_Pin,LOW);
      }
    
    }
    
    
    void move_actuator2_rvs(const long interval_actuator2)
    {
      unsigned long Actuator2Rvs_currentMillis = millis();
      digitalWrite(Actuator2_Rvs_Pin,HIGH);
      digitalWrite(Actuator2_Fwd_Pin,LOW);
    if(Actuator2Rvs_currentMillis - Actuator2Rvs_previousMillis >= interval_actuator2) {
      Actuator2Rvs_previousMillis = Actuator2Rvs_currentMillis;
      digitalWrite(Actuator2_Fwd_Pin,LOW);
      digitalWrite(Actuator2_Rvs_Pin,LOW);
      }
    
    }
    
    
    
    void move_actuator3_fwd(const long interval_actuator3)
    {
      unsigned long Actuator3Fwd_currentMillis = millis();
      digitalWrite(Actuator3_Fwd_Pin,HIGH);
      digitalWrite(Actuator3_Rvs_Pin,LOW);
      if(Actuator3Fwd_currentMillis - Actuator3Fwd_previousMillis >= interval_actuator3) {
    Actuator3Fwd_previousMillis = Actuator3Fwd_currentMillis;
        digitalWrite(Actuator3_Fwd_Pin,LOW);
        digitalWrite(Actuator3_Rvs_Pin,LOW);
      }
    
    }
    
    
    void move_actuator3_rvs(const long interval_actuator3)
    {
      unsigned long Actuator3Rvs_currentMillis = millis();
      digitalWrite(Actuator3_Rvs_Pin,HIGH);
      digitalWrite(Actuator3_Fwd_Pin,LOW);
    if(Actuator3Rvs_currentMillis - Actuator3Rvs_previousMillis >= interval_actuator3) {
      Actuator3Rvs_previousMillis = Actuator3Rvs_currentMillis;
      digitalWrite(Actuator3_Fwd_Pin,LOW);
      digitalWrite(Actuator3_Rvs_Pin,LOW);
      }
    
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    void Red_LED_Off()
    {
        digitalWrite(RedLedPin,LOW);
    
    }
    void Yel_LED_Off()
    {
    
        digitalWrite(YelLedPin,LOW);
    
    }
    
    void Green_LED_Off()
    {
    
        digitalWrite(GreenLedPin,LOW);
    }
    
    
    void initialize_actuator_position()
    {
    
      digitalWrite(Actuator1_Fwd_Pin,LOW);
      digitalWrite(Actuator1_Rvs_Pin,LOW);
      digitalWrite(Actuator2_Fwd_Pin,LOW);
      digitalWrite(Actuator2_Rvs_Pin,LOW);
      digitalWrite(Actuator3_Fwd_Pin,LOW);
      digitalWrite(Actuator3_Rvs_Pin,LOW);
    
    
    digitalWrite(RedLedPin,LOW);
    delay(100);
    int initialize=1;
    int fwd_status=1;
    int rvs_status=0;
    int  count_fwd=0;
    int count_rvs=0;
    int count=0;
    while(initialize)
    {
      int rand_val=rand();
      if (rand_val>1000){rand_val=1000;}
      Yel_LED_Blink(rand_val);
      if((fwd_status==1)&&(rvs_status==0))
      {
      count_fwd=count_fwd+1;
      count_rvs=0;
      digitalWrite(Actuator1_Fwd_Pin,HIGH);
      digitalWrite(Actuator1_Rvs_Pin,LOW);
      delay(100);
      digitalWrite(Actuator2_Fwd_Pin,HIGH);
      digitalWrite(Actuator2_Rvs_Pin,LOW);
      delay(100);
      digitalWrite(Actuator3_Fwd_Pin,HIGH);
      digitalWrite(Actuator3_Rvs_Pin,LOW);                                       
      if(count_fwd==40){
                          fwd_status=0;
                          rvs_status=1;
                          count=count+1;
                            digitalWrite(Actuator1_Fwd_Pin,LOW);
                            digitalWrite(Actuator1_Rvs_Pin,LOW);
                            digitalWrite(Actuator2_Fwd_Pin,LOW);
                            digitalWrite(Actuator2_Rvs_Pin,LOW);
                            digitalWrite(Actuator3_Fwd_Pin,LOW);
                            digitalWrite(Actuator3_Rvs_Pin,LOW);
                            delay(100);
                       }
      int   switch_status=digitalRead(Limit_Switch1_Pin);
    
      if(switch_status==0){initialize=0;
                           Yel_LED_Off();
                            digitalWrite(GreenLedPin,HIGH);
                            digitalWrite(Actuator1_Fwd_Pin,LOW);
                            digitalWrite(Actuator1_Rvs_Pin,LOW);
                            digitalWrite(Actuator2_Fwd_Pin,LOW);
                            digitalWrite(Actuator2_Rvs_Pin,LOW);
                            digitalWrite(Actuator3_Fwd_Pin,LOW);
                            digitalWrite(Actuator3_Rvs_Pin,LOW);
                            delay(100);
                           }
      }
    
      if((fwd_status==0)&&(rvs_status==1))
      {
      count_fwd=0;
      count_rvs=count_rvs+1;
      digitalWrite(Actuator1_Fwd_Pin,LOW);
      digitalWrite(Actuator1_Rvs_Pin,HIGH);
      delay(100);
      digitalWrite(Actuator2_Fwd_Pin,LOW);
      digitalWrite(Actuator2_Rvs_Pin,HIGH);
      delay(100);
      digitalWrite(Actuator3_Fwd_Pin,LOW);
      digitalWrite(Actuator3_Rvs_Pin,HIGH);
    
      if(count_rvs==40){
                          fwd_status=1;
                          rvs_status=0;
                          count=count+1;
                            digitalWrite(Actuator1_Fwd_Pin,LOW);
                            digitalWrite(Actuator1_Rvs_Pin,LOW);
                            digitalWrite(Actuator2_Fwd_Pin,LOW);
                            digitalWrite(Actuator2_Rvs_Pin,LOW);
                            digitalWrite(Actuator3_Fwd_Pin,LOW);
                            digitalWrite(Actuator3_Rvs_Pin,LOW);
                            delay(100);
                       }
      int   switch_status=digitalRead(Limit_Switch1_Pin);
    
      if(switch_status==0){initialize=0;
                           Yel_LED_Off();
                            digitalWrite(GreenLedPin,HIGH);
                            digitalWrite(Actuator1_Fwd_Pin,LOW);
                            digitalWrite(Actuator1_Rvs_Pin,LOW);
                            digitalWrite(Actuator2_Fwd_Pin,LOW);
                            digitalWrite(Actuator2_Rvs_Pin,LOW);
                            digitalWrite(Actuator3_Fwd_Pin,LOW);
                            digitalWrite(Actuator3_Rvs_Pin,LOW);
                            delay(100);
                           }
      }
    
    
    
        if(count==5){
    
                            digitalWrite(Actuator1_Fwd_Pin,LOW);
                            digitalWrite(Actuator1_Rvs_Pin,LOW);
                            digitalWrite(Actuator2_Fwd_Pin,LOW);
                            digitalWrite(Actuator2_Rvs_Pin,LOW);
                            digitalWrite(Actuator3_Fwd_Pin,LOW);
                            digitalWrite(Actuator3_Rvs_Pin,LOW);
                            digitalWrite(RedLedPin,HIGH);
                            while(1){}
                   }
    
    
    }
    }
    
    
    
    
    
    void loop()
    {
    Red_LED_Off();
    Yel_LED_Off();
    Green_LED_Off();
    delay(100);
    initialize_actuator_position();
    unsigned previous_data_X=511;
    unsigned  previous_data_Y=511;
    unsigned previous_data_Z=511;
    signed int val_X;
    signed int val_Y;
    signed int val_Z;
    while(1)
    {
    
    int rand_val=rand();
    if (rand_val>1000){rand_val=1000;}
    Green_LED_Blink(rand_val);
    int check_data=1;
    int count=0;
    while(check_data)
         {
               if ( Serial.available () > 0 )
                {
              
                  numStr[count]=Serial.read();
                  mySerial.write(numStr[count]);
    
                 }
    
                if(numStr[count]=='C')
                    {
                
                      check_data=0;
                    }
    
               count=count+1;
            
           }
    
    
    
    
      //mySerial.write(numStr);
    
    
    String data= String(numStr);
    mySerial.println(data);
    
    String data_x=data.substring(2,5);
    int X=data_x.toInt();
    mySerial.println(X);
    String data_y=data.substring(6,9);
    int Y=data_y.toInt();
    mySerial.println(Y);
    String data_z=data.substring(10,13);
    int Z=data_z.toInt();
    mySerial.println(Z);
    
    if(X<previous_data_X)
    {
      move_actuator1_rvs(1000);
      delay(250);                                 
      previous_data_X=X;
    }
    if(X>previous_data_X)
    {
    
      move_actuator1_fwd(1000);
      delay(250);                                 
      previous_data_X=X;
    
    }
    
    if(Y<previous_data_Y)
    {
    
      move_actuator2_rvs(1000);
      delay(250);                                 
      previous_data_Y=Y;
    }
    if(Y>previous_data_Y)
    {
    
      move_actuator2_fwd(1000);
      delay(250);                                 
      previous_data_Y=Y;
    
    }
    
    if(Z<previous_data_Z)
    {
    
      move_actuator3_rvs(1000);
      delay(250);                                 
      previous_data_Z=Z;
    }
    if(Z>previous_data_Z)
    {
    
      move_actuator3_fwd(1000);
      delay(250);                                 
      previous_data_Z=Z;
    
    }
    
    
      
      }
    }
    Last edited by a moderator: Mar 6, 2016
  13. Malik10

    Malik10 Member

    Joined:
    Mar 3, 2016
    Messages:
    68
    Location:
    MALAYSIA
    Balance:
    657Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino, SimforceGT, Motion platform
    one question from me everybody..how much cost or average cost to buy motor i mean per unit? if i must buy with other country i think it is more expensive..
  14. Casey Pareni

    Casey Pareni MasterP

    Joined:
    Aug 18, 2015
    Messages:
    24
    Occupation:
    Firefighter
    Location:
    Arizona
    Balance:
    350Coins
    Ratings:
    +4 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
  15. Malik10

    Malik10 Member

    Joined:
    Mar 3, 2016
    Messages:
    68
    Location:
    MALAYSIA
    Balance:
    657Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino, SimforceGT, Motion platform
  16. Malik10

    Malik10 Member

    Joined:
    Mar 3, 2016
    Messages:
    68
    Location:
    MALAYSIA
    Balance:
    657Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino, SimforceGT, Motion platform
    try this one..
    #include <SoftwareSerial.h>



    const int RedLedPin = 2;
    const int YelLedPin = 3;
    const int GreenLedPin = 4;
    const int Actuator1_Fwd_Pin=6;
    const int Actuator1_Rvs_Pin=5;
    const int Actuator2_Fwd_Pin=8;
    const int Actuator2_Rvs_Pin=7;
    const int Actuator3_Fwd_Pin=10;
    const int Actuator3_Rvs_Pin=9;
    const int Limit_Switch1_Pin=11;
    const int Rx_Pin=12;
    const int Tx_Pin=13;
    int Red_LED_State = LOW;
    int Yel_LED_State = LOW;
    int Green_LED_State = LOW;

    unsigned long Red_LED_previousMillis = 0;
    unsigned long Yel_LED_previousMillis = 0;
    unsigned long Green_LED_previousMillis = 0;
    unsigned long Actuator1Fwd_previousMillis=0;
    unsigned long Actuator1Rvs_previousMillis=0;
    unsigned long Actuator2Fwd_previousMillis=0;
    unsigned long Actuator2Rvs_previousMillis=0;
    unsigned long Actuator3Fwd_previousMillis=0;
    unsigned long Actuator3Rvs_previousMillis=0;

    char numStr[16]; // the number characters and null
    String X_axis[]="";
    long data_X; // the number stored as a long integer
    long data_Y; // the number stored as a long integer
    long data_Z; // the number stored as a long integer
    int position_X;
    int position_Y;
    int position_Z;
    char data_serial[3];
    char X_axis_data[3];

    SoftwareSerial mySerial(12, 13); // RX, TX
    void setup()
    {
    pinMode(RedLedPin, OUTPUT);
    pinMode(YelLedPin, OUTPUT);
    pinMode(GreenLedPin, OUTPUT);
    pinMode(Actuator1_Fwd_Pin, OUTPUT);
    pinMode(Actuator1_Rvs_Pin, OUTPUT);
    pinMode(Actuator2_Fwd_Pin, OUTPUT);
    pinMode(Actuator2_Rvs_Pin, OUTPUT);
    pinMode(Actuator3_Fwd_Pin, OUTPUT);
    pinMode(Actuator3_Rvs_Pin, OUTPUT);
    pinMode(Limit_Switch1_Pin, INPUT);


    Serial.begin(9600);
    mySerial.begin(9600);

    }

    void Red_LED_Blink(const long interval_Red)
    {
    unsigned long Red_LED_currentMillis = millis();

    if(Red_LED_currentMillis - Red_LED_previousMillis >= interval_Red) {
    // save the last time you blinked the LED
    Red_LED_previousMillis = Red_LED_currentMillis;

    // if the LED is off turn it on and vice-versa:
    if (Red_LED_State == LOW)
    Red_LED_State = HIGH;
    else
    Red_LED_State = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(RedLedPin, Red_LED_State);
    }
    }


    void Yel_LED_Blink(const long interval_Yel)
    {
    unsigned long Yel_LED_currentMillis = millis();

    if(Yel_LED_currentMillis - Yel_LED_previousMillis >= interval_Yel) {
    // save the last time you blinked the LED
    Yel_LED_previousMillis = Yel_LED_currentMillis;

    // if the LED is off turn it on and vice-versa:
    if (Yel_LED_State == LOW)
    Yel_LED_State = HIGH;
    else
    Yel_LED_State = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(YelLedPin, Yel_LED_State);
    }
    }

    void Green_LED_Blink(const long interval_Green)
    {
    unsigned long Green_LED_currentMillis = millis();

    if(Green_LED_currentMillis - Green_LED_previousMillis >= interval_Green) {
    // save the last time you blinked the LED
    Green_LED_previousMillis = Green_LED_currentMillis;

    // if the LED is off turn it on and vice-versa:
    if (Green_LED_State == LOW)
    Green_LED_State = HIGH;
    else
    Green_LED_State = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(GreenLedPin, Green_LED_State);
    }
    }

    void move_actuator1_fwd(const long interval_actuator1)
    {
    unsigned long Actuator1Fwd_currentMillis = millis();
    digitalWrite(Actuator1_Fwd_Pin,HIGH);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    if(Actuator1Fwd_currentMillis - Actuator1Fwd_previousMillis >= interval_actuator1) {
    Actuator1Fwd_previousMillis = Actuator1Fwd_currentMillis;
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    }
    delay(50);
    }


    void move_actuator1_rvs(const long interval_actuator1)
    {
    unsigned long Actuator1Rvs_currentMillis = millis();
    digitalWrite(Actuator1_Rvs_Pin,HIGH);
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    if(Actuator1Rvs_currentMillis - Actuator1Rvs_previousMillis >= interval_actuator1) {
    Actuator1Rvs_previousMillis = Actuator1Rvs_currentMillis;
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    }
    delay(50);
    }




    void move_actuator2_fwd(const long interval_actuator2)
    {
    unsigned long Actuator2Fwd_currentMillis = millis();
    digitalWrite(Actuator2_Fwd_Pin,HIGH);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    if(Actuator2Fwd_currentMillis - Actuator2Fwd_previousMillis >= interval_actuator2) {
    Actuator2Fwd_previousMillis = Actuator2Fwd_currentMillis;
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    }

    }


    void move_actuator2_rvs(const long interval_actuator2)
    {
    unsigned long Actuator2Rvs_currentMillis = millis();
    digitalWrite(Actuator2_Rvs_Pin,HIGH);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    if(Actuator2Rvs_currentMillis - Actuator2Rvs_previousMillis >= interval_actuator2) {
    Actuator2Rvs_previousMillis = Actuator2Rvs_currentMillis;
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    }

    }



    void move_actuator3_fwd(const long interval_actuator3)
    {
    unsigned long Actuator3Fwd_currentMillis = millis();
    digitalWrite(Actuator3_Fwd_Pin,HIGH);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    if(Actuator3Fwd_currentMillis - Actuator3Fwd_previousMillis >= interval_actuator3) {
    Actuator3Fwd_previousMillis = Actuator3Fwd_currentMillis;
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    }

    }


    void move_actuator3_rvs(const long interval_actuator3)
    {
    unsigned long Actuator3Rvs_currentMillis = millis();
    digitalWrite(Actuator3_Rvs_Pin,HIGH);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    if(Actuator3Rvs_currentMillis - Actuator3Rvs_previousMillis >= interval_actuator3) {
    Actuator3Rvs_previousMillis = Actuator3Rvs_currentMillis;
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    }

    }




















    void Red_LED_Off()
    {
    digitalWrite(RedLedPin,LOW);

    }
    void Yel_LED_Off()
    {

    digitalWrite(YelLedPin,LOW);

    }

    void Green_LED_Off()
    {

    digitalWrite(GreenLedPin,LOW);
    }


    void initialize_actuator_position()
    {

    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);


    digitalWrite(RedLedPin,LOW);
    delay(100);
    int initialize=1;
    int fwd_status=1;
    int rvs_status=0;
    int count_fwd=0;
    int count_rvs=0;
    int count=0;
    while(initialize)
    {
    int rand_val=rand();
    if (rand_val>1000){rand_val=1000;}
    Yel_LED_Blink(rand_val);
    if((fwd_status==1)&&(rvs_status==0))
    {
    count_fwd=count_fwd+1;
    count_rvs=0;
    digitalWrite(Actuator1_Fwd_Pin,HIGH);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    delay(100);
    digitalWrite(Actuator2_Fwd_Pin,HIGH);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    delay(100);
    digitalWrite(Actuator3_Fwd_Pin,HIGH);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    if(count_fwd==40){
    fwd_status=0;
    rvs_status=1;
    count=count+1;
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    delay(100);
    }
    int switch_status=digitalRead(Limit_Switch1_Pin);

    if(switch_status==0){initialize=0;
    Yel_LED_Off();
    digitalWrite(GreenLedPin,HIGH);
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    delay(100);
    }
    }

    if((fwd_status==0)&&(rvs_status==1))
    {
    count_fwd=0;
    count_rvs=count_rvs+1;
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,HIGH);
    delay(100);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,HIGH);
    delay(100);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,HIGH);

    if(count_rvs==40){
    fwd_status=1;
    rvs_status=0;
    count=count+1;
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    delay(100);
    }
    int switch_status=digitalRead(Limit_Switch1_Pin);

    if(switch_status==0){initialize=0;
    Yel_LED_Off();
    digitalWrite(GreenLedPin,HIGH);
    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    delay(100);
    }
    }



    if(count==5){

    digitalWrite(Actuator1_Fwd_Pin,LOW);
    digitalWrite(Actuator1_Rvs_Pin,LOW);
    digitalWrite(Actuator2_Fwd_Pin,LOW);
    digitalWrite(Actuator2_Rvs_Pin,LOW);
    digitalWrite(Actuator3_Fwd_Pin,LOW);
    digitalWrite(Actuator3_Rvs_Pin,LOW);
    digitalWrite(RedLedPin,HIGH);
    while(1){}
    }


    }
    }





    void loop()
    {
    Red_LED_Off();
    Yel_LED_Off();
    Green_LED_Off();
    delay(100);
    initialize_actuator_position();
    unsigned previous_data_X=511;
    unsigned previous_data_Y=511;
    unsigned previous_data_Z=511;
    signed int val_X;
    signed int val_Y;
    signed int val_Z;
    while(1)
    {

    int rand_val=rand();
    if (rand_val>1000){rand_val=1000;}
    Green_LED_Blink(rand_val);
    int check_data=1;
    int count=0;
    while(check_data)
    {
    if ( Serial.available () > 0 )
    {

    numStr[count]=Serial.read();
    mySerial.write(numStr[count]);

    }

    if(numStr[count]=='C')
    {

    check_data=0;
    }

    count=count+1;

    }




    //mySerial.write(numStr);


    String data= String(numStr);
    mySerial.println(data);

    String data_x=data.substring(2,5);
    int X=data_x.toInt();
    mySerial.println(X);
    String data_y=data.substring(6,9);
    int Y=data_y.toInt();
    mySerial.println(Y);
    String data_z=data.substring(10,13);
    int Z=data_z.toInt();
    mySerial.println(Z);

    if(X<previous_data_X)
    {
    move_actuator1_rvs(1000);
    delay(250);
    previous_data_X=X;
    }
    if(X>previous_data_X)
    {

    move_actuator1_fwd(1000);
    delay(250);
    previous_data_X=X;

    }

    if(Y<previous_data_Y)
    {

    move_actuator2_rvs(1000);
    delay(250);
    previous_data_Y=Y;
    }
    if(Y>previous_data_Y)
    {

    move_actuator2_fwd(1000);
    delay(250);
    previous_data_Y=Y;

    }

    if(Z<previous_data_Z)
    {

    move_actuator3_rvs(1000);
    delay(250);
    previous_data_Z=Z;
    }
    if(Z>previous_data_Z)
    {

    move_actuator3_fwd(1000);
    delay(250);
    previous_data_Z=Z;

    }



    }
    }
  17. Pedro Silva

    Pedro Silva New Member

    Joined:
    Oct 1, 2016
    Messages:
    8
    Occupation:
    Telecomm, Electronics
    Location:
    Yoshkar-Ola, Russia
    Balance:
    251Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Hello Robbie!

    Im a starter in this forum (just signed up last week) and i got your project to be my first shot, i found it the easies to understand. Nice job, BTW!
    I just have 2 questions about it:

    1) I made the setup exactly the way you explained, i triple checked all detailes, Axis Assignments, i used the interface config you put in your zip, and so on. I assembled Arduino outputs on my osciloscope to check PWM variation as i still dont have my motors. However, i noticed that i have inverted result, i mean, when i slide roll on Game Engine Output Test i get pitch result on osciloscope (both PWM moving together) and when i slide pitch on output test i get roll result (inverse proportional PWM on osciloscope). How is the correct way to solve it?

    and

    2) IN one of your posts you said that we need to create a default axis assignment and you said to distribute 50%/50%. However when i was sutdying the documentation they gave as an example of default assignment the distribution of 60%/60%, which by the way i found strange because they dont make 100% ... Anyway, in practice what does it really change to use 50% or 60% in this case?

    Once more congrats for your job and hope i can soon get ready my first SIM. Thanks!
  18. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,155
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,616Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Just change the pitch and roll in the Axis Assignments.

    See here re percentage allocations: https://www.xsimulator.net/community/faq/axis-assignment-percentage-totals.120/
    • Like Like x 1
  19. Pedro Silva

    Pedro Silva New Member

    Joined:
    Oct 1, 2016
    Messages:
    8
    Occupation:
    Telecomm, Electronics
    Location:
    Yoshkar-Ola, Russia
    Balance:
    251Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Hummm... that im afraid i did already... or maybe im just mistaken? As per my understanding, if i swap the axis on axis assignment it would produce the same result as swap the output pins from Arduino, and still would be inverted pitch and roll, just changing the side. It seems to be something else that im not getting yet. Take a look on the following pictures.
    My actual axis assignment:
    upload_2016-10-4_8-10-10.png

    My interface settings:
    upload_2016-10-4_8-10-59.png

    PWM with Roll all to the right (should be max PWM for one output and min PWM for another out, instead they move together, what is pitch behavior):
    upload_2016-10-4_8-13-32.png

    PWM with Pitch on maximum (should be max PWM for both outputs, instead they move inverse, what is roll behavior):
    upload_2016-10-4_8-15-54.png

    Thanks!!

    Attached Files:

  20. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,155
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,616Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    It sounds like one motor needs its direction reversed @Pedro Silva, as the way the Axis Assignment is set with one Dir checked for roll is correct and one motor should go up and the other down.