Shop OBEX P1 Docs P2 Docs Learn Events
$3 Stepper Motor & Board - Page 4 — Parallax Forums

$3 Stepper Motor & Board

1246

Comments

  • ercoerco Posts: 20,257
    edited 2012-11-08 13:54
    mindrobots wrote: »
    I would have gone with the "umph" crowd until I read the Urban Dictionary definitions...I DON'T want my robot to have THAT!!!!

    So umph DOESN'T mean micro miles per hour?
  • ercoerco Posts: 20,257
    edited 2012-11-08 15:27
    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?
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-11-08 17:41
    erco wrote: »
    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.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-11-09 05:43
    erco wrote: »
    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?

    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.
  • ercoerco Posts: 20,257
    edited 2012-11-09 08:40
    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.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-11-09 08:51
    erco wrote: »
    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.
  • ercoerco Posts: 20,257
    edited 2012-11-09 09:13
    I'll have to try mine and see. I only got stalling when I entered the wrong stepper sequence.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-11-09 09:36
    erco wrote: »
    I'll have to try mine and see. I only got stalling when I entered the wrong stepper sequence.
    Using your code from post #14, it is easier to stall going counter-clockwise.
    Increasing B0 value makes a difference.
  • localrogerlocalroger Posts: 3,452
    edited 2012-11-11 08:55
    Well I finally drank the kool-aid and ordered 4 of the 5V model for $2.49 each. I might even have a use for one of 'em.
  • ercoerco Posts: 20,257
    edited 2012-11-11 09:13
    I "herd" ya, localroger. Stay with the flock!
  • ercoerco Posts: 20,257
    edited 2012-11-21 16:56
    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!
    1024 x 768 - 59K
    1024 x 768 - 48K
  • Martin_HMartin_H Posts: 4,051
    edited 2012-11-21 17:52
    31 teeth? That's pretty freaky as it's a prime number. I wonder if that was a mistake which is why they are so cheap.
  • ercoerco Posts: 20,257
    edited 2012-11-21 18:39
    If you simply clip off one tooth, then you have a 30-tooth gear, which makes all the math works out nicer.
  • Bill HenningBill Henning Posts: 6,445
    edited 2012-11-21 18:58
    Guys,

    It's entirely your fault that the postman recently dropped off a shipment of these for me to play with...
  • GarethGareth Posts: 278
    edited 2012-11-22 02:04
    erco wrote: »
    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....
  • GarethGareth Posts: 278
    edited 2012-11-22 02:10
    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.
  • localrogerlocalroger Posts: 3,452
    edited 2012-11-30 17:01
    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.
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-12-01 07:51
    Martin_H wrote: »
    31 teeth? That's pretty freaky as it's a prime number. I wonder if that was a mistake which is why they are so cheap.

    Don't they use a prime number of teeth so it wears evenly? I thought we always have to use a prime number someplace.
  • rjo__rjo__ Posts: 2,114
    edited 2012-12-01 16:22
    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.

    Rich
  • ercoerco Posts: 20,257
    edited 2012-12-07 09:55
    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.

    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.
  • ercoerco Posts: 20,257
    edited 2013-01-18 17:47
    Stepper motor only (no driver board) is down to $2.19 shipped now: http://www.ebay.com/itm/New-1pc-5V-4-phase-5-wire-Stepper-Motor-Gear-Motor-28BYJ-48-/360517939887?pt=LH_DefaultDomain_0&hash=item53f08b32af

    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.
    816 x 612 - 94K
  • tritoniumtritonium Posts: 543
    edited 2013-01-30 12:29
    Hi all
    Well I had to get some of these and wired as
    No torque? Try full step (2 coils at a time) per http://www.parallax.com/dl/docs/prod...otor_27964.pdf

    ~2 ms per step.
    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 :smile:
    Dave H
  • ercoerco Posts: 20,257
    edited 2013-01-30 13:31
    @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.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-02-05 22:26
    There's some nice BASIC stamp examples in this thread, and even a Spin example or two...

    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..
    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
    Var
      byte BitPattern[ 4 ] 
      long count
    
    Pub Demo
      BitPattern[ 0 ] := %1100
      BitPattern[ 1 ] := %0110
      BitPattern[ 2 ] := %0011
      BitPattern[ 3 ] := %1001
    
      DirA[ 0..3 ] := %1111
      repeat
        repeat count from 0 to 3 
          OutA[ 0..3 ] := BitPattern[count]
          repeat 1200
    
  • ercoerco Posts: 20,257
    edited 2013-02-06 00:40
    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.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-02-06 07:40
    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...

    Jeff
  • tritoniumtritonium Posts: 543
    edited 2013-02-06 10:47
    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
  • strostro Posts: 4
    edited 2013-02-09 09:24
    Thanks! Certainly makes a difference.

    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.

    Many thanks!
    -stro
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2013-02-09 09:51
    I've had mixed results running these as 8-step. Try 4-step: AB-BC-CD-DA, 1100,0110,0011,1001

    Jeff
  • strostro Posts: 4
    edited 2013-02-09 13:21
    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.

    Cheers!
    stro
Sign In or Register to comment.