Motor shield V2.0, connected stepper becomes to hot

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
TomHei
 
Posts: 20
Joined: Tue May 13, 2014 4:26 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by TomHei »

Thank you Bill, it works now.
In which range can I adjust the holding torque ? (0 - 255) ?
What's the min and max value ?

Regards
Tom

TomHei
 
Posts: 20
Joined: Tue May 13, 2014 4:26 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by TomHei »

I see the holding torque is allway's the same.
No matter what value is given, 50, 100, 1000.
It seems not adjustable.

Tom

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

Re: Motor shield V2.0, connected stepper becomes to hot

Post by adafruit_support_bill »

It should be adjustable between 0 and 255. Setting it to 0 should be about the same as calling 'release()'.

TomHei
 
Posts: 20
Joined: Tue May 13, 2014 4:26 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by TomHei »

Thank you very much Bill !

Greetings
Tom

User avatar
openresistor
 
Posts: 4
Joined: Sat May 24, 2014 3:15 pm

Re: Motor shield V2.0, connected stepper becomes to hot

Post by openresistor »

Thank You...This does work!
You just need to make sure that you call
myStepper1->hold(50);
(or your favorite value) AFTER the call to move that same stepper.
That value will hold until your code calls to move that stepper again, where maximum hold returns again.
Great way to control "duty cycle" with steppers without completely removing a holding current!

User avatar
kalniss
 
Posts: 7
Joined: Sun Aug 31, 2014 9:38 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by kalniss »

This method doesn't work for me. No matter what value is passed to hold() it wont hold, the motor will "sing" and no current will be drawn. I figure that the coils are not completely powered down as with release(), but no significant current is fed to them, and for some reason I can't control the current.

I have stacked to Motor Shields V2.0 (and V2.3) that powers three Adafruit steppers.

Is there maybe some other library edit I'm missing?

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

Re: Motor shield V2.0, connected stepper becomes to hot

Post by adafruit_support_bill »

No matter what value is passed to hold() it wont hold, the motor will "sing" and no current will be drawn.
There must be some current, or the motors would be silent. Hold(255); should be the same as just not calling release().

What are you using to power the motors?

User avatar
kalniss
 
Posts: 7
Joined: Sun Aug 31, 2014 9:38 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by kalniss »

I'm powering both shields with the same 12 V 5 A power supply. That's plenty of power, isn't it? If I don't call release(); all three motors together draw close to 2A as expected while holding, and hold very well.

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

Re: Motor shield V2.0, connected stepper becomes to hot

Post by adafruit_support_bill »

5A should be plenty of current. Post the code you are using and we'll see if we can spot the problem.

User avatar
kalniss
 
Posts: 7
Joined: Sun Aug 31, 2014 9:38 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by kalniss »

Even in this very simple test code none of the motors hold.

Code: Select all

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

Adafruit_MotorShield AFMStop(0x61);
Adafruit_MotorShield AFMSbot(0x60);

Adafruit_StepperMotor *slideMotor = AFMSbot.getStepper(200, 1);
Adafruit_StepperMotor *panMotor = AFMSbot.getStepper(200, 2);
Adafruit_StepperMotor *tiltMotor = AFMStop.getStepper(200, 1);

void setup()
{  
    AFMStop.begin();
    AFMSbot.begin();
    Serial.begin(9600);
}

void loop()
{
    panMotor->step(10, FORWARD, DOUBLE);
    tiltMotor->step(10, FORWARD, DOUBLE);
    slideMotor->step(10, FORWARD, DOUBLE);
    
    panMotor->hold(0);
    tiltMotor->hold(150);
    slideMotor->hold(255);
    
    delay(3000);
}
Also of course I have made all the library changes mentioned in this topic. And if it changes anything, I've changed IC2 to 400kHz.

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

Re: Motor shield V2.0, connected stepper becomes to hot

Post by adafruit_support_bill »

i2c clock speed should not make a difference. If your library modification is correct, that code should work.

User avatar
kalniss
 
Posts: 7
Joined: Sun Aug 31, 2014 9:38 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by kalniss »

Right, so the conclusion would be that there are mistakes in my library changes. Here's what I did:

In Adafruit_MotorShield.cpp right after this:

Code: Select all

void Adafruit_StepperMotor::release(void) {
  MC->setPin(AIN1pin, LOW);
  MC->setPin(AIN2pin, LOW);
  MC->setPin(BIN1pin, LOW);
  MC->setPin(BIN2pin, LOW);
  MC->setPWM(PWMApin, 0);
  MC->setPWM(PWMBpin, 0);
}
I added this:

Code: Select all

void Adafruit_StepperMotor::hold(uint8_t holdingCurrent){
  MC->setPWM(PWMApin, holdingCurrent);
  MC->setPWM(PWMBpin, holdingCurrent);
}

and in Adafruit_MotorShield.h, after this:

Code: Select all

 void release(void);
added this:

Code: Select all

void hold(uint8_t holdingCurrent);
Am I missing something? It compiles, no errors pop up. What could be other possible library issues?

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

Re: Motor shield V2.0, connected stepper becomes to hot

Post by adafruit_support_bill »

OK. I see the problem now. The range of holding currents is 0-4095 for the V2 shield (it was 0-255 on the V1 shields).
In order to set holding currents higher than 255, the holdingCurrent parameter type needs to be uint16_t - not uint8_t.

Code: Select all

void Adafruit_StepperMotor::hold(uint16_t holdingCurrent)
{
  MC->setPWM(PWMApin, holdingCurrent);
  MC->setPWM(PWMBpin, holdingCurrent);
}

User avatar
kalniss
 
Posts: 7
Joined: Sun Aug 31, 2014 9:38 am

Re: Motor shield V2.0, connected stepper becomes to hot

Post by kalniss »

You, sir, just made my day. It works!!! :)

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

Return to “Arduino Shields from Adafruit”