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

3DOF homemade

Discussion in 'DIY Motion Simulator Projects' started by lebclem, Feb 6, 2023.

  1. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Hi everyone !
    I want to share with you guys our 3 DOF build.
    I say "our" but, it's made by my stepdad for us.
    Start for scratch, I bought everything we needed and we searched on the net everything.

    Motors bought on alibaba 3x 350W 50rpm, some 3D print things on Simukit etc...
    All the structure is made by aluminium (don't know the english word for these bars) oh, i'm French btw.

    I could post some photos but there are a plenty of them, i have a google photo link with all the process from start to where we are now(almost finish).

    https://photos.google.com/share/AF1...&key=WE1FMTM2NTdMYUhyaC1RWkpRdktLdHJ3T0l6R0d3

    I'll receive the 3 screens this week, for the wheel/pedals I keep for the moment my G920, and I have a handbrake and shifter Fanatec. (support needs to be made).

    I keep this thread update as soon as I receive the screens, the installation and the first test in game (the motors are already test and everything is OK).

    Thanks again to my stepdad "The boss" I call him.

    hope you'll like it, and i'm aware to any suggestion :)

    Clem
    • Like Like x 2
  2. cgodwin

    cgodwin Active Member

    Joined:
    Sep 18, 2015
    Messages:
    225
    Occupation:
    Engineer
    Location:
    Eugene, Oregon
    Balance:
    2,478Coins
    Ratings:
    +278 / 2 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    That is an impressive, professional looking build! Nice to have a mill for making parts.
  3. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Thank you Cgodwin !

    Here they are, not the best on the market but: 2K, 165HZ, VA, just what I need.
    I chose 32" because I think that's better for the immersion...
    329669695_1191599798414615_8002746611357495098_n.jpg
    • Like Like x 1
  4. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,395
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    150,025Coins
    Ratings:
    +10,993 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    What do you have in mind for mounting them?
  5. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    We've made a custom aluminium support on wheels.
    I receive the Shifter, first test should be on monday... fingers crossed !
    thumbnail.jpg
    • Like Like x 1
  6. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    So... not going qo well of course lol.
    Everything is moving, but it's like the motors don't have enough strength.
    Without the seat etc, we can stop the motor by hand .
    Motors 350W 50rpm, sabertooth 2x32 (x2), we can mesure only 4v on the sabertooth where motors are.
    Alimentation is 1200W 24v 50amp
    Where can i adjust the strength of the motors?
  7. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,395
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    150,025Coins
    Ratings:
    +10,993 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    What control board and code are you using?
  8. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    I'm using the arduino micro.
    Here is my setting in simtools:
    Sans-titre-1.jpg

    In Describe I configured each sabertooth like this:
    Sans-titre-2.jpg
    Sans-titre-3.jpg
    Sans-titre-4.jpg

    Attached Files:

  9. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    for the code arduino:

    /*
    * Original source code from sirnoname : x-sim.de
    changelog:
    1.6
    - changing var for array of (int) values

    1.5 (to do in this sketch) :
    - add a switch to reset position of motors
    1.4 :
    - you can use a potentiometer to modify the global power of the motion simulator
    - to disable this functionnality you need to set GP_select = 0;

    1.23 :
    - When serial send XE00C, the motion plateform will be placed in original position
    - Use of packet serial communication instead of simplified serial (more stable)


    10 bits (16 bits value / 64)
    57600 bauds 8N1

    Simtools : X1<Axis1a>CX2<Axis2a>CX3<Axis3a>CX4<Axis4a>CX5<Axis5a>CX6<Axis6a>C

    XE00C - End
    Pin out of arduino for Sabertooth

    Pin 2 - TX data to connect to S1 Sabertooth 1
    Pin 3 - TX data to connect to S1 Sabertooth 2
    Pin 4 - TX data to connect to S1 Sabertooth 3

    Analog Pins

    Pin A0 - input of feedback positioning from motor 1
    Pin A1 - input of feedback positioning from motor 2
    Pin A2 - input of feedback positioning from motor 3
    Pin A3 - input of feedback positioning from motor 4
    Pin A4 - input of feedback positioning from motor 5
    Pin A5 - input of feedback positioning from motor 6

    Pin A11 - input of potentiometer to define the global power

    Pin 11 - switch to move the motion simulator in standby value. connect to GND

    As well 5v and GND pins tapped in to feed feedback pots too.
    */

    #include <Sabertooth.h>
    #include <SoftwareSerial.h>

    //Some speed test switches for testers ;)
    #define FASTADC 1 //Hack to speed up the arduino analogue read function, comment out with // to disable this hack

    // defines for setting and clearing register bits
    #ifndef cbi
    #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
    #endif
    #ifndef sbi
    #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
    #endif

    #define LOWBYTE(v) ((unsigned char) (v)) //Read
    #define HIGHBYTE(v) ((unsigned char) (((unsigned int) (v)) >> 8))
    #define BYTELOW(v) (*(((unsigned char *) (&v) + 1))) //Write
    #define BYTEHIGH(v) (*((unsigned char *) (&v)))

    int DeadZone = 9; //increase this value to reduce vibrations of motors
    int ReadAnalog = 6;

    int EmergencyPin = 11; // Emergency switch (GND)

    //motors array : Pin, currentAnalog, target, Minpot, MaxPot, pot deadzone, standby value, P, I, D, integrated error, last error, Power
    int motors[6][13] = { {A0, 0, 0, 62, 962, 0, 512, 100, 0, 100, 0, 0, 0}, //motor 1
    {A1, 0, 0, 62, 962, 0, 512, 100, 0, 100, 0, 0, 0}, //motor 2
    {A2, 0, 0, 62, 962, 0, 512, 100, 0, 100, 0, 0, 0}, //motor 3
    {A3, 0, 0, 62, 962, 0, 512, 100, 0, 100, 0, 0, 0}, //motor 4
    {A4, 0, 0, 62, 962, 0, 512, 100, 0, 100, 0, 0, 0}, //motor 5
    {A5, 0, 0, 62, 962, 0, 512, 100, 0, 100, 0, 0, 0}}; //motor 6

    int GlobalPowerPin = 12; //use a potentiometer to define the power of the motion simulator on pin A11 (12)
    int GP_select = 0; //1:use potentiometer 0:always 100%
    double GlobalPower = 1.00; //100%

    int buffer=0;
    int buffercount=-1;
    int commandbuffer[5]={0};

    int disable = 1; //Motor stop flag

    SoftwareSerial SWSerial1(NOT_A_PIN, 2); //Pin 2 utilisé pour communiquer avec la Sabertooth
    SoftwareSerial SWSerial2(NOT_A_PIN, 3); //Pin 3 utilisé pour communiquer avec la Sabertooth
    SoftwareSerial SWSerial3(NOT_A_PIN, 4); //Pin 3 utilisé pour communiquer avec la Sabertooth
    Sabertooth ST1(128, SWSerial1); //nom de l'objet communication serie avec une pin differente de TX
    Sabertooth ST2(128, SWSerial2); //nom de l'objet communication serie avec une pin differente de TX
    Sabertooth ST3(128, SWSerial3); //nom de l'objet communication serie avec une pin differente de TX

    void setup()
    {
    Serial.begin(57600);

    SWSerial1.begin(115200); //boutons 1 et 2 OFF
    SWSerial2.begin(115200); //boutons 1 et 2 OFF
    SWSerial3.begin(115200); //boutons 1 et 2 OFF

    ST_stop();

    disable=1;

    pinMode(EmergencyPin, INPUT_PULLUP);


    #if FASTADC
    // set analogue prescale to 16
    sbi(ADCSRA,ADPS2) ;
    cbi(ADCSRA,ADPS1) ;
    cbi(ADCSRA,ADPS0) ;
    #endif
    }

    void ST_stop()
    {
    ST1.motor(1, 0);
    ST1.motor(2, 0);
    ST2.motor(1, 0);
    ST2.motor(2, 0);
    ST3.motor(1, 0);
    ST3.motor(2, 0);

    ST1.stop();
    ST2.stop();
    ST3.stop();
    }

    void FeedbackPotWorker()
    {
    for(int z=0;z<6;z++)
    {
    motors[z][1]=0; //set to 0 all current analog
    }

    for(int i=0;i<ReadAnalog;i++)
    {
    for(int z=0;z<6;z++)
    {
    motors[z][1] += analogRead(motors[z][0]);
    }
    }

    for(int z=0;z<6;z++)
    {
    motors[z][1] /= ReadAnalog;
    }
    }

    void SerialWorker()
    {
    while(Serial.available())
    {
    if(buffercount==-1)
    {
    buffer = Serial.read();
    if(buffer != 'X')
    {
    buffercount=-1;
    }
    else
    {
    buffercount=0;
    }
    }
    else
    {
    buffer = Serial.read();
    commandbuffer[buffercount]=buffer;
    buffercount++;
    if(buffercount > 3)
    {
    if(commandbuffer[3]=='C')
    {
    ParseCommand();
    }
    buffercount=-1;
    }
    }
    }
    }

    void ParseCommand()
    {
    int diff;
    int i;
    bool commande = false;

    switch (commandbuffer[0])
    {
    case '1':
    i = 0;
    commande = true;
    break;

    case '2':
    i = 1;
    commande = true;
    break;

    case '3':
    i = 2;
    commande = true;
    break;

    case '4':
    i = 3;
    commande = true;
    break;

    case '5':
    i = 4;
    commande = true;
    break;

    case '6':
    i = 5;
    commande = true;
    break;

    case 'E':
    commande = false;
    unsigned long start;
    unsigned long time;
    start=millis();

    for(int z=0;z<6;z++)
    {
    motors[z][2]=motors[z][6]; //reset to standby position
    }

    time = millis();

    while(time < (start + 1500)) //1.5s
    {
    FeedbackPotWorker();
    CalculatePID();
    SetPWM();
    time=millis();
    }

    ST_stop();

    disable=1;
    break;

    default:
    commande = false;
    return;
    break;
    }

    if (commande)
    {
    commande = false;
    motors[2]=(commandbuffer[1]*256)+commandbuffer[2]; //target
    diff = constrain((GlobalPower * (motors[2] - 512)), -511, 511) + 512;
    motors[2]=map(diff,0,1023,motors[3],motors[4]); //ajustement en fonction des min et max
    disable=0;
    }
    }

    int updateMotorPid(int targetPosition, int currentPosition, int numMot)
    {
    float error = (float)targetPosition - (float)currentPosition;
    motors[numMot][10] += error;
    motors[numMot][11] = error;
    float pTerm_motor = ((float)motors[numMot][7] * error) / 100.0;
    float iTerm_motor = ((float)motors[numMot][8] * constrain(motors[numMot][10], -100, 100)) / 100.0;
    float dTerm_motor = ((float)motors[numMot][9] * (error - motors[numMot][11])) / 100.0;

    return constrain((pTerm_motor + iTerm_motor + dTerm_motor)/2, -127, 127);
    }

    void CalculatePID()
    {
    for (int z=0;z<6;z++)
    {
    motors[z][12] = updateMotorPid(motors[z][2],motors[z][1], z);
    }
    }

    void SetPWM()
    {
    for(int z=0;z<6;z++)
    {
    if (abs(motors[z][2] - motors[z][1]) <= (DeadZone + motors[z][5]))
    {
    motors[z][12] = 0;
    }
    }

    ST1.motor(1, motors[0][12]);
    ST1.motor(2, motors[1][12]);
    ST2.motor(1, motors[2][12]);
    ST2.motor(2, motors[3][12]);
    ST3.motor(1, motors[4][12]);
    ST3.motor(2, motors[5][12]);
    }

    void loop()
    {
    //Program loop
    while (1==1) //Important hack: Use this own real time loop code without arduino framework delays
    {
    FeedbackPotWorker();
    if (GP_select == 1)
    {
    GlobalPower = double(analogRead(GlobalPowerPin)) / 512.0 ;
    }
    else GlobalPower = 1.00;

    if (digitalRead(EmergencyPin) == LOW)
    {
    for (int z=0;z<6;z++)
    {
    motors[z][2] = motors[z][6]; //target = stdby
    }
    }

    else SerialWorker();

    CalculatePID();
    if(disable==0 || digitalRead(EmergencyPin) == LOW)
    {
    SetPWM();
    }
    }
    }
  10. CarlosElMaster

    CarlosElMaster New Member

    Joined:
    Feb 13, 2023
    Messages:
    9
    Occupation:
    Student
    Location:
    Miami
    Balance:
    30Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, 6DOF
    Hello,

    First of all, nice setup you got there! Props to you!

    On second hand, do you have a connection schematic of your motors? Maybe that will help us to find out where is your lack of motor power coming from.

    Greetins.
  11. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Hope it will help
    20230213_173929.jpg 20230213_175316.jpg
  12. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,395
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    150,025Coins
    Ratings:
    +10,993 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  13. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Yes Arduino micro.
    I post the code i'm using just above, in the spoiler.
  14. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    The motion rig is finally ok !
    I put an other code in the arduino, and now motors have strengh and energy.

    The last thing is that the 2nd motor on the sabertooth is less powerfull...
    Do you have an idea? I have now 18V on each motor on the sabertooth BTW.
  15. lebclem

    lebclem New Member

    Joined:
    Jan 1, 2023
    Messages:
    11
    Occupation:
    Graphiste
    Location:
    France, oise
    Balance:
    67Coins
    Ratings:
    +7 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Hi everyone,

    My setup is finally done...
    20230226_105054.jpg
    received_1138752317525533.jpeg
    • Winner Winner x 1