Code for standalone stepper motor controller.
Richard905
Posts: 4
I am very new to PARALLAX Propeller.
I'd like make a simple Standalone stepper motor controller by using P8X32A QuickStart and Easydriver(DIR & STEP),
What I need do is: when I press momentary push button switch, The stepper motor turn 30 rev. (assume 200STEPS/REV.), then
stop.
Can somebody write a code for me?
Thanks a lot in advance!
I'd like make a simple Standalone stepper motor controller by using P8X32A QuickStart and Easydriver(DIR & STEP),
What I need do is: when I press momentary push button switch, The stepper motor turn 30 rev. (assume 200STEPS/REV.), then
stop.
Can somebody write a code for me?
Thanks a lot in advance!
Comments
How much does this job pay?
and then create a loop in Spin that change a pin state 200*30 times and stop.
Quote:
Step Input (STEP). A low-to-high transition on the STEP input sequences the translator and advances the motor one increment.
If you want to use a driver device such as the Easy Driver, you really have to read all the material and figure out what does what. Nobody wants to read documents for somebody else. That Easy Driver has some sort of 'control language' that should have examples included with its documentation.
Frankly, depending on the size and voltage of the stepper motor, the wiring of it is actually a much bigger hurdle than the coding. You can Google for both coding and wiring samples, but it is just of loop of 4 or 8 steps in the usual setups. Rotation rate is determined by inserting a delay.
I do have an example of doing this in PropForth with a UNL2803 and a tiny 5 volt stepper and it was extremely easy.
Here is just one code example from OBEX. Sorry, but no code for Easy Driver.. that's a SparkFun product.
http://obex.parallax.com/objects/682/
After purchasing a Propeller Professional Development Board, I wanted to try writing a program that would use the buttons (normally pulled high) to control a stepper with the on board L293D chip. The attached code was written in June 2010 (expect for the modifications I made this morning).
I've attached that program modified to only turn 30 times one way or the other based on which of two buttons if pressed.
The code should work with a lot of different motor control chip that use a "half" H-bridge circuit.
There's no ramping or speed control. I'll likely be adding these as soon as OBC sends me a set of cheap steppers and wheels for another robot.
Here's the part of the code that looks for the button presses and sends the motor driving object instructions to turn 30 times.
I'm sure there are many better stepper objects around (including Loopy's).
As Loopy warned, there are lots of different kinds of steppers. The code I attached was used with a bipolar (four wire) stepper motor.
The original poster got a rather cold reception for being a new user. Your help is more in keeping with what Parallax Forums do best.
Your question is a little broad, being there are many stepper motor options out there, but here's some simple code which I'm using to run those little 5v stepper motors you find almost everywhere.
I'm sure I'll be working on my stepper code more once I start working with your version of a cheap an inexpensive robot.
When I first started working with a stepper, I noticed how the bit pattern just seemed to rotate so I decided to use bit rotation of a single bit mask instead of having multiple bit masks.
I define the intial pattern as:
And then rotate the pattern one way or the other depending on the direction.
Since bit ratotation is a "long" operation, I repeat the byte sized bit pattern four times. Only the lowest byte of the long is used to set the output pins.
Anyway, I thought it was kind of a cool way to do it. (I'm sure I'm not the first to do it this way.)
I'll have to see if I can get my OBC CheapBot to do a figure 8 with this method.