Three IBT-2 Motor Drivers on one Arduino Uno

I am trying to control three linear actuators, each one hooked up to its own IBT-2 motor controller. I am using some test code just to see if they work first and I'm getting unexpected results. When I use the code to extend the linear actuators only the left motor (using pwm pins 9 and 10) works. Then when I retract the actuators, all three are working just fine. I'm brand new to arduino so I don't know what I don't know.

#include <Arduino.h>
#include <PWM.h>
#include <IRremote.hpp>

// Motor Connections (All must use PWM pins)
// ML is Motor Left
#define ML1 9
#define ML2 10
// MR is Motor Right
#define MR1 3
#define MR2 11
// MM is Motor Middle
#define MM1 5
#define MM2 6

#define IR_RECEIVE_PIN A5
//Button layout for IR Remote: Power-1, Plus-14, Minus-20, Up-22, Down-26, Stop-41

// Define a fixed speed - do not exceed 250
int fixedSpeed = 240;

//define the pwm frequency
int pwmFreq = 20000;

void setup() {
  // put your setup code here, to run once:
  // Set motor & enable connections as outputs
  pinMode(ML1, OUTPUT);
  pinMode(ML2, OUTPUT);
  pinMode(MR1, OUTPUT);
  pinMode(MR2, OUTPUT);
  pinMode(MM1, OUTPUT);
  pinMode(MM2, OUTPUT);
  pinMode(IR_RECEIVE_PIN, INPUT);

   //initialize all timers except for 0, to save time keeping functions
  InitTimersSafe();

  //sets the frequency for the specified pin
  SetPinFrequencySafe(ML1, pwmFreq);
  SetPinFrequencySafe(ML2, pwmFreq);
  SetPinFrequencySafe(MR1, pwmFreq);
  SetPinFrequencySafe(MR2, pwmFreq);
  SetPinFrequencySafe(MM1, pwmFreq);
  SetPinFrequencySafe(MM2, pwmFreq);

  // Stop motors
  pwmWrite(ML1, 0);
  pwmWrite(ML2, 0);
  pwmWrite(MR1, 0);
  pwmWrite(MR2, 0);
  pwmWrite(MM1, 0);
  pwmWrite(MM2, 0);

  Serial.begin(9600);
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
}

void loop() {
  // put your main code here, to run repeatedly:
  // initialize IR Receiver
  if (IrReceiver.decode()) {
    int IRread = IrReceiver.decodedIRData.command;

      // read IR Remote button push
      switch(IRread) {
        case 26: // open button
          // extend all motors
          pwmWrite(ML2, 0);
          pwmWrite(ML1, fixedSpeed);
          pwmWrite(MR2, 0);
          pwmWrite(MR1, fixedSpeed);
          pwmWrite(MM2, 0);
          pwmWrite(MM1, fixedSpeed);
          break;
        case 22: // close button
          // retract all motors
          pwmWrite(ML1, 0);
          pwmWrite(ML2, fixedSpeed);
          pwmWrite(MR1, 0);
          pwmWrite(MR2, fixedSpeed);
          pwmWrite(MM1, 0);
          pwmWrite(MM2, fixedSpeed);
          break;
        case 41: // stop button
          // stop all motors
          pwmWrite(ML1, 0);
          pwmWrite(ML2, 0);
          pwmWrite(MR1, 0);
          pwmWrite(MR2, 0);
          pwmWrite(MM1, 0);
          pwmWrite(MM2, 0);
      }
  IrReceiver.resume();
  }
}

Can you post a link to the IBT -2 controller datasheet ?

How are all these bits wired and powered ?

Do you know this GitHub - Arduino-IRremote/Arduino-IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols ?

Some additional info. I know that each of the motor drivers and linear actuators work just fine. If I switch the own pins around I can get each motor driver and linear actuator to work in both directions. In the current setup the pin 3 and 11 pairing won’t extend and the pin 5 and 6 pairing won’t extend. More on how everything is hooked up below.
Data sheet:
https://www.handsontec.com/dataspecs/module/BTS7960%20Motor%20Driver.pdf
I have all the vcc, r_en, and l_en pins from all three motor controllers hooked up to 5V. Gnd on all three motor controllers hooked up to gnd. One motor controller has the rpwm and lpwm pins hooked to 3 and 11, another to 5 and 6, and the last to 9 and 10.
All three motor controllers are being powered by a meanwell lrs-350-12 power supply. Datasheet:
https://www.meanwell.com/productPdf.aspx?i=459&utm_source=google&utm_medium=cpc&utm_campaign=dsa&utm_content=&utm_term=&gad_source=1&gbraid=0AAAAADDbxn5bjp44ptrV0Gmj_zfD8JSIa
The actuators are under no load currently.I couldn’t find a datasheet for linear actuators, but here is the sellers webpage with specs:
https://mo.eco-worthy.com/catalog/worthy-1850mm-450mm-stroke-linear-actuator-1000n-14mms-p-625.html
Thanks in advance for your help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.