Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] [Moved] Need Help: AVR - L293D - Bipolar stepper motor

Status
Not open for further replies.

Don_dody

Full Member level 1
Full Member level 1
Joined
Nov 4, 2012
Messages
96
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Indonesia
Visit site
Activity points
1,921
Can somebody suggest me the right connection of AVR to L293D to TWO Stepper motors (24V) ? I really need it.
 


Re: Need Help: AVR - L293D - Bipolar stepper motor

Ok thanks, I got it.

For programming these motors (AVR), can I just use delay as shown in that link or any other method? Actually I want to use it to open/close the roof like open 1/4, open 1/2, open 3/4, and open full. Just as simple as that but I just don't understand yet.
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

For a simple project the delay should be fine.
Note that you can use the delay routine _delay_ms(x) from delay.h, no need to create loops
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

Oh wait, just realize it. I think I need to include the code inside my interrupt service routine then I just read that delay is not good here. Is there any other solution?
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

You don;t have to put the delay inside an interrupt, you can alwys set a flag variable and execute some code in main based on that.

The alternative is to use timers
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

Ok i'll try it first and bring the result here. Thank you
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

stp.png

On that picture, where should I connect the ground? is it the ground from 24V power supply OR the ground from my minimum system? I use two different power supply actually.
 
Last edited:

Re: Need Help: AVR - L293D - Bipolar stepper motor

Both grounds should be connected together at some point, if the grounds are separated then you can't feed a logic pulse at the input of L293, you need a common reference (unless you intend to use optocouplers for all signals)
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

OK, actually I've built power supply 12V and 5 V only. Since my motor is 24V, then I plan to use external power supply from the LAB. That's why i'm confuse.

What If i connect it to the 12V ? Will it work? I use PM42S-096 stepper motor
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

According to the datasheet the bipolar motor is 24v/10ohm 500mA which means it is intended for PWM , if you give 24v it will get 2.4A , with 12v 1.2A , these are both out of spec.
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

Can I do something like this:

(not tested, coz I'm not sure)

Code:
void left (void)
{
PORTB = 0X01; delay_ms(5);
PORTB = 0X03; delay_ms(5);
PORTB = 0X02; delay_ms(5);
PORTB = 0X06; delay_ms(5);
PORTB = 0X04; delay_ms(5);
PORTB = 0X0C; delay_ms(5);
PORTB = 0X08; delay_ms(5);
PORTB = 0X09; delay_ms(5);
PORTB = 0X01; delay_ms(5);
}

void right (void)
{
PORTB = 0X01; delay_ms(5);
PORTB = 0X09; delay_ms(5);
PORTB = 0X08; delay_ms(5);
PORTB = 0X0C; delay_ms(5);
PORTB = 0X04; delay_ms(5);
PORTB = 0X06; delay_ms(5);
PORTB = 0X02; delay_ms(5);
PORTB = 0X03; delay_ms(5);
PORTB = 0X01; delay_ms(5);
}
 
Last edited:

Re: Need Help: AVR - L293D - Bipolar stepper motor

The problem is not the motor type but the fact that the coil has a low resistance.

To use the motor with plain DC you would have to use 5v since 5v/10ohm =500mA , the difference is that the current when the voltage is high reaches the 500mA much faster and this it allows faster steps and higher torque.

If you just want to experiment you can either use a resistor in series with the motor coils or 5v supply.
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

What about the driver (l293d) ? Can i still use it ?

I just read the datasheet that drive IC for this motor is UDN2916B-V.
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

Yes, there is no problem about the driver (L293), you just have to implement the PWM with the AVR.
The other driver you mention is autonomous and includes internal PWM that limits the current, it is up to you to use the way you prefer
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

Hi, I just wondering why the datasheet says drive voltage 24V while the resistance is so small..
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

Basically the current can reach the 500mA much faster when you supply 24v than 5v and this has to do with the inductance of the motor coils.
I think it will be better explained if you read https://www.stepperworld.com/Tutorials/pgCurrentControl.htm
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

For the programming, is there any examples of driving stepper motor using PWM feature in AVR?

I got an example of PWM used to increase or decrease the speed of DC motor only.
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

Hi, about the L293d pin connection with the AVR, I just dont get the logic yet, can I change the pin as what I want or not. I really confuse in programming, guide me please..
 

Re: Need Help: AVR - L293D - Bipolar stepper motor

There are four control pins 1A, 2A, 3A, 4A each of them sets high an output when you set it to high and low when you set them low.
There are two enable pins 1,2EN and 3,4EN that each is an enable for an an output pair and should be set high for the output to work.

There are four steps that need to be repeated but the bipolar motor, you can see them or https://homepage.cs.uiowa.edu/~jones/step/types.html#bipolar
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top