Motore che va a 1/2 passo

Ciao. Ho un problema con un controllo A4988 comandato da Arduino 1. I Pin MS1 MS2 MS3 sono liberi ma il motore funziona in modalità 1/2 passo. Per compiere un giro completo devo inviare 400 impulsi. Il motore è da 200 passi giro. Potete aiutarmi. Ho controllato ripetute volte i collegamenti

Hello. I have a problem with an A4988 control commanded by Arduino 1. Pin MS1 MS2 MS3 are free but the motor works in 1/2 step mode. To make a complete turn I have to send 400 pulses. The engine is 200 steps per revolution. Can you help me. I have checked the connections over and over again


Could you measure the voltage on each of the MS# pins? Also, could you post picture of your setup that show all of your connections?


Thanks for the reply. The voltages are practically all three at 0 V (<0.05V).
But I think I understand the problem. The step pulse must be fairly symmetrical (HIGH part duration similar to LOW part duration). Now my sketch is long enough and introduces considerable delays between the LOW phase and the HIGH phase. So the LOW phase lasts much longer than the HIGH phase. If I write a shorter sketch with only the instructions needed to operate the engine, everything goes back to normal. Can you give me some advice?

The step pulse does not need to be symmetrical, as long as the signal is high or low for at least 1μs, it should register according to the A4988 datasheet.

As far as your sketch, it sounds like you are probably having problems with blocking code. It is hard to have any specific advice without seeing the code or a video demonstrating to the problem, but you might consider using something like the StepperDriver Arduino library if you are not already. That library has a few nice features, including a non-blocking mode that might be useful for you.


okay. I don’t know this library. I’m studying it and I’ll try to apply it to my skech then I’ll let you know the results. for now, thank you very much

Good morning. I haven’t had good results with the library. I then worked on my skech and I replaced the microDelay() function with micros() and now everything works so as you said it doesn’t depend on the driver but on my skech. I feed the motor at 22 V and I get a maximum of 660 rpm then the motor stalls. If I increased the voltage to say 26V could I have a higher speed? Thank you

I am glad to hear you got it working better. There are a few factors that affect the maximum achievable step rate, but the operating voltage does typically have a big impact, so that would be a good place to start. You can find some additional suggestions in this post by Ben.


I found this library “AccelStepper.h”. I managed to get the runSpeed() command working. But the acceleration function doesn’t work. Can you help me ?

We did not write that library, so the support we can offer is limited, but if you post your Arduino sketch here, I can see if I notice any obvious issues.


Hello. My sketch is long enough but the points where I use the library are only these. The project is used to control a winding machine for transformers. The spindle motor must run at a fixed speed but must have a soft start so as not to break the wire.
The wire guide feed motor must be synchronized with the spindle and must turn at a speed that can be set according to the diameter of the wire:

#include <LiquidCrystal.h>
#include <AccelStepper.h>
// Crea i due oggetti stepper per il controllo dei motori
AccelStepper stepper1(1,11,10 );
AccelStepper stepper2(1,9,8 );
 void setup() {
// Imposto i valori per la libreria gestione motori
      if (girPar <= 10360){    // Stop a n. giri per strato impostato. 
        girPar = stepper1.currentPosition();

As I mentioned before, I am not very familiar with that library, but from the documentation, it sounds like the runSpeed() command is for running the motor at a constant speed (set with the setSpeed() command). You might try changing your runSpeed() commands to run() since it sounds like that is intended for acceleration limiting, and see if that makes any difference.


Replacing runSpeed() with run() the motor doesn’t run. I believe the run() function only accepts per position operation (not good for me) while runSpeed() only works with a fixed speed set with setSpeed() ( As you said). The mode with placement is too complicated for my application. I was thinking of creating my own acceleration “ramp” and passing the increasing values to the setSpeed() function every loop before the runSpeed() function. This will perhaps slow down the code. I’m trying then I’ll let you know

good morning. I managed to get my application working. Now i have this problem. Every time the program varies the speed I have to adjust the current adjustment potentiometer. Is this normal?

Could you post more details about what happens when you run your code? A video showing the problem would be helpful.

You should not have to adjust the current limiting potentiometer based on the speed. In general, I recommend leaving the current limit potentiometer set to the current per phase rating of your motor (or what the driver is capable of handling continuously, whichever is lower). Instructions for doing so can be found under the “Current limiting” section of our A4988 carrier’s product page.

Could you post more information about your setup, such as what motor and power supply you are using? Also, could you post picture of your setup that show all of your connections?


I can send you a wokwi simulator file where I simulated the operation and the circuitry that I made there is all my schech. If that’s okay with you.
The power supply is self-built and delivers 24 Vdc max 4 A. However, I noticed that when the two motors are running I have a ripple of 10V (!!!)
I’m waiting for the components to improve this aspect
the two motors are nema 17 with 1/5.18 reducer purchased on the net whose brand I don’t know