Arduino Forum

Using Arduino => Motors, Mechanics, and Power => Topic started by: padorange on Jun 17, 2013, 04:05 pm

Title: MotorShield and Stepper : troubles
Post by: padorange on Jun 17, 2013, 04:05 pm
Hi,
I'm a newbie and it was my first experiences with stepper. I'm also french (nobody is perfect) and my english is poor.

I have to drive a stepper with high torque to made 2 rounds when a button is pressed...

Configuration :
- Arduino Uno R3
- MotorShield Rev3 (2A/circuit) with Stepper Library
- Stepper 57SH76-M (torque 1,8 Nm, 2.8 A, 4 wires)

I just add a simple button and a LED to show when it's running.

I've read the documentation i can found at Arduino reference, tutorial and many blogs but i'm a bit confused with what happened.

I've understand that it was better to power the Motorshield with an external power directly (and cut the Vin track below), but i don't want to cut the track now, just made some quick experiment before doing a irreversible action ;-)

1. I just connect the stepper and only the USB power to Arduino.
The motor works at low speed, below 35 rpm it's OK (low torque of course).

2. Then a add an external power (AC-DC wall adapter) to the Arduino (doc said i can) : i could achieve 50-60 rpm, but when the stepper stop it has a sort of very little shake (it make noise like an old power and you can feel small shake if you put you finger on it)...
Note : the L298 became hot, even if i do not make the stepper turn.

3. If a remove the USB power (there is only the external wall adapter 6V), the Arduino seems to hang, the button do nothing and the LED (but also the small LED on motorshield for each line) blink at

First,
I do not understand. What happened ?
Perhaps the steppers has a too big torque and requirements for the Motor Shield or do i miss something (i'm new in electronics).
Do i have to cut now the Vin tracks and plug an external power of 12V ?
I think i need real instruction about power usage ;-)

Second,
The MotorShield Rev3 also lack of documentation (http://arduino.cc/en/Main/ArduinoMotorShieldR3 (http://arduino.cc/en/Main/ArduinoMotorShieldR3))
I do not found anywhere an explanation i could understand of usage for the pins (4 pins for each phase), brake is not explain, PWM neither...
The sample code only call the constructor with direction pins and set PMW and brake as output... but i don't know why.
I'm really confused.

Thanks.

Below the code i used (adapted from standard sample) :

Quote


#include <Stepper.h>

// constants won't change. They're used here to 
// set pin numbers:
const int buttonPin = 2;     // pushbutton pin
const int ledPin =  4;      // LED pin

const int pwmA = 3;    // PWM Channel A
const int pwmB = 11;    // PWM Channel B
const int brakeA = 9;    // Brake Channel A
const int brakeB = 8;    // Brake Channel B
const int dirA = 12;    // Direction Channel A
const int dirB = 13;    // Direction Channel B

const int STEPS = 200;

// variables will change:
int buttonState = 0;     // variable for reading the pushbutton status
int rpm=30;              // stepper speed (round per minute)
int stepButton=200;      // stepper steps when button pressed

Stepper myStepper(STEPS, dirA, dirB);  // init the stepper class

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);     
  digitalWrite(ledPin, HIGH); 
 
  // Turn on pulse width modulation
  pinMode(pwmA, OUTPUT);
  digitalWrite(pwmA, HIGH);
  pinMode(pwmB, OUTPUT);
  digitalWrite(pwmB, HIGH);

  // Turn off the brakes
  pinMode(brakeA, OUTPUT);
  digitalWrite(brakeA, LOW);
  pinMode(brakeB, OUTPUT);
  digitalWrite(brakeB, LOW);

  // Set the RPM of the motor
  myStepper.setSpeed(rpm);

  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);     
  
  Serial.begin(9600); 
  delay(200);
  digitalWrite(ledPin, LOW); 
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) { 
    digitalWrite(ledPin, HIGH); 

    myStepper.setSpeed(rpm);
    myStepper.step(stepButton);
//  turn off the brake ?
//    digitalWrite(brakeA, LOW);
//    digitalWrite(brakeB, LOW);
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}

Title: Re: MotorShield and Stepper : troubles
Post by: MarkT on Jun 17, 2013, 04:27 pm
This won't work - the motor shield cannot supply enough current, and is designed for a higher voltage than
the stepper motor windings - its the wrong motor controller for a low-impedance bipolar stepper, these
require a chopper-drive circuit - and you really need a microstepping driver or it'll vibrate/resonate badly.

A motor rated at 2.8A is beyond the range a single chip driver can manage really, the best I've seen is
the TB6600 which has 0.4 ohms total on resistance, and seems to be available on eBay cheaply: http://www.ebay.co.uk/itm/TB6600-5A-Single-Axis-5A-CNC-Stepper-Driver-For-CNC-Milling-Machine-DIY-Max-50V-/300909044677?pt=UK_ToysGames_RadioControlled_JN&hash=item460f93a3c5 (http://www.ebay.co.uk/itm/TB6600-5A-Single-Axis-5A-CNC-Stepper-Driver-For-CNC-Milling-Machine-DIY-Max-50V-/300909044677?pt=UK_ToysGames_RadioControlled_JN&hash=item460f93a3c5)

You could try driving it at a lower current (1A?) using something like an A4988 chopper driver board (Polulu
have some), but its a waste of a powerful motor.

Since these chopper drivers do automatic buck-conversion you power them at a high voltage like 24V -- 80V
and get far faster max step rates from the motor.

If you don't want fast performance its easier to buy a unipolar stepper with high-impedance windings (12V 0.5A
or some such).  low-impedance bipolar motors are designed to go fast from a chopper drive circuit.
Title: Re: MotorShield and Stepper : troubles
Post by: sonnyyu on Jun 17, 2013, 05:15 pm
(http://s21.postimg.org/6cpaxlepj/tb6600.jpg)

http://www.toshiba-components.com/productpages/Linear/TB6600HG.html (http://www.toshiba-components.com/productpages/Linear/TB6600HG.html)

you could order free sample chip, but no datasheet. now you have paperweight with 25 legs?!

anyway google is lifesaver, here is the datasheet.

http://www.haoyuelectronics.com/Attachment/TB6600_module/TB6600_Datasheet.pdf (http://www.haoyuelectronics.com/Attachment/TB6600_module/TB6600_Datasheet.pdf)
Title: Re: MotorShield and Stepper : troubles
Post by: padorange on Jun 17, 2013, 05:47 pm
Thanks, i suspect such a thing (not low impedance, i do not really understand, but a non-conformity between the stepper and the controller).
I'll investigate the TB6600 and how use it with an arduino.
Thanks for the advice and the documentation.
Title: Re: MotorShield and Stepper : troubles
Post by: padorange on Jun 18, 2013, 09:02 am
Before getting a real stepper-driver for the big torque stepper, i just try the same circuit and same program, with another stepper :
a smaller one i get from an old scanner : 4H4018x0503, i do not have the complete specification just what is written on it : 6.8V 1.0A (200 steps).

It works better but i still got some troubles.

The stepper works at higher speed (150 rpm) with USB power only, but the circuit still do not work with only external 6V power (the LED only blinks at 1 Hz, do not understand where it came from).

I got another behavior if i plug an external 6V power + USB (if i remove USB see above) :

At rest, the stepper and the L298 get hot (but not very hot, but hotter than with only USB).
At rest, the stepper seems to have a very little shaking : if i touch the stepper i feel a very small vibration, if i touch the rotate axis also and if i press on it, the small vibration get a little higher :the stepper try to stay at its position i think, but i do not understand the brake command.
I try to activate brake when there is "running" order but it doesn't change anything.
At rest the stepper alway try to keep it position when powered by an external 6V + USB

Quote

   digitalWrite(brakeA, LOW);
   digitalWrite(brakeB, LOW);

Title: Re: MotorShield and Stepper : troubles
Post by: MarkT on Jun 19, 2013, 12:30 am
Steppers don't run fast with a low voltage supply, the back-EMF chokes off the current.

For speed you use a high voltage supply, a chopper-driver, and bipolar connection.  The
chopper applies whatever average voltage is needed to overcome back-EMF plus the small voltage
to overcome I-R losses in the winding.  By chopping (its effectively a buck-DC-DC-converter) it
doesn't waste much power converting the supply voltage to the voltage at the motor.
Title: Re: MotorShield and Stepper : troubles
Post by: padorange on Jun 19, 2013, 12:16 pm
Title: Re: MotorShield and Stepper : troubles
Post by: sonnyyu on Jun 19, 2013, 02:06 pm
(http://s21.postimg.org/5k8cm8acn/module.jpg)

I enclosed TB6600 Module Schematic, and hope it will answer your most of questions if not all.
Title: Re: MotorShield and Stepper : troubles
Post by: munchie on Jun 24, 2013, 04:08 pm
I just got a TB6600 going.  I connected the three negative pins and the enable plus pin to the ground pin on the Arduino.  The direction plus pin must be changed when the pulse pin is low.  I use a loop to set the pulse pin high, delay, set the plus pin low, delay.

void turn(int steps)
{
  int i;
  for (i=0; i<steps; i++)
  {
      digitalWrite(pin_pulse, HIGH);
      delay(1);
      digitalWrite(pin_pulse, LOW);
      delay(1);
  }