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 motion platform build.. again (It's been a while)

Discussion in 'DIY Motion Simulator Projects' started by wimpo`, Oct 15, 2017.

  1. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    Hi it's been a while since I was even remotely active on this forum.
    A couple years back I tried building a motion sim, however the learning curve for the electronics and my initial goals where to high for me.
    I tried building a joyrider/seatmover fankenstein combo.
    The control board I wanted to use was a arduino mega, back than I even sent one to tronicgr. The amc1.5 was the board that was used for motor controll. I never got it working tho:(. that's why I wanted to use the arduino wich was "easier" to program. I started programming with the arduino an used a devantech MD03 motor driver board for the motors. I blew 4 of those a 80$ a pop.
    And the motors that where used had to much play and used to much power, 24v at 120w. Nowadays that isn't to much power because the motor drivers/H-bridges are al lot more affordable now.
    So I gave up, I just didn't have the motivation for it anymore.

    Now a couple of years later I was reorganising the attic, that's when i've found my old stuff back.
    And in dire need of a hobby, i've decided to give it another try.

    Here is what i've been up to in my spare time.

    I've gathered the electronics that i had , and ordered what I think I needed.
    This is what i have/had so far:
    1x Arduino mega r3 2560
    [​IMG]
    4x El cheapo aliexpres moto monster board.(none of them worked, did not reverse or whent up in smoke or blew up.)
    [​IMG]

    4x Double BTS7960b (Did not work when 5 volt was connected, only ground, Lpwm and Rpwm decided the direction Len and Ren did absolutely nothing.... then they blew up) .
    [​IMG]
    2x continuous rotation pot 10Kohm (Did not like the delay it gave when reading pot values + noise)

    2x incremental encoder 360CPR (this with the use of the extra interupt pins on the arduino mega works)

    2x 24v 300w wormgear motors.

    And last but not least...
    2x Dual Motor Driver Module Board H-bridge DC MOSFET IRF3205 3 -36V 10A 30a peak. wich looks a bit weak.
    [​IMG]

    however these are also for sale on aliexpres with cooling blocks atached, their rating is 30A 60A peak. So i added the cooling blocks myself en use the h-bridge with both motor inputs/outputs as one h-bridge. And I added solder on the thick traces.

    For now I am testing these motors with a 12v 40a supply, with a 25a fuse on the + lead. Using only 1 motor. The fuse burned out a couple a times, however the h-bridge did not show any signs of heating up.

    The programming side of things is slowly moving forward because i keep changing my goals.
    This is what i was thinkering with today, it's a crood way for proportional motor control. But it works...sorta

    #define ENCODER_OPTIMIZE_INTERRUPTS
    #define pwmpin 10
    #define dirpin 12

    #include <Encoder.h>
    // Change these two numbers to the pins connected to your encoder.
    // Best Performance: both pins have interrupt capability
    // Good Performance: only the first pin has interrupt capability
    // Low Performance: neither pin has interrupt capability
    Encoder myEnc(2, 3);
    // avoid using pins with LEDs attached

    void setup()
    {
    Serial.begin(250000);
    // set timer for 31.000hz pwm only pin 9 and 10.
    int myEraser = 7;
    TCCR2B &= ~myEraser;
    int myPrescaler = 1;
    TCCR2B |= myPrescaler;
    }

    long oldPosition = -999;
    int pwm;
    int target;
    int error;
    int minpos = 0;
    int maxpos = 30000;
    int maxerror = 250;
    int minpwm = 120;
    int maxpwm = 254;

    void loop()
    {
    long newPosition = myEnc.read();
    if (newPosition != oldPosition)
    {
    oldPosition = newPosition;
    }

    target = map(analogRead(A0),0, 1023, minpos ,maxpos);
    error = abs(newPosition - target);
    pwm = map(error,minpos, maxpos, minpwm ,maxpwm);

    Serial.print(" Error:");
    Serial.print(error);
    Serial.print(" PWM:");
    Serial.print(pwm);
    Serial.print(" Target:");
    Serial.println(newPosition);

    if(newPosition >= target)
    {
    if (error <= maxerror)
    {
    digitalWrite(dirpin, LOW);
    analogWrite(pwmpin, 0);
    }
    else
    {
    digitalWrite(dirpin, LOW);
    analogWrite(pwmpin, pwm);
    }
    }
    else if (newPosition <= target)
    {
    if (error <= maxerror)
    {
    digitalWrite(dirpin, HIGH);
    analogWrite(pwmpin, 0);
    }

    else
    {
    digitalWrite(dirpin, HIGH);
    analogWrite(pwmpin, pwm);
    }
    }

    }

    I want to implement PID of course but haven't found the right/easy way to do it yet.

    And I now what you're thinking, why re-invent the wheel. Just use what already worked for others.
    But that's just it, I like doing it this way. This way I get to learn how these things work. This way it's also easier to change the way how I want it to work. And with the things I learn from this, I can also use for other projects.

    I always forget to properly document what i'm doing, so here are some pictures/video of what i did.

    WhatsApp Image 2017-09-17 at 21.28.37.jpeg
    Bunch of shite motor drivers.

    20171015_190435.jpg
    Tinkering with the programming


    My first platform using wipermotors. This way of doing things is now of the table. I will be building a new compact platform with the 24v wormgear motors.

    So not a lot to show yet, but at least it's a start...

    I wanted to use the simtools software for further testing and programming, but I understand this can only be done with a license. Is this already enough to get such a license? Or am I being to frank?

    Well I will at least thank everybody with already providing so much information, this forum was and is realy helpfull and full of great ideas:thumbs

    Best regards,
  2. wimpo`

    wimpo` Member

    Joined:
    Jul 27, 2008
    Messages:
    89
    Occupation:
    metselaar
    Location:
    nederland, twente, vroomshoop
    Balance:
    178Coins
    Ratings:
    +5 / 0 / -0
    20171015_205105.jpg
    the h-bridge with thicker traces and kooling blocks attached

    20171015_205054.jpg
    How i mounted the encoder to the motorshaft, not the wormgear.
    0/18000 steps is about 200 degrees of rotation.

    testing the code and motor

    ... a long way to go..
    • Like Like x 1