Pages: [1] 2 3 ... 6   Go Down
Author Topic: question re' controlling stepper with potentiometer (easy driver)  (Read 1982 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys

I've been looking at the tutorial called Motorknob as it is very similar to what I want I think, but one thing I'm unsure about is whether the same thing is all applicable if I'm using an 'Easy driver' in place of the Darlington etc mentioned in the hardware list.

Basically my project is to run a stepper forwards or backwards continuously via turning a potentiometer either way about a central point on the pot, and to include both speed & direction control from one potentiometer ideally. 

I might add end switches at some point but am not worried about it initially, until I get it working at least that far.

That's all I need it to do, and I've got the arduino, an 'easy driver' board, the stepper (bipolar I think - 4 wires), and various pots, sundry components etc.

I've got a display and buttons etc so one day it'd be nice to upgrade it to setting a speed/direction via that then pressing 'go' but need to walk before I can run & all that!!

So basically I'm just wondering if I can still effectively follow the same tutorial using easy driver as it shows for the Darlington etc?  Or what sort of changes I'd need for this.

Appreciate any input as I'm very new with arduino (other than using it with my reprap printer)!
 
Many thanks
Jim
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 640
Posts: 50335
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Basically my project is to run a stepper forwards or backwards continuously via turning a potentiometer either way about a central point on the pot, and to include both speed & direction control from one potentiometer ideally. 
The potentiometer will be connected to an analog pin. The pin will be read using analogRead(). Suppose that the reading is 723.

How is that value supposed to be used to make a stepper motor step?
Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7724
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming you are referring to the code that comes as one of the examples in the Arduino IDE I think it should work perfectly with an Easydriver as long as you change the line  Stepper stepper(STEPS, 8, 9, 10, 11); so that it relates to the Easy driver which only needs two connections. I assume the Stepper library explains how to do that.

The Easydriver can only control small motors with motor currents below (I think) 750mA.

...R
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the tutorial I mean:
http://arduino.cc/en/Tutorial/MotorKnob

Thanks though that's really helpful!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Forgot to add that it's a small nema17 stepper.
I forget the spec for it offhand but it might need a big more juice than that easy driver can do so perhaps I should have got a polulu or whatever they're called. I'll check it out though.
Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7724
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nema17 just defines the size of the front face of the motor and the location of the fixing holes, It says nothing about the electrical requirements.

Post a link to the specifications for your motor if you need advice.

...R
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Robin, yes I realise that - as I said I'll check the spec but off the top of my head I've a feeling it was rated 1.4 amps.

Either way, I've ordered a couple of cheap stepsticks anyway since they can do up to 2 amps, and are the same A4988 chip that is used for driving the steppers in my printer via its Melzi control board.  They'll be fine since I know the steppers I'm planning on using work fine with those drivers. smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok the stepper is a 17HS3404N and is rated 0.4 amps.

A pair of stepsticks arrived in the post today so I'm going to try writing it and running some test bits of code tonight.
Wish me luck!!  smiley-lol
Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7724
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I said in Reply #2 that I assumed the Stepper library could work with stepper driver board.

Having been experimenting with the AccelStepper library yesterday I am now not sure if I was right.

AccelStepper has the ability to drive 2-wire steppers (whatver they are) and I suspect that the Stepper library may be similar.
However AccelStepper has another option called DRIVER which is intended for stepper driver boards.

Before I realized there was a DRIVER option I did get the 2-wire option in AccelStepper to drive my A4988 stepper driver but it was not doing it as I had expected - it was not performing the same speed as my own stepper code. When I changed to the DRIVER option the AccelStepper performance was the same as my own code.

Perhaps someone more knowledgeable than I can say whether a stepper driver board can be use with the Stepper library.

...R
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the input Robin - useful to know about that.

I'll be doing some googling and searching on here when I get a sec for the best setup.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok guys, I got everything hooked up how I thought I needed it and uploaded the code from the motorknob tutorial but with just pins 2 & 3 listed instead of 8, 9, 10, 11, hooked up the power to the arduino and the Stepstick/Pololu, but nothing happened except the stepstick chip getting very hot very quickly!

This is the circuit I've put together -



The pot is outputting a varied voltage of 0-5v+ to Analog 0 on the arduino, and the input to the A4988 driver board is from pins 2 & 3.

Could someone possibly help point out what I've done wrong please?  Presumably a dumb noob mistake but I do learn from them, honest!

Really appreciate it.  I'm itching to get this motor control running now I have all I need, assuming of course I haven't somehow killed the motor driver.  I've got another if that's happened but would rather isolate what I've done wrong first of course.
Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7724
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This Pololu web page has very good and clear instructions.

You are missing a connection between reset and sleep. And you should probably connect step and direction to ground if you are not using them.

...R
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!  Not sure why I had the reset hooked up to 9 on the arduino.  I must have seen that on another diagram perhaps.

The step & dir pins on the Pololu are connected to pins 2 & 3 on the arduino.  Just the diagram shows their respective numbers rather than a direct drawn connection - sorry for not being clearer with that.

I've connected the sleep & reset pins together but I get the same thing with the pololu chip heating the moment I hook up the power and nothing going on with the stepper.  Back to the drawing board/search facility!

My diagram is basically as per the one on the Pololu page:



But with the addition of the Pot as per the diagram on the motorknob tutorial. 

I think somewhere between the two I've gone quite wrong. smiley-sad
« Last Edit: July 12, 2014, 11:56:47 am by Cretster » Logged

UK
Offline Offline
Tesla Member
***
Karma: 135
Posts: 7724
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try this simple test code - change it to suit your connections, or change the connections to suit the code.

And have you the current limit set correctly?

Code:
// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// as posted on Arduino Forum at http://forum.arduino.cc/index.php?topic=208905.0

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 25; // milliseconds


void setup()
{

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
  
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
 
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
  delay(3000);
  

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
}

void loop()
{

}

...R
« Last Edit: July 12, 2014, 12:45:12 pm by Robin2 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks! Will give that a try. Will the the pot cause an issue being wired in still?

I haven't set any current setting on the driver yet as I've not dared keep it connected that long since it gets hot so fast. I'll try turning it right down though to begin and see if that helps.
Logged

Pages: [1] 2 3 ... 6   Go Up
Jump to: