fbpx

Interface Dc Motor With AVR

Description

DC Motor is small in size, inexpensive and powerful. It is widely used in robotics for their small size and high energy out.

  • A typical DC motor operates at a very high speed.
  • Gear reduces the speed of the motor and increases the torque.

L293D Motor Driver

  • L293D is an H-BRIDGE dc motor controller, which can control dc motor up to 36V.
  • Driver allows the dc motor to rotate in both directions, which can interface and control the two motor at a time with a microcontroller.
  • Driver allows voltage to flow in both direction hence motor can rotate in both clockwise and anti-clockwise direction.

Direction Table

Hardware Required

  • Dc Motor.
  • L293D Motor Driver.
  • Atmega16 MicroController.

Circuit

Virtual Circuit

Code

 #include <avr/io.h>
 #include <util/delay.h>
 int main(void)
 {
 DDRA=0xff;
 DDRC=0x00;
 PORTA=0x00;
 PORTC=0x00;
 while(1)
 {
 int a= PINC;
 if (a==0)
 {
 PORTA=0x01;
 }
 else
 {
 PORTA=0x00;
 }
 }
 } 

Leave a Reply

Your email address will not be published. Required fields are marked *