I used erco's code in post #14 and it seems the steppers have good torque going clockwise (looking at the end of the shaft), but easily slip and quit turning going counter clockwise.
Both of my steppers act the same.
Has anyone else noticed this??
Sorry, I missed this one.
Mysterious. Should be identical speed & torque in both directions, which I achieved while running the square pattern and had to reverse one wheel for the turn.Are you certain you had the coils triggered in the right sequence?
Mysterious. Should be identical speed & torque in both directions, which I achieved while running the square pattern and had to reverse one wheel for the turn.Are you certain you had the coils triggered in the right sequence?
I noticed that one motor doesn't respond quite so well in one direction. It could be that they are just really cheap motors? I just run it at a slower speed and it seems ok.
Mysterious. Should be identical speed & torque in both directions, which I achieved while running the square pattern and had to reverse one wheel for the turn.Are you certain you had the coils triggered in the right sequence?
The coils were being triggered in the correct sequence but too quickly - see Gareth's reply #83 and my reply #84 where I posted half-step code.
Sure, slowing it down always works. But it should operate at the same RPM in both directions. Are you saying my code worked for you in one direction only, and you had to slow it down to run in the opposite direction? That doesn't make sense to me.
Sure, slowing it down always works. But it should operate at the same RPM in both directions. Are you saying my code worked for you in one direction only, and you had to slow it down to run in the opposite direction? That doesn't make sense to me.
No the RPM was not affected but the torque was - if you applied resistance to the shaft, in one direction the torque was diminished and "slipped". Slowing it down resolved the issue.
Others have experienced the same thing.
I opened one up a 5V stepper to check out the odd gear ratio. Probably a one-way trip, but it was worth $2.50 to satisfy my curiosity.
The metal case is staked in 4 places. Some gentle tapping with a hammer and small chisel is in order to open her up, then the flat mounting plate comes off with the output gear. All small nylon gears, with enough total backlash to be annoying. $2.50 doesn't buy perfection.
The motor & 9T pinion have 16 steps per revolution. 3 compound gears: 32x11, 22x9, 26x10 and the oddball output gear has 31 (yes, 31) teeth. So the overall gear ratio is 31/10 x 26/9 x 22/11 x 32/9 = 63.68395062 or 25792/405.
That times 16 steps per motor revolution yields a maddening 1018.94321 steps per output shaft revolution. Call it 1019. DOH! I had seen previous guestimates of 1024, about half a percent off. They were just messing with us when they chose a 31-tooth output gear. I guess ANYONE could use them if they had nice round numbers. We forumistas like a good challenge, right?
Pics attached. If I get inspired later from your amazed comments to follow, I might make a video of the motor shaft stepping along. Ask real nice!
and the oddball output gear has 31 (yes, 31) teeth.
Genetics........
Humans have 32 teeth ...... $3 Robot Steppers motors have 31 ...... Period "." (Darwin made it so..)
Does that explain why during a figure of eight maneuver the end point is 1 tooth short....... or do i still have to blame my sloppy code..........
.... i like the idea of removing one of its teeth ......hmmmmm
Thanks for reverse engineering this, Very useful information and now it looks like 32Bit maths has to be used....
And BTW ......... I have made a second $3 Motor Chassis ...... complete walk_through video is in my camera ...... soon to be rendered ..... Will post "Premiere" links somewhere here....and start a new project blog.
Well, mine finally arrived (actually we finally rendezvoused; they arrived while I was out on holiday vacation). Thanks for the pics erco and the rundown of the hilarious gear ratio.
It develops that these things are nearly perfect for a little project I'm up to that might turn into a big project. As our friend Gordon wrote in the first edition of Robot Builder's Bonanza, it can be hard to find things that move slowly. The weird gear ratio and backlash aren't a big deal for me since I'll be using them to drive lead screws. (I'll be cutting rocks. Rocks cut really, really slowly.) These guys are so much cheaper and simpler than the usual controls and yet quite strong and fast enough that it completely rearranges my design. And that's a good thing, because when you are cutting rocks really slowly it can be a nice thing to be able to afford to build 10 machines instead of 2.
It is pretty simple...first you count up the number of teeth you have sitting around. Then you decide how many motors you want to build.
Actually, this is a pretty impressive design. I would like someone to explain exactly what is going on in this little gem/monster.
Would make a great Masters thesis.
I was never able to get a round number for the steps in 360deg or multiplets of same. Always ended up less than the published facts. The Mayans would have figured it out.
Video shows someone's dedicated servo controller, but in particular I like the 4 motors in sync, which could be done with most any uC. Note that the motors in the video are MUCH faster than the $2 cheapies.
as mentioned in post #65.
Well if you plot out the signals on the four wires it turns out that coils C and D are the inverse of A and B.
Always looking to save pins I tried tieing the outputs of A and B to the inputs of C and D with 10k resistors (after disconnecting C and D from the processor) and hey presto - 2 pin stepper motors.
Now I didn't know if it might be better to use the spare inverters (we only use four out of the seven provided) with pullup resistors, and that works too, but I dont think its any improvement on the first try.
So if you've got to drive 4 motors, you need only use 8 driving bits instead of 16
Dave H
@Dave H: Ingenious! I love saving pins. My only comment is that there is no way to switch the motor "off" with your clever 2-pin configuration. Even when stopped, two coils are always energized and can overheat. Not a problem if you keep moving. It could be solved using one extra pin as an enable to switch one or all motors on/off.
They appear to be a little stronger (and maybe a little faster) running them in a four steps: AB-BC-CD-DA
I suspect a robotics application like I'm using would benefit from 4 steps, while a more precise application would be better 8 steps?
Those steppers are cheap, and in this case you truly do get what you pay for. I love 'em for testing & learning but IMO they are quite slow and not terribly useful nor ideal for beginner robotics. Their tiny gears must eventually strip when they get abused enough (manually turning the wheels). Even brand new, they have sufficient backlash to rule them out for many precision applications, no matter what step pattern you use.
I agree, they are cheap and pretty much disposable, but they potentially could do one very important task.. They could set the "hook" for robotics on a shoestring!
Spend an hour playing with a robot based on these and a bluetooth module and I'd bet on wanting to explore more...
Cheap - yes; nasty no though not for hi tech engineering however-
I've just built a 51/2 inch square "mouse" 2 wheeled robot initially to solve white line mazes. (like micro mouse without the walls, just a roll of easily re-configurable tape).
Cost
ali base £2
stepmo's + drivers modified to two pin £6
Wheels, two jam jar lids with brass house wiring connectors soldered to centre for hub £0.20
Cpu and bits £15
Batteries * 6 Ni Mh in holder £7
optp readers for line following + transistor amplifier £2
other stuff £3
Total 2+6+0.20+15+7+2+3 = £35.20 (about $45)
Oh yes blue-tooth £4 for remote control and reporting
less than fifty quid and hours and hours of fun to come.
Any other step motors could seriously increase the price.
I have seen the same thing done with 'ordinary' DC motors without any position feedback and they were 2 for a pound (needed ingenious reduction using a rubber band around the perimeter of the wheel to the roughened motor spindle giving 4": 1/16" reduction ie 64:1)
Dave H
Using half-step phase sequencing provides good torque...
' {$STAMP BS2}
' {$PBASIC 2.5}
' The 28BYJ-48 requires 512 8-step half-step sequences to rotate 360 degrees
Phase VAR OUTA ' phase control outputs
StpsPerRev CON 512 ' whole steps per rev
idx VAR Word ' loop counter
lup VAR Word
stpIdx VAR Word ' step pointer
stpDelay VAR Byte ' delay for speed control
Steps DATA 01, 11, 10, 10, 00, 00, 00, 01
Setup:
DIRL=001111 ' make P0..P3 outputs
stpDelay = 1 ' set step delay
Main:
FOR idx = 1 TO StpsPerRev * 8 ' one revolution
GOSUB Step_Fwd ' rotate clockwise
NEXT
PAUSE 500 ' wait 1/2 second
FOR idx = 1 TO StpsPerRev * 8 ' one revolution
GOSUB Step_Rev ' rotate counter-clockwise
NEXT
PAUSE 500 ' wait 1/2 second
OUTL = 0
'GOTO Main
END
Step_Fwd:
stpIdx = stpIdx + 1 // 8 ' point to next step
GOTO Do_Step
Step_Rev:
stpIdx = stpIdx + 7 // 8 ' point to previous step
GOTO Do_Step
Do_Step:
READ (Steps + stpIdx), Phase ' output new phase data
' DEBUG DEC idx, " ", DEC stpidx, " ", BIN4 phase, CR
PAUSE stpDelay ' pause between steps
RETURN
Hello-
I purchased a couple of these boards/steppers in order to learn how to use a simple stepper setup with the BS2. I was able to get the code in post 14 of this thread to work just fine but I am struggling a bit with the code above (from post 84 in this thread) . It does not appear to be sending the correct bit pattern to the output pins. Using DATA and READ are both new to me and I've read about them in the syntax manual, but I can't figure out how the entire lower byte "OUTA" is assembled from the nib in the DATA array plus the "stpIdx" variable. I think it is the READ statement in the "Do-Step" sub that is causing the problem. It seems to be writing other values into "phase" instead of what they should be.
Since no one else commented about errors in the code, could it be that there is something wrong with my hardware (or maybe no one else tried it)? The fact that the code in post 14 works fine makes me think it is not the hardware.
I've had mixed results running these as 8-step. Try 4-step: AB-BC-CD-DA, 1100,0110,0011,1001
Jeff
Hi Jeff-
I was able to get it to work with the 4 step configuration by writing to the pins via OUTL.
The technique of using the DATA and READ statements is interesting as I've never used them before and I like to learn new ways of doing things. Somehow, the original author was able to combine nibs to drive an OUTA and I'm curious about how that could be done.
Comments
So umph DOESN'T mean micro miles per hour?
Sorry, I missed this one.
Mysterious. Should be identical speed & torque in both directions, which I achieved while running the square pattern and had to reverse one wheel for the turn.Are you certain you had the coils triggered in the right sequence?
I noticed that one motor doesn't respond quite so well in one direction. It could be that they are just really cheap motors? I just run it at a slower speed and it seems ok.
The coils were being triggered in the correct sequence but too quickly - see Gareth's reply #83 and my reply #84 where I posted half-step code.
No the RPM was not affected but the torque was - if you applied resistance to the shaft, in one direction the torque was diminished and "slipped". Slowing it down resolved the issue.
Others have experienced the same thing.
Increasing B0 value makes a difference.
The metal case is staked in 4 places. Some gentle tapping with a hammer and small chisel is in order to open her up, then the flat mounting plate comes off with the output gear. All small nylon gears, with enough total backlash to be annoying. $2.50 doesn't buy perfection.
The motor & 9T pinion have 16 steps per revolution. 3 compound gears: 32x11, 22x9, 26x10 and the oddball output gear has 31 (yes, 31) teeth. So the overall gear ratio is 31/10 x 26/9 x 22/11 x 32/9 = 63.68395062 or 25792/405.
That times 16 steps per motor revolution yields a maddening 1018.94321 steps per output shaft revolution. Call it 1019. DOH! I had seen previous guestimates of 1024, about half a percent off. They were just messing with us when they chose a 31-tooth output gear. I guess ANYONE could use them if they had nice round numbers. We forumistas like a good challenge, right?
Pics attached. If I get inspired later from your amazed comments to follow, I might make a video of the motor shaft stepping along. Ask real nice!
It's entirely your fault that the postman recently dropped off a shipment of these for me to play with...
Genetics........
Humans have 32 teeth ...... $3 Robot Steppers motors have 31 ...... Period "." (Darwin made it so..)
Does that explain why during a figure of eight maneuver the end point is 1 tooth short....... or do i still have to blame my sloppy code..........
.... i like the idea of removing one of its teeth ......hmmmmm
Thanks for reverse engineering this, Very useful information and now it looks like 32Bit maths has to be used....
It develops that these things are nearly perfect for a little project I'm up to that might turn into a big project. As our friend Gordon wrote in the first edition of Robot Builder's Bonanza, it can be hard to find things that move slowly. The weird gear ratio and backlash aren't a big deal for me since I'll be using them to drive lead screws. (I'll be cutting rocks. Rocks cut really, really slowly.) These guys are so much cheaper and simpler than the usual controls and yet quite strong and fast enough that it completely rearranges my design. And that's a good thing, because when you are cutting rocks really slowly it can be a nice thing to be able to afford to build 10 machines instead of 2.
Don't they use a prime number of teeth so it wears evenly? I thought we always have to use a prime number someplace.
Actually, this is a pretty impressive design. I would like someone to explain exactly what is going on in this little gem/monster.
Would make a great Masters thesis.
I was never able to get a round number for the steps in 360deg or multiplets of same. Always ended up less than the published facts. The Mayans would have figured it out.
Rich
But even with the slower $2 motors, consider running 16 motors in sync, or 256. What could be done? Hmmm, the mind reels with possibilities for large-scale synchronized motion.
The motors are $2.18 alone http://www.ebay.com/itm/271025308870 , or 7 cents more ($2.25) with the controller board http://www.ebay.com/itm/Stepper-Motor-28BYJ-48-With-Drive-Test-Module-Board-ULN2003-5-Line-4-Phase-5V-/271025356632 . Free ship, natch.
I have several of the often-included driver boards which I may never use anyway. They work, but they are big, ULN2003 based and only good for one motor. IMO for a robot it's better to use a bare 2803, which can drive 2 of these, is tiny, and only ~60 cents each: http://www.ebay.com/itm/3-x-ULN2803A-ULN2803-2803-TRANSISTOR-ARRAY-8-NPN-IC-/260816285151?pt=LH_DefaultDomain_0&hash=item3cb9dcaddf Pic shows my BoeBot using steppers and a 2803.
Well I had to get some of these and wired as as mentioned in post #65.
Well if you plot out the signals on the four wires it turns out that coils C and D are the inverse of A and B.
Always looking to save pins I tried tieing the outputs of A and B to the inputs of C and D with 10k resistors (after disconnecting C and D from the processor) and hey presto - 2 pin stepper motors.
Now I didn't know if it might be better to use the spare inverters (we only use four out of the seven provided) with pullup resistors, and that works too, but I dont think its any improvement on the first try.
So if you've got to drive 4 motors, you need only use 8 driving bits instead of 16
Dave H
One thing I noticed about these is that they can be run in one of two different ways...
@_rjo's example is using an eight step method: A - AB - B - BC - C - CD - D - DA - A
They appear to be a little stronger (and maybe a little faster) running them in a four steps: AB-BC-CD-DA
I suspect a robotics application like I'm using would benefit from 4 steps, while a more precise application would be better 8 steps?
Here's some test code I'm using..
Those steppers are cheap, and in this case you truly do get what you pay for. I love 'em for testing & learning but IMO they are quite slow and not terribly useful nor ideal for beginner robotics. Their tiny gears must eventually strip when they get abused enough (manually turning the wheels). Even brand new, they have sufficient backlash to rule them out for many precision applications, no matter what step pattern you use.
Spend an hour playing with a robot based on these and a bluetooth module and I'd bet on wanting to explore more...
Jeff
I've just built a 51/2 inch square "mouse" 2 wheeled robot initially to solve white line mazes. (like micro mouse without the walls, just a roll of easily re-configurable tape).
Cost
ali base £2
stepmo's + drivers modified to two pin £6
Wheels, two jam jar lids with brass house wiring connectors soldered to centre for hub £0.20
Cpu and bits £15
Batteries * 6 Ni Mh in holder £7
optp readers for line following + transistor amplifier £2
other stuff £3
Total 2+6+0.20+15+7+2+3 = £35.20 (about $45)
Oh yes blue-tooth £4 for remote control and reporting
less than fifty quid and hours and hours of fun to come.
Any other step motors could seriously increase the price.
I have seen the same thing done with 'ordinary' DC motors without any position feedback and they were 2 for a pound (needed ingenious reduction using a rubber band around the perimeter of the wheel to the roughened motor spindle giving 4": 1/16" reduction ie 64:1)
Dave H
Hello-
I purchased a couple of these boards/steppers in order to learn how to use a simple stepper setup with the BS2. I was able to get the code in post 14 of this thread to work just fine but I am struggling a bit with the code above (from post 84 in this thread) . It does not appear to be sending the correct bit pattern to the output pins. Using DATA and READ are both new to me and I've read about them in the syntax manual, but I can't figure out how the entire lower byte "OUTA" is assembled from the nib in the DATA array plus the "stpIdx" variable. I think it is the READ statement in the "Do-Step" sub that is causing the problem. It seems to be writing other values into "phase" instead of what they should be.
Since no one else commented about errors in the code, could it be that there is something wrong with my hardware (or maybe no one else tried it)? The fact that the code in post 14 works fine makes me think it is not the hardware.
Many thanks!
-stro
Jeff
Hi Jeff-
I was able to get it to work with the 4 step configuration by writing to the pins via OUTL.
The technique of using the DATA and READ statements is interesting as I've never used them before and I like to learn new ways of doing things. Somehow, the original author was able to combine nibs to drive an OUTA and I'm curious about how that could be done.
Cheers!
stro