Roboclaw - Problems with control behavior PID

Hello all,

To understand the problem, a few data about the setup which I use for the control:

  1. 1 X DC brushed motor (sunroof motors) with hall sensor.
  2. Roboclaw 2X30A
  3. Arduino UNO
  4. SW - Basicmicro Motionstudio

With my Display controller I move to 3 positions.

  1. Start position (0 increments)
  2. Middle position (2800 increments)
  3. End position (4550 increments)

The positioning via the sketch works relatively well, I exclude errors in the sketch for now, but if someone needs the sketch for error analysis, I can gladly post it.

About the problem:

Settings of the PID controller:

I made the system (control loop) overshoot to be able to determine the limits of the P part as well as I part. Slowly corrected the values downward until a smooth and fluid movement of the engine.

If I want to move only with the P part and a D part of the motor to the positions remains a small control deviation in the positioning (5-10 increments) this is not a problem for me because the Sketch after 300ms without movement, the actual position stored as a target position. A tolerance of 20 increments is also implemented.

The Middle and End position is approached with a small control deviation. The Roboclaw stops controlling after a short time and the current goes towards 0,1A.
However, when the display returns to the start position (0 increments), an unexplained regulation remains. Current consumption up to 1,2A.

If I add an I part to the regulation, the motor hits exactly the positions but when reaching at whatever positions it regulates unexplainable white between 3A - 10A.

I have already spent hours to adjust the controler. Have any of you the same problem? Or do you have an idea what it could be.

I have worked with the “Deadzone” as well as “Error Limits” all to no avail.

Thank you very much.

Control behavior at Touch Position - perfect

Control behavior at Start Position (1) - existing control behavior

Control behavior at Start Position (2) - existing control behavior

Have you checked your power supply? It is possible that the power supply is not supplying sufficient voltage and current.

Thank you for your answer, yes the power supply is sufficient. When moving the DC motor, I only have a current consumption of 1.5 - 2A. The power supply can deliver ~ 20A at 13.5 V

Many greetings


It sounds like when you add an integral term, your system is better at reaching the target position but the current draw becomes higher. That might be a sign that it is repeatedly overcorrecting. Have you tried lowering the I coefficients to see if it improves?

Is it possible that your system is running into some kind of mechanical limit as it gets close to the start position? (Is it any better if you change the start position slightly, to 100 for example?)


Hello Brandon,

thanks for your message.

You have understood correctly, if I enter an I part, I reach exactly the positions but at each position I have an existing control behavior. I have gradually decreased the I part, but even with an I part of 0.005 there is still a control behavior.

Thanks for the information regarding the mechanical limit, I also suspected this for the first time, however, when I add an I part, it moves exactly to the start position 0.
If I remove the I part, then I do not drive exactly to the position but through my SW (block detection - at standstill, the actual position is set to target position after 900ms) and the controller also stops controlling.
Except for the start position (see previous graphics) there remains the control behavior.

Very strange behavior.