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

Solving A Motor jumping issue (MM driver and Ard)

Discussion in 'DIY Motion Simulator Building Q&A / FAQ' started by james wheeler, Jan 23, 2016.

  1. james wheeler

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    To start with I am using the following...

    PSU = Dell server 12v , 47 a
    Ard board with racingmat code from the tutorial
    Hummer motormonster board
    12v wiper motor and 25k linear pots

    This video shows the issuse.



    I have done the fallowing tring to solve the issuse.
    Changed the pots from 10k to 25k
    Isolated and insolated the pot wires from the motor wires
    changed the psu from 47 amp to 59amp.

    what I wil try next is a 2 MM board set up
    if anyone else has had this issue or know what the cause is plase help.
  2. RufusDufus

    RufusDufus Well-Known Member

    Joined:
    Jul 21, 2013
    Messages:
    681
    Location:
    Adelaide Australia
    Balance:
    15,603Coins
    Ratings:
    +1,008 / 8 / -1
    Some thoughts:

    1. It could be that there is some mechanical flexing between the POT mount and the motor mount which is causing oscillation when the motor moves.
    2. The coupling between the motor and POT maybe loose?
    3. Alternatively the gain in the motor control feedback loop is to high for that particular motor/driver/feedback combo. Try reducing the gain in software. I'm pretty sure in @RacingMat's code it is a simple value change in one line of code to reduce the gain.
    4. It could be a dirty or faulty POT.

    What causes it to stop shaking - do you hold the seat?
    • Agree Agree x 2
    • Informative Informative x 2
  3. james wheeler

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    Al right I have been working on this issue all night and changed every piece one at a time. Including the coupling between the motor and POT . This video runs though it all. Finally a dived into the ard code. Just changing a couple of values which helped slightly but it still is not perfect. What else could I try? I think next i will change the ard and go to a duel driver config in hope to get a more persice response.



    I don't know if this is reliant but in the video around 1:38 when i slow the pot the motor gitters slowly.

    One thing I did forget to mention was I did switch the wires going between the ard and the MM
    Last edited: Jan 24, 2016
  4. pipis2015

    pipis2015 over-boost

    Joined:
    Feb 18, 2015
    Messages:
    222
    Location:
    Athens, GREECE
    Balance:
    10,248Coins
    Ratings:
    +270 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Did you change the tolerance value on the code?

    You can change the "tol" value from 30 to 40(even 50 in extreme cases).




    Just saw the whole vid

    Also... From the motor whining... I understand you are not using the ultrasonic code.
    • Creative Creative x 1
  5. pipis2015

    pipis2015 over-boost

    Joined:
    Feb 18, 2015
    Messages:
    222
    Location:
    Athens, GREECE
    Balance:
    10,248Coins
    Ratings:
    +270 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    i have been usint the same code (ultrasonic version) with arduino uno r3 and pololu dual vnh5019(ard shield equivalant to sparkfans MM).

    so i suggest you switch to the ultrasonic version.

    My project: http://www.xsimulator.net/community/threads/2dof-compact-seat-mover.6654/#post-73308

    I had some minor issues in the beginning of my setup which were solved with the following changes to the original code:

    1)tol value from 20 to 30( i saw that increasing the value in the video made things better but didnt solve your problem)

    2)brakingDistance value from 30 to 40 (braking distance must always be greater than tolerance)

    3)pwm control from:

    pwm=195;
    if (gap>50) pwm=215;
    if (gap>75) pwm=235;
    if (gap>100) pwm=255

    to:
    pwm=195;
    if (gap>50) pwm=225;
    if (gap>100) pwm=230;
    if (gap>150) pwm=235;
    if (gap>200) pwm=240;
    if (gap>250) pwm=245;
    if (gap>300) pwm=250

    for softer transitions

    EDIT: one more thing that comes to mind... do you power the arduino board with a dedicated psu?
    Last edited: Jan 24, 2016
  6. james wheeler

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    Thank you for taking the time to watch it all. I know it was long and I did try and editted down as best I could.

    I will try the other code in hopes to rule out a strange code issue.
    Also the ard does not have a dedicated power, however this is my second sim and both use all the same parts and set up and the first one did not have a dedicated power either. What power level am I looking for?
  7. pipis2015

    pipis2015 over-boost

    Joined:
    Feb 18, 2015
    Messages:
    222
    Location:
    Athens, GREECE
    Balance:
    10,248Coins
    Ratings:
    +270 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Last edited: Jan 24, 2016
  8. RacingMat

    RacingMat Well-Known Member Gold Contributor

    Joined:
    Feb 22, 2013
    Messages:
    2,233
    Location:
    Marseille - FRANCE
    Balance:
    20,875Coins
    Ratings:
    +2,079 / 21 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    @james wheeler
    did you follow the step by step procedure I advice (in the resources post)?

    1- with Arduino serial monitor: do you have same behaviour?
    no simtools, no game
    • Like Like x 1
    • Useful Useful x 1
  9. james wheeler

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    I had tried the ultrsonc code @pipis2015 and moved the ard..mm wires accordingly. changed the tolerance and >values, Nothing new. I then reverted back to the origional tryed changing the tolerance there and made sure the brake was 1/3 higher and it worked the same as the end of the video. One last is to find a psu for the ard. I also @RacingMat have gone over the guide from wiring to code. where i get stuck is the pot ratio.
    short vid



    Any suggestion on what to change?
    I am still working on a duel motor driver system.
  10. james wheeler

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    ok i have been workng on setting up a 2 driver system. i have wired it as follows insync with racingmat 2dof code

    On 1st driver board
    ARD > MM Driver
    pin 4 > pin 4 m1a
    ____> pin 8 m1b
    pin 5 > pin 5 pwm 1
    ____> pin 6 pwm2
    pin 7 > pin 7 m2a
    ____> pin 9 m2b

    On 2nd driver board
    ARD > MM Driver
    pin 6 > pin 5 pwm 1
    ____> pin 6 pwm 2
    pin 8 > pin 4 m1a
    ____> pin 8 m1b
    pin 9 > pin 7 m2a
    ____> pin 9 m2a

    I used the photo as a refference[​IMG]

    the resaul i am getting is that on thje 1rst driver i have a red light and on the second driver i have a green light once i hook up the ARDs 5v and ground even with no psu attached

    Last edited: Jan 25, 2016
  11. Pit

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

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

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    @Pit what code is the ARD using. I ask because I notice the pins are not starting at port 4 and running to port 9.
    also why do I get a green and red light.

    After studding your picture it appears that the wiring is opposite then the reference i got from
    Monster Moto Shield acts as a single motor driver = more power!
    In the reference the split wire shares the same motor.

    Expamle
    2dof code pin4 = M1inA and in the reference M1inA is shared with M1inB

    However in you picture the split wire shares the same channel.

    Example
    2dof code pin2 = M1inA and in picture M1inA is shared with M2inA

    So I need to wire Racingmats 2DoF code as follows

    ARD...............> MM Drivers
    Pin4 (M1inA) > Pin4 M1inA + Pin7 M2inA (1rst MM driver)
    Pin5 (pwm1) > Pin5 pwm1 + Pin6 pwm2 (1rst MM driver)
    Pin6 (pwm2) > Pin5 pwm1 + Pin6 pwm2 (2nd MM driver)
    Pin7 (M2inA)> Pin4 M1inA + Pin7 M2inA (2nd MM driver)
    Pin8 (M1inB)> Pin8 M1inB + Pin9 M2inB (1rst MM driver)
    Pin9 (M2inB)> Pin8 M1inB + Pin9 M2inB (2nd MM driver)

    Does this seem more correct than my previous post?

    The reason I am doing all this is, after changing the configuration of the hardware and adjusting the tolerance in the ard code I am triing a new board configuration.

    If this solved the issue I will try with a Ard and one MM driver to see if it is a power management issue. If it works then I will swap the Ard boards to isolate weather it was a issue with the Origional Ard or MM driver.
    Last edited: Jan 25, 2016
  13. Pit

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

    Joined:
    Oct 2, 2013
    Messages:
    3,013
    Location:
    Switzerland
    Balance:
    30,409Coins
    Ratings:
    +3,088 / 31 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    You used the VNH5019 board layout as a reference so I uploaded the wiring of the VNH5019 but using the SMC3 code
    • Useful Useful x 1
  14. james wheeler

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    Sorry I should have mentioned the set up
    Ard-2 hummer motor monster & racingmat 2dof code.
    The code is written for the mm driver as a shield. I simply converted the pololu vnh5019 to a Mm configuration. But when comparing the diagram and your actual picture it appears that the setup is opposite.
    Have you ever got a red and green light as I showed in the end of the video?
  15. james wheeler

    james wheeler Active Member

    Joined:
    Mar 17, 2014
    Messages:
    185
    Balance:
    216Coins
    Ratings:
    +48 / 1 / -0
    My Motion Simulator:
    2DOF, Arduino
    I have a question @RacingMat . Is there a way to increace the braking power of a motor?
  16. OZHEAT

    OZHEAT Active Member

    Joined:
    Oct 26, 2015
    Messages:
    208
    Location:
    Australia
    Balance:
    2,458Coins
    Ratings:
    +105 / 6 / -0
    My Motion Simulator:
    3DOF, DC motor
    @james wheeler
    For you motor jumping issue, I have a large feeling that your problem is a combination of cumulative parts.
    1. Worm drive gearboxes have large backlash.
    2. your pot @ 25K instead of the usual 10k pot.
    3. The mounting of the pot.

    All of these will lead to a hunting motor with the most important being the use of the 25k pot.
    I will assume that you changed with the intention of improving the range of voltage/precission but in reality you have made it worse.
    I will compare the 2 different pots so you can see why you have lost precission, lets say that your pots range equal around 170deg. With a 10k pot that 170deg might translate to 0.7 -3.8V returning to the ardinino's A/D converter, while the 25k pot may range from 0.2 -4.6V. It may seem that you have increased precission as you have changed the voltage range but in reality you haven't because both pots move only 170deg, all you have done is made each 1deg equal say 0.03V with the 25k pot compared to 0.02V with the 10k pot.
    Lets compare the 2 pots with a relatively small movement of 3deg which would translate to 25K pot = 0.09V and 10K pot = 0.06V, it is clear to see that the 25K pot is going to make a larger change in voltage for the same movement compared to the 10K pot.

    Now all geartrains be it belt,screw or gears have backlash. What is backlash? Backlash is the lost motion that occurs when the motor changes direction but the driven gear doesn't move till the backlash has been taken up, geartrains require there be some gap between gears otherwise they will seize.
    The use of worm drive gearbox while being a high ratio of 50:1 will have a relatively large backlash, highest of all gearbox types. You may have 1/8 - 1/4 turn of the worm shaft before the gear moves on each change of direction.

    Finally we come to the issue you are experiancing.
    lets say for both 25K & 10K pots it is 2.00V at center.
    When the ardinino/controller commands that it wants to be in position 0 or center and wants to hold that position, the motor will move in the direction trying to make the pot equal 2.00V
    It is very hard for the controller to stop dead on 2.00V and usually undershoots or overshoots the 2.00V point. Depending on controller deadzone setting it will try to correct the under/overshoot for example a deadzone of +/-0.05V. Now go back up and you can see that with the 25K pot that translates to around 1.3deg while the 10K pot will be 2.5deg
    This is where it all comes together...using 25K pot.
    1- actuator is at the bottom position pot=0.20V
    2- Controller commands center position
    3- controller determines it needs to rotate clockwise
    4- move motor clockwise
    5- check if pot =2.00+/- 0.05V (position requested +/- deadzone setting)
    6- if undershoot <1.95V yet, keep repeating move till 2.00V
    7- If overshoot ie >2.05V reverse motor
    8- if 1.95V - 2.05V stop motor and hold position, Target realized.

    It is during the phases 6-7 that is the ocillation you experiance due to constant over and undershooting and the controller trying to correct the error.
    When trying to make small corrections a combination of things will happen.
    The backlash of the gearbox will have lost motion so at each change of direction the motor will move but no change in the pot occurs, controller keeps power on...
    Backlash has been finally taken up and due to the motor's acceleration and inertia it has past it's set point.
    Now its gone too far and it is commanded to reverse, it goes through the backlash routine and has overshot and now need to go forward again...It will continue to do this until it luckily hits 1.95 - 2.05V and stops or the controller commands a different position.

    In reality, in the motion sim using worm gearboxes and pots has a large backlash component.
    As said previously the gearbox/motor backlash but there is also the pot that will add backlashish behavior.
    If the mounting and connection of the pot to output shaft has any play in them it will cause the same effect as backlash at each change of direction. I would suggest a solid coupling from pot to output shaft, no motor couplers especially the ones with the polyurethane spider in the middle and a soilidly constructed pot mount. Any sloppyness translates the same as backlash.
    In the real motion control world it is a big no-no to put the position sensor after the gearbox due to backlash which has a high chance of oscillation unless a high deadzone is allowed for, reducing precision. This is why you will see industrial servo motors with position sensor directly connected to the motor's shaft.
    Pots also experience a thing called "sticksion" or "stick slip" which means when the pot shaft is stationary it requires more torque to initally move the shaft causing a slight jump than when it is allready moving due to friction. That slight jump translates to non-linear voltage jump

    Finally in conclusion...
    Change your pot to a lower value 10K ohm
    Solid mount of pot shaft to output shaft.
    Solidly mounted pot to base, if you need to allow for misalignment the use of hard rubber between pot mount and base will allow for slight misallignment.
    Increase deadzone in motor settings but remember higher deadzone equates to less finer effects being felt.

    Sorry if this is long winded and slightly confusing as I'm a slow typer and tend to forget what I was going to say by time I get to finding the correct letters.

    Cheers Andy
    • Useful Useful x 2
    • Informative Informative x 1
  17. RacingMat

    RacingMat Well-Known Member Gold Contributor

    Joined:
    Feb 22, 2013
    Messages:
    2,233
    Location:
    Marseille - FRANCE
    Balance:
    20,875Coins
    Ratings:
    +2,079 / 21 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    you can increase the PWM values in the ramp but your motor gear teeth have to cope with that and your Hbridge with higher current
  18. h106frp

    h106frp New Member

    Joined:
    Jul 18, 2015
    Messages:
    17
    Location:
    UK
    Balance:
    117Coins
    Ratings:
    +42 / 0 / -0
    My Motion Simulator:
    2DOF
    You may need to investigate a back EMF / voltage clamp /regen braking circuit to avoid having the PSU constantly shutting down and re-starting due to high voltage appearing at its output terminals if you increase braking
  19. pipis2015

    pipis2015 over-boost

    Joined:
    Feb 18, 2015
    Messages:
    222
    Location:
    Athens, GREECE
    Balance:
    10,248Coins
    Ratings:
    +270 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    The main reason that a bigger than 10kohm pot will cause problems on the arduino adc (analog to digital converter) readings is that high impedance values make the S/H (sample and hold) capacitor charge slower (affecting sampling accuracy)...thus giving possible erratic values.

    For anyone interested you can check how the analog input cirquitry works.


    edit:
    another thing that comes to my mind:
    The lower the impedance of a pot, the greater the demand on the source to drive it(higher current but stronger signal).
    The greater the impedance of a pot, the greater the vulnerability of its signal to noise .
    Last edited: Jan 27, 2016
  20. pipis2015

    pipis2015 over-boost

    Joined:
    Feb 18, 2015
    Messages:
    222
    Location:
    Athens, GREECE
    Balance:
    10,248Coins
    Ratings:
    +270 / 1 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    @OZHEAT

    i read your examples but i got a little confused.i think you make some wrong asumptions.

    A pot is an adjustable voltage divider.
    As in any voltage divider ...the resistor values used don't affect the signal.
    ONLY the ratio of the values affect the signal.
    If you have two pots with different total resistances (one 10k and the other 20k as in your example) but with the same taper(linear in our simulators), their ratio of the resistances is the same across the entire sweep of each pot.
    The voltage division is the same at the same point in the travel (sweep) of each pot.
    The voltage output is the same for each pot at a given position.
    Given our goal is to balance source load with the noise interference we choose the best pot according to aplication.

    All the above are explained with Ohms Law.
    • Like Like x 1