top of page
Search
Writer's pictureGenius BRO!!

DC Motor

DC Motor (L293D Motor Driver)



Introduction

DC motors are commonly used to operate machinery in a variety of applications on the factory floor. DC motors were one of the first types of energy converters used in industry. Recall that the earliest machines require speed control and DC motors could have their speed changed by varying the voltage sent to them. The earliest speed controls for DC motors were nothing more than large resistors.


DC motors required large amounts of DC voltage for operation. In other words, a source for the DC voltage is needed at the factory. This creates a problem because DC voltage can't be generated and distributed over a long distance, so AC voltage is the industry standard. One way to provide the DC voltage is to use generators that are set up at the factory site where large AC motors are used to turn them to produce the amount of required DC voltage. This system uses a large AC motor to drive a DC generator directly at a constant speed. The field current in the generator is regulated to adjust the level of DC voltage from the generator, which in turn is used to vary the speed of any DC motor that the generator powers. This system, the Ward-Lennard system, was popular until solid-state diodes became available for rectifying large amounts of AC voltage to DC for use in motor-driven circuits. Once solid-state diodes and SCRs became available, DC motors became more usable in industry.


L293D Motor Driver


L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive on either direction. L293D is a 16-pin IC that can control a set of two DC motors simultaneously in any direction. It means that you can control two DC motors with a single L293D IC.

There are 4 input pins for l293d, pin 2,7 on the left, and pin 15,10 on the right as shown on the pin diagram. Left input pins will regulate the rotation of the motor connected across the left side and right input for the motor on the right-hand side. The motors are rotated on the basis of the inputs provided across the input pins as LOGIC 0 or LOGIC 1.


In simple, you need to provide Logic 0 or 1 across the input pins for rotating the motor.


WIRING



Circuit Diagram


CODE




//Declaring the pins for controlling the motors.
//I have not declared enable pins because I want the motor to run when I turn it on. If you want to turn on the motor manually then you can connect the enable pin. 
const int leftForward = 8; 
const int leftBackward = 9; 
const int rightForward = 10; 
const int rightBackward = 11;
void setup() 
{
 pinMode(leftForward , OUTPUT);
 pinMode(leftBackward , OUTPUT);
 pinMode(rightForward , OUTPUT);
 pinMode(rightBackward , OUTPUT);
}
void loop()
{
  //One pin should be HIGH and the other should be LOW for the motor to turn in one direction. By reversing, you can change the direction of the motors.
 digitalWrite(leftForward , HIGH);
 digitalWrite(leftBackward , LOW);
 digitalWrite(rightForward , HIGH);
 digitalWrite(rightBackward , LOW);
 
}


7 views0 comments

Comments


bottom of page