DRV8835 Strange Behavior

Hello,
I have a DRV8835 running in PHASE/ENABLE mode that was working normally. But it is suddenly behaving strangely.
Here is a video running this sketch:

const int leftMotorDir = 7;
const int leftMotorPwm = 9;
const int rightMotorDir = 8;
const int rightMotorPwm = 10;

void setup() {
  pinMode(leftMotorDir, OUTPUT);
  pinMode(rightMotorDir, OUTPUT);
}

void loop() {
  digitalWrite(leftMotorDir, LOW);
  analogWrite(leftMotorPwm, 40);
  digitalWrite(rightMotorDir, HIGH);
  analogWrite(rightMotorPwm, 40);
  delay(5000);
  
  digitalWrite(leftMotorDir, HIGH);
  analogWrite(leftMotorPwm, 40);
  digitalWrite(rightMotorDir, LOW);
  analogWrite(rightMotorPwm, 40);
  delay(5000);
}

For 5 seconds, the top motor is rotating in the right direction but the bottom motor is supposed to move counter-clockwise. In the next 5 seconds the bottom motor is not supposed to stop. Also, both motors are rotating faster than normal for that duty cycle.

Here is closer picture of the connection and boards.
I am using an Arduino nano clone, S7V8A Regulator set at 6.25 V, and 30:1 micro gearmotors. VOUT on the regulator is connected to VIN on the nano and VIN on the DRV8835. 5V on the nano is connected to VCC and MODE on the DRV8835. Aphase and Bphase are connected to pins 7 and 8 on the nano. Aenable and Benable are connected to PWM pins 9 and 10 on the nano.

Any idea what happened?
Thanks

Hello.

That behavior does seem a bit strange. Can you try swapping the channel that each motor connects to on the DRV8835 carrier to see if the problem follows the motor or the motor channel?

There are a few things I noticed about your setup that could be causing an issue. The S7V8A regulator might not be appropriate for running those two motors; can you post the specifications of the motors you are using (e.g. the operating voltage and stall current)? The Arduino Nano’s recommended minimum operating voltage is 7V, and its absolute minimum is 6V, so you are very close to that limit. You might try adjusting the output of the regulator to slightly above 7V to power your Arduino and powering the motors (e.g. the DRV8835 carrier’s VIN pin) directly from the battery. If it still behaves the same, then we know the regulator is not causing the problem with the motor. If you have access to an oscilloscope, can you try measuring the PWM pins to see if they are outputting the expected duty cycle?

Brandon

Hello,
I have swapped the motors, set the regulator to 7.08v, and powered VIN on the DRV8835 directly from the battery but the motors are still behaving the same. The place where I got the motors doesn’t specify the stall current, but I have measured ~700ma at 6v from both motors. I don’t have an oscilloscope to verify if the PWM pins on the nano are outputting the correct duty cycle, but I have just tried it with a ti launchpad running the same sketch via energia. Video here. Unfortunately, the motors are still not behaving as expected.
Thanks

Hello.

Can you clarify if the same motor only ran in one direction or if the motor connected to the same channel on the DRV8835 showed the problem? If the problem follows the motor, can you try powering the motor directly from your power supply in both directions to see if the motor might be damaged?

If the motor functions correctly, can you try tying the APHASE and BPHASE pins to ground and then try connecting AENBL and BENBL pins to 5V to see if both of the motors work in that direction. Then try switching the APHASE and BPHASE pins to 5V to test the other direction?

Brandon

Sorry, each motor connected to the same channel A on the DRV8835 showed the problem. I checked both motors directly with the power supply anyways, and they work in both directions.
With APHASE and BPHASE connected to ground and AENBL and BENBL connected to 5V, channel A motor is spinning clockwise and channel B motor is spinning counterclockwise. Which is odd because the robot would be driving in reverse when I expected it to be driving forward. When I plug in APHASE and BPHASE to 5V, both motors stop.

I believe I have the same problem as the guys in this thread. I am able to run the operating modes of IN/IN mode on channel B even if the mode pin is driven high and I have the same direction problem with channel A. So I guess something about my setup damaged the board? I have a spare DRV8835 board so I would like to know what may have happened before I use it.

Hello.

From the picture you linked to in your first post, it looks like the MODE pin is connected to the 5V out on your Arduino Nano, so if it is not operating correctly in phase/enable mode (and seems to still respond as if using in/in mode), it does sound like it might be damaged. However, the direction problem you mentioned can be fixed with a simple wiring change. The direction the motors turn will depend on the polarity of the motor terminals, so if the channel A and channel B are turning in different directions when they aren’t supposed to be, you can swap the motor leads connected to one of the motor channels (e.g. swap the connections to AOUT1 and AOUT2).

It is not clear to me what might have damaged the driver. It could have been something like an electrostatic discharge (ESD) while handling the board. Do you recall a time where you could have been sending logic signals to the board without VCC connected? In general sending signals to an un-powered board is not good practice and could damage a pin. Are you connecting the VCC pin on the driver to VIN on your Arduino? If so, please note that the maximum logic voltage on the DRV8835 driver is 7V, and the recommended minimum for the Arduino is 7V, so if your regulator was ever set to above 7V while powering the driver, it could have damaged the driver as well.

Brandon

Actually, the motor polarity is correct. When I later read the thread I linked and found out the driver could be in IN/IN mode, the behavior is consistent with IN/IN mode truth table row 3. That’s why the motors stopped when I switched APHASE and BPHASE to 5V. So I was wrong saying that reverse direction was odd. Well, it’s still odd because it supposed to be in PHASE/ENABLE mode. Anyways, thanks for your help.