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
-
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). -
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. -
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)
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) :
#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 pinconst 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 Bconst 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 pressedStepper 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);
}
}