Control a DC motor such that it outputs a constant torque

Hello,

I am new to arduino and I want to do a little project where I rotate a paddle in air and water at constant torque (so it goes faster in the air, then slow down when entering the water,...). Is there any tutorial showing how to control the DC such that the current is constant?

Thanks

Rem

You need something to measure the current. What is the range of currents involved?

However the difference in resistance between water and air is so great that this seems rather pointless. Just adjust things so the motor runs at the required speed in water and then it will inevitably run faster (probably at maximum speed) when it is not in water. I can't see how measuring and controlling the current would give different behaviour.

...R

Thanks robin.

I am just looking for a tutorial for constant current. I am aware of the air part. I was actually planning on controlling the angular velocity in the air. What is important to me is that the torque is constant in the water phase. For the current values, I will vary the values. I currently use a DC motor + gear box similar to the one in this tutorial :

Maybe you can help me out. I have found plenty of tutorial on how to control a DC motor with a H-bridge (like the link above). And in the code you have something like

int Power = 0 to 255;
analogWrite(MotorForward1,Power);

Not sure what the power means here? Is it actually a constant power target? a constant velocity? or a constant torque?
Here since the load does not vary, they all end up constant, but I would like to control the torque.

Thanks

Rem

Not sure what the power means here?

"Power" is the fraction of the time (of 255 max) that the output "MotorForward1" pin is HIGH, which depending on the wiring and motor driver, probably translates to higher average voltage applied to the motor.

It is possible to build a constant current source; google will show you typical circuits. A high voltage source and suitable resistor is an approximation of one.

Use a motor driver chip with current feedback. The VNH2SP30 is very good. You can get these on Sparkfun Monster Motor shields and their copies.

Note that you will need additional capacitance on the feedback pin when used with most Arduinos, which have a very low PWM frequency. Add 1uF to get a "more correct" result.

Then do some experiments to work out the friction losses in your particular motor and you can correct for them in the code. Most motors need a "bump" to get them moving and then you can reduce the drive power to get back to the torque setting you desire.

Thanks Morgan. I will look it up.

MorganS:
Note that you will need additional capacitance on the feedback pin when used with most Arduinos, which have a very low PWM frequency. Add 1uF to get a "more correct" result.

No, much better to fix the right problem, configure the PWM to be at a sensible frequency, small motors tend to like
8kHz+ due to their smaller inductance. Checkout various timer libraries or the datasheet for the chip to understand
how to change the timer prescale clock divider, or search here.