Page 1 of 9

How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 11:22 am
by sich
This post is moved from FAQ for SD01A, SD02A & SD02B, originally posted by glee_glare.

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 11:24 am
by sich
Posted by: glee_glare
Post subject: Re: FAQ for SD01A, SD02A & SD02B Posted: Wed Oct 07, 2009 10:05 pm


i'm not really understand about the signal and en pin
as far as i know..stepper motor configured to run by step as figured like below
In the full step sequence, two coils are energized at the same time and motor shaft rotates. The order in which coils has to be energized is given in the table below.

Full Mode Sequence
Step A B A\ B\
0 1 1 0 0
1 0 1 1 0
2 0 0 1 1
3 1 0 0 1

so when this driver only 2 input..how can i set the sequence?
i'm using assembly language and try to move the stepper 45 degree cw and ccw

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 11:25 am
by sich
Posted by: Moderator
Post subject: Re: FAQ for SD01A, SD02A & SD02B Posted: Wed Oct 07, 2009 10:23 pm


Hi glee_glare,

You are right and actually this is why we come out with these stepper motor drivers. Generate step sequence is a resource consuming process when your controller is not only taking care of the stepper motor alone. Proper algorithm is needed to achieve that.

With these drivers, you only need 3 pins to control the stepper motor driver which will help you to generate the correct step sequence. Your controller only needs to give pulses and control the enable and direction signals. Each single pulse to the stepper motor driver will trigger the stepper motor to move one step at the given direction. The frequency of the pulses you give will determine the rotation speed of the stepper motor.

I hope I clarified your doubt.

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 11:26 am
by sich
Posted by: glee_glare
Post subject: Re: FAQ for SD01A, SD02A & SD02B Posted: Thu Oct 08, 2009 3:57 pm


hmm..not quite understood
i've used rc2 for pwm..can you give example on how to generate pulse in other alter way

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 11:27 am
by sich
Posted by: Moderator
Post subject: Re: FAQ for SD01A, SD02A & SD02B Posted: Thu Oct 08, 2009 5:30 pm


May I know which part you don't understand?

The simplest way to generate pulse would be assign a pin as output then gives it HIGH and LOW signal continuously. The frequency will be determined by the delays in between these HIGH/LOW signals.

Time ---->
LOW (delay) HIGH (delay) LOW (delay) HIGH (delay)....

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 11:57 am
by sich
Posted by: glee_glare
Post subject: Re: FAQ for SD01A, SD02A & SD02B Posted: Thu Oct 15, 2009 8:53 am


do you mean..if i'm using PortD0 as pulse
i just code Hi and Lo continously and PortD1 as direction pin?
POrtd0 function to move the motor and Portd1 as direction of the motor?

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 12:01 pm
by sich
Yes, you can do that. Please take note that the frequency of stepping is depending on the frequency of the pulses you give. If your frequency is too high, the motor won't move correctly. You can try with a low frequency first. Let say 50Hz and increase it to find the max frequency your motor can support.

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Oct 15, 2009 1:56 pm
by glee_glare
hmm..kind of difficult
any idea on how calculate the hi n lo to get the freq?
kind of confuse..
let see..if i;m using assembly language..

bsf portd0
call delay5micros
bcf portd0
call delay5micros

how many of these i need to repeat until i get 45 degree of rotation?

Re: How to control a stepper motor using SD02B?

PostPosted: Fri Oct 16, 2009 10:36 am
by sich
Delay is a common yet useful routine so u really have to master it. It's very simple if u take ur time to understand it.

This calculator can help u. It even generates the assembly codes for u. You only need to specify the clock (crystal) frequency you use and the desired delay. Remember to check the 'Generate Routine' if u want it to generate a routine for u to call.

http://www.piclist.com/techref/piclist/codegen/delay.htm

About how many pulses u need to move 45 degree, u can refer to SD02B FAQ no.7.

Re: How to control a stepper motor using SD02B?

PostPosted: Thu Jan 14, 2010 9:55 am
by dante
i had try to control stepper motor by using switches to generate pulses to SD02B..
but the LED indicator for stepper motor coil shown 3 coil is power at a moment..
when i generate pulse to SD02B, 3 coil also power but different coil from previous..
it supposed only two coil power at a moment.