Hi all is there anyone good with stepper drives I have a new project to control a stepper. Drive to a max speed of 600rpm
Driver = DM332T (may not be the right driver for what I need )
Stepper nemus 17 1.6a with a 10:1 box
Arduino Nano 33 IoT
My issue is everything works but the stepper not even a flinch unsure if it’s my program or the driver if anyone has a moment just to look over my program and let me know if I have done something wrong I’m screen blind today
#include <Stepper.h>
#include <LiquidCrystal_I2C.h>
// Define pins
const int stepPin = 2;
const int dirPin = 3;
const int enPin = 4;
const int potPin = A0;
const int footPedalPin = 4;
// Define stepper motor steps per revolution and gear ratio
const int stepsPerRevolution = 200; // Adjust based on microstepping
const float gearRatio = 10.0; // Adjust based on your gear configuration
// Define LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Create a Stepper object
Stepper myStepper(stepsPerRevolution, stepPin, dirPin);
void setup() {
// Initialize the stepper motor
myStepper.setSpeed(0);
// Initialize the LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Wrap Jet");
// Initialize the foot pedal pin as input
pinMode(footPedalPin, INPUT_PULLUP);
// Initialize DM332T control pins
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(enPin, OUTPUT);
// Enable the DM332T
digitalWrite(enPin, HIGH);
// Initialize serial communication
Serial.begin(9600);
}
void loop() {
// Read the potentiometer value
int potValue = analogRead(potPin);
// Map the potentiometer value to a speed range (adjust as needed)
int speed = map(potValue, 0, 1023, 0, 1000);
myStepper.setSpeed(speed);
// Check if the foot pedal is pressed
if (digitalRead(footPedalPin) == LOW) {
// Set direction (adjust as needed)
digitalWrite(dirPin, HIGH); // Adjust direction as needed
// Generate a step pulse
digitalWrite(stepPin, HIGH);
delayMicroseconds(100); // Adjust pulse duration
digitalWrite(stepPin, LOW);
Serial.println("Step pulse sent"); // Debug message
} else {
// Stop the motor
digitalWrite(stepPin, LOW);
}
// Calculate and display speed in RPM
lcd.setCursor(0, 1);
lcd.print("Speed: ");
lcd.print(speed);
lcd.print(" RPM");
}

