Stepper with Motor Shield v2.3 sounds like chewing glass :0

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ben_cowden
 
Posts: 26
Joined: Fri Jun 26, 2015 11:38 am

Stepper with Motor Shield v2.3 sounds like chewing glass :0

Post by ben_cowden »

I have a Nema 17 bipolar stepper connected to an Adafruit Motor shield. I'm running tests to see if I can get it to sound at all acceptable (it's for a display feature), but I have been unable to make it sound like anything but crunching glass. Well, microstepping sounds decent, but moves at a snail's pace. Any help would be much appreciated.

The motor specs:
200 steps (1.8deg)
1.5a current/phase
1.5ohm phase resistance

Powered by 12V 3A battery.

Connected to Metro M0 board, which is powered via USB

Here's the test code I'm using (drives the motor a bit one way, then reverses it until it hits a limit switch):

Code: Select all

#include <Wire.h>
#include <Adafruit_MotorShield.h>

Adafruit_MotorShield AFMStop = Adafruit_MotorShield(0x61); //right jumpers soldered
Adafruit_MotorShield AFMSbot = Adafruit_MotorShield(0x60); //bottom board with stacking headers

Adafruit_StepperMotor *myMotor1 = AFMSbot.getStepper(200, 1); //this is the bourbon motor

#define limit1 13 //Pin8 connected to the limit switch activate for limit switch
#define limit2 9 //Pin9 connected to the limit switch activate for limit switch
#define fill 5 //Pin5 connected to homing and bitters-fill 
#define pourbutton 4 //Pin 4 connected to pour button
#define estop 6 //Pin 6 connected to e-stop button

int buttonState = 0;  //variable for reading the pour button
int estopState = 0;  //variable for reading the e-stop button
int steps1;           // Variable for pot1 reading

void setup() {
  Serial.begin(9600); // initialize serial communication at 9600 bits per second
  //while (!Serial);    //only begins after serial monitor is opened
  Serial.println("Weeee! let's go!");  
  delay(100);
  
  Serial.println("Begin talking to the bottom board");  
  AFMSbot.begin(); 

  Serial.println("Begin talking to the top board");  
  AFMStop.begin();// create with the default frequency 1.6KHz
   
  myMotor1->release(); //release the motors so they don't have to maintain position

   Serial.println("waiting for homing button");  
  // Homing procedure at startup:
 while  (digitalRead(fill) == LOW) { //if the fill button is NOT pressed
    Serial.println("matteru...");   
    delay(100);
 }

   bourbonHome();
   steps1=0;  // Reset position variable to zero
}  

void loop(){
  // read the state of the pour button:
buttonState = digitalRead(pourbutton);

if (digitalRead(pourbutton) == HIGH) { //if the pour button is pressed
    steps1 = map(analogRead(A0), 1, 1023, 50, 1200);
    Serial.print("Bourbon pot = ");
    Serial.println(steps1);
    delay (500);

  myMotor1->setSpeed(100);  
  for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, SINGLE);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, SINGLE); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, SINGLE);
  }
  for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, DOUBLE);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, DOUBLE); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, DOUBLE);
  }
  for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, INTERLEAVE);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, INTERLEAVE); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, INTERLEAVE);
  }
  for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, MICROSTEP);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, MICROSTEP); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, MICROSTEP);
  }  
  myMotor1->setSpeed(200);  
  for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, SINGLE);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, SINGLE); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, SINGLE);
  }
  for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, DOUBLE);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, DOUBLE); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, DOUBLE);
  }
  for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, INTERLEAVE);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, INTERLEAVE); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, INTERLEAVE);
  }
    for (int i=0; i<steps1; i++) {
    myMotor1->step(1, FORWARD, MICROSTEP);
    if  (digitalRead(estop) == HIGH) { //if the e-stop button is pressed
      bourbonHome();
    }
  }
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, MICROSTEP); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, MICROSTEP);
  }
}
}

void bourbonHome()
{
  while (digitalRead(limit2) == LOW) {  // Do this until the switch is activated   
      myMotor1->step(1, BACKWARD, DOUBLE); 
   }
  while (digitalRead(limit2) == HIGH) { // Do this until the switch is not activated
      myMotor1->step(1, FORWARD, INTERLEAVE);
  }
  myMotor1->release(); 
  steps1=0;  // Reset position variable to zero  myMotor1->release();
}

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

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by adafruit_support_bill »

The motor specs:
200 steps (1.8deg)
1.5a current/phase
1.5ohm phase resistance

Powered by 12V 3A battery.
That motor is not compatible with the shield. Powered with 12v through the shield it will try to pull 8A/phase (16A total).
Based on the specs, the motor appears to have been designed for use with a current limiting "chopper" type driver.

https://learn.adafruit.com/all-about-st ... he-stepper

User avatar
ben_cowden
 
Posts: 26
Joined: Fri Jun 26, 2015 11:38 am

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by ben_cowden »

Thanks Bill!
Could you point to a motor with ideal specs for the shield?
Or some specific numbers to look for?

I'll be honest, I haven't been able to figure out what numbers from a motor's specifications plug in, or how, to the formulas on the tutorial you link to.
If I had a positive example, like "this motor is perfect for the shield," that would be enormously helpful.

Thanks!

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

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by adafruit_support_bill »

Yes. Motor specs can be confusing. And some vendors post incomplete specs which can be downright misleading at times.

For use with the shield, motors with a phase resistance of 10 ohms or higher are safe to use with up to a 12v supply.

The #324 motors in the shop have a phase resistance of 35 ohms and work well with the shield - unfortunately they are out of stock at the moment: https://www.adafruit.com/product/324

Sparkfun carries a similar model which will also work well: https://www.sparkfun.com/products/9238

And Amazon has this one: https://www.amazon.com/STEPPERONLINE-17 ... ef=sr_1_10

Note that we have seen mis-labeled motors from Amazon. If you order from there, it would be smart to check the resistance across the coils to see that they match the specs.

User avatar
ben_cowden
 
Posts: 26
Joined: Fri Jun 26, 2015 11:38 am

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by ben_cowden »

Thanks so much, Bill!
I believe I understand it now.
Really, this is so helpful.

(this part is more for my own future reference, and for others):

My motor, plugged into Ohm's Law, looks like this:
12V power supply, 1.5ohm resistance; 12v / 1.5ohm = 8amps :$
Since the shield can only provide 1.2A constant current, 8a is a no-go

The #324 stepper Bill linked to looks like this:
12V power, 35ohm resistance; 12V / 35ohm = 0.34A :)

Brilliant, now hopefully I can buy better steppers!

User avatar
ben_cowden
 
Posts: 26
Joined: Fri Jun 26, 2015 11:38 am

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by ben_cowden »

It has been a couple months but I'm back at this project.
I purchased #324 steppers that Bill recommended from Adafruit.
They still sound like crunching glass.
Microstepping works, but any other speed (using the Adafruit test code) is just terrible.

I found several other threads with similar problems with the Adafruit Motor Shield, and none of them ever seem to actually solve the issue, they just sort of end unresolved.
viewtopic.php?f=22&t=72974
viewtopic.php?f=31&t=45632

Since I'm fairly sure this shield must work for some people, my best guess is that there is a QC issue at Adafruit and some shields are just bad.

I'm pretty bummed that I've invested so much time and money in this.

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

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by adafruit_support_bill »

Stepper motors do naturally create vibrations due to the fact that they move in discrete steps. Microstepping moves in smaller steps so it creates smaller vibrations.

Vibrations can be amplified if the step rate is close to the resonant frequency or harmonic of whatever the motor is connected to. There are various things you can do to manage vibrations and any associated noise. If you can tell us more about your system, we may be able to recommend some possible remedies.

User avatar
ben_cowden
 
Posts: 26
Joined: Fri Jun 26, 2015 11:38 am

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by ben_cowden »

I appreciate you trying to help diagnose, Bill, but my purpose in posting was more to document for others, so that they might save some time and move on to a working product earlier than I have.

There is a great deal I don't know, but the sound this motor is making is not a "tweak this or that and manage the vibrations" kind of sound. It is a "something is terribly wrong and must stop" kind of sound. I have some other drivers I've been working with, and they make the motors spin with a wonderful, gentle hum. I mostly wanted to use the Adafruit board to save a bit of money since I needed more motors anyway.

I'll try a few more things, but after that this board is going in the bin.

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

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by adafruit_support_bill »

The previous motors were creating a severe overload and quite possibly caused damage to the drivers on the shield. If one leg of an H-bridge is damaged, the motor will often still run, but the stepping will be uneven and rough.

User avatar
ben_cowden
 
Posts: 26
Joined: Fri Jun 26, 2015 11:38 am

Re: Stepper with Motor Shield v2.3 sounds like chewing glass

Post by ben_cowden »

It would be nice, in that case, if the motor shield were sold with really explicit guidlines for choosing stepper motors. As it is, there are some numbers in a tutorial, and the buyer has to do some math to figure out what those numbers mean w/r/t a given stepper. The shield is sold as a solution to "drive stepper motors" (etc.), and there is not a single note on the product page cautioning buyers that the board will only work with some steppers. I know it is my responsibility as a customer to do my homework, but I think it's reasonable to think that a novice-friendly company like Adafruit would try to give key information upfront.

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

Return to “Arduino Shields from Adafruit”