I am working on a mecanum wheeled robot. It has four dc motors, two motor drivers (each controlling two motors). Feedback for distance travelled and angle is taken from four encoders. Now the problem is: all the motors at same PWM are not giving same counts. Some times one motor starts giving more counts and after sometime when I run the code again, the same motor's encoder count is lowest. Motors are running with different rpm at same PWM. Due to this issue, feedback from four encoders for distance travelled is not correct as I am using average of all four encoders to measure distance travelled by robot. Robot stops at before it travels the required distance. I have been facing this issue for a week now. I tried searching solutions online but couldn’t resolve the problem. Please help me out. Thanks in advance.
Hi,
Can you post;
A schematic diagram, include power supplies, component names and pin numbers.
What model Arduino you are using.
Are you using a motor driver module?
Specs on the motors.
Thanks.. Tom..
That's normal and that's why you are using encoders to find out what each motor does and how to adjust its control.
I am using Arduino Mega and encoders are connected to interrupt pins of mega. Motor driver module is L298N and specs on motors are 30.3VDC 19.7 1 Ratio 500cpr.
Could you please elaborate a little more. I am still confused. How can I possibly solve the problem?
No, they won't. The PWM of each motor needs to be adjusted, continuously tuned by your code, to try to make the counts the same.
If PWM is continuously changing, won't it make robot move with jerks?
Not really. The adjustments will be small and should not cause any visible jerking.
See post 2
It will compensate the jerks produced by the different motors. Typically a PID controller is dedicated to every single motor.
Is there a way to tune PID without model? or I have to go with hit and trial method?
What do you mean?
As far as I understand PID, for tuning a model of system i.e dc motor is . Then based on simulated analysis, PID gains are found and then implemented. But I have motors and I am stuck where to start PID thing for my robot.
so you think you can find the value of individual PWM for each motor through trial and error? Well it might make it go straightER.
I have no special recommendation, but search for "PID tuning" and read some of the tutorials.
Hi,
Some pictures of your project and circuit diagram would be helpful.
Please include your power supplies, component names and pin labels.
Please do not use Fritzy image, a photo of a hand drawn schematic will be fine.
Tom...
Rarely, and usually only in advanced applications. With motor speed control, very little experimentation is needed to find a "P" value that works well, and that is all you need for a hobby project.
P value is changing for every different situation i.e. Whne robot is moving straight and when its turning at certain angle. How to solve it?
The "situation" is encoded in the reduced motor speed at the input of the PID. The P value indicates how much power is supplied to the motor when the speed differs from the set point.
The P value is a number that you decide to use, based on the results of experiments you do.
So pick a reasonable compromise.