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

Hobsi simulator

Discussion in 'DIY Motion Simulator Projects' started by hobsi, Dec 3, 2017.

  1. hobsi

    hobsi New Member

    Joined:
    Dec 3, 2017
    Messages:
    3
    Location:
    Vidin, Bulgaria
    Balance:
    154Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, 4DOF, 6DOF
    1. Arduino IDE and STM32 based position contrler
    2. Motors DC from car wipers
    3. Encoder
    3.1 rotary and lineal encode type (two signals for one axis)
    3.2 rotary and lineal based on variable resistor(one signal for one axis)
    4 current controll logyc
    4.1 Porpotional (current=kp*(targetposion-curentposition))
    4.2 PID current control
    5. Mechanical consrtruction is discussed
  2. Daguru

    Daguru Rally drivers do it in the Dirt

    Joined:
    Sep 4, 2013
    Messages:
    719
    Occupation:
    Kitchen installer
    Location:
    Wales uk
    Balance:
    454Coins
    Ratings:
    +632 / 1 / -0
    My Motion Simulator:
    Motion platform
    good luck with your project and would love to see some plans ;)
    • Agree Agree x 1
  3. hobsi

    hobsi New Member

    Joined:
    Dec 3, 2017
    Messages:
    3
    Location:
    Vidin, Bulgaria
    Balance:
    154Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, 4DOF, 6DOF
    for now i make this
    Code:
    #include <Servo.h>
    
    #define srv1_PIN PB9
    #define srv2_PIN PB8
    Servo s1,s2;
    
    bool wsp=false;
    bool wsv=false;
    bool wfp=false;
    bool wfv=false;
    bool wt=false;
    bool wd=false;
    
    bool lwsp=false;
    bool lwsv=false;
    bool lwfp=false;
    bool lwfv=false;
    bool lwt=false;
    bool lwd=false;
    
    bool sa=false;
    
    int cnt=0;
    
    unsigned char lrx,rxbyte,p;
    
    void lss()
    {
      lwsp=wsp;
      lwsv=wsv;
      lwfp=wfp;
      lwfv=wfv;
      lwt=wt;
      lwd=wd;
    }
    
    void cls()
    {
    lss();
    wsp=wsv=wfp=wfv=wt=wd=false;
    }
    
    
    void SerialServicer()
    {
    if (Serial.available() > 0)
      {
        lss();
        cnt++;
      //sa=true;
        lrx=rxbyte;
      rxbyte=Serial.read();
      if(wfv || wsv)
        {
        Serial2.print(rxbyte,DEC); 
        }
      else
        {
        Serial2.write(rxbyte); 
        }
      if(wsv)
        {
          s2.write(rxbyte/1.4);
          wsv=false;
          wt=true;
        }
      if(wsp)
        {
        wsp=false;
        if(rxbyte=='S')
          {
          wsv=true;
          }
        else
          {
            wt=true;
          }
        }
        if(wfv)
        {
          s1.write(rxbyte/1.4);
          wfv=false;
          wsp=true;
        }
      if(wfp)
        {
        wfp=false;
        if(rxbyte=='A')
          {
          wfv=true;
          }
        else
          {
            wt=true;
          }
        }
      if(wd)
        {
        wd=false; 
        if(rxbyte==10)
          {
          wfp=true;
          }
        else
          {
          wt=true;
          }
        }
      if(wt && (rxbyte==13) && !wsv )
        {
          cls();//wt=false;
          wd=true;
        }
      if(wt && wsv)
          {
            wsv=false;
          }
      } 
    }
    
    void setup() {
      // put your setup code here, to run once:
    Serial.begin(115200);
    Serial2.begin(115200);
    s1.attach(srv1_PIN);
    s2.attach(srv2_PIN);
    //s1.setMinimumPulse(1);
    //s1.setMaximumPulse(2);
    wt=true;
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      if(sa)
        {
        Serial.print(cnt,DEC);
        Serial.print(" ");
        Serial.print(lrx,DEC);
        Serial.print(" ");
        Serial.print(rxbyte,DEC);
        Serial.print(" ");
        Serial.print(lwfp);
        Serial.print(lwfv);
        Serial.print(lwsp);
        Serial.print(lwsv);
        Serial.print(lwt);
        Serial.print(lwd);
        Serial.print(" ");
        Serial.print(wfp);
        Serial.print(wfv);
        Serial.print(wsp);
        Serial.print(wsv);
        Serial.print(wt);
        Serial.println(wd);
        sa=false;
        }
     
    SerialServicer();
    }
    

    Attached Files:

  4. hobsi

    hobsi New Member

    Joined:
    Dec 3, 2017
    Messages:
    3
    Location:
    Vidin, Bulgaria
    Balance:
    154Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, 4DOF, 6DOF
    DC Motor Driver an angular Fed back Regulation P(current=kp*(targetposion-curentposition)
    -Problem: Very Hight Curent in revese monent, "kp" is 0.03 and curent is to smal without mehanical load.

    Attached Files:

    • Like Like x 1