Tutorial for Arduino Mini DC Motor Driver Dual H-Bridge PWM Control (L293D)

47,041

89

17

Introduction: Tutorial for Arduino Mini DC Motor Driver Dual H-Bridge PWM Control (L293D)

Description

Tutorial for Arduino Mini DC Motor Driver Dual H-Bridge PWM Control module is ideal for use in battery-powered smart car, toy cars, robots. Supply voltage 2V ~ 10V, can drive two DC motors or a 4-wire 2-phase stepper motors, can achieve forward rotation or reverse rotation, it is possible to adjust the rotation speed. Each can provide continuous current of 1.5A, peak current up to 2.5A, thermal protection and can be automatically restored. Use of imported original chip, built-in low on-resistance MOS switch, minimal heat, no heat sink, small size, low power consumption, is ideal for battery powered.

Specification

  • Module supply voltage: 2V-10V
  • Signal input voltage: 1.8-7V
  • Single working current: 1.5A
  • Peak current up to 2.5A
  • Low standby current (less than 0.1uA)
  • Built-in common conduction circuit, the input terminal vacant, the motor does not malfunction
  • Size: 24.7 * 21 * 7mm
  • Mounting hole diameter: 2 mm

Step 1: Material Needed

To do this tutorial, you will need to prepare all the following below:

1. Tutorial for Arduino Mini DC Motor Driver Dual H-Bridge PWM Control

2.Arduino Uno Board and USB

3. 2 DC Motors (any kind of DC motor can do)

4. Jumper Wires

5. Crocodile Clip (if needed)

Step 2: Pinout Details

  • +/- to give power supply to the module and motor
  • IN1 IN2 to control Motor A
  • IN3 IN4 to control Motor B
  • Motor A to be connected to DC Motor 1
  • Motor B to be connected to DC Motor 2

Step 3: Hardware Installation

1. Tutorial for Arduino Mini DC Motor Driver Dual H-Bridge PWM Control to Arduino Uno

  • + to VIN
  • - to GND
  • IN1 to D12 (OR you can change to any Digital Pin available on your UNO)
  • IN2 to D11 (OR you can change to any Digital Pin available on your UNO)
  • IN3 to D7 (OR you can change to any Digital Pin available on your UNO)
  • IN4 to D6 (OR you can change to any Digital Pin available on your UNO)

2. Connect your DC Motor to pinout Motor A and Motor B (refer picturefor help)

3. Connect your Arduino Uno Board to your computer using USB Cables.

Step 4: Sample Source Code

This is a sample source code for the circuit. You can download, open and and upload it into your Arduino Uno Board. Make sure to go to tools > Port & Board. Select the correct board (Arduino/Genuino Uno) and port (refer to your own port COM#) before uploading the code.

Step 5: Serial Monitor

After you have succesfully upload it into you Arduino Uno Board. Go to tools > Serial Monitor and you will see as shown in the picture above printed on your serial monitor. Key-in number option (1, 2 OR 3) to start the operation!

Step 6: Result

  • when user enter number '1', both dc motor start to rotate forward and serial monitor will print "Motor 1 forward, Motor 2 Forward".
  • when user enter number '2', both dc motor start to reverse and serial monitor will print "Motor 1 Reverse, Motor 2 Reverse"
  • when user enter number '3', both dc motor stop from rotating and serial monitor will print "Motor 1 Stop, Motor 2 Stop".

Step 7: Video

This video show how the DC motor function according to the sample source code attached in this tutorial.

1 Person Made This Project!

Recommendations

  • Make It Bridge

    Make It Bridge
  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Big and Small Contest

    Big and Small Contest

17 Comments

0
peterhczaja
peterhczaja

1 year ago

Has anyone had any success with connecting a nema 17 stepper to the MX1508, and running it with the raspberry pi under python3 ? Can the MX1508 actually control a stepper in the first place ?

0
babiM1
babiM1

2 years ago

Hi sir, thank you for this explanation. can we use this module for RC signals like drone remote controllers?

0
shubham_bhatt
shubham_bhatt

Question 3 years ago on Step 7

Hi how to do speed control i tried to give pwm but still running at full speed here is the code.

int IN1 = 12;
int IN2 = 11;
int IN3 = 10;
int IN4 = 9;
void setup()
{
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
Serial.begin(9600);
}
void loop()
{
Forward();
delay(5000);
Reverse();
delay(5000);
// Left();
// delay(5000);
// Right();
// delay(5000);
}
void Forward()
{
digitalWrite(IN1, 255);
digitalWrite(IN2, 0);
// Serial.print("Motor 1 Forward");
// Serial.println();
digitalWrite(IN3, 0);
digitalWrite(IN4, 255);
// Serial.println("Motor 2 Forward");
// Serial.println();
}
void Reverse()
{
digitalWrite(IN1, 0);
digitalWrite(IN2, 100);
Serial.print("Motor 1002 Reverse");
// Serial.println();
digitalWrite(IN3, 100);
digitalWrite(IN4, 0);
// Serial.println("Motor 2 Reverse");
// Serial.println();
}

0
helio1
helio1

Answer 2 years ago

replace digitalWrite with analogWrite
0
Scramblbot126
Scramblbot126

6 years ago

Great instructable!! Lots of detail!! Do you know if it's possible to change the speed? I have been considering buying one of the modules but need speed control. Thank you in advance.

0
mybotic
mybotic

Reply 6 years ago

Yes, the speed can be control by connecting the PWM pin to IN1 to IN4. See the picture above inside tutorial. Thanks and have a nice day

0
Scramblbot126
Scramblbot126

Reply 6 years ago

Thanks a lot!!! I really appreciate it!!!

0
shubham_bhatt
shubham_bhatt

Reply 3 years ago

Hello how to do speed contol plese help

0
anthonyschwartz7
anthonyschwartz7

4 years ago

for some reason it keeps giving me the invalid entry output I'm one putting in 1,2 or 3

0
uwezi
uwezi

6 years ago

Thank you for this documentations, however it's not a L293D chip on
these boards: the pinout does not match! But the manufacturer of these
boards has been very careful to strip down the chip markings... but the
L293D would not contain MOSFETs either... I found an image with complete chip code on Alibaba, it's either an MX130B or MX1308.

1
diy_bloke
diy_bloke

Reply 4 years ago

I think it is an MX1508

0
UtkarshVerma
UtkarshVerma

Reply 5 years ago

Yes, same proposition here. It isn't L293D.

0
UtkarshVerma
UtkarshVerma

Tip 5 years ago on Step 7

You could also do PWM. I have, but it's for PIC.

1
robertt310
robertt310

Question 5 years ago on Step 4

what is a .rar file ? How do I get into something that will compile?

0
robertt310
robertt310

Answer 5 years ago

nevermind! It opens like any zip file. I used 7s

0
proteu
proteu

5 years ago

Hi. I can't make this H-bridge control a stepper motor. It just makes the motor jerk without smooth movement. Any possibility you can make a tutorial with this same module controling a nema 17? Thanks.

0
signOnthe
signOnthe

6 years ago

Nice one for L293D. Thank you for your time.