Go Down

Topic: Controlling Torque of a DC motor in a balancing robot (Read 497 times) previous topic - next topic

grasshopper

Hi everyone,
I'm trying to build a balancing robot for my uni project. I've seen several balancing robot, but I didn't understand how they did the control of the motors thoroughly.

For the LQR control strategy I'm doing, based on the state space I have, I need to act on the torque of the motors. Do you know how to control the torque of the motors? I know that torque is related to current, but I really don't know if there are some controller I can use for this task. Currently I have a previous L298N which I could use.  I know I can give a PWM signal to the controller and sense current using a sensing resistor (via the voltage on the resistor codified using one analog input), so that I could make a control loop to increase or decrease PWM in order to get the targeted torque.

But my professor told me that way I would get a lot of noise on the current signal meassured and the control would be "messy", so that seems not to be a good option.

My main questions are: Is there any controller that I can give target torque as an input and it makes all the work? Do you know if there is another model where I don't need to use torque? Do you know how to make proper control only by PWM signal?

Another problem my professor told me to figure out was the "dead zone" of the motors. That is that there is a low enough voltage for which the motor doesn't start running. So if I use  a PID strategy, when the robot is almost balanced, the output of the control loop would be low enough as not to make the motors move, so the robot would be oscillating too much.

Last, but not least, I would like to thank you for all your comments and answers. I'm sorry for my bad English, it's not my native language.


johnwasser

Balancing is usually done with a PID (Proportional Integral Differential) control loop.  The input is how far off vertical you are.  The output is the direction and PWM value for the motor controller.  Any H-Bridge motor controller (like the L298N) that can handle the voltage and current requirements of the motor will work.

There is a PID library that can help with the coding: http://playground.arduino.cc/Code/PIDLibrary

The hard part is usually "Tuning" the PID constants.  You need the control to react quickly but not overshoot.  There is an PIDAutotune library that may help with that: http://playground.arduino.cc/Code/PIDAutotuneLibrary
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

grasshopper

Thanks johnwasser for your answer.
I know this control can be done using PWM as an output, but this way it would be like a "black box model" where the controller is very generic. I would like to use my model where the output is torque because is based on the dynamics of the problem.

Any other ideas? Thanks in advance

Go Up