DROK L298 Driver board not running 24V DC motor

I am trying to run 2 motors off of a DROK L298.
Here is the test code I am running to try and get it to run on:

test_pin_1 = Pin(14, Pin.OUT, Pin.PULL_UP)
test_pin_2 = Pin(27, Pin.OUT, Pin.PULL_DOWN)
test_pin_3 = PWM(Pin(26), freq = 5000, duty = 1023)
while True:

The motor power is coming from a 24V battery, and the logic power is being supplied from the esp32. The expected logic does not spin the motor regardless of input.

I am able to get the motor to spin if only one of the IN pins is plugged in, it does not, however, matter the value of the in pin. So long as it is connected to any pin on the esp32 the motor will spin at full speed, the direction depends on which pin is touched (to reiterate, it doesn’t matter what the value of the pin is) you can even attach the single IN to a non-initiated/ unused pin and it will still run.

If IN1 AND IN2 are both plugged in, regardless of values (1,1 / 1,0 / 0,0) the motor will not run.

If anyone has worked with this board and could offer some insight, that would be so awesome. Thanks in advance!

Sorry, but I do have a link for a working version… Not the same board, but the same L298 chip…

He’s doing it on an Arduino… the source is also there. It’s in the h-bridge section.

The specifications state it will be a high input state at 2.3V, so you should be ok…

Good luck


Thank you for the feedback! I should have noted this already in the post, using the L298N board, the code I have works perfectly, but when transferring to this board to allow for more current, it no longer works… could it just be a faulty board?

It could be a bad board, that’s not unheard of…

The ic itself shows an input of >=2.3V for a high state, however, reading the advertisement, it states it goes through an optical isolator…

Are you able to drive that sufficiently with a 3.3V processor in a ttl environment?


Goodness, there’s a lot in there I don’t fully understand! You obviously know much more about this than myself… thank heavens for Chat GPT :stuck_out_tongue: Doing my best though, it seems that there is enough power, running on a 3.3v system (from the ESP32.) I’m not really sure what the TTL environment means, but from the data sheet I’m looking at for the board, it’s just saying the logic signal must be 3.3 or 5. IDK if that’s entirely accurate, but I’m supplying it with at least 3.3!

Also… I just noticed one more weird behavior. I have an IR Reciever connected to the esp32 as well. Whenever I plug in test_pin_1 (a HIGH pin) to any of the IN pins on the driver board, the IR Receiver led starts to lightly flash. The flashes are dim, but seem fairly consistent. This doesn’t seem like expected behavior.

Your 3.3V should probably be ok. TTL is the specified as 0 to 5V signal. If the board says it will operate at 3.3V then I’d take their word for it and look elsewhere.

The article link specified how their board works with an applied voltage.

Try to control it manually without the micro… and see if it works.

If it does, then maybe you have a control logic issue with this board…

How are you controlling the ENA and ENB pins? Is this what you are using to feed a common pwm?

On what? Must be a different motor driver board?

I’d ensure the EN pins are off before you change any inputs. Don’t want to turn both sides of an h-switch on at the same time…

The chip may prevent that… ?


The code works well on these boards https://www.amazon.com/HiLetgo-Controller-Stepper-H-Bridge-Mega2560/dp/B07BK1QL5T/ref=sr_1_1_sspa?keywords=l298n+motor+driver&qid=1691630873&sprefix=l298%2Caps%2C156&sr=8-1-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1

The pins are all set to high already on Drok board by default, manually touching the pins will start the motor.

the original code is just for one motor, I don’t have both going right now. I figure I can get one going and then try the other one.

The ENA pin is set using test_pin_3 right now, just to get the motor to at least behave as expected, so the pin input on the Drok board is
5v, pwm, in1, in2, ground. these are coming from the esp32 as 5v, pin 26, pin 14, pin 27, gnd

I thought the esp32 was a 3.3V machine? There is no output of 5V unless it’s going through some external voltage translator…

The link you sent is for a 2650 controller, which is 5V I think…

It’s not switching, so I’m wondering if the 3.3V systems isn’t switching it…

Can you pull the pin high and run the motor without the controller?

It’s odd that without any kind of setup, a connection turns it on… That is not right… These processors go into a tri-state mode when booted, so they are not inputs or output… they just float.


You’re right the esp32 is a 3.3v machine I should have put in 3.3 rather than 5!

But I have some new developments.

After a lot of testing I was able to discover that if the PWM and on IN pin is connected, I can control the board speed and it will run in the direction that the individual pin is connected. This seems to eliminate the possibility that it’s a PWM issue and is rather an input issue.

The same is true if I have both INs connected but one IN is connected to an uninitialized esp32 pin. However as soon as both pins are connected the motor stops running. Or in other words as soon as the circuit is complete, regardless of how low the voltage is, the second pin being connected is still putting the driver board into a high state.

I am wondering, do you know of a way that i can programatically “disconnect” the circuit? OR is there additional hardware needed in order for me to be able to bring the voltage low enough that it would read absolutely zero?

More info, I have tried the driver board with an arduino uno with similar code in c++ rather than micropython, and the motor responded correctly! I can switch all my other code to the arduino and c++, but at this point I’m very curious (and I feel like i’m very close) to find out how to make it work with an esp32. But we at least now know that the driver board is not the issue, it’s something about the interaction between the two boards.

Edit: I was aboe to discover that if the PWM and one in pin is connected…

Check the controlling pin at the micro and at the in terminal without the micro…

If these do have optical idolators, then you either have to supply voltage to them or sink current through them…

The micro usually boots with all uninitialized pins in a tri state mode. In this state, it will neither supply or sink current.

Something here isn’t correct…

I also noticed you do not have snub diodes on these motors, do you have them somewhere else or?


More commonly known as High Impedance (hi-Z).

Be wary of assuming this for all pins, the ESP32 uses several pins during boot as inputs to guide the boot sequence and enables their internal pull-ups, so these pins are high during boot. Similar stuff happens with most all MCU’s so a quick check of the docs can save a lot of frustration and confusion!
I’m speaking from experience here :wink:

Edit: Even when a pin is high-impedance the float voltage can be enough to turn a sensitive MOSFET on, as your finger touch test shows.
Which is why MOSFET circuits always have an external pulldown on the pin, if an opto-isolator is used this needs a pulldown too.

1 Like

I specified mostly…


1 Like