Dual VNH2SP30 motor controller - doesn't work

I have ordered two Dual VNH2SP30 motor controllers from two different suppliers. Both of them seem to show the same issue whether used as a shield on an Uno or via a nano with jumper leads.

Each controller has two drivers and two outputs. One motor driver will work very well turning a motor at full speed, then half speed clockwise then alternate and do the same counter clockwise at half and full speed. The issue appears to be with the second driver - it will only turn clockwise but won’t go counter clockwise, the direction LED just flickers a faint red - with or without motors connected.

I’m using a 2C lipo and separate supply for the arduinos which have a common ground in each configuration.

I would really appreciate some advice as I am close to binning both of these chips and searching out a different chip altogether. The motors I am using are 1) a test motor which draws 500mA @ 6V and 2) a pair of Dagu Wild Thumper motors connected in parallel.

Code sample:

[code]
#define CW 0 // Clockwise motor direction
#define CCW 1 // Clockwise motor direction
#define BREAK_GND 2 // Break motor to GND
#define BREAK_VCC 3 // Break motor to GND

#define MOTOR1 0 // Used to select motor output 1 (A1-B1)
#define MOTOR2 1 // Used to select motor output 2 (A2-B2)

#define INA1 7 // DIO pin used for motor A1 control
#define INB1 8 // DIO pin used for motor B1 control
#define INA2 4 // DIO pin used for motor A2 control
#define INB2 9 // DIO pin used for motor B2 control
#define PWM1 5 // DIO pin used for motor 1 PWM speed control
#define PWM2 6 // DIO pin used for motor 1 PWM speed control

void setup()
{
/* Set control pins to outputs */
pinMode(INA1, OUTPUT); // Motor 1 control A
pinMode(INB1, OUTPUT); // Motor 1 control B
pinMode(INA2, OUTPUT); // Motor 2 control A
pinMode(INB2, OUTPUT); // Motor 2 control B
pinMode(PWM1, OUTPUT); // Motor 1 PWM speed control
pinMode(PWM2, OUTPUT); // Motor 2 PWM speed control

/* Set both motor outputs to stop */
MotorState(MOTOR1, BREAK_GND);
MotorState(MOTOR2, BREAK_GND);
}

/* Main program */
void loop()
{

MotorState(MOTOR1, CW); // Set motor to clockwise direction
MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
delay(500);
MotorSpeed(MOTOR1, 255); // Set motor 1 to full speed
delay(500);
MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
delay(500);
MotorState(MOTOR1, BREAK_GND); // Stop the motor
delay(500);

MotorState(MOTOR1, CCW); // Set motor to counter clockwise direction
MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
delay(500);
MotorSpeed(MOTOR1, 255); // Set motor 1 to full speed
delay(500);
MotorSpeed(MOTOR1, 128); // Set motor 1 to half speed
delay(500);
MotorState(MOTOR1, BREAK_GND); // Stop the motor
delay(500);

MotorState(MOTOR2, CW); // Set motor to clockwise direction
MotorSpeed(MOTOR2, 128); // Set motor 1 to half speed
delay(500);
MotorSpeed(MOTOR2, 255); // Set motor 1 to full speed
delay(500);
MotorSpeed(MOTOR2, 128); // Set motor 1 to half speed
delay(500);
MotorState(MOTOR2, BREAK_GND); // Stop the motor
delay(500);

MotorState(MOTOR2, CCW); // Set motor to counter clockwise direction
MotorSpeed(MOTOR2, 128); // Set motor 1 to half speed
delay(500);
MotorSpeed(MOTOR2, 255); // Set motor 1 to full speed
delay(500);
MotorSpeed(MOTOR2, 128); // Set motor 1 to half speed
delay(500);
MotorState(MOTOR2, BREAK_GND); // Stop the motor
delay(500);
}

/* Sets the state of one of the motors where Motor is either
MOTOR1 or MOTOR2 and State is one of 4 options:
CW = Motor turns in clockwise direction
CCW = Motor turns in counter clockwise direction
BREAK_GND = Breaks the motor to GND
BREAK_VCC = Breaks the motor to VCC */

void MotorState(byte Motor, byte State)
{
switch(State)
{
case CW:
digitalWrite(Motor ? INA2 : INA1, HIGH);
digitalWrite(Motor ? INB2 : INB1, LOW);
break;

case CCW:
  digitalWrite(Motor ? INA2 : INA1, LOW);
  digitalWrite(Motor ? INB2 : INB1, HIGH);
break;

case BREAK_GND:
  digitalWrite(Motor ? INA2 : INA1, LOW);
  digitalWrite(Motor ? INB2 : INB1, LOW);
break;

case BREAK_VCC:
  digitalWrite(Motor ? INA2 : INA1, HIGH);
  digitalWrite(Motor ? INB2 : INB1, HIGH);
break;

}

}

/* Sets the motor speed where Motor is either MOTOR1 or MOTOR2
and Speed is a number between 0 and 255 where 0 = stopped
and 255 = full speed. */
void MotorSpeed(byte Motor, byte Speed)
{
if (Motor)
{
analogWrite(PWM2, Speed);
}else
{
analogWrite(PWM1, Speed);
}
}[/code]

Hello.

From your description and code, it looks like you might be using the SparkFun Monster Moto Shield. If so, you might try using the example code they provide. If you are using one of our VNH2SP30 carriers, could you tell us more about your setup and post pictures of your setup?

- Jeremy

One of them says Sparkfun on the back the other one does not - but both look identical.

I have also used the code sample they supply with the same results.

Does anyone have any suggestions - could both have a hardware fault?? I have occasionally found this with chips from fear east, but I’ve had half a dozen L289n motor controllers in the past which have always worked flawlessly.

[quote]I would really appreciate some advice as I am close to binning both of these chips and searching out a different chip altogether.[/quote]My suggestion is to buy from a reputable supplier, for example Pololu, who also provide outstanding product support.

I have this very problem (exactly as OP described to the letter!). It is a Sparkfun shield. Any resolution for this?

Hello,

I suggest contacting Sparkfun to get support for their drivers.

-Derrill

Hi

I have a similar problem, but I noticed that chips have different serial numbers. I have two Monster Moto Shield, one of them, with VNH2SP30 990K0 V3 MYS 99 133 and VNH2SP30 9912K V3 MYS 99 140, doesnt’t work properly ( different speed of motor depending on rotary direction ), but second shield with the same chips VNH2SP30 99ATV3 MYS 99618 works fine. Obviously I use the same code for two shields.

If anyone had a similar situation?

Hello,

I suggest contacting the manufacturer of your Monster Moto shields to get support for their drivers.

-Derrill