Summary of Interfacing DC Motor with 8051 Microcontroller
This article explains how to control a DC motor using the AT89C51 microcontroller with an L293D motor driver IC. Since the microcontroller cannot supply sufficient current and to protect it from back EMF, the L293D is used to drive the motor. The motor's direction is controlled through inputs connected to the microcontroller pins, with switches to change the rotation direction. The L293D uses an H-Bridge configuration allowing voltage to flow in either direction to control motor direction and speed.
Parts used in the Interfacing DC Motor to 8051 Microcontroller:
- AT89C51 Microcontroller
- PCB board
- Programming cable
- 12V DC battery or Adapter
- L293D Motor driver IC
- DC Motor
- 10uF Electrolytic capacitor
- 33pF Ceramic capacitors (2 pieces)
- 10kΩ Resistors (3 pieces, 1/4 watt)
- Push buttons (2 pieces)
- Connecting wires
When we talk about controlling the robot, the first thing comes into the mind is controlling DC motors. Interfacing DC motor to the microcontroller is very important concept in Robotic applications. By interfacing DC motor to the microcontroller, we can do many things like controlling the direction of the motor, controlling the speed of the motor. This article describes you how to control the DC motor using AT89C51 controller.
Interfacing DC Motor to 8051 Circuit Principle:
The maximum output current of microcontroller pin is 15mA at 5V. But the power requirements of most of DC motors is out of reach of the microcontroller and even the back emf (electro motive force) which is produced by the motor may damage the microcontroller. Hence it is not good to interface DC motor directly to the controller. So use motor driver circuit in between of DC motor and controller.
Also read the interesting concept: Interfacing 7 Segment Display to 8051 Microcontroller
Here, we are using L293D motor driver IC to drive DC motors. Using this IC, we can drive 2 DC motors at a time. For this IC motor supply is variable 4.5 to 36V and it provides maximum current of 600mA.
Circuit Diagram of Interfacing DC motor to 8051 Microcontroller:
Circuit Components:
- at89c51 microcontroller
- PCB board
- programming cable
- 12V DC battery or Adaptor
- L293D motor driver
- DC motor
- Electrolytic capacitor – 10uF
- 2 Ceramic capacitors – 33pF
- 10k resistors (1/4 watt) – 3
- push buttons – 2
- Connecting sires.
Get an idea about How PWM Based DC Motor Speed Controlling Circuit Works using Microcontroller
Interfacing DC Motor to 8051 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 in pull down configuration. First switch rotates the motor in clockwise direction and second switch rotates the motor in anti clockwise direction. 8th pin of motor driver is connected to the battery directly.
L293D Motor Driver:
L293D is a quadruple H- bridge motor driver, as the name suggests it used to drive the DC motors. This IC works based on the concept of H- Bridge. H-bridge is a circuit which allows the voltage in either direction to control the motor direction.
There are 4 input pins for L293D. Motors directions depends on the logic inputs applied at this pins. EN1 and EN2 must be high to drive the 2 DC motors.
- IN1=0 and IN2=0 -> Motor1 idle
- IN1=0 and IN2=1 -> Motor1 Anti-clock wise direction
- IN1=1 and IN2=0 -> Motor1 Clock wise direction
- IN1=1 and IN2=1 -> Motor1 idle
- IN3=0 and IN4=0 -> Motor2 idle
- IN3=0 and IN4=1 -> Motor2 Anti-clock wise direction
- IN3=1 and IN4=0 -> Motor2 Clock wise direction
- IN3=1 and IN4=1 -> Motor2 idle
For more detail: Interfacing DC Motor with 8051 Microcontroller