I recently purchased a linear actuator, the FUYU FSL30 model with a 200 mm stroke, for my final project. This actuator is based on a NEMA 14 stepper motor. The purpose of the linear actuator is to perform cyclic back-and-forth motion.
I connected the linear actuator to an Arduino UNO and an L298 driver, supplying it with a voltage of 12V at the input of the driver. Additionally, I wrote simple code for it.
However, I've encountered some unexpected issues. Most of the time, the motion is as expected, but occasionally it behaves randomly, moving a certain number of times to the right and then to the left. Furthermore, when attempting to operate the actuator at speeds higher than those specified in the motor's datasheet, it does not rotate and emits only noise.
I've thoroughly checked the connections and even tried using other motors, but the response remains similar. I'm reaching out to seek assistance from anyone who might have insight into what the problem could be. Thank you ahead.
THE CODE:
#include <Stepper.h>
const int stepsPerRevolution = 60; // Change this to fit the number of steps per revolution of your motor
const int motorSpeed = 1100; // Speed in steps per minute
int rev=70;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); // IN1, IN2, IN3, IN4 connected to digital pins 8, 9, 10, 11
void setup() {
myStepper.setSpeed(motorSpeed); // Set motor speed
}
void loop() {
// Step forward
for(int i=0; i<rev; i++)
{
myStepper.step(stepsPerRevolution);
}
delay(500); // Adjust delay as needed for desired velocity
for(int i=0; i<rev; i++)
{
myStepper.step(-stepsPerRevolution);
}
delay(500); // Adjust delay as needed for desired velocity
}
The L298 is a very inappropriate driver for that stepper motor. That stepper requires a current controlled driver like the A4988, DRV8825, TB6600, depending on the coil current requirement. And the Stepper library is not for bipolar motors. I like the MobaTools stepper library. The library is available to install using the IDE library manager.
Post the data sheet for the motor and we can help with a driver.
Using the proper driver will also help with the max speed and max torque. You can raise the motor supply voltage (to the max allowed by the driver). The properly adjusted coil current limit will maintain the current.
Current controlled drivers must have their coil current limits set before use. Here is how 2 are done. Instructions for others can be easily obtained.
the issue is that it doesn't come close to the maximum speed value - the speed in the video is approximately the maximum speed at which the motor operates smoothly.
Thank you very much. I will try to use other folders like Mobatools as you mentioned, and I will also try to operate the engine with a different driver. Regarding the current - I am using a power supply limited to 1A