starter pack for NEMA 17 stepper motor

For makers who have purchased an Adafruit Starter Pack, get help with the tutorials here!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

starter pack for NEMA 17 stepper motor

Post by BABOafrica »

I mentioned to a friend that I was doing a barn-door tracker for astrophotography. (I built the tracker and now I want to motorize it.) He bought a present for me -- an Arduino UNO from adafruit.com. It came with a cable to attach to my laptop. He said all I had to do was get in touch with the adafruit people to find out how to make a stepper motor work using the Arduino UNO.

Given the way the tracker is designed -- I can operate it manually -- I would need a motor that can do about 35 rpm.

So, here I am getting in touch.

From what I can tell, I need to buy a NEMA 17 stepper motor, a breadboard, a few cables and a some kind of driver for the motor.

The breadboard is obvious. I have no idea which driver to buy or how many cables would be needed.

Can you recommend the proper driver?

Thanks,
Joe

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: starter pack for NEMA 17 stepper motor

Post by adafruit_support_bill »

The simplest way is to use the motor shield:
https://www.adafruit.com/product/1438
This plugs directly into your UNO and can handle up to 2 stepper motors and can be programmed using the Adafruit Motor Shield Library.

A lower-cost option is the TB6612 driver breakout board. This will handle one stepper using the Arduino Stepper library.
https://www.adafruit.com/product/2448
You can wire the breakout using a breadboard and some 22 awg hookup wire, but that's not a good long-term solution. It would be better to use soldered connections for reliability.

Either board is a good match for this motor:
https://www.adafruit.com/product/324

In either case, you will need a 12v power supply capable of 700mA per motor. This one will power one motor:
https://www.adafruit.com/products/798

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

I took your advice and bought the stepper motor and shield.

One lingering question. My friend told me I could run the Arduino on a 9V battery. (He gave me the attachment that allows me to connect a 9V to electrical input of the Arduino UNO R3.) You seemed to suggest that I need 12V input to run the stepper motor off the shield.

Can I get away with the 9V? Or should I buy a 12V DC power supply?

Joe

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: starter pack for NEMA 17 stepper motor

Post by adafruit_support_bill »

The stepper motor can run from 9v, but it will have less torque (about 75%) than when running from 12v. A typical rectangular 9v battery will not last very long powering this motor.

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

Many thanks!!!

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

I got the stepper motor running with the Arduino & Shield combination. I hooked up the Arduino to my desktop and I used a 12V DC power supply. I used the example code just to get started. That is as far as I have progressed.

I was greatly surprised by two things:

1) The motor just kept running -- at least mine did for more than half an hour. I just unplugged everything to make it stop. I had no idea how to make it stop otherwise.

2) The motor became much hotter than expected. Too hot to hold. So let's say around 150degrees F. Is this normal?

Joe

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: starter pack for NEMA 17 stepper motor

Post by adafruit_support_bill »

The motor just kept running
What code are you using? Any code in the loop will execute over and over again as long as the system is powered.
The motor became much hotter than expected. Too hot to hold. So let's say around 150degrees F. Is this normal?
Yes. This is normal for stepper motors. That motor is rated for up to a 70C temperature rise with an ambient temperature of 50C. That is about 248F

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

Thanks for all the help so far.

I find one thing a bit frustrating. In the LEARN section of this website, you have a section labeled:

>>Master the Arduino with these easy to follow lessons<<

Whenever I click on that icon, it sends me to icons for advanced stuff (multi-tasking). I can't seem to get back to the LESSONS for really BASIC stuff (using the libraries). There were these 18 basic lessons and I can't seem to find them again.

Anyway, I can run the sample program for operating a stepper motor.

Is there a tutorial on how to use other stuff in the library -- specifically to run the stepper motor?

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

I finally found what I was looking for.

https://learn.adafruit.com/lesson-0-getting-started

Thanks,
Joe

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: starter pack for NEMA 17 stepper motor

Post by adafruit_support_bill »

This page has links to all the basic lessons: https://learn.adafruit.com/lesson-0-get ... he-lessons

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

MANY thanks. Very helpful.

Joe

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

Is there some kind of program in a library somewhere that can run the stepper at a constant rpm?

No direction changes. Just run the motor?

Joe

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: starter pack for NEMA 17 stepper motor

Post by adafruit_support_bill »

like this?

Code: Select all

void setup()
{
  AFMS.begin(); 
  myMotor->setSpeed(10);  // 10 rpm   
}

void loop()
{
   motor->step(1, FORWARD, DOUBLE);
}

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

Oh, that's simple.

I was trying to run the test code with some lines removed.

Thanks,
Joe

User avatar
BABOafrica
 
Posts: 15
Joined: Fri Oct 09, 2015 6:14 am

Re: starter pack for NEMA 17 stepper motor

Post by BABOafrica »

Several months ago, I managed to download the library for using the Adafruit MotorShield and run the test for a stepper motor. Since purchacing my arduino, shield and stepper motor, that is all I have managed to do.

For reasons I cannot understand—no matter how many times I read thru your learning packages and try to follow them—I cannot even repeat what I once managed to do, i.e., run the stepper test for the Motorshield.

The stepper test is located here:

Joe Babendreier > Documents > Arduino > libraries > Adafruit_MotorShield > examples > StepperTest

When I load this sketch, something funny seems to happen with the utility:

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"

Just seeing the quotation marks (instead of < >), I suppose it will fail to compile.

Sure enough, when I compile, I get the error message:

Arduino: 1.6.5 (Windows 8.1), Board: "Arduino/Genuino Uno"

Using library Wire in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire C:\Users\FRJOE~1\AppData\Local\Temp\build1223468069993803526.tmp\Adafruit_MotorShield.cpp -o C:\Users\FRJOE~1\AppData\Local\Temp\build1223468069993803526.tmp\Adafruit_MotorShield.cpp.o
In file included from C:\Users\FRJOE~1\AppData\Local\Temp\build1223468069993803526.tmp\Adafruit_MotorShield.cpp:24:0:
C:\Users\FRJOE~1\AppData\Local\Temp\build1223468069993803526.tmp\Adafruit_MotorShield.h:22:45: fatal error: utility/Adafruit_PWMServoDriver.h: No such file or directory
#include "utility/Adafruit_PWMServoDriver.h"
^
compilation terminated.
Error compiling.

****************************************

The utility directory exists and it has two files:

utility/Adafruit_PWMServoDriver.ccp
utility/Adafruit_PWMServoDriver.h


The directory is located here:

Joe Babendreier > Documents > Arduino > libraries > Adafruit_MotorShield > utility

What am I doing wrong?

Joe


PS In case it is of any interest:

I’m using a DELL laptop with Windows 8. When I first used the Arduino library I was using an old desktop that I don't have any more. I copied the files from my old computer into my laptop.

The Arduino library copied into my laptop includes examples.

The examples seem to compile perfectly. (I assume they would work on an Arduino if I had the board set up correctly for each example.)

For instance, the following compiles with no problem:

This PC > OS(C:) > Program Files (x86) > Arduino > libraries > Stepper > examples > stepper_oneRevolution

I want to run a stepper motor at a certain rpm. You suggested I used the following code:

void setup()
{
AFMS.begin();
myMotor->setSpeed(10); // 10 rpm
}

void loop()
{
motor->step(1, FORWARD, DOUBLE);
}

I created a new Arduino sketch by copying this code exactly into a blank sketch.

I named the sketch “stepper_rpm_control_10rpm” and I put the sketch into the following folder:

This PC > OS(C:) > Program Files (x86) > Arduino > libraries > Stepper > stepper_rpm_control_10rpm

I can open the Arduino program and the code appears on the screen as expected. But it will not compile.

I get this error message:

Arduino: 1.6.5 (Windows 8.1), Board: "Arduino/Genuino Uno"

stepper_rpm_control_10rpm.ino: In function 'void setup()':
stepper_rpm_control_10rpm:3: error: 'AFMS' was not declared in this scope
stepper_rpm_control_10rpm:4: error: 'myMotor' was not declared in this scope
stepper_rpm_control_10rpm.ino: In function 'void loop()':
stepper_rpm_control_10rpm:9: error: 'motor' was not declared in this scope
stepper_rpm_control_10rpm:9: error: 'FORWARD' was not declared in this scope
stepper_rpm_control_10rpm:9: error: 'DOUBLE' was not declared in this scope
'AFMS' was not declared in this scope

Not sure what to do.

Any advice greatly appreciated.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Starter Pack”