0% found this document useful (0 votes)
59 views4 pages

Experiment 4

This document provides a tutorial on interfacing a DC motor with the 8051 microcontroller using the L293D motor driver. It explains the working algorithm for controlling the motor's direction, the necessary circuit diagram, and includes sample code for implementation. The tutorial emphasizes the importance of using a motor driver to prevent damage to the microcontroller due to high current and back EMF from the motor.

Uploaded by

Aziz Bohra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views4 pages

Experiment 4

This document provides a tutorial on interfacing a DC motor with the 8051 microcontroller using the L293D motor driver. It explains the working algorithm for controlling the motor's direction, the necessary circuit diagram, and includes sample code for implementation. The tutorial emphasizes the importance of using a motor driver to prevent damage to the microcontroller due to high current and back EMF from the motor.

Uploaded by

Aziz Bohra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

‭Introduction‬

‭Experiment 4‬ ‭DC Motor Interfacing with 8051‬


‭Circuit Diagram‬
‭Working Algorithm‬
‭Forward‬
‭Reverse‬
‭Code‬
‭Output‬
‭Tasks‬
‭Discover more from‬
‭AmbeTronicS‬

‭8051 – DC‬
‭Suggestion to read‬
‭Motor‬
‭●‬ M
‭ otor Driver Working‬
‭(L293D)‬
‭Interfacing‬
‭by‬‭Admin‬
‭Introduction‬
‭Tags‬

‭8051‬‭,‬‭DC Motor‬‭,‬‭L293D‬‭,‬‭Tutorials‬ ‭ hen‬ ‭we‬ ‭talk‬ ‭about‬ ‭controlling‬ ‭the‬


W
‭robot,‬‭the‬‭first‬‭thing‬‭comes‬‭into‬‭mind‬‭is‬
‭Categories‬
‭controlling‬ ‭DC‬ ‭motors.‬ ‭Interfacing‬ ‭the‬
‭8051‬ ‭DC‬ ‭motor‬ ‭to‬ ‭the‬ ‭microcontroller‬ ‭is‬ ‭a‬
‭very‬ ‭important‬ ‭concept‬ ‭in‬ ‭Robotic‬
‭Last Updated on: November 23rd, 2024‬ ‭applications.‬ ‭By‬ ‭interfacing‬ ‭the‬ ‭DC‬
‭motor‬‭to‬‭the‬‭microcontroller,‬‭we‬‭can‬‭do‬
‭many‬ ‭things‬ ‭like‬ ‭controlling‬ ‭the‬
I‭n‬‭our‬‭previous‬‭tutorial‬‭,‬‭we‬‭saw‬‭how‬‭to‬
‭direction‬ ‭of‬ ‭the‬ ‭motor,‬ ‭controlling‬ ‭the‬
‭interface‬ ‭the‬ ‭LCD‬ ‭with‬ ‭8051‬ ‭in‬ ‭4-bit‬
‭speed‬ ‭of‬ ‭the‬ ‭motor.‬ ‭This‬ ‭article‬
‭mode.‬ ‭In‬ ‭this‬ ‭tutorial,‬ ‭we‬ ‭are‬ ‭going‬ ‭to‬
‭describes‬‭how‬‭to‬‭control‬‭the‬‭DC‬‭motor‬
‭learn‬ ‭DC‬ ‭Motor‬ ‭Interfacing‬ ‭with‬ ‭8051.‬
‭using the AT89C51 controller.‬
‭Let’s run….‬

‭ ‬ ‭DC‬ ‭motor‬ ‭in‬ ‭simple‬ ‭words‬ ‭is‬ ‭a‬


A
‭Table of Contents‬ ‭device‬ ‭that‬ ‭converts‬ ‭electrical‬ ‭energy‬
‭(direct‬‭current‬‭system)‬‭into‬‭mechanical‬

‭Suggestion to read‬
‭ nergy.‬ ‭It‬ ‭is‬ ‭of‬ ‭vital‬‭importance‬‭for‬‭the‬
e
‭industry today.‬

‭ he‬ ‭maximum‬ ‭output‬ ‭current‬ ‭of‬ ‭the‬


T
‭microcontroller‬ ‭pin‬ ‭is‬ ‭15mA‬ ‭at‬‭5V.‬‭But‬
‭the‬ ‭power‬ ‭requirements‬ ‭of‬ ‭most‬ ‭DC‬
‭motors‬ ‭is‬ ‭out‬ ‭of‬ ‭reach‬ ‭of‬ ‭the‬
‭microcontroller‬‭and‬‭even‬‭the‬‭back‬‭emf‬
‭(electromotive‬ ‭force)‬ ‭which‬ ‭is‬
‭produced‬ ‭by‬ ‭the‬ ‭motor‬ ‭may‬ ‭damage‬
‭the‬ ‭microcontroller.‬ ‭Hence‬ ‭it‬ ‭is‬ ‭not‬ ‭Working Algorithm‬
‭good‬‭to‬‭interface‬‭the‬‭DC‬‭motor‬‭directly‬
‭to‬ ‭the‬ ‭controller.‬ ‭So‬ ‭use‬ ‭the‬ ‭motor‬
‭Forward‬
‭driver‬ ‭circuit‬ ‭in‬ ‭between‬‭the‬‭DC‬‭motor‬
‭and controller.‬
‭●‬ E ‭ N‬‭Pin High (En1 = 1 or‬
‭En2 = 1)‬
‭ ere,‬ ‭we‬ ‭are‬ ‭using‬ ‭an‬ ‭L293D‬ ‭motor‬
H
‭●‬ ‭Input 1 or Input 3 Pin‬
‭driver‬ ‭IC‬ ‭to‬ ‭drive‬ ‭DC‬ ‭motors.‬ ‭Using‬
‭High (In1 = 1 or In3=1)‬
‭this‬‭IC,‬‭we‬‭can‬‭drive‬‭2‬‭DC‬‭motors‬‭at‬‭a‬
‭●‬ ‭Input 2 or Input 4 Pin‬
‭time.‬ ‭For‬ ‭this‬ ‭IC‬ ‭motor‬ ‭supply‬ ‭is‬
‭Low (In2 = 0 or In4 = 0)‬
‭variable‬ ‭4.5‬ ‭to‬ ‭36V‬ ‭and‬ ‭it‬ ‭provides‬
‭maximum‬‭current‬‭of‬‭600mA.‬‭Just‬‭refer‬
‭Here‬‭for the L293d Driver’s operation.‬ ‭Reverse‬

‭●‬ E ‭ N‬‭Pin High (En1 = 1 or‬


‭DC Motor‬ ‭En2 = 1)‬
‭●‬ ‭Input 1 or Input 3 Pin‬
‭Interfacing with‬ ‭Low (In1 = 0 or In3=0)‬
‭●‬ ‭Input 2 or Input 4 Pin‬

‭8051‬ ‭Low (In2 = 1 or In4 = 1)‬

‭Code‬
‭Circuit Diagram‬
I‭n this code, the First motor will rotate‬
‭forward and the second motor will‬
‭‬
● I‭nput 1 – Port 2.0‬
‭rotate reverse.‬
‭●‬ ‭Input 2 – Port 2.1‬
‭●‬ ‭Enable 1 – Port 2.2‬
‭●‬ ‭Enable 2 – Port 2.3‬ #include<reg51.h>‬

‭●‬ ‭Input 3 – Port 2.4‬
‭●‬ ‭Input 4 – Port 2.5‬
sbit in1=P2^0;‬

sbit in2=P2^1;‬
‭ {‬

sbit en1=P2^2;‬
‭ in1=1;‬

sbit en2=P2^3;‬
‭ in2=0;‬

sbit in3=P2^4;‬
‭ }‬

sbit in4=P3^5;‬
‭ void‬‭
‭ reverse‬
()‬

void‬‭
‭ forward‬
()‬
‭ ;‬
‭ {‬

void‬‭
‭ reverse‬
()‬
‭ ;‬
‭ in4=1;‬

void‬‭
‭ main‬
()‬
‭ in3=0;‬

{‬
‭ }‬

en1=1;‬

‭Output‬

en2=1;‬

while‬
‭ (‭
‭1‬‬
)‬‭
‭ {‬

forward‬
‭ ()‬
‭ ;‬

reverse‬
‭ ()‬
‭ ;‬

‭[ Please find the output image ]‬
}‬

‭Notes:‬

}‬

‭●‬ T
‭ he maximum current‬
‭capacity of L293 is‬
void‬‭
‭ forward‬
()‬
‭ ‭600mA/channel. So do‬
‭not use a motor that‬
c‭ onsumes more than‬
‭that.‬
‭ ‬ ‭The supply voltage range‬

‭of L293 is between 4.5‬
‭and 36V DC. So you can‬
‭use a motor falling in that‬
‭range.‬
‭●‬ ‭Mostly in Robotic‬
‭application, we will use‬
‭DC gear Motor. So the‬
‭same logic is used for‬
‭that Gear motor also.‬

You might also like