Hello.
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?
Brandon
Hello.
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?
Brandon
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.
Brandon
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.
Brandon
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.
Brandon
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
stepper1.setMaxSpeed(4000);
stepper2.setMaxSpeed(4000);
stepper1.setAcceleration(1000);
stepper2.setAcceleration(1000);
stepper1.setSpeed(velMan);
stepper2.setSpeed(velMan/2);
...
digitalWrite(ENA_M,LOW);
digitalWrite(ENA_A,LOW);
if (girPar <= 10360){ // Stop a n. giri per strato impostato.
stepper1.runSpeed();
girPar = stepper1.currentPosition();
stepper2.runSpeed();
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.
Brandon
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 pictures of your setup that show all of your connections?
Brandon
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
A 10V ripple in the power supply definitely sounds like it could be causing problems, so I suggest fixing that first (or using a known good power supply for testing). I am not sure how helpful a simulation would be, but in meantime, could you post the information I asked for in my previous post? In particular, pictures of your actual system that show all of your connections, as well as the specs of your stepper motors (the NEMA size does not give any indication of the voltage or current per phase ratings). Additionally, could you tell me what you have the VREF voltage set to on the drivers?
Brandon
Hello. As you suggested I improved the power supply of the motors by increasing the filter capacity and now I have a ripple of only 1V.
Now the engines run much smoother and many of the problems have disappeared. To answer your questions:
-I don’t know the exact specifications of my motors but on the net I found a very similar motor with these characteristics.
Angular displacement: 1.8° (full step)
Accuracy: ±5% (full step, no load)
Current per phase: 1.68A
Resistance per phase: 1.8 Ω ±10 Ω
Inductance per phase: 2.8mH
Holding torque: 4800 g cm
Number of stages: 2
Shaft diameter: Ø8mm
Axle length: 20mm
-The vRef that I adjusted is 0.475 V.
_Finally I attach the photos of my circuit. As you can see it is about
a homemade and very messy homemade circuit
The fact remains that the maximum speed of the engines does not exceed 600 rpm. Could I have some advantage by increasing the power supply voltage of the motors?
I am glad to hear that improving the power supply fixed most of your problems.
As I mentioned before, there are a few factors that affect the maximum achievable step rate, but the operating voltage is a good place to start. You might just be reaching the practical upper limit of speed that your stepper motors are capable of. Ideally, you could find a datasheet for them that has a pull-out torque curve, which would give you a general idea of the kind of performance they can achieve.
However, I am concerned that you are setting the current limit without knowing the current per phase rating of your stepper motors (basing it on one that looks similar is probably not valid). If you set the current higher than the motor is rated for, you could overheat and/or damage the motors. It is generally okay to run them at a lower current than they are rated for, but doing so will result in a lower achievable step rate (i.e. lower speed) and torque. If your motors are actually rated for 1.68A per phase, then you could probably reach higher speeds by using a driver that can safely drive them at higher currents, like the DRV8825 carrier or TB67S249FTG carrier.
Brandon
Thanks for your help. Now the driver-motorstep operation is clearer to me. Can I somehow measure the current that the motor absorbs? If I measure the input current to the driver, can I have an idea of the current per phase?
The current per phase rating of a stepper motor is the current the coil will draw at the rated voltage, so you would need to know the rated voltage to measure the current.
If you know the rated voltage, you could also measure the resistance of the coil to calculate the current per phase rating using Ohm’s law. This also works in reverse, so if you know the rated current per phase, you can use the resistance of the coil to determine the rated voltage, but you need to know one or the other to start with.
Brandon
Unfortunately, I don’t know either of the two data required for calculating the current. I have now adjusted the potentiometer to have a voltage of 0.9V. With this setting the motor runs at an acceptable speed around 600rpm. The system ran for about 15 minutes. The engine remained completely cold while the driver’s heatsink was barely warm. (I can estimate 30 degrees).
For now I am satisfied with the result and later I will increase the supply voltage to see if the speed can be increased. Thank you for your availability and for your help. Good day and good work.
Anthony