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)!
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?
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.
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.
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.
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.
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.
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.
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.
Leave it in and see/Remove it and not worry. But with the latter then I'm changing the circuit from the intended use of course.
Anyway, I've set vref at 0.16v as the stepper is rated 0.4A, so I 'think' that's correct for it.
Not yet tried your code (am about to) but with the arduino powered and pololu connected, but without the battery for the steppers connected the pololu gets too hot to touch after it's on for around a minute. This might be ok since all the blurb on the pololu site says it gets hot enough to burn in normal use, but it doesn't reassure me much....
Anyway, I've pulled the analogue input from the pot, and am going to try your code.....
Nothing apparently happening after I upload the code and hook it all up (sans potentiometer), other than the driver chip getting very hot and the LED flashing as per the code. No movement of the stepper that I could see.
I'm going to go and study a ton of other threads and tutorials and see if I can spot what I'm doing wrong. Clearly something is screwy with this setup.
Cretster:
Nothing apparently happening after I upload the code and hook it all up (sans potentiometer), other than the driver chip getting very hot and the LED flashing as per the code. No movement of the stepper that I could see.
When I connect my Pololu A4988 driver to a stepper motor that requires 0.33amps using the Pololu wiring diagram and the sketch I posted "it just works".
If yours is not working either your driver is different from the Pololu driver or it is broken.
Bought 2 of them so on the offchance that one is faulty or I've damaged it, I'm trying the other.
Going to try the exact same setup as this youtube video:
I've found a 220uf 16v capacitor so I'll add that to the equation as I didn't previously have one wired in.
My stepper power is coming from a lead acid 12v battery (a small 7ah one like a burglar alarm might use), so I can't see how it would spike, but nonetheless I'll add the capacitor as a precaution anyway.
Will advise what the outcome is shortly (if any!)...