Currently I am building a omnidirectional robot with 4 DC Motors with embedded incremental encoder.

However, with a constant pwm input, i am not able to control the motor to rotate in a "relatively stable" state, refer to the figure, it can be observed that the linear speed of the motors can varied in 10cm/s range. I believe one possible reason is the PWM signal generated from my Arduino Mega Controller is not good enough.

And my problem is how can I implement a stable PID controller in this case? As the speed of the motor varies even with the same input, I believe extra work like adding a filter is needed?

Any advice is appreciated >.< Thank you

Velocity feedback (cm/s) against time

  • $\begingroup$ Can you provide the code you have used to generate the PWM signal and the datasheet for the motors? $\endgroup$ – Chuck Jun 17 '15 at 13:35
  • $\begingroup$ What motors do you use? How are the motors positioned? How are the motors connected to the arduino? How is the encoder connected to the arduino? How is the motor powered? What control scheme are you currently using? $\endgroup$ – Bending Unit 22 Jul 21 '15 at 15:15
  • $\begingroup$ You need to implement a current controller first and then a velocity controller. What you do is open loop control of the current using PWM, this is not stable. You have to add a feedback loop for the the current, and then another outer loop for the velocity. $\endgroup$ – jjack Jul 25 '15 at 19:37

I have used Arduino and the PWM signal worked fine.

Have you tried supplying the motors from a DC power source, just to see how they react to a constant DC power signal, not a PWM?


Have you checked the supply voltage of the sensors? Sometimes PWM can cause problems. If that is not the problem try to measure the voltage/current directly on the sensor using a scope. If this is stable something else is wrong in your circuit or arduino

EDIT: think I read it wrong. Is the driver you are using correct? is the signal which the arduino delivers good? Sometimes a pull-up resistor will do the trick.

If everything functions well, the PID values are not chosen correctly. Try using the ziegler and nichols method if this is posssible

  • 1
    $\begingroup$ I don't think a PID controller has been implemented yet. As I understand the problem statement, I think OP is saying, "If open loop response is unstable, how can I control it?" I agree with you that I think there is a problem with the PWM signal, either on the transmission (arduino) end or the receiving (motor) end. $\endgroup$ – Chuck Jun 17 '15 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.