Control speed and distance for a rover with two dc motor with encoder

Hi all,
I saw several tutorial about controlling dc motor with opto encoder for controlling speed or distance but not both at the same time. I need to check encoder to be sure that the rover goes straight (both wheels at the same speed) controlling acceleration and distance. Is there sonething like accellstepper that also check two motors to move a rover with a programmed mouvement?

Thanks

There are good encoder libraries, and many people have written code that measures both distance traveled and speed using wheel encoders. Examples can be found on line.

1 Like

That's a mistake to look for a complete project code. Learn to split the project down to the low levels. Here there are two:

  1. Control the motor.
  2. Read and receive the encoder data.
  3. Integrate the two pieces of code.

Search for the topic "Doing several things at the same time".

1 Like

Hi Railroader, of corse. I know the topic you mentioned, I just aked for a library. I used in the past accelstepper that it's very easy to use: just set a speed, acceleration and distance to run and with just a line of code in the loop all the job it's done. The other lines in the loop (doing several things) are mine.

Such combined libraries don't exist. Use a library for the encoder. Then calculate the PWM for the motor and use a PID library to manage a certain speed.

1 Like

thanks a lot, that's probably the reason I can't find it

Imagine the huge amount of libraries, the endless amount of combinations...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.