help with simple stepper control for bs1
i am attempting to control a stepper motor with a bs1. I am very new at this.
The stepper is a 6 wire, four coil, unipolar with two common leads. So i have set it up with four tip120 darlington transistors with the bases on pins 4 through 7, the collectors to each of the four stepper leads (one for each coil in the motor), and the emitters to ground. This setup using 4 darlington tip120s is described in "physical computing", on page 262.
However, the stepper control example code for bs1 from parallax isn't working for me.
I don't quite understand all of the code so I would like to make a test code as simply as possible.
Would this work to turn the motor?:
Thanks,
Blake
Post Edited (Blake) : 1/13/2008 9:08:10 PM GMT
The stepper is a 6 wire, four coil, unipolar with two common leads. So i have set it up with four tip120 darlington transistors with the bases on pins 4 through 7, the collectors to each of the four stepper leads (one for each coil in the motor), and the emitters to ground. This setup using 4 darlington tip120s is described in "physical computing", on page 262.
However, the stepper control example code for bs1 from parallax isn't working for me.
I don't quite understand all of the code so I would like to make a test code as simply as possible.
Would this work to turn the motor?:
' {$STAMP BS1} ' {$PBASIC 1.0} LOW 4 LOW 5 LOW 6 LOW 7 Main: HIGH 4 PAUSE 2000 LOW 4 HIGH 5 PAUSE 2000 LOW 5 HIGH 6 PAUSE 2000 LOW 6 HIGH 7 PAUSE 2000 LOW 7 GOTO Main
Thanks,
Blake
Post Edited (Blake) : 1/13/2008 9:08:10 PM GMT
Comments
A simple schematic of how you have it wired would be real helpful. I've never heard of "Physical Computing" so I can't go there to see what it says. Perhaps there is a schemtic in there you can scan and upload by attaching it to your next posting.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If you do post a schematic, be sure to show the Basic Stamp
and what you have for a power supply. The stepper needs its
own separate supply that can deliver the rated current.
Using the Basic Stamp supply for the stepper isn't likely to be
adequate.
The code should work, although I don't know why you are
energizing the winding connected to pin 4 twice.
phil
I have been reading about this and I think I may need to energize two pins at once in a specific sequence (i.e. 1010, 0110, 0101, 1001).
Any thoughts?
Thanks,
Blake
First thing, is that you need current limiting resistors on p4,p5,p6, and p7 going to the base of the tip120's
12V 36 Ohm = 333mA ... say 350mA ... as a good rule of thumb quadruple that... 350mA --> becomes --> 1400mA.
The hFe (gain) of those transistors is about 1000. So we only need about 1.4mA of base current (1400mA/ 1000 = 1.4mA) ... lets figure 1.5mA Base current.
Since a darlington transistor has two diode drops (1.2V), the formula would be...
Current Limiting Resistor = ( I/O Voltage - Diode Drop ) / Base Current
Current Limiting Resistor = ( 5V - 1.2V ) / 1.5mA
Current Limiting Resistor = 3.8V / 1.5mA = 2533 Ohms = 2.5K resistor .... In this case I would used the closest standard resistor value of 2.2K or 2.7K
The second thing that I see in your code... not a big deal, other than a hiccup... You have two instances that assign control to pin 4
As far as your pattern.... you can get away with only one pin, or use a combination of one and two pins to achieve half-stepping.
Half Stepping - (0001, 0011, 0010, 0110, 0100, 1100, 1000, 1001)
Full Stepping - (0001, 0010, 0100, 1000)
or
Full Stepping - (0011, 0110, 1100, 1001)
Note: The main difference between using 1 or 2 pins is that you have better torque control with 2 pins than you do with 1 pin... during half stepping the torque gets averaged.
What's cool is that if you want to reverse the direction, you swap just the EVEN, or just the ODD bits.
i.e.
Forward = (A,B,C,D)
Reverse = (A,D,C,B)
or
Reverse = (C,B,A,D)
As far as manipulating more than one pin simultaneously, look into the PINS and DIRS commands.
Also, you should have reverse biased diodes across the C-E junction of each transistor to minimize back emf effects that could damage·the transistors and/or the Stamp.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 1/13/2008 8:15:24 AM GMT
Here is a tutorial on stepper motors which is often referenced by those who are just learning about stepper motors. It is neither processor nor stepper manufacturer specific, thus it provides excellent generalized examples. Here is the link to that web site: http://www.cs.uiowa.edu/~jones/step/
What you may need to do, before you go much further, is to "ring out" (check out the internal connections) of all of the wires on your stepper motor to ensure you know which windings are which. If I believe your wiring diagram, and Airpax follows what minimal conventions there usually are on the color coding of the wires, it's my suspicion that you may have the wrong two wires connected for common. More often then not the two common wires are the same color, or they may be black and red. You seem to have a green wire on you common connection. It's not impossible that green is one of the common wires, but I wouldn't also expect it to be a power winding wire as well, which seems to be the case in your diagram.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks for your responses,
Blake
Thanks,
Blake
Too bad you didn't mention that earlier. That points to one of two problems. What's happening is OPPOSING windings are being activated together, thus causing the "lock-up" instead of stepper advancement.
One of these two things is the cause:
1. Mis-wired coil windings
or
2. The binary pattern you are using to activate the coils is incorrect or out of sequence.
In either case I would go back to the tutorial "Jones on Stepper Motors" and review both conditions. One of them nearly has to be the case.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.me.umn.edu/courses/me2011/robot/technotes/stepper/
I uploaded the following code:
When I upload this, during upload the stepper's shaft locks tight. When the upload finishes, the shaft stays held for another three seconds then becomes easily turnable as expected. But it never locks again after an additional three second pause. If I reset the BS1, it locks tight for 3 seconds, then never locks again. Shouldn't this code make it repeat 3 seconds locked, 3 unlocked, 3 locked, etc.?
Here is a link to the original BS1 & BS2 text. Application number 6 may be of some help. It is a BS1 controller for a unipolar stepper.
http://www.parallax.com/Portals/0/Downloads/appnt/stamps/bs1Appnotes.pdf
Stephen Wagner
·
Thanks for all the info from everyone it was really informative and I have read through almost all of it.
Blake