Shop OBEX P1 Docs P2 Docs Learn Events
dc motor speed controll pwm — Parallax Forums

dc motor speed controll pwm

ObiwanObiwan Posts: 36
edited 2005-06-07 19:15 in Robotics
i have an h-bridge with four approximately 100-200 hfe transistors.· It drives a 9v dc motor.· Each base of each transistor is controlled by its own pin from the basic stamp.· what is the best way to use pwm to vary the speed of the motor.· My problem is, they have enough current, but the motor rotates too fast for my project.· Can i use pwm on some bases instead of just bringing them high to make the motor operate at a slower speed whenever its on.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-05 23:24
    Hello,

    ·· You will need a chip (co-processor) to generate the PWN for the H-Bridge to do it practically...There is always the PWM PAL, or one of Al Williams PAK chips does this as well...



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • ObiwanObiwan Posts: 36
    edited 2005-06-05 23:25
    so there is no way to just do it with the basic stamp
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-05 23:27
    Hello,

    ·· The Stamp is a single-tasking MCU, so if you setup a PWN routine, the Stamp won't have any time to do anything else.· Best to get the co-processor...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • ObiwanObiwan Posts: 36
    edited 2005-06-07 14:21
    does this mean that there is no way to just permanently decrease the speed of the motor.· If I could have it always run at half the speed it does now that would be great.· Would putting a resistor in front of it do that?
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2005-06-07 15:06

    Don't use a resistor to create a voltage divider with your motor.· Use an adjustable voltage regulator if you are going to go that route.
    The·LM317 [noparse]/noparse][url=http://cache.national.com/ds/LM/LM117.pdf][u][color=#800080]http://cache.national.com/ds/LM/LM117.pdf[/color][/u][/url·is a popular choice.

    Obiwan said...
    so there is no way to just do it with the basic stamp
    Not without external components.· The PWMPAL will work and takes a lot of guesswork out of the equation, but if you really want to roll your own you need
    a few things...

    1)·A triangle wave generator operating at you PWM base frequency
    2) A comparator that looks at the triangle wave against a DC offset between 0V and 5V.· The output of the comparator is the PWM that you want.··
    3) A DC offset can be generated directly from the Stamp via the Stamps PWM configured as an analog reference (will need to be updated on a regular basis)
    ·········· · OR·
    ·· A DC offset can be generated from the output of a digital potentiometer controlled by the Stamp (which does not need regular updates)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-06-07 15:43
    If your seeking to permanently decrease the speed of the motor, I don't see why you couldn't add a (small) resistor in series with the motor (except you will be lowering your motor's torque). This should increase the effective resistance of the motor as seen by the H-bridge and hence lower the drive current. Someone please chime in if there is something wrong with doing this.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2005-06-07 19:15
    Without knowing more information about the motor, other than it is 9V dc, it's hard do determine or guess what resistor could be used.
    That said, the "optimal" resistor value could vary widely depending on the load the motor experiences. The most efficient method would
    be PWM, second on the list would be some sort of linear regulator, lastly would be to use a resistor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
Sign In or Register to comment.