Data Storage Tool Display Human Input Protocol Math Motor Control Sensor Signal Generation Speech & Sound Fun View all Objects


Quick Links
Contact Us
Forums
Support

Register
Login

This object is provided under license. By downloading this object, you are agreeing to the terms of the MIT License.

Control of a DC motors with H-Bridge chips

Control speed and direction of DC motors using H-Bridge chips such as the LMD18201

The setMotor procedure sets the duty cycle (0%-100%), direction and delay per % change in duty cycle. The delay per % change in duty cycle allows the motor speed to ramp up and down in a smooth manner. The amount of delay to use will depend on the characteristics of the motor
and the load on the motor. This procedure is operating open loop which means that if the delay
per % change in duty cycle is not long enough you can over run the motor. The procedure keeps track of the direction of the motor and will ramp the speed to 0 before changing direction. The setMotor procedure is run in a new cog which waits for any previous operation to quit before starting the new one. The setMotor cog is released after the new motor setting has been reached. The pwm loop will run constantly in its own cog to keep the motor running at the set duty cycle. A test program is included that controls two motors.

Version:
  1.0

Author:
  Thomas Doyle

Categories:
  Motor Control
  Signal Generation

Downloads:
  1,385

Last Updated:
  2007-02-25



User Reviews:

  • movellan commented:
    I'm having problems getting this baby to work. The signals coming from the out1 and out2 pins from the H bridge are in phase and thus, the motor does not move ... I may have figured out the problem. You need to make sure that the "brake" pin in the LMD18201 is grounded. The instructions for connecting the LMD to the propeller are a bit unclear. Here are instructions for driving a single motor with a single LMD18201: LMD18201 Pin1: BS1 -> empty Pin2: Outpu1 -> Motor Pin3: Direction -> Propeller Pin 7 Pin4: Brake -> Ground Pin5: PWM input -> Propeller Pin 5 Pin 6: Vs Power Supply -> Motor Battery + Pin 7: Power Ground/Sense -> Motor Battery - Pin 8: Signal Ground: -> VSS pin from Propeller Pin 9: Thermal Flat Output -> empty Pin 10: Output2 -> Motor Pin 11: BS2 -> empty
    March 17, 2008 1:05 p.m.


  • watchimgo commented:
    This is a useful object, except that it lacks the ability to interface h-bridge chips which require two direction pin inputs - such as the VNH3SP30, which Pololu uses for its high current motor driver. It would be nice to add this feature.
    October 21, 2007 1:33 p.m.




  • Copyright 2007 by Parallax, Inc.
    Please contact obex.support@parallax.com with comments or questions.