Shop OBEX P1 Docs P2 Docs Learn Events
DC Motor driver help — Parallax Forums

DC Motor driver help

WalterWalter Posts: 17
edited 2005-06-28 17:46 in Robotics
HI, i'm trying to work on a school project that will use
a gps , 2 srf10 sensor,· a compass,·lcd/keypad and a robot base.
I ordered a BS2Pe for this project. (I think I made the right choice because of code space)

right now my problem is trying some sample code to get my robot base working.

I'm using a base from Zagros Robotics· at https://www.zagrosrobotics.com/Index.asp
droid.jpg

which has 2 DC motors controlled by attachment.php?attachmentid=73739
it basically uses 2 PWM for input and 2 analog output to control the direction.
i'm a newbie to the bs2 and·I love it.·(...I got frustrated trying to use a Pic). does anyone have a sample of how to drive this robot base?

all the help is appreciated..
(This is the first my first posting of many to follow until i'm done with this project in early august) HELP!

Walter
756 x 256 - 16K

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-21 00:25
    Walter,

    ·· One more thing that might make your life a little easier with this is by adding our PWMPAL, or any PWM co-processor to control the PWM inputs of your motor controller.· You can find the PWMPAL on our website.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • edited 2005-06-21 00:54
    I agree with Chris, you would be better off with the PWMPAL. It will make life easier interfacing the WIRZ to the Stamp. I have used the Motor Mind B & C modules both sold by Parallax. They are serial DC motor controllers. They take the burden away from the Stamp having to perform the PWM. They also support alot of features not found on the WIRZ motor controller.


    Regards,
    Michael G. Jessat
  • WalterWalter Posts: 17
    edited 2005-06-21 00:55
    yes, I just reilized that parallax has motor drivers. but I will use PMWPAL as the last result becasue I already have the motor driver with me...and besides I have plenty of I/O lines open.
    I'll use I2C to control lcd/keypad, compass, and sensors.
    2 for the rs232 for the gps, and 4 to control the robot. which is 8/12 I/Os.

    but if I can't figure this out in the next few days/weeks, I'll have to buy it...(but I spent too much money in this project so far)

    thanks

    Walter
  • WalterWalter Posts: 17
    edited 2005-06-21 01:11
    ok, I'll give PWMPAL a look anyways...
    thank you guys

    Walter
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-21 04:42
    The PWMPAL can be used to supply the necessary PWM signal to your motor driver. Since the PWMPAL runs in the background and you have full control over the PWM frequency and duty-cycle (which affects motor speed, and by using different motor speeds you can cause steering), it should suit your driver just fine. Just remember not to change your direction control inputs to the motor driver unless you've stopped the PWM signal to the driver.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 6/21/2005 3:11:06 PM GMT
  • WalterWalter Posts: 17
    edited 2005-06-22 13:51
    thanks Jon,
    I did some reading on the PWMPal documentation and it looks pretty good and I have decided to use it.
    I looked at the sample code, but I'm still a little confused about how to make the dc motors operate in my robot base.
    how do I make it reverse? or turn right or left?

    Thanks

    walter
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-22 14:22
    You should probably download and read our "Robotics" text.· That uses servos, but the concept of using differential steering·is the same.·

    I believe the motor driver you're intending to use has direction control for each motor.· With the motor stopped, you set the direction to move and then ramp up its speed by increasing the PWM duty cycle (from off to the speed you desire) to make that motor move.

    Perhaps this simple table will help you start to visualize the robot's behavior vis-a-vis motor activity (F = forward, R = reverse, S = Stop):

    LMotor·· RMotor··· Behavior

    ··
    ···
    · S······· S·······Stop
    · F········F·······Forward
    ··F······· S·······Pivot-turn, to right
    · F······· R·······Spin,·clockwise
    ··S······· F·······Pivot-turn, to left
    · R······· F·······Spin, counter-clockwise
    · R········R·······Reverse

    Remember, instant switching of the direction bits on your motor driver while the motors are running will probably kill it (the motor driver).· In your shoes I would work on a subroutine that lets me tell the motors what speed and direction I want and then let them ramp up or down to those target values.· Accelerating and decelerating are going to be important aspects of your robot and I trust you'll want to focus on that part first.· After you can get your robot to behave -- motion-wise -- the way you want, then you can take on the navigation aspect.

    Your project is complex, so save yourself a lot of grief and just work on one part of it at a time.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • WalterWalter Posts: 17
    edited 2005-06-22 18:51
    thanks Jon,
    I'll do some reading on the subject.
    and where can I find that "Robotics" text ?

    Thanks
    Walter
  • Kevin B SlaterKevin B Slater Posts: 49
    edited 2005-06-22 21:45
    Walter,
    · You can find the Robotics v2.2 text here.

    Kevin
  • WalterWalter Posts: 17
    edited 2005-06-23 03:24
    Thanks

    Walter
  • WalterWalter Posts: 17
    edited 2005-06-27 15:28
    Ok...so now I have the PWMPAL and the IRL520-ND Mosfet. could someone please help me out and tell me

    1) how are the wirings supposed to be done? I see a sample, but what about the direction pin?

    2) I looked at the sample code for the PWMPAL, but still can't figure out how to controll the direction of the motor.

    Thanks

    Walter
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-28 17:46
    Walter,

    ·· The example schematic provided in the PWMPAL docs is for turning the motor on/off and controlling it's speed with the PWMPAL.· To control direction you would need an H-Bridge.· One MOSFET won't do it.· You will need 4.· You can easily find example circuit by typing "H-Bridge" on Google under Image Search...I just checked.· Dozens come up.· Most H-Bridges accept a pulse-width modulated input to control speed.· The direction pin comes into play on some H-Bridge configurations.· You will see if you check the results of that search.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.