Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

MINI PROJECT MARCH 2022

NAME : VIKRAMAN D

COURSE: EMBEDDED SYSTEMS


DC MOTOR INTERFACING WITH 8051
MICROCONTROLLER

DC MOTOR INTERFACING WITH 8051 MICROCONTROLLER: In many


projects of embedded systems, we may need to control a DC motor
using controller.
It is not good to connect DC motor directly to the microcontroller. Since
the maximum current that can be sink from 8051 microcontroller is 15 mA
at 5v.

But a DC Motor needs much more currents. It also needs more voltages as
6v, 12v, 24v etc., (depending upon the type of motor used). One more
thing to notice is that the back emf produced by the motor may affect the
proper functioning of the microcontroller and reversing the direction can
damage the controller.

Due to these reasons we can’t connect a DC Motor directly to a


microcontroller. This article will demonstrate how to control the DC motor
using AT89C51 Microcontroller.
MOTOR DRIVER for dc motor interfacing with 8051 microcontroller
To overcome the problems in their interfacing, a motor Driver IC is
connected between microcontroller and DC motor. Motor driver is a little
current amplifier.

It takes a low current signal and gives out a high current signal which can
drive a motor. It can also control the direction of motor. We can use any
dual H-bridge IC like L293D or L298.

The main differences between L293D and L298 are:


CHARACTERISTICS L293D L298
Max. Output current 2A 0.6A
per channel
Peak max.output per 3A 1A
channel
Protection diodes Use externally Internally available
across motors
COMPONENTS REQUIRED:
 AT89C51 (8051 MICROCONTROLLER)
 8051 PROGRAMMER
 PROGRAMMING CABLE
 12V DC BATTERY OF ADAPTOR
 L293D MOTOR DRIVER
 DC MOTOR
 ELECTROLYTIC CAPACITOR- 10uF
 2 CERAMIC CAPACITORS-33pF
 10K RESISTORS(1/4 WATT)-4
 PUSH BUTTONS-3
 CONNECTING WIRES.
CIRCUIT DESIGN:

The major components in the above circuit diagram are at89c51


microcontroller and motor driver.
Here, the motor driver input pins IN1, IN2 are connected to the
P3.0 and P3.1 respectively to control the motor directions. DC
motor is connected to output terminals of L293D. EN1 pin is
connected to the 5V DC to drive the motor. Switches are
connected to the P2.0 and P2.1 of the Microcontroller in pull down
configuration. First switch rotates the motor in clockwise direction
and second switch rotates the motor in anti clockwise direction.
8th and 16th pins of the motor driver are
connected to the +5V supply.
CODE of dc motor interfacing with 8051
microcontroller

#include <reg51.h>
sbit switch1= P2^0;
sbit switch2 = P2^1;
sbit clk=p3^0;
sbit anticlk=p3^1;

void main()

switch1=switch2=1;
switch1=switch2=0;
clk=anticlk=0;
while(1)
{
if ((switch1))
clk=1;
else if((switch2))
anticlk=1;
else
p3=0x00;
}
}
WORKING of dc motor interfacing with 8051
microcontorller

After loading the program in the controller, the motors will not start
turning until the buttons are not pressed. According to my coding:
When I press button 1, motor 1 starts rotate in clockwise direction.
When I leave button 1, motor 1 will stop.
When I press button 2, motor 2 will start rotating in Anti-clockwise
direction.
When I leave button 2, motor 2 will stop.
PINS STATUS:

Enabling pin 1, if we give logic as:


Pin2 = 1, pin7 = 0, motor 1 will start turning clockwise.
Pin2 = 0, pin7 = 1, motor 1 will start turning anticlockwise
Pin2 = 1, pin7 = 1, motor 1 will stop
Pin2 = 0, pin7 = 0, motor 1 will stop

Enabling pin 9, if we give logic as:

Pin10 = 1, pin15 = 0, motor 2 will start turning clockwise

Pin10 = 0, pin15 = 1, motor 2 will start turning anticlockwise


Pin10 = 1, pin15 = 1, motor 2 will stop
Pin10 = 0, pin15 = 0, motor 2 will stop
Fig. demonstrated representation of the circuit.

video demonstration
LINK : https://drive.google.com/file/d/14ZPgoiFleZjOr01CStPyafMujXYLMDEi/view?usp=drivesdk
THANK YOU!!!

You might also like