current limiting issue in DRV8874

I am trying to limit the current of my motor using Pololu DRV8874 and Arduino Mega, but I am running into a problem.
These are my connections :
EN - HIGH
PH - LOW
Vin - +12V
PMODE - LOW
nSLEEP = HIGH
VREF - 0.55V PWM
But the Current Limiting isn’t just working.
Am I doing something wrong?
If there is any other way to limit the current to the desired value, please share

Hello.

The VREF pin on the DRV8874 is not intended to be used with a direct PWM signal to VREF, but it would probably be fine with the addition of a suitable RC filter. If you are having trouble getting it working, could you provide more information about your setup including a schematic or connection diagram? What frequency is your PWM signal and how you are measuring the VREF voltage and motor current to check whether the limit is working? Is the driver working as expected other than the current limiting?

Alternatively, as mentioned on the product page, you can lower the current limit by one of these options:

  1. Apply a lower logic voltage to nSLEEP
  2. Connect an additional resistor between VREF and GND
  3. Connect an external reference voltage directly to VREF

Even if your goal is to make the current limit controllable by the Arduino, it might be useful for you to test one of the other methods above to check the basic functionality of the driver. You can find more details about how the driver’s current limiting works in the “Current Regulation” section of the DRV8874 datasheet, which is available on our carrier’s product page under the “Resources” tab.

- Patrick

I am using the Pololu DRV8874 motor driver carrier (#4035) with an Arduino Mega and a PG36M555 12 V geared DC motor (13.7:1 gearbox). My goal is to use the DRV8874’s built-in current regulation to implement torque control using the VREF pin.

Hardware setup:

  • Motor supply: 12 V battery
  • Driver: Pololu DRV8874 carrier (#4035)
  • Microcontroller: Arduino Mega
  • Motor: PG36M555 geared DC motor
  • Current feedback: IPROPI connected to Arduino A0
  • VREF generated externally
  • IMODE left at the board default (20 kΩ to GND, Level 2 / cycle-by-cycle current regulation)
  • PMODE is intended to be PH/EN mode
  • nSLEEP enabled

Connections:

  • IN1 = EN
  • IN2 = PH
  • nSLEEP = D3
  • PMODE = D4
  • IPROPI connected to Arduino A0
  • Motor connected between OUT1 and OUT2

What I observed:

Initially, the motor only ran when PMODE was left disconnected. I later realised PMODE is latched when the device exits sleep. After changing the startup sequence to:

  1. nSLEEP LOW
  2. PMODE LOW
  3. Wait 10 ms
  4. nSLEEP HIGH
  5. Vref external 0.46V(to limit current to 0.42A)
    But the motor still does not run.

My Arduino code :

#define IN1 7
#define IN2 8
#define pmode 4
#define nsleep 3

void setup() {

  Serial.begin(115200);

  pinMode(IN1,OUTPUT);
  pinMode(IN2,OUTPUT);
  pinMode(nsleep, OUTPUT);
  pinMode(pmode, OUTPUT);

  digitalWrite(nsleep, LOW);
  digitalWrite(pmode,LOW);
  delay(10);
  digitalWrite(nsleep, HIGH);
  
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
}

void loop() {

  int curr_i = analogRead(A0);
  float curr_i_to_v = curr_i * 5.0 / 1023.0;
  float curr_i_amp = curr_i_to_v / 1.1;

  Serial.print("Current: ");
  Serial.print(curr_i_amp, 3);
  Serial.print(" A     ,   ");
  Serial.print(curr_i_to_v, 3);
  Serial.println(" v");
  
  delay(500);
}

Questions:

  1. What exactly am I doing wrong?

plz provide me with the correct connections and code snippet if possible

The connections you listed and your code generally look okay, though it is not clear how you are setting (and confirming) the voltage on the VREF pin. Does everything else work on the driver work if you leave the VREF pin disconnected? Can you post some pictures that show your board and all of your connections?

If the driver is still not working after that, the next thing I suggest is connecting PMODE directly to GND instead of an Arduino I/O as shown in the PH/EN mode minimal wiring diagram on the product page.

- Patrick