Precision issue with MotorShield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
dennisgriffin
 
Posts: 4
Joined: Fri Jul 08, 2011 9:30 pm

Precision issue with MotorShield

Post by dennisgriffin »

I bought the 2WD robot platform from DFRobot and a motor shield, and I'm experiencing what I can only describe as a precision problem...and I don't know quite where to begin debugging.

I soldered it together, wired it up, and modified the motor test program to drive both motors simultaneously, ramping up to speed 255 and then back down to 0, just to verify that everything was operating smoothly before getting into anything more advanced. When I run it, the robot turns a bit, rather than going straight forwards and backwards.

Upon investigation, it appears that one of the motors starts a bit earlier, and then continues turning a bit after the other has stopped, which is causing the slight turn. I swapped the connection to see if it was the motor or the shield, and the behavior swapped too, so it appears to be the shield . I have one motor connected to M2, and the other to M3, so they're each being driven by a different driver IC. My first thought is that one of the drivers may be getting less current, so the voltage being delivered to the motor is lower, resulting in it turning less quickly or being below threshold while the other is above.

Is this something that has been seen before, and can be explained? Or can anybody suggest how I could begin to debug this without needing some of the extremely expensive equipment I remember using back in the day when I was messing with electronics (TEK logic analyzer)?

I imagine that for real precision I'll want to move to using a stepper motor, but I was expecting to at least be able to drive in a moderately straight line!

Thanks for any feedback!

Warning, I'm just getting back into playing with electronics after 20 years, so may be a bit slow on the uptake <grin>.

User avatar
brucef
 
Posts: 215
Joined: Tue May 03, 2011 4:51 pm

Re: Precision issue with MotorShield

Post by brucef »

Are you talking about this 2WD Mobile Platform? If so, I notice that they list encoders as an optional part. I'm guessing you didn't get the encoders?

dennisgriffin
 
Posts: 4
Joined: Fri Jul 08, 2011 9:30 pm

Re: Precision issue with MotorShield

Post by dennisgriffin »

That is the platform, and no, I did not get encoders. I expect that I could have a more elaborate feedback setup to compensate for the difference I'm seeing, but am still curious about the significant divergence just increasing and decreasing the power linearly.

I'm seeking not only to remedy the issue, but to learn how to determine what may be causing it.

User avatar
brucef
 
Posts: 215
Joined: Tue May 03, 2011 4:51 pm

Re: Precision issue with MotorShield

Post by brucef »

More experienced people will hopefully correct me if I'm wrong, but I don't think it's possible to get consistent, repeatable performance out of DC motors without some sort of feedback. They allude to that in the discussion of the DC motors you get with that kit.

You could come close if your motors and drivers were built with expensive, tight tolerance components and carefully tuned and all, but even then the first lump of dirt hit by one wheel would throw everything off track if you don't have feedback. Therefore designers get practical and rely on encoders to compensate for everything short of lost traction.

If you're just wanting to tinker around and get kinda steampunk on the whole thing I suppose you could try somehow measuring the cumulative current running through the motors or something, but I imagine shaft encoders are going to be the only simple, reliable option. That said, skipping the simple and obvious can sometimes lead to a better solution, so don't feel like you have to do what everyone else does.

dennisgriffin
 
Posts: 4
Joined: Fri Jul 08, 2011 9:30 pm

Re: Precision issue with MotorShield

Post by dennisgriffin »

Super, and thanks!

I'll look into how to use a wheel encoder (any pointers to some online reading?). I wonder, though, what are the relative advantages of using Steppers vs. DC Motors with Encoders. Where would I learn which would likely be the best tool for my application? Also, it seems that the MotorShield uses Pin 3, which is one of the two digital interrupt pins on the arduino, so I'm not sure that I can hook up two encoders unless I disable the use of Pin3 on the motorshield.

For info, I'm building an autonomous wheeled robot with some environment sensors to get around, likely eventually becoming a micromouse maze solve.
I'm starting with the DFRobot 2WD platform because it's cheap & complete, and I expect that I can reuse bits...however, for a competing micromouse I'll need a much smaller platform than this, so I already expect to replace everything over time as I learn.

dennisgriffin
 
Posts: 4
Joined: Fri Jul 08, 2011 9:30 pm

Re: Precision issue with MotorShield

Post by dennisgriffin »

So a little more experimentation with control...I found that the voltage supplied at the low end wouldn't reliably drive the motors during the 'ramp' of the test program....So I fiddled with the speed settings until I found the minimum that made both of the motors turn reliably. With that as my new minimum motor speed setting, I am able to make the robot move back and forth in a mostly straight line. I'm still not sure exactly where the tolerance issue is arising, but probably a combination of cheap motors & my rusty soldering skills.

I am still interested in the encoder vs. stepper question though, as I learn to make my robot more sophisticated in its controls!

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Precision issue with MotorShield

Post by adafruit_support_bill »

There are a lot of variables that contribute to the drift. Variability in the motors and friction in the gear-trains are likely the biggest ones.

Steppers are a little simpler to work with than motors with encoder feedback. As long as the steppers are sufficiently over-specified, the movements will be precise and repeatable. Encoders provide feedback of the actual postion regardless of any loading or stall condition. In ultra-critical stepper motor applications, it is not unusual to also have encoders to detect any lost steps.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”