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

Question Motor Control Theory

Discussion in 'Motor actuators and drivers' started by Alexey, May 18, 2017.

  1. Alexey

    Alexey Well-Known Member

    Joined:
    Sep 23, 2014
    Messages:
    452
    Occupation:
    Electronics Technician
    Location:
    Adelaide, Australia
    Balance:
    8,060Coins
    Ratings:
    +620 / 2 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Hello all!

    I have recently started to play around with stepper motor control and I have gotten a little stuck and would like any advice on a way forward.

    So far I have managed to use the SMC3 "Target" value to control a stepper motor and follow any waveform generated by the utility. But..... I have encountered a flaw in the accelstepper library in arduino. For those who don't know, the accelstepper library applies an acceleration/deceleration to any movement performed by the stepper motor. While this is great for moving point to point, I have found that when following a sine wave motion profile the motor will jitter into position. I think this is because a new target value is given in quick succession and the stepper motor does an acceleration/deceleration for each target value. The motor does not have enough time to complete the movement before a new target position is sent and thus the motor stops part way through the movement and tries to accelerate to the new position. One thought was to ignore any new positions until the first position was reached but the flaw in this design is that the motor will decelerate upon reaching the position, which is unwanted as the motor should move smoothly the whole path of the sine wave.
    While it would be smoother there still would be jitter in moments when the motor gets to the given positions.

    So, in my mind what needs to happen is to feed the positional data to the controller and get the motor to move there as usual. But only apply a deceleration if no new positional data is given, so while following a sine wave the controller should tell the motor to accelerate to the position and if a new position is given, continue to that position rather than calculate a new acceleration curve for every new position.

    It is all well and good of me to say this but I am still very new to coding and I am not too sure how to handle this or if it is even the correct direction to go. I'm not asking anyone to write the code for me but any pointers or advice would be greatly appreciated.
  2. Pit

    Pit - - - - - - - - - - - - - - - - Gold Contributor

    Joined:
    Oct 2, 2013
    Messages:
    3,013
    Location:
    Switzerland
    Balance:
    30,417Coins
    Ratings:
    +3,088 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF