chipKIT® Development Platform

Inspired by Arduino™

proper A4988 stepper motor driver delay sequence ??

Created Sun, 02 Oct 2011 19:26:09 +0000 by submission


Sun, 02 Oct 2011 19:26:09 +0000

Hello , Well this may not be a direct UNO32 question , but I am using UNO32 to controll it ... what is the proper way to set up a delay sequence to run a stepper using a stepper motor driver , like a A4988 .

..... For this example lets assume 1 sec == 1 step .

Digitalwright( Pin , LOW )
Digitalwright( Pin , HIGH )

Digitalwright( Pin , LOW )
Digitalwright( Pin , HIGH )

Digitalwright( Pin , LOW )
Digitalwright( Pin , HIGH )

I have seen code ( sketches ) posted showing each .... it would seem that all will work ... so is there an Advantage or Disadvantage of each and / or what is the proper way to do this ??

Also as a side note , is there a differance between using LOW/HIGH order as to HIGH/LOW order ?

Just want to get it wright ..Thanks for any help you can offer

Kyle .


Mon, 03 Oct 2011 00:39:33 +0000

I've done a lot of work with steppers on many platforms, including designing the Easy Driver and Big Easy Driver (the later of which is an A4988 based breadkout board that SparkFun now sells). I've seen the same things you've seen.

For the STEP input on these drivers, it doesn't matter as long as you don't go any faster than the driver chip can take. I.e., the width of your pulse (either high or low) must be at least 1uS. If it is shorter than that, it is not guaranteed to actually be 'seen' by the driver chip. So any value greater than that will work.

There are other pros/cons than that depending upon exactly how you're generating the pulses. For example, some timer output hardware can only generate at 50% duty cycle square wave, so the on and off time will always be the same but the overall frequency can be varied to vary the step rate. That's fine.

When you generate this pulse in software (i.e. from an interrupt) make sure that you wait at least 1uS before turning off the step pulse and you'll be fine.

The actual step will happen on the rising edge of the STEP signal.

Since Delay() is in mS units, using even Delay(1) is 1000 times longer than you need to meet the above requirement.



Mon, 03 Oct 2011 01:13:37 +0000

Cool , Thanks Brian Good to know that the step takes place on the riseing edge as well . Im still working on my PC software GUI for the UNO32 and the Big Easy Drivers are the stepper drivers Im planning on using , I just didn't want to get to far into this and have this come back and bite me in the end .

Well thanks again , Im sure Ill be back with more questions in the near future.