Interfacing Motor

Interfacing Motor with AVR

In this tutorial we will discuss how to use DC Motors.
First, we simulate it in Proteus :

Codes

#define F_CPU 1000000UL
#include<avr/io.h>
#include<util/delay.h>

void main()
{
DDRD=0xFF;
while(1)
{
PORTD=0b00000010;  // forward Direction 
_delay_ms(3000); 
PORTD=0b00000001;  //// reverse direction
_delay_ms(3000);  

}

}

Proteus Simulation

Proteus_simulation

Motor Drivers

L239D Motor Driver Pin Configuration

The L293 and L293D are quadruple high-current half-H drivers. The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications.

All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo-Darlington source.

 

Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN.

When an enable input is high, the associated drivers are enabled and their outputs are active and in phase with their inputs.

When the enable input is low, those drivers are disabled and their outputs are off and in the high-impedance state.

With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications.

On the L293, external high-speed output clamp diodes should be used for inductive transient suppression.

A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize device power dissipation.

 

Recommended Conditions

Recommended Operation Conditions

Proteus Simulation

 proteus_simulation_using_l293d

Codes

#define F_CPU 1000000UL
#include<avr/io.h>
#include<util/delay.h>

void main()
{
DDRD=0xFF;
while(1)
{
PORTD=0b00001010;   //motor 1 & 2 in forward direction
_delay_ms(3000);
PORTD=0b00000101;  //motor 1 & 2 in reverse direction
_delay_ms(3000);    

}

}

Share