Esp32 L293D motor control issues

Hello, I am trying to get a 5V motor to work with my ESP32 C3 Mini-1 but I can't get the motor to work. I try the same code(different speedpin for PWM)with Arduino Uno and it works. I need help figuring out what the problem is.
Here is the code:

int speedpin=0;
int direction1=4;
int direction2=5;
void setup() {
pinMode(direction1,OUTPUT);
pinMode(direction2, OUTPUT);
pinMode(speedpin, OUTPUT);
}

void loop() {
digitalWrite(direction1, HIGH);
digitalWrite(direction2, LOW);
analogWrite(speedpin,255);
}

Questions that involve hardware should be accompanied by schematics. Including power supplies and power supply specifications.

Show schematics for the Uno connection as well as the ESP32 connections.

1 Like

Maybe you placed the purple wire where the yellow one goes. That is about the best I can answer looking at your non posted schematic. My eyes are not good enough to see your setup.

Add up to 4V to the motor voltage for the driver supply voltage, i.e. 9V for a 5V motor. Or use a modern (MOSFET) motor driver instead of the inefficient Darlington drivers.


Trying to draw a schematic seemed too much of a hassle but here is the photo of the setup

That's because the Uno has 5V outputs and the ESP is only 3.3V
Looks like the green wire is connected to ground

I am just beginning to understand how to use the ESP32s I knew that they have an output voltage of 3.3V but I thought the motor would work since it is connected to an external power supply of 5V through the L293D but from what I understand, to control the L293D I need to supply the direction pins along with the speed pin of it with 5V as well otherwise it doesn't work with 3.3V of the ESP. Is that correct?

Yes, it is very problematic with 3.3V. Sometimes it works, sometimes not but it always works with 5V

1 Like

Does this have anything to do with the specific ESP32 that I am using (ESP32 C3 mini 1)? Because there are videos and guides online that depict this particular setup working with other ESP32s.

It could be, and it's also related to the specific C3 IC that is used on your module and the specific L293 IC your are using.
Without going into details, the L293 works best with 5V logic.

Also many of those videos are fake or just plain wrong.

1 Like

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