Main Site Documentation

Controlling motor speed


#1

Hello,

I am currently making a line follower, and i am looking for accuracy on my motor speed.

I made a test using the FEZ Panda II and the DFRobot 2A.
I set the PWM at the same value for both motors, and also ensured they were symetrically mounted on both sides of my robot.
When I run a test like this (same fixed PWM on both motors), the robot slowly drifts on one side.

So, i’m now looking for a solution. i can think of two things :

1 - Adding encoders to the motors and apply a software correction. That will help when i’ll need to "go straight and have both motors go to the same speed, but when i’ll need to follow a line and turn, how will i take the correction into account?
2 - Using stepper motors, then I’ll know exactly how fact both motors are.

Is there anyone who tried solution 1, or 2, and would like to comment, or have another solution?

Thanks in advance.


#2

1 & 2 make no sense. You then just know how many turns the motor make. You don’t know the distance they have moved (each wheel has an other diameter). I think you just have to follow the line :slight_smile:


#3

I agree. You should be making course corrections MANY times per second due to your light sensor readings. Keeping the wheels in sync shouldn’t even be an issue. Is there another part of this equation you’re not telling us? Why would you ever need to drive straight with this bot w/o using the line for navigation?


#4

I think you are right.

I just made a preliminary test of the motorshield and got focused/stuck on the fact that the wheels weren’t running at the same speed, and that drove me away from my primary objective (line following).

Thank you for clarifying this.

What I have so far now is a black & white detection system that works, and a motor system that works.

I intend to use 4 sensors that i’ll use for a proportional correction algorithm on the motors.
I also want to use a screen and buttons to communicate with the device during an initialization/calibration phase (but i may skip this part).

I will keep you posted on my progress, and i’ll make a video when I’ll have something to show :slight_smile:

Thank you again for your help.


#5

Great! We’ll look forward to seeing the video.

Oh, and welcome to the forum!