I am new here, I actually work on application programming.

As a hobby I started to work with arduino and dc motors. Soon I ended up with backlash problems. Right now I am using a rotary encoder which give 4000 counts per rotation.

This is with a 12v planetary geared dc motor. I also tried with spur geared motor.

I am able to control the motor. But it's not very precise. The difference between counts changes each time.

For example, when I try to stop motor at 2000 counts it will stop anywhere between 2004-2016 counts. This problem is due to backlash. I connected the encoder to motor shaft using a timing pulley.

What if I attach a disc to motor shaft and stop it using solenoid. Anyone ever tried something like that or any other inexpensive idea.

I am from India and I do not get precise products easily here. I can post pictures of setup if needed. I shall give up with DC motor and opt for stepper?

  • 2
    \$\begingroup\$ This is not due to backlash, because the motor would stop at 2000 counts, it doesn't know about backlash. You can check backlash only with a scale: like motor stops at 2000 counts, then you apply external force and you have +/- mm of clearance, this is called backlash. \$\endgroup\$ – Marko Buršič Mar 23 '16 at 14:58
  • \$\begingroup\$ There is mechanical backlash. Is there anyway to avoid it \$\endgroup\$ – Aadam Mar 23 '16 at 15:03
  • \$\begingroup\$ Yes if your encoder is attached to a load, then the motor should track the position error everytime. \$\endgroup\$ – Marko Buršič Mar 23 '16 at 15:22
  • 1
    \$\begingroup\$ The only way to eliminate backlash is to get a mechanical setup which doesn't have any. Helical gears would be better than plain, but still not perfect. Otherwise you are limited to algorithms like a manual machinist uses on a tool with traditional acme screws - slow down as you near the setpoint and make sure not to cross it. If you do, you'll have to back up more than the backlash distance and reapproach in the same direction. A simple PID with backlash in its feedback will either oscillate or stop at an innacurate position. \$\endgroup\$ – Chris Stratton Mar 23 '16 at 15:49
  • \$\begingroup\$ They make spring loaded anti-backlash gears. (google) \$\endgroup\$ – George Herold Mar 23 '16 at 15:54

Why don't you use a control loop to integrate out the count error? You want to stop at 2000 and without a controller it stops at maybe 2010. If you had a feedback system it might overshoot up to 2016 but the feedback would bring the output shaft rapidly back to position 2000.

Can you live with this type of overshoot? More sophistication can be incorporated so that the motor begins to decelerate as position 2000 is reached. A 3 term controller might be what you need and the basic overshoot could be possibly halved or more.

However, if the optical encoder is not on the output shaft then it won't work.

  • \$\begingroup\$ Thanks for quick response. I have attache the encoder to output shaft using timing pulley that is not a problem right? and I am using a dc motor driver which break(halt) the dc motor immediately. as you suggested bringing it back to position, there would be a lot of problem if it already crossed the given point. Second you suggested to slow down the motor I think this would really work if the motor is rotating continuously for some time. What if I what to take next move from 2000 to 2020. Here I think the motor starts and the remaining distance will be already covered by the back lash. \$\endgroup\$ – Aadam Mar 23 '16 at 14:45
  • \$\begingroup\$ Feedback won't help in the presence of mechanical backlash. Most likely the system hunts back and forth around the set point. \$\endgroup\$ – WhatRoughBeast Mar 23 '16 at 15:00
  • \$\begingroup\$ Yes there is minor mechanical backlash as I can read in encoder points with manual shaft movements \$\endgroup\$ – Aadam Mar 23 '16 at 15:02
  • \$\begingroup\$ I am ready to change motor, its provides 38kgcm of torque. Now what is the equivalent of that which I should buy? Also what about the bold text in my question, will that work out? \$\endgroup\$ – Aadam Mar 23 '16 at 15:04
  • \$\begingroup\$ @WhatRoughBeast there are plenty of systems (if not most) that have mechanical backlash and use feedback systems and live with the problems backlash creates. The net benefit of feedback even in the presence of backlash can be valuable nonetheless. \$\endgroup\$ – Andy aka Mar 23 '16 at 16:05

Backlash is caused by the gear teeth not fitting tightly together. The result is that the gearbox output shaft will sit in a different position depending on whether it is pulled in one direction or another. If the load always pulls against the direction the gearbox is driving then the gears will stay together and backlash shouldn't be a problem. If the load may pull in either direction then you might be able to bias it to one side with a spring.

However I think your problem is not backlash, but inertia.

when I try to stop motor at 2000 counts it will stop anywhere between 2004-2016 counts.

This suggests that the gearbox is not stopping as soon as you stop the motor. When you remove power from the motor it won't stop immediately because it takes time for the armature and gears to decelerate, and the load may also have inertia which pulls the gearbox output along with it. The only way you can fix this is by stopping the motor before the count gets to where to you want it. For example, if you know it runs on by 10 counts then you can stop at 1990 counts and let it run on to 2000.

Getting an exact run-on count can be difficult if the load varies. You can reduce this problem by slowing the motor down as it gets close to the target position, then it will take less time to stop and the run-on count variation will be less. If you make motor speed proportional to positioning error then it will automatically get slower and slower as it approaches the target position.

  • \$\begingroup\$ I agree with what all you said. The problem is the error count is varying. Also it is different for forward and reverse. One more prob is what if I want to move by few counts. Like from 0 to 10. How can I minimise positioning error in this case. As the displacement would be almost equal to error \$\endgroup\$ – Aadam Mar 24 '16 at 5:36
  • 1
    \$\begingroup\$ Slow the motor down until each count takes longer than the motor/gearbox takes to stop. Then it should only go for one more count at most. \$\endgroup\$ – Bruce Abbott Mar 24 '16 at 15:38

You can use relay to stop the dc motor fastly, make some circuit that make dc motor shorted afther relay contact changing.

  • 2
    \$\begingroup\$ A relay is likely quite a poor choice for motor control. \$\endgroup\$ – Dmitry Grigoryev Mar 11 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.