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

I have bought the following motor shield:

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. :( 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).


#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() {
  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);   

void loop() {
  if (irrecv.decode(&results)) {
    irvalue = results.value;
    if (irvalue == IRrepeat && irvalue_prev)
      irvalue = irvalue_prev; 
    if (irvalue == IRforward)
    if (irvalue == IRbackward)
    if (irvalue == IRstop)
    if (irvalue == IRdecc)
    if (irvalue == IRacc)
    irvalue_prev = irvalue;
    irrecv.resume();          // Receive the next value

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);

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);  

void moveTurn() {
  digitalWrite(MA_1, HIGH);  
  digitalWrite(MB_1, LOW);   
  digitalWrite(MA_2, LOW);  
  digitalWrite(MB_2, HIGH);    
  analogWrite(MA_E, moveSpeed);
  analogWrite(MB_E, moveSpeed);

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

void stopMovement() {
  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.




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