Hey guys, In this post I'm gonna show you guys how you can hook an L293D Motor driving IC with an ESP32 board to control a DC Motor. also, how to increase the current supplying capacity of L293D with a simple Hack.
watch the video for more thorough tutorial and result clip-
Components Required- ESP32 Development board (I'm using Lolin D32 Pro V2)
- DC motor
- L293D IC x 2
- Battery or just use ESP32 VCC if you are powering small DC motor like me.
- Breadboard wires
- Breadboard
also, Thanks UTSOURCE.net to offer electronic components for this project!you can check UTSOURCE.net, they deal in all kinds of electronics components like for example L293D Motor driver, ESP12F, and other discreet electronics components which I'm using in this project.
INTRO
L293D is a quadruple half-H driver which is designed to provide bidirectional drive current of up to 600-mA at voltages from 4.5 V to 36 V. It can be used to drive inductive loads such as relays, solenoids, dc, and bipolar stepping motors but they are mostly used to drive DC motors as they are cheap and easily available.
one downside of using them is its Low current providing capability. it can at most provide 1A to a 12V DC motor which is not enough to drive it properly, as a result, people generally discard using it and choose L238N Motor driver which can provide current up to 2A.
L298N is a great motor driver but it's main IC is not easily available as L293D so using it on a breadboard is out of the question if you don't use aliexpress or banggood to buy these bare ICs.
Here's a Solution for Tweaking the current output of L293D H bridge IC-
Just solder Two L293D in parallel stacked upon one another.
By doing this, the Current of L293D will increase twice, Great.
Here's the Pinout for L293D along with Pin function (read its datasheet for more info https://www.ti.com/lit/ds/symlink/l293.pdf)
I'm using these small Micro DC gear motor which cost around 6-10$, they are small and powerful so they can be used in a small robotics project. I'm planning to build a 4 wheel robot myself with an esp32 as the main controller and L293D as Motor driver, will probably use 4 of them (two in parallel x 2 for 4 wheels)
ESP32
Generally, people use an Arduino Uno to drive these H bridge ICs for making robot projects but that thing is now old, why not use an ESP32 which offers lots of PWM pins, Wifi connection, and so much space for your CODE.
In order to use an ESP32 with Arduino IDE, just read this https://github.com/espressif/arduino-esp32 install it and get everything set up. installing it is well documented, I don't think it would be a problem.
WIRING
Enable 1 and 2 to GPIO14
1A to GPIO27
2A to GPIO26
GND to GND (Pin 4 and 5 of L293D)
Connect Vcc1 and Vcc2 together and hook them with USB pin of Lolin D32 (connect it to 5V or VCC of any Generic ESP32) this connection is meant to be especially for this Micro DC motor because it can run on 5V, if you want to drive 12V motor then connect according to this-
Vcc2 to 12V battery (for powering the motor)
Vcc1 to Vcc of ESP32 (for powering the L293D chip, not the motor)
CODE
Upload the given code and your good to go-
RESULTS AND CONCLUSION
the test code will rotate the motor in one direction for two seconds, then stop for 1 Second and then change the direction and rotate for 2 seconds, and this cycle goes on and on- basic stuff
watch the video-
So what's next, next thing is to design a full-fleshed Breakout board for a robot project which will have total 4 L293D IC for driving 4 Micro DC motor, I will add a jumper between Vcc1 and Vcc2 so I can switch the Supply to 5V and 12V for driving small Micromotor and big 12V motor.
anyways, Leave a comment if you run into some issue!
Comments