1

I built a test jig to experiment with a friend's 16-pin A4988 stepper driver, and even added bi-directional LEDs to the outputs and, regular LEDs to the inputs, to see if it behaved as expected.

By default, it does a full circle in 200 steps, and both coils were always driven. Fine. If MS1 is set, every other step features a coil off. 200 steps rotate it half-way. Expected.

But in any jumpered "microstep" mode, and pulsing VERY slow, I can see and feel that it MERELY COUNTS steps, before the last two. For instance, at Sixteenth Stepping, the first 14 steps do nothing whatsoever. Step 15 advances a half-step, and Step 16, the next full step.

No PWM, no fractional voltages. Just counts until the final two steps, and half-steps.

So I ordered a pair of LV8729 controllers of the same 16-pin RAMPS-style from BigTree on Ali. Certainly these would microstep ... but no. Precisely the same behavior.

Anything above half-stepping, they just count until the final two pulses in the sequence. No modulated PWM, and no in-between. Half-stepping is the finest resolution available.

Does anyone have the same experience? Is there some secret to force this style of stepper driver to do real microstepping?

Have found no online references to fake microstepping on cheap stepper drivers. It is hard to imagine that millions of these are being sold, without true PWM fractional steps. Someone would notice, eh? At regular speeds though, it is difficult for a human to see.

My expectations may be amiss.

  • 1
    You need to observe the drive waveforms. It may be cheating as you say, or it may be that stiction and pole shapes make for non-linear torque (cogging) specific to the motor, so the first 14 steps don't move anything. –  Apr 14 '21 at 12:40
  • #GnuReligion, I just started playing with A4988 a couple of days ago. I only tried full step with a bipolar motor with quadrature encoder A and B signals. This afternoon I used square wave 1kHz, 50%dc as step pauses. Preliminary test shows that full step, half step, 16th step mode drives the motor from slowest to fastest. I have uploaded the scope screen captures as my answer. I don't understand how you count the step movements. Do you use a very slow frequency, say 1 step pause per second, and use your eyes to do the counting? – tlfong01 Apr 18 '21 at 08:59
  • 1
    Thank you for engaging. I do not have an oscilloscope, and admit that for duty cycles above 15%, I may not "see" dimming of my indicator LEDs very well, and that my stepper may be cogging. But still, the discrete half-step/full-step on adjacent pulses when 1/16th stepping, seem to indicate "cheating." @tlfong01 I watched your YouTube video. Nice test rig! Your red A4988 module looks same as mine. If I understand, you use PWM on the enable pin to limit current. To see my problem, you would run full enabled, and pulse steps VERY slowly. Will make a reply video for you soon. – GnuReligion Apr 19 '21 at 13:52
  • Just a quick reply. I did try to lower step frequency to 100Hz, but the motor started trembling. I found 400Hz drives the motor smoothly. I might try to see 1Hz to 10Hz. I have not tried PWM because I don't really understand why use PWM, because I think square wave is just PWM 50%. Anyway, I will try other duty cycles and see the difference. I will let you know perhaps tomorrow. Cheers, – tlfong01 Apr 19 '21 at 13:59
  • 1
    Last night, made a home-made driver with an L293D dual H-bridge. More complicated to control than the stand-alone modules; 4-wires instead of 2. Will take me a day more to write the software. I want to position the rotor BETWEEN steps. Would like to have no torsional vibration whatsoever even when turning very, very slowly. You should try use the small trim-pot on your module to regulate the output current, instead of using PWM on the enable pin. Might glue-on a heat-sink too! Your stepper is HUGE. – GnuReligion Apr 19 '21 at 14:14
  • Ah, L293D was the first driver when I learnt DC/Stepper motor drivers in my Arduino Decimilla days. It did take long hours to figure out what is going on. DC motor is easy, comparing with steppers. I did also play with small stepper in the beginning, such as 28BYJ48. I remember I started 28BJY48 in original unipolar mode, then I tore down the motor and modified it to bipolar mode. Let me see if I can find it in my junk box, and try it. – tlfong01 Apr 20 '21 at 02:30
  • I searched my old answers file directory and found the following Q&As you might be interested: (1) How to control unipolar/bipolar stepper/stepping motors such as 28BYJ48 using motor drivers such as L293D Asked 1 year, 11 months ago Active 10 days ago Viewed 831 times: https://raspberrypi.stackexchange.com/questions/97975/how-to-control-unipolar-bipolar-stepper-stepping-motors-such-as-28byj48-using-mo / to continue, ... – tlfong01 Apr 20 '21 at 02:39
  • / cont'd, ... (2) How to control DC motor speed by motor driver with PWM input? Asked 9 months ago Active 9 days ago Viewed 950 times https://electronics.stackexchange.com/questions/510755/how-to-control-dc-motor-speed-by-motor-driver-with-pwm-input/510834#510834 (3) 57BYG NEMA23 stepper motor, 4.2A, 3NM, L112mm, Ratio 50: 1, for CNC router - AliExpress US$52 https://fr.aliexpress.com/item/32837887016.html. Note I also play with really huge steppers, as the link in (3). – tlfong01 Apr 20 '21 at 02:40
  • BTW, I don't write Arduino C++ or Rpi python programs to do online testing. I usually test offline by hand, using NE555 astable, or cheapy battery charger (as shown in my video) as PWM sig gen. – tlfong01 Apr 20 '21 at 02:44
  • And so I searched my junk box and found two small stepper motors (one of the two is 28byj-48 which I modified the wiring to convert the motor from unipolar to biploar. And when I tried to replace the big motor by the small motor, I surprisingly found that for the driver board, all 4 screws securing the posts were fallen off, causing the whole structure staking violently. I guess if I use the small motors, then there might be very little shaking, and so I can count the motor step movements by eyes easier. – tlfong01 Apr 20 '21 at 14:40
  • I also think that if I use soft absorbing pads (those for making electric fans quiet) then there would be also less shaking/vibrating. This is what I am going to do next. Bed time. See you tomorrow. Cheers. – tlfong01 Apr 20 '21 at 14:40
  • (1) I am a little bit confused why you diverted to L293D, I am still confused between L293D/L298N both of which has two full bridges to drive two motor, and for each motor there are 3 signals, IN1, In2, INH, where IN1, IN2 to control direction, and INH to enable/disable motor. And in INH is PWM, can also control speed. (2) Now I confused me by asking me if I used PWM signal as INH to control stepper motor speed. I am 90% sure that for A4988, (a) you used a "step pulse" to anable and control speed at the same time: – tlfong01 Apr 21 '21 at 03:23
  • That is why earlier I said that (a) a square wave pulse is just one step pulse with 50% dc. I think the duty cycle makes no difference in control speed (unlike L298N) In other word, a 10% dc pulse or 90%dc pulse, is just the same as a 50% pulse. Well, I am only 60% sure. Well Talk is Cheap, let me show proof the concept by comparing the speed of three kinds of step pulses: 10%, 50%, and 90%. I know you are not experience in looking at scope screen captures, so this time and later, I would show the manual measurement results, without scope. Just thinking aloud, sorry for the typos. Cheers – tlfong01 Apr 21 '21 at 03:31
  • #GnuRegion, MY BIG APOLOGY! I always wrongly thought that only A4988's step is used to control speed. I AM LL WRONG!. I did not notice that there is an A4988 has ENABLE pin. So please ignore my earlier comment on using the step signal. I need to read the datasheet and think again. Sorry about that. Cheers. – tlfong01 Apr 21 '21 at 05:26

2 Answers2

1

Short Answer: These drivers are made to work with a specific class of 3d printer steppers, and will not engage PWM in the microstep region until a given amount of current is drawn.

My problem was, that the stepper I am using to test these RAMPS style drivers is salvaged from and old 5.25 floppy. Runs at 12V, wired for bipolar operation, and has 200 full steps per rotation ... all very much like a NEMA 17, but it simply does not draw enough current to properly engage PWM, except slightly, at the very extent of the trim pot.

Now I understand these drivers are actively monitoring the current draw and adjusting the duty cycle accordingly. They are made specifically to hit full steps.

There are other types of driver chips that work the way I had expected, and have already built something similar with a dual H-bridge and MCU.

Lets see if I can figure out how to close this question.

0

Question

A4899's microstepping operation seems not performing as specified. Is it fake microstepping?


Answer

Short Answer

I proved that my A4988 is doing real microstepping, as specified in datasheet.


Long Answer (TLDR)

Abstract

This long answer shows how the A4988 is tested using

  1. High frequency signal, 1kHz, 50% duty cycle, using a oscilloscope to measure microstep timing/performance, and,

  2. Low frequency signal, 20Hz, 10% ~ 90% duty cycle, using a stop watch to time by hand the full step, half step, and micro step operations.


References

(1) A4988 Datasheet - Allergo

(2) A4988 Stepper Motor Driver Module - AliExpress US$0.6

(3) Fake microstepping in A4899 and LV8729 stepper-drivers? - @GnuReligion, EESE, Asked 2021apr14

(4) What could be the reasons for a stepper motor stuttering with an A4988 driver? [Locked] EESE, Asked 2021apr05

(5) What is better for precision? Stepper motor VS DC Motor [Closed] - EESE 2021apr13

(6) AliExpress HK42BYG250-001 Stepper Motor NEMA17 | High torque 1.2A 38mm stepper motor for 3D printer 42 with speed feedback

(7) Youtube video of A4988 Full Step Performance - tlfong01 2021apr18

(8) RpiMotorLib python library to drive NEMA 17 stepper for A4988 - DiyProjects 2021feb09


Appendices

Contents

Appendix A - Testing A4988 using 1kHz 50% Ducty Cycle Square Wave

Appendix B - Testing A4899 using 500Hz, 50% square wave

Appendix C - Testing A4988 Micro Stepping using 20Hz, 50%dc signa

Appendix D - Proof of concept - Motor speed is independent of PWM pulse width

Appendix E - Clarify difference between A4899's Step and Enable Signals

Appendix A - Testing A4988 using 1kHz 50% Ducty Cycle Square Wave

Chat record #1

#GnuReligion, I just started playing with A4988 a couple of days ago. I only tried full step with a bipolar motor with quadrature encoder A and B signals. This afternoon I used square wave 1kHz, 50%dc as step pauses. Preliminary test shows that full step, half step, 16th step mode drives the motor from slowest to fastest. I have uploaded the scope screen captures as my answer. I don't understand how you count the step movements. Do you use a very slow frequency, say 1 step pause per second, and use your human eyes to do the counting?


full step


full step


half step


16th step


a4988 step motor test

Youtube A4988 Test 01


Appendix B - Testing A4899 using 500Hz, 50% square wave

Full step

full


Half step not sure

not sure


Step 16

step16


Appendix C - Testing A4988 Micro Stepping using 20Hz, 50%dc signal


Configuration

  1. A4988 Setting - (a) full step, (b) half step, (c) microstepping (16th step)

  2. Step pause setting = 20 step pulses per second (20Hz, 50%dc)

  3. Stepper motor HK42BYG250-001 1.8 degrees (360 / 1,8 = 200 steps per revolution)


Results

Time taken for one revolution:

Full Step ~= 10 seconds

Half Step = ~= 20 seconds

16th Step = ~= 2:39 min ~= 159 ~=160 seconds


Conclusion

a4899 microstepping seems working OK.


Appendix D - Proof of concept - A4899 performance/Operation/Motor speed is independent of pulse width of step pulse input

Configuration

  1. Pulse frequency = 20Hz = 20 pulses per second

  2. Pulse width (a) 10% dc, (b) 20% dc, (c) 90% dc

Results

Times taken per revolution for different pulse widths: 10%, 50%, 90% are all the same: 10 seconds.

Conclusion

Motor speed is independent of pulse width.


Appendix E - Clarify difference between A4899's Step and Enable Signals

So far I have been using the Step signal to prove that A4899 can detect the microstep jumper configuration and perform the operation. But I might have misled readers that the Step pin/signal is used to control the speed of the motor. It is true that Step pulse frequency can be used to control motor speed, but I think step signal is used to position the motor, or revolutions and degrees traversed. It think it is the enable signal which can be PWM, is used to control the motor speed. So I am now extracting materials from Ref 4 and placed here for discussion.


The pin functions.

pin functions


A4899 Spec Summary

a4899 spec summary


Stepper motor spec summary

motor spec summary


Notes

The above motor spec shows that torque decreases with increasing torque. For future tests, the default 1KHz, 50%dc will be used as the default.


tlfong01
  • 2,766
  • 1
  • 9
  • 17