2

Author Topic: How to change polarity of dc motor  (Read 6111 times)

0 Members and 1 Guest are viewing this topic.

Offline mohit sharmaTopic starter

  • Jr. Member
  • **
  • Posts: 28
  • Helpful? 0
How to change polarity of dc motor
« on: October 03, 2009, 06:57:29 AM »
I m working on a project in which i am mounting a camera on a base having a dc motor . Now i want to rotate the motor in one direction for 40 sec and then 40 sec in other direction. What i have to do for that ? In this i am using ATmega8 . I have given a delay of 40 sec in program but how to change the polarity of that motor.  ???   

Offline billhowl

  • Supreme Robot
  • *****
  • Posts: 375
  • Helpful? 32
  • Your success is in your hands.
Re: How to change polarity of dc motor
« Reply #1 on: October 03, 2009, 07:37:06 AM »

Offline mohit sharmaTopic starter

  • Jr. Member
  • **
  • Posts: 28
  • Helpful? 0
Re: How to change polarity of dc motor
« Reply #2 on: October 03, 2009, 10:14:36 AM »
I want to use a motor driver ic , l293d have an output of 600 mA while l293 have an output of 1 A . And there are h bridge circuits and motor drivers ic . Here my motor has requirement of 5 amp to run and please tell me that can we change polarity of motor using h bridge or motor driver ic

Offline galannthegreat

  • Supreme Robot
  • *****
  • Posts: 615
  • Helpful? 4
  • Blue-Lensed Blue LEDs?! What?! Impossible!!
Re: How to change polarity of dc motor
« Reply #3 on: October 04, 2009, 02:41:07 PM »
Solarbotics has a great kit for motor drivers, it uses a L298, and it can handle about 2.5A of continuous load per channel (ie. per motor). The kit is great because it shows and explains in simplicity on how it's used.

http://www.solarbotics.com/products/k_cmd/
Kurt

Offline mohit sharmaTopic starter

  • Jr. Member
  • **
  • Posts: 28
  • Helpful? 0
Re: How to change polarity of dc motor
« Reply #4 on: October 07, 2009, 09:55:56 AM »
Here i am giving a code through which i am trying to get polarity change of dc motor after every 30 sec but i am not succeed please help me if there is any error in it. I am using ATmega8L and L293D .

#include<avr/io.h>
#include<util/delay.h>

int main(void)
{
DDRB=0x03;


while (1)
{
 PORTB=0x01;     // forward
_delay_ms(30000);

 PORTB=0x02;     // reverse
_delay_ms(30000);


}
}


Thank you........

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,939
  • Helpful? 98
Re: How to change polarity of dc motor
« Reply #5 on: October 07, 2009, 01:18:06 PM »
What pins of the L293D are the portB bits 0 & 1 connected to?

Figure 5 on page 9 of the data sheet shows the motor and logic connections for a bidirectional motor control.

Offline mohit sharmaTopic starter

  • Jr. Member
  • **
  • Posts: 28
  • Helpful? 0
Re: How to change polarity of dc motor
« Reply #6 on: October 08, 2009, 09:55:41 AM »
I have connected pin no. 10 and 15 to the ATmega8L pin PB0 and PB1 .

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,939
  • Helpful? 98
Re: How to change polarity of dc motor
« Reply #7 on: October 08, 2009, 01:38:03 PM »
The L293D pins 10 & 15 are the 3A & 4A inputs.
I'll assume you have the motor connected between pins 11 & 14 (3Y & 4Y) outputs.
Pins 4,5,12 and 13 to ground.
Pin 16 (Vcc1) to +5V (would work with +3.3V, however the logic inputs A's and EN's will work from a 3.3V uC)
pin 8 (Vcc2) to the motor power supply or battery.
pin 9 (EN) tied high.
This is from the function table and circuit diagram on page 2 of the data sheet.
The other H-bridge (1 & 2) are not connected (pins 1,2,3,6,7,8).

Ok, now back to figure 9 and the truth table on page 9.
EN must be high else motor = stop.
If both 3A & 4A = high then motor = fast stop.

To run the motor 3A != 4A or if one is high the other must be low.
Which is what your code does:

 PORTB=0x01;     // forward  0001, 3A = H, 4A =L
_delay_ms(30000);

 PORTB=0x02;     // reverse 0010, 3A = L, 4A = H
_delay_ms(30000);

Check the L293's pins 10 & 15 with a voltmeter. They should be toggling every thirty seconds.
If not check that you have PORTB pins setup as outputs.

Do you have the L293's grounds connected to your uC's ground?
Do you have the L293's EN pulled high?
Is the voltage on VCC1 = +5V
Is the voltage on VCC2 enough for your motor?

Recheck these and let us know what you found.

« Last Edit: October 08, 2009, 01:47:06 PM by waltr »

 


Get Your Ad Here