Hello everybody,
I have been struggling with an Arduino UNO project for the last few days so I decided to write a post on the forum. I thank you for taking the time to read this and I hope someone can help me.
For the project I am working on, linear actuation at a maximum of 250 N is required. The force increases gradually from zero to the maximal value. As a linear actuator, I am using a NEMA 17 coupled with a lead screw and a nut. The driver of the motor is an Elegoo A4988 used in full step mode.
The problem I have is that the stepper stops moving and makes noise, I guess it’s losing steps when it can’t provide the required force. When such a failure occurs, the delivered force is around 30 N.
The motor datasheet guarantees a holding torque of 420 mN*m at 1.5 A. If my computations are right, such a torque corresponds to a force of 1319 N, considering a lead screw capable of perfectly transmitting the motor power to the nut. Even being very pessimistic about the lead screw efficiency, the motor seems to be good enough for the job. It should be noted that, to have a torque as close as possible to the torque at zero velocity, I am using the motor at a very small speed, around 50 rpm. I suspect I am doing something wrong with the power supply of the motor.
In order to set the current limit, I have watched a video by Pololu. I have managed to set the current limit at 1.5 A single phase, the motor rated current. However, I have observed that the current decreases to a value in the order of 0.01 A as the motor starts moving. The current drops during the homing and remains low when it needs to provide the gradually increasing force. When the motor starts losing steps and making noise, the current remains low.
I have noticed something that might be interesting stating here. In the video by Pololu I have linked before, the current is also changing when the motor is moving. However, in their case it oscillates from the rated current value to the negative rated current value. In my case it seems to oscillate from 0.02 A to -0.02 A.
Could it be that the tension of the power supply is not high enough? The datasheet recommends a tension between 12 V and 36 V and I am currently using 12 V. The only other explanation I can come up with is that there is a problem with the pulses I am sending to the motor. I post the code in case the problem is in there:
const int homePin = 7;
const int switchPin = 8;
const int stepPin = 5;
const int dirPin = 4;
int homeState = LOW;
int switchState = LOW;
int steps;
// --------------------------------------------------------------
void setup() {
// --------------------------------------------------------------
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(switchPin,INPUT);
pinMode(homePin,INPUT);
delay(5000); // Here the current is 1.5 A
while (homeState == LOW) { // From here the current drops to 0.02 A
digitalWrite(dirPin,LOW);
digitalWrite(stepPin,HIGH);
delayMicroseconds(9500);
digitalWrite(stepPin,LOW);
delayMicroseconds(9500);
homeState = digitalRead(homePin);
}
while (homeState == HIGH) {
digitalWrite(dirPin,HIGH);
digitalWrite(stepPin,HIGH);
delayMicroseconds(9500);
digitalWrite(stepPin,LOW);
delayMicroseconds(9500);
homeState = digitalRead(homePin);
}
steps=0;
delay(500);
for(int steps = 0; steps < 120; steps++) {
digitalWrite(dirPin,HIGH);
digitalWrite(stepPin,HIGH);
delayMicroseconds(9500);
digitalWrite(stepPin,LOW);
delayMicroseconds(9500);
}
delay(1000);
}
// --------------------------------------------------------------
void loop() {
// --------------------------------------------------------------
while (switchState == LOW) {
digitalWrite(dirPin,HIGH);
digitalWrite(stepPin,HIGH);
delayMicroseconds(48000);
digitalWrite(stepPin,LOW);
delayMicroseconds(48000);
switchState = digitalRead(switchPin);
}
delay(5000);
}
Thank you very much for reading the post until the bottom, it's a bit long but I tried to be as precise as possible.