Motor shield - reverse rotation not working for one of the outputs

I have bought the following motor shield:
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=190779229320

The controller works fine, except that for one of the motors the reverse rotation doesn't work! There's a very very small movement when I do the following in arduino:
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(ENA, HIGH);

For the other output, it works fine (reverse):
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
digitalWrite(ENB, HIGH);

Also for IN1 and IN2, the following works (rotate forward):
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(ENA, HIGH);

Only for IN1 and IN2, the reverse rotation doesn't work. :frowning: Any ideas why?

Thanks a lot!

Best regards,
Bence

Either there's a faulty connection somewhere or part of the driver chip has been toasted or your code is broken
(but we cannot tell as you haven't posted all of it)

I'd first check you've set all the pinModes correctly, then a careful visual inspection of the whole setup - including
the the motor shield for any visible signs of faulty manufacture (dry solder joint perhaps).

See attachment for wiring (the motor shield is slightly different, but has the same pins).

Code:

#include <IRremote.h>
#include <SimpleTimer.h>

SimpleTimer timer;

int MA_1=1;
int MA_2=2;
int MB_1=3;
int MB_2=4;
int MA_E=5;
int MB_E=6;

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long irvalue;
unsigned long irvalue_prev;

unsigned long IRforward = 0xFF9867; // 100+
unsigned long IRbackward = 0xFFB04F; // back
unsigned long IRleft = 0xFF22DD; // prev
unsigned long IRright = 0xFF02FD; // next
unsigned long IRbeep = 0xFFE21D; // mute
unsigned long IRstop = 0xFFA25D; // power
unsigned long IRdecc = 0xFFE01F; // -vol
unsigned long IRacc = 0xFFA857; // +vol
unsigned long IRrepeat = REPEAT;

int moveTimer;

int moveSpeed = 150;

void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn();        // Start the receiver

  pinMode(MA_1, OUTPUT);  
  pinMode(MA_2, OUTPUT);  
  pinMode(MB_1, OUTPUT);  
  pinMode(MB_2, OUTPUT);  
  pinMode(MA_E, OUTPUT);  
  pinMode(MB_E, OUTPUT);   
  
  stopMovement();
}

void loop() {
  if (irrecv.decode(&results)) {
    irvalue = results.value;
    if (irvalue == IRrepeat && irvalue_prev)
      irvalue = irvalue_prev; 
    if (irvalue == IRforward)
      moveForward();
    if (irvalue == IRbackward)
      moveBackward();   
    if (irvalue == IRstop)
      stopMovement();        
    if (irvalue == IRdecc)
      addSpeed(-30); 
    if (irvalue == IRacc)
      addSpeed(30);         
  
    irvalue_prev = irvalue;
    
    irrecv.resume();          // Receive the next value
  }
  timer.run();
}

void moveForward() {
  Serial.println("moving forward");
  digitalWrite(MA_1, HIGH);  
  digitalWrite(MB_1, HIGH);      
  digitalWrite(MA_2, LOW);  
  digitalWrite(MB_2, LOW);
//  digitalWrite(MA_E, HIGH);
//  digitalWrite(MB_E, HIGH);
  analogWrite(MA_E, moveSpeed);
  analogWrite(MB_E, moveSpeed);
  setMoveTimer(1000);
}

void moveBackward() {
  Serial.println("moving backward");
  digitalWrite(MA_1, LOW);      
  digitalWrite(MA_2, HIGH);   
  digitalWrite(MA_E, HIGH);
//  digitalWrite(MB_1, LOW);      
//  digitalWrite(MB_2, HIGH);   
//  digitalWrite(MB_E, HIGH);  
  setMoveTimer(1000);
}

void moveTurn() {
  Serial.println("turning");
  digitalWrite(MA_1, HIGH);  
  digitalWrite(MB_1, LOW);   
  digitalWrite(MA_2, LOW);  
  digitalWrite(MB_2, HIGH);    
  analogWrite(MA_E, moveSpeed);
  analogWrite(MB_E, moveSpeed);
  setMoveTimer(300);
}

void setMoveTimer(int timeOut) {
  timer.deleteTimer(moveTimer);
  moveTimer = timer.setTimeout(timeOut, stopMovement);
}
  

void stopMovement() {
  Serial.println("stopping");
  digitalWrite(MA_1, LOW);
  digitalWrite(MB_1, LOW);  
  digitalWrite(MA_2, LOW);
  digitalWrite(MB_2, LOW);  
  digitalWrite(MA_E, LOW);
  digitalWrite(MB_E, LOW);  
}

void addSpeed(int speed) {
  moveSpeed = moveSpeed + speed;
  if (moveSpeed <= 100)
    moveSpeed = 10;
  else if (moveSpeed > 255) 
    moveSpeed = 255;
}

Thanks! :slight_smile: I have inspected the shield, doesn't show any visible sign of bad soldering.

DSC_4022.JPG

DSC_4023.JPG

DSC_4024.JPG

Does sound like its dud - check the diodes for that motor maybe? They are easier to replace than the chip(!)