Shop OBEX P1 Docs P2 Docs Learn Events
help newbie with bs2 and motor control — Parallax Forums

help newbie with bs2 and motor control

KiddKidd Posts: 14
edited 2004-11-08 16:47 in BASIC Stamp
i just bought the "What is a Microcontroller" kit. i need to program a motor to run for 20 seconds and then shut off. i dont know how to wire it all together and i dont understand much of the technical talk. Is there a way to hook up a motor, (it needs 9 volts), to the basic stamp or do i need to buy something else? please help

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-10 05:22
    You need something to swtich the motor current -- a transistor or MOSFET will do. DO NOT connect the motor directly to the BASIC Stamp or you will probably burn-up an IO pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • KiddKidd Posts: 14
    edited 2004-10-10 05:41
    does the microcontroller kit come with those? is there a more advanced tutorial or something that i can read, so i know what to do?
  • BeanBean Posts: 8,129
    edited 2004-10-10 12:58
    Do you know how much current (amps) the motor requires ? If you have a meter you could measure it.

    Terry
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-10 14:40
    The WAM kit does not go into motor control. We do have docs on our site, though, specifically the documentation for the NX-1000-24/40 board which has a small motor driver circuit (opamp) on it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • KiddKidd Posts: 14
    edited 2004-10-11 17:18
    I'm not sure how many amps it requires, will that help me wire it to the homework board?
  • OTC InstructorOTC Instructor Posts: 6
    edited 2004-10-11 19:47
    Kidd,

    Here are a couple very basic essentials for running a small motor with the BASIC Stamp:

    Motors need power to run.· Power is the product of volts times current. The STAMP can provide about 5 volts on an output pin, and provide about .025 amps of current, no more. If you multiply the two together, you will find that the maximum power that the STAMP can provide is about 0.125 watts. This is really not enough to do much, and it certainly can't run a motor.

    Most small hobby motors require more voltage than 5 volts and far more current than .025 amps. It would be good for you to note the voltage of your motor and measure·the current it draws when it is running.·Multiply these values together, and that will tell you the power requirement of your motor. Foe example, if the motor runs at 12 volts and draws 1.5 amps,·it'll need 18 watts of power.

    That is why you need a transistor on the output of the stamp to run a motor. It'll take the output power that the stamp provides and amplify it enough to make the motor run.

    In my classes, we typically use a small switching transistor such as a 2N2222 and drive it with a 600-800 ohm resistor between the output and the base lead of the transistor. The transistor is between the motor and ground. This lets you power the motor at·the voltage that it runs at such as 12 volts, and you can turn it on and off by making the output pin high or low.

    This transistor can handle about 1 amp. If you have a motor that needs more current to run, you'll need a bigger transistor.

    Be sure you connect the grounds of the motor power supply and the Stamp power supply together.





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bruce Clemens, CET Sr.

    Instructor, Electronics and Computer Repair Technology
    Ozarks Technical Community College
    www.otc.edu
  • KiddKidd Posts: 14
    edited 2004-10-12 19:55
    Thank you all for your help, OTC thanks for explaining, i understand better now.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-10-13 14:13
    Bruce,

    ·· I would recommend a Power Transistor, such as a TIP41, or possibly a TIP120 instead of the 2N2222.· In my experience the 2N2222 can't handle more than 600mA without getting extremely warm, and my ratings list it's absolute maximum current as 800mA.

    · In retrospect, for motor control, an H-Bridge might be more applicable, depending on the project, since it provides directional control as well...

    Take Care!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • mikeslaneymikeslaney Posts: 17
    edited 2004-11-08 16:10
    I've been experimenting with different transistors for a motor driver and have found that different transistors (2n3904, 2n2222, TIP107 Darlington...) result in different lengths of time before the motor comes up to full speed. Would a MOSFet react quicker?
    The PN2907A handles about 800MA and only pulls about 2MA from the Basic Stamp when operating.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2004-11-08 16:47
    Switching times of standard and power transitors are fast enough that you wouldn't perceive them with the naked eye (In the Mhz range)...So that shouldn't be slowing startup of your motor down.· Does it come up any faster if you connect it directly to the same power supply?· Also, is the resistor you're using the right value...Too small of a value of resistor can affect the output of the transitor (As in not conducting enough).



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
Sign In or Register to comment.