Three ways to connect a NEMA 17 Stepper Motor

Hi all,

I think i probably already know the answer but i just want to ask this to make sure i'm not missing anything.

I've got a project that involves a stepper motor (JK42HS34). This motor wil only turn once a day a specific amount of steps, usually about 2.5 turns. The rest of the day it will be completely off and it does not require any holding torque.

So the options are:

  • Use the Accelstepper.h library and drive it directly from the arduino;
  • Use the Accelstepper.h library and drive it via a stepper driver A4988;
  • Don't use the Accelstepper.h library and drive it via a stepper driver A4988.

I would like to go for option 1 because its the easiest way and probably sufficient for this project but what are the potential problems i could come across?

Hope someone can help

Peter

Well you can't, its not possible. Arduino output logic signals, motor wants power, logic signals
are not power.

That motor seems to be a 1.3A bipolar motor. An Arduino (with an absolute maximum
output current of 0.04A) isn't remotely able to drive it.

Go for a DRV8825 driver, will run cooler. You'll want to control the enable pin to switch the motor
off, note, and also note that you could lose the odd step or two every time you power cycle the
motor, so its position may drift day by day.

hmmm… Ok? :confused:

But when i use this library: https://www.pjrc.com/teensy/arduino_libraries/AccelStepper-1.30.zip and the code below i can run it directly of the Arduino (just tried it).

// Random.pde
// -*- mode: C++ -*-
//
// Make a single stepper perform random changes in speed, position and acceleration
//
// Copyright (C) 2009 Mike McCauley
// $Id: Random.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $

#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5

void setup()
{  
}

void loop()
{
    if (stepper.distanceToGo() == 0)
    {
	// Random change to speed, position and acceleration
	// Make sure we dont get 0 speed or accelerations
	delay(1000);
	stepper.moveTo(rand() % 200);
	stepper.setMaxSpeed((rand() % 200) + 1);
	stepper.setAcceleration((rand() % 200) + 1);
    }
    stepper.run();
}

Sephen:
hmmm… Ok? :confused:

But when i use this library: https://www.pjrc.com/teensy/arduino_libraries/AccelStepper-1.30.zip and the code below i can run it directly of the Arduino (just tried it).

// Random.pde

// -- mode: C++ --
//
// Make a single stepper perform random changes in speed, position and acceleration
//
// Copyright (C) 2009 Mike McCauley
// $Id: Random.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $

#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5

void setup()
{  
}

void loop()
{
   if (stepper.distanceToGo() == 0)
   {
// Random change to speed, position and acceleration
// Make sure we dont get 0 speed or accelerations
delay(1000);
stepper.moveTo(rand() % 200);
stepper.setMaxSpeed((rand() % 200) + 1);
stepper.setAcceleration((rand() % 200) + 1);
   }
   stepper.run();
}

If you’re connecting the stepper motor’s coils directly to the Arduino pins with no form of driver or transistors/MOSFETs even after reading Mark’s warning, then you’re not very smart. You will destroy your Arduino.

Sephen:
hmmm... Ok?

i can run it directly of the Arduino (just tried it).

It can be important to have adequate understanding of certain things you do before you actually go ahead to do something. In this case..... it will be helpful to learn about power handling.... ie maximum power that a device can output without compromising performance or integrity of a system. Manufacturer specifications will show power handling information. The arduino output is not meant to drive a nema 17 motor.

The option of using A4988 or DRV8825 is a good one.

I've abandoned option 1 and going for option 2 with stepper driver.

going to take a look at those DRV8825's because with the A4988's the motor is getting quite warm.

Thanks for the info!

You need to check your Arduino to see if any of the pins you used are working now. You
exceeded their absolute maximum ratings.

Sephen:
I've abandoned option 1 and going for option 2 with stepper driver.

going to take a look at those DRV8825's because with the A4988's the motor is getting quite warm.

Thanks for the info!

Yes, it's supposed to get warm. Hot, even. The DRV8825 is even better at warming up the motor. 1.3A (times two) continuous is a lot of power.

I drive the reset pin low on my DRV8825s to shut them down when I want the steppers to cool off. Enable will do the same thing.

Stepper rated current is usually for some given temperature rise like 50C when bolted onto a chassis. They
can get too hot to touch if just sitting on the bench for an hour. That's normal. You can run at a lower current
(within reason) and its normal to drop the current to 50% or so whenever the motor is stationary (available
torque is at a maximum when stationary anyway).

You may find something useful in these links
Stepper Motor Basics
Simple Stepper Code

...R