Thank you for sharing the great content! I am using the same stepper motor. It looks like EA- and EB- cables from the encoder are not connected to Arduino? Should I leave the two lines as it is? Or should they be connected to GND?
Now wire up a noisy Grove (pot) Joystick using just the X axis to the Arduino to control the motor position and let's see if it can handle the jitter and also the motor returns home when the joystick is centered as well. I use "Exponential Smoothing" to address the jitter but for some reason sometimes the motor can't find its way back home and it becomes off. I also use an L298N and Arduino GIGA R1. Let me know, thanks! Here's my code: #include // Change this to the number of steps on your motor #define STEPS 200 // Create an instance of the stepper class, specifying // the number of steps of the motor and the pins it's // attached to Stepper stepper(STEPS, 7, 6, 5, 4); // The previous filtered sensor reading float filteredSensorValue = 0; // The previous filtered reading for smoothing float filteredPrevious = 0; // The smoothing factor (alpha value) float alpha = 0.2; // You can adjust this value as needed void setup() { // Set the speed of the motor to 200 steps per second stepper.setSpeed(200); // Initialize the filtered sensor reading filteredSensorValue = analogRead(0); filteredPrevious = filteredSensorValue; // Initialize filteredPrevious } void loop() { // Get the raw sensor value int rawSensorValue = analogRead(0); // Apply exponential smoothing to the sensor reading filteredSensorValue = alpha * rawSensorValue + (1 - alpha) * filteredPrevious; // Calculate the difference between the filtered and previous readings int diff = abs(filteredSensorValue - filteredPrevious); // Move the stepper motor only if the difference is greater than a threshold (e.g., 5) if (diff > 5) { // Move a number of steps equal to the change in the sensor reading stepper.step(filteredSensorValue - filteredPrevious); // Update the previous filtered reading filteredPrevious = filteredSensorValue; } }
It is posible to move the stepper by the angle?
Thank you for sharing the great content! I am using the same stepper motor. It looks like EA- and EB- cables from the encoder are not connected to Arduino? Should I leave the two lines as it is? Or should they be connected to GND?
what is the part that you are using to display angular position called and how did u show it
Congratulations from Belgium and thank you for sharing. 👋👏👍
Hii.. this program can show actial rpm on lcd? Pls help me
This project is very good!
Very nice!
Now wire up a noisy Grove (pot) Joystick using just the X axis to the Arduino to control the motor position and let's see if it can handle the jitter and also the motor returns home when the joystick is centered as well. I use "Exponential Smoothing" to address the jitter but for some reason sometimes the motor can't find its way back home and it becomes off. I also use an L298N and Arduino GIGA R1. Let me know, thanks!
Here's my code:
#include
// Change this to the number of steps on your motor
#define STEPS 200
// Create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 7, 6, 5, 4);
// The previous filtered sensor reading
float filteredSensorValue = 0;
// The previous filtered reading for smoothing
float filteredPrevious = 0;
// The smoothing factor (alpha value)
float alpha = 0.2; // You can adjust this value as needed
void setup() {
// Set the speed of the motor to 200 steps per second
stepper.setSpeed(200);
// Initialize the filtered sensor reading
filteredSensorValue = analogRead(0);
filteredPrevious = filteredSensorValue; // Initialize filteredPrevious
}
void loop() {
// Get the raw sensor value
int rawSensorValue = analogRead(0);
// Apply exponential smoothing to the sensor reading
filteredSensorValue = alpha * rawSensorValue + (1 - alpha) * filteredPrevious;
// Calculate the difference between the filtered and previous readings
int diff = abs(filteredSensorValue - filteredPrevious);
// Move the stepper motor only if the difference is greater than a threshold (e.g., 5)
if (diff > 5) {
// Move a number of steps equal to the change in the sensor reading
stepper.step(filteredSensorValue - filteredPrevious);
// Update the previous filtered reading
filteredPrevious = filteredSensorValue;
}
}
Like 124, big show 👏👏👏
the postion control mode should be tested in higher speed
I love you ❤❤❤❤
Good!!!