Shop OBEX P1 Docs P2 Docs Learn Events
smooth movement — Parallax Forums

smooth movement

exskoolexskool Posts: 24
edited 2006-02-21 13:55 in Robotics
hi...i'm want to build a mover robot controlled by keypad..from the past experience, when i pressed forward button(or other direction also), the robot will suddenly move with jerk...how can i control the jerky motion so that the robot can start·smoothly·with increasing speed? (assume that i'm using dc motor·)

Comments

  • A.C. fishingA.C. fishing Posts: 262
    edited 2006-02-18 13:16
    what you want is called ramping. To slowly start up, right?· I think this should do it. (assumming your robot has two wheels)
    ' Slowly start gainning speed
    

    VARIABLE var word
     
    For VARIABLE 1 to 150
    pulsout (place on motherboard where servo is connected), 750 + VARIABLE
    pulsout "                                             ", 750 - VARIABLE
    Pause 15
    Next
    END
    

    roll.gif·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-18 13:22
    exschool -

    The answer "ramping" is certainly correct, but the example given will only work with an R/C servo, and you mention that you're just using a DC motor. How are you presently controlling the speed? If you aren't, therein lies the whole problem.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • exskoolexskool Posts: 24
    edited 2006-02-18 13:52
    from the previous project, i just make the button as switch to make a complete circuit from battery to motor
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-18 14:39
    exschool -

    So the answer is you presently have NO speed control In that case you may want to look into using an H-Bridge. This will permit FORWARD and BACKWARD movement, along with the ability to control the speed by using PWM output from the Stamp. See the PWM command in the PBASIC Manual, or in the PBASIC Help File to get an idea what that's all about.

    H-Bridge chips can be purchased to provide all the necessary circuitry in one IC. Usually, two pins are used to drive it. One pin controls the DIRECTION, and the other controls the SPEED. Here is a typical example of an H-Bridge chip and this one also includes a BRAKE control line:
    http://www.national.com/pf/LM/LMD18200.html

    If you prefer, you can DIY and build your own H-Bridge with a few MOSFETS, and a handful of other parts:
    http://www.armory.com/~rstevew/Public/Motors/H-Bridges/Blanchard/h-bridge.htm

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • exskoolexskool Posts: 24
    edited 2006-02-18 15:01
    so if i'm using h-bridge, there will be no jerky any more?
  • BeanBean Posts: 8,129
    edited 2006-02-18 15:38
    What are you using to control the motor now ? A FET ? A Transistor ? A H-Bridge ?

    You can probably use continue to use the same control circuit just feed it PWM to get it up to speed.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."
    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-18 18:17
    exschool -

    You asked: "So if i'm using h-bridge, there will be no jerky any more?"

    The direct answer to that is, it depends. Please realize the following.

    Presently you have only two modes: OFF and ON (full power). To the extent that the mobile platform _will_ JERK when it goes from a DEAD STOP to FULL SPEED, with a PWM powered H-Bridge, you won't have to go from DEAD STOP to FULL POWER. You will be able to bring up the power (and speed) in discrete steps as slowly or quickly as you choose. Not that you would WANT to do it, but you COULD go from DEAD STOP to FULL SPEED just as you did before. What I'm saying here is that nothing is lost in the process.

    Here is a short, but probably incomplete routine, to illustrate what I'm saying:

    'Untested PWM Ramping Routine to Power an H-Bridge

    Direction PIN 1 'Arbitrary Control Pin Assignments
    Speed PIN 2' " " " "

    FWD CON 0 'Arbitrary values for
    REV CON 1 'Forward and Reverse

    Duration CON 128 'Adjust as required

    RPM VAR BYTE

    OUTPUT Direction 'Set control pins
    OUTPUT Speed ' to output mode

    Speed = 0 'Initially set RPM to zero
    Direction = FWD "Initially set direction to forward

    'Let's go forward a bit, slowly

    FOR RPM = 1 to 127 STEP 2
    PWM Speed, RPM, Duration
    PAUSE 1 ' Pause may or may not be needed
    NEXT

    'Let's STOP and reverse direction, travelling VERY slowly
    OUTPUT Speed
    Speed = 0
    Direction = REV

    FOR RPM = 1 to 32
    PWM Speed, RPM, Duration
    PAUSE 1 ' Pause may or may not be needed
    NEXT

    'Let's STOP again and go ahead quickly
    OUTPUT Speed
    Speed = 0
    Direction = FWD

    FOR RPM = 1 to 255
    PWM Speed, RPM, Duration
    PAUSE 1 ' Pause may or may not be needed
    NEXT

    'Stop for good
    OUTPUT Speed
    Speed = 0

    END

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • exskoolexskool Posts: 24
    edited 2006-02-19 14:13
    ok...i get what you want to say Bruce...very thankful for the codes wink.gif is there any simpler circuit to build the h-bridge..i found some but just like to know whether if there is much better one.. also, if i want to move a load on the mover (about 10-15 kg), is there any junk motors (high availability and cheap) that are suitable for the wheels except the wiper motor? actually, i want to enter a competition and i need my robot to be really fast
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-19 15:32
    exschool -

    I'm not sure how you might want to define "simpler", but here is another H-Bridge project which only has 10 different parts, for a total of less than 20 parts. I'm not sure it can get much "simplier" than that:
    http://www.bobblick.com/techref/projects/hbridge/hbridge.html

    Obviously, the simplest and least expensive way to do it is to find an appropriate H-Bridge chip that meets your needs, and ask the manufacturer for a sample. I find that gets me back to the overall project goal much more quickly than trying to re-invent the wheel smile.gif

    Please be advised that there are H-bridge chips which contain TWO full H-Bridges on ONE chip. Thus, one chip can control two different motors. Just keep the topic of heat dissappation in mind, and be prepared to invest some money in decent heat sinks, regardless of which route you intend to take.

    If I were designing a robot to carry or move 15 kg, I'd be much more worried about the torque required to move it, than moving it quickly. Speed and torque are really at two different ends of the spectrum, when speaking about DC PM motors. You can have one, or the other, but usually not both, unless you want to invest some substantial money in both the motors and an appropriate motor controller.

    Wheel chair motors with appropriate gearing are often used in competition robots. Here is one source of same, but these are hardly considered "junk" motors:
    http://www.npcrobotics.com/products/index.asp

    Here is an excellent resource for various motor controllers for wheelchair motors:
    http://divelec.tripod.com/html/motor_controllers.html

    Here is another resource for high torque DC motors of various sizes, types and voltages:
    http://www.herbach.com/Merchant2/merchant.mv?Screen=CTGY&Store_Code=HAR&Category_Code=MTR

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • exskoolexskool Posts: 24
    edited 2006-02-21 01:45
    duh, some money will go out for the motor...anyway, thanks Bruce, the 'forumians' are sooo supportive
  • Steve JoblinSteve Joblin Posts: 784
    edited 2006-02-21 13:55
    If you are looking for a very cost effective and easy way to control motors, check out Pololu's Dual Serial Motor Controller... Parallax actually sells it... http://www.parallax.com/detail.asp?product_id=30052

    It is very easy to interface with a Basic Stamp. You can control the speed and direction.
Sign In or Register to comment.