torque rpm curve in arduino

Hi

I have a school project where we need to control a dc motor of robot with a arduino and shield, but i'm new to arduino and can't figure out how to control the torque of a dc motor with an arduino.

The problem is that I would like to use a DC motor where I reduce the rpm wich would result in a increase of torque, as is seen in the graph.

But how do you describe this in your sketch, I used the code below.

#include "DualVNH5019MotorShield.h"

DualVNH5019MotorShield md;


void setup()
{
  Serial.begin(115200);
  Serial.println("Dual VNH5019 Motor Shield");
  md.init();
}

void loop()
{
  int i = 380;
  md.setM1Speed(i);
  Serial.print("M1 current: ");
  Serial.println(md.getM1CurrentMilliamps());    
}

But when you set te value low (so low speed) then you should have a high torque and low speed, when you set the value high then you would have a low torque and a hight speed.
but when we test this with the motor then you see that the torque is at its highest when the value is the highest and then also the speed is at it's highest.
And when you decrease the value than the speed is lower but also the torque is much less.

BTW we use at school an adjustable power source for the motor shield, and when we only use this power source and not the arduino with shield then torque increase when the rpm decreases as decribed in the graph

My question is how can I get a high torque with a low speed (rpm) as described in the graph using my arduino mega 2560 and pololu vn5019 motor shield ?

Hi.

That power supply you use, what is that you are setting ?

Voltage, current or really power ?

Current is what you need to control the power.
It is also what you are setting with a motorshield.
Voltage sets the speed.
But these will influence each other.
The combination of voltage and current is known as power

If you do not control the motor, it will draw a certain current at a certain voltage (power = voltage times current; P=U*I ).
If you drop the voltage, the current will go up and vice versa, so an attempt is made to keep the same value for power.
If you control the current, you'll also see the voltage change.

Of course this is within limits, and other inlfuences should also be taken into account.
Like the load you are trying to haul, and your gearbox is also a load.

So if you need to control speed and power, you need to control both voltage and current.
And that will not be an easy thing to do, because they will interact.
A motorshield will not offer voltage control.
That is based on PWM, and will control the current (you've even got that word in your sketch).
Low voltage and high (or uncontrolled) current would result in high torque.

If you want this, then you need some other solution than a motorshield to do this.
You need voltage control, not current control.

How are you measuring torque?