Help need with a problem with a stepper and driver

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");
}

Please, show a wiring diagram. Include the parameters of your power supply.

Why not use serial.Print(potValue) to verify the actual values you are working with?

Hi I will have a drawing shortly for you but basically

Driver and stepper controlled by 24v power supply arduino supplied by 3.3 from a buck converter 24vdc to 3.3

Arduino wired as listed in the code but will upload a diagram shortly

Yes seen this foot pedal is now on pin 5 lol

If your stepper isn't moving, then step #1 is to remove all the extraneous code except for what you need to send steps to the motor driver. Debug one thing at a time!

Remove the "EN" wire... I think you have it at the wrong state. No connection will let the EN be enabled.

** Also, in the simulation of your code, I needed to remove this line, or the sketch would not function. A shared timer somewhere in a library, probably.

The value shows on the LCD.

That is the computed value, not the raw value.

1 Like

Thank you so much I was going blind today looking at my screen

Do you think from your experience that this program will be capable of 600 rpm as max speed?

Or would you suggest a different method

Thank you again for your time

Simon

I neither know or have enough experience to give a valid answer.

Depends how that gear box is connected. Geared up or geared down. 600RPM (2000 steps/sec) should be possible for a stepper motor without gear box, but not with that stepper.h library. You need a library with acceleration, like MobaTools.
Leo..

Hi Leo

Thank you for the advice I will have to see if I can find it in the library in the morning

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.