help newbie with bs2 and motor control
Kidd
Posts: 14
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 Williams
Applications Engineer, Parallax
Dallas Office
Terry
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
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
·· 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
·
The PN2907A handles about 800MA and only pulls about 2MA from the Basic Stamp when operating.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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
·