Uncategorized

A4988 fake micro stepping

Fake microstepping in A4899 and LV8729 stepper-drivers?

Ask QuestionAsked 6 days agoActive todayViewed 63 times1

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.pwmstepper-drivermicrosteppingShareCiteEditFollowFlagasked Apr 14 at 8:21GnuReligion1133 bronze badges New contributor

  • 1You 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. – user_1818839 Apr 14 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 2 days ago   
  • 1Thank 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 yesterday
  • 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 yesterday   
  • 1Last 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 yesterday
  • 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 yesterday   
  • 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: raspberrypi.stackexchange.com/questions/97975/… / to continue, … – tlfong01 yesterday   
  • / 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 electronics.stackexchange.com/questions/510755/… (3) 57BYG NEMA23 stepper motor, 4.2A, 3NM, L112mm, Ratio 50: 1, for CNC router – AliExpress US$52 fr.aliexpress.com/item/32837887016.html. Note I also play with really huge steppers, as the link in (3). – tlfong01 yesterday   
  • 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 yesterday   
  • 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 14 hours ago    
  • 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 14 hours ago   
  • (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 1 hour ago    
  • 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 1 hour ago   

Add a commentStart a bounty

1 Answer

ActiveOldestVotes0

Answer

Short Answer

I proved that my A4988 is doing 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


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 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.ShareCiteEditDeleteFlagedited just nowanswered 2 days agotlfong011,77611 gold badge66 silver badges1313 bronze badgesAdd a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.