Problem with the Adafruit l293D motor shield heating up very much

Hi. I am making a car which contains 4 9V motors... these motos are attached to the adafruit l293D motor shield which is on top of the arduino. the motor shield is receiving 12 V dc from a 3 lion cells all connected in series.. i am using the FlySky CT6B as a method of wireless communication. when throttling the motor Shield heats up to extreme tempratures...

Here is my code -

#include <AFMotor.h>
 
//initial motors pin
AF_DCMotor mlf(1);
AF_DCMotor mlb(2);
AF_DCMotor mrb(3);
AF_DCMotor mrf(4);
const unsigned long minPulseWidth = 1231; // Example: replace with your minCh1
const unsigned long maxPulseWidth = 1876; // Example: replace with your maxCh1
const int ch1Pin = 10;
const int ch2Pin = 9;
unsigned long ch1Value;
unsigned long ch2Value;
int steer;
int throttle;
int deadzone = 10;
int motorDirection = 1;

void setup() {
  Serial.begin(9600);
  pinMode(ch1Pin, INPUT);
  pinMode(ch2Pin, INPUT);
  mlf.run(RELEASE);
  mlb.run(RELEASE);
  mrf.run(RELEASE);
  mrb.run(RELEASE);
}

void rotateMotor(int rightMotorSpeed, int leftMotorSpeed)
{
  mrf.setSpeed(abs(rightMotorSpeed));
  mrb.setSpeed(abs(rightMotorSpeed));
  
  mlf.setSpeed(abs(leftMotorSpeed));
  mlb.setSpeed(abs(leftMotorSpeed));
 
  if (rightMotorSpeed < 0)
  {
    mrf.run(BACKWARD);    
    mrb.run(BACKWARD);    
  }
  else if (rightMotorSpeed > 0)
  {
    mrf.run(FORWARD);    
    mrb.run(FORWARD);  
  }
  else
  {
    mrf.run(RELEASE);    
    mrb.run(RELEASE);       
  }
  
  if (leftMotorSpeed < 0)
  {
    mlf.run(BACKWARD);    
    mlb.run(BACKWARD);   
  }
  else if (leftMotorSpeed > 0)
  {
    mlf.run(FORWARD);    
    mlb.run(FORWARD);     
  }
  else
  {
    mlf.run(RELEASE);   
    mlb.run(RELEASE);   
  } 

}


void loop() {
  // Read pulse width of channel 1 in microseconds
  ch1Value = pulseIn(ch1Pin, HIGH);
  ch2Value = pulseIn(ch2Pin, HIGH);

  // Check if pulseIn() returns 0  (indicating a timeout)
  if (ch1Value == 0) {
    // If no valid signal is read, set mappedCh1 to 0 or a safe default
    steer = 0;
  } else {
    // Map ch1Value from actual min/max range to -255 to 255
    steer = map(ch1Value, minPulseWidth, maxPulseWidth, -100, 100);

    // Constrain the mapped value to make sure it's within -255 to 255
    steer = constrain(steer, -100, 100);
  }

  if (ch2Value == 0) {
    // If no valid signal is read, set mappedCh1 to 0 or a safe default
    throttle = 0;
  } else {
    // Map ch1Value from actual min/max range to -255 to 255
    throttle = map(ch2Value, minPulseWidth, 1890, -100, 100);

    // Constrain the mapped value to make sure it's within -255 to 255
    throttle = constrain(throttle , -100, 100);
  }

  if(steer > -20 && steer < deadzone ){
    steer = 0;
  }
  if(throttle > -deadzone && throttle < deadzone ){
    throttle = 0;
  }
  int rightMotorSpeed = 0;
  int leftMotorSpeed = 0;

  if (throttle < 0){
    motorDirection = -1;
  } else{
    motorDirection = 1;
  }
  
 if (steer == 0) {
    // No steering input, both motors get the same speed
    rightMotorSpeed = abs(throttle);
    leftMotorSpeed = abs(throttle);
  } else {
    // Adjust motor speeds for turning
    rightMotorSpeed = abs(throttle) - steer;
    leftMotorSpeed = abs(throttle) + steer;
  }
  rightMotorSpeed = constrain(rightMotorSpeed, -100, 100);
  leftMotorSpeed = constrain(leftMotorSpeed, -100, 100);

   
  rotateMotor(rightMotorSpeed * motorDirection, leftMotorSpeed * motorDirection);
  Serial.print(rightMotorSpeed * motorDirection);
  Serial.print(" - ");
  Serial.println(leftMotorSpeed * motorDirection);
  Serial.println(throttle);
  delay(100);
}

what could be the issue????

Extra info---- When throttling the motor shield becomes very hot but as soon as i stop throtting, within 10-15 seconds it cools down

i need this car for a competition of speed so too much head could be fatal

That ancient dinosaur of a motor driver.

Use a modern motor driver, chosen to handle the stall current of the motors. Pololu has the best selection.

1 Like

There's a reason why Adafruit (and others) moved away from the L293D ages ago, as indicated on the tutorial page:

This tutorial is for the now ancient V1 Motor shield.

can u pls provide some reccomendations with Links so as to control 4 motors with the arduino uno

Click on the link in my previous post.

That is on the edge. What does the datasheet for the motors say?

thanks for the quick reply, for now i have resorted to use 2 l298N motor drivers but i'll use ur suggestions the next time :slightly_smiling_face:

Although ancient, L293 should work. After all, dinosaurs have successfully walked on this planet for millions of years.

What type of motors do you have? What stall current do they have?
How are they wired?
What do the motors drive?

Add a schematic and a picture in your next post.
Overheating is often caused by a short circuit... ...or maybe poor dimensioning (large motor on small controller). A modern board will also get damaged if you have a short...

How hot does the controller get? If you cannot touch it with bare hands you are in the danger zone...

What arduino do you have? Pin 0 an pin 1 are often used for usb communication. Not a good idea to use it for your motor driver.

i have 4 9v dc motors, they are directly wired to the motor shield, the motos drive 4 bodies of tt gear motors i have seperated

the motor shield gets soo hot that some times i can only touch it for 1-3 seconds i& i am using arduino uno only

now i have dissasebled it and used 2 l298n as i was in a rush

Those are designed for higher heat dissipation. So that should work.

Tt gear motors is not really a specification that will help me to find a datasheet for you....