Help, I just want to make a motor spin
vla7
Posts: 79
I'm new to the basic stamp.· Can someone please walk me through connecting a dc motor to my homework board and programming it to spin.
Comments
You need a motor controller.You can use H-Bridge. Try google you may find a lot of H-Bridge circuit or you can use continuous rotation servo for ease of use. If you can't get the continuous rotation servo you can make one by modified the servo.
What are the current and voltage rating of the motor? If you just want it to spin without controlling speed or direction, a single transistor may do it... unless you are talking about a 90V, 1.5HP motor or such :P
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting Software
Southern Illinois University Carbondale, Electronic Systems Technologies
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
Post Edited (Dgswaner) : 11/7/2007 5:06:56 PM GMT
www.parallax.com/Store/Books/EducationalTexts/tabid/181/CategoryID/66/List/0/Level/a/ProductID/139/Default.aspx?SortField=ProductName%2cProductName)
and the StampWorks manual
(www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/stampworks/List/1/ProductID/144/Default.aspx?SortField=ProductName%2cProductName).
Both will introduce you to hooking sensors and motors to a Stamp.
You can keep asking questions one at a time and getting answers that may or may not fit your particular needs, but I think you'll get up to speed faster by looking through these manuals and the Basic Stamp manual (which has some examples of hooking things up to a Stamp).
Post Edited (Mike Green) : 11/7/2007 4:16:42 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
I had looked at "What's a Microcontroller" but it just had a section on wiring and programming a servo motor and other tutorials got into stepper motors.· I was just looking for wiring and programming a simple dc motor to try to build a car that goes forward and turns.
or a DC faceplate starter? set of contacts with resistances between them and an arm wiper that gradually reduces the resistance as you move the arm that could be interfaced to a servo aswell?
In both cases the resistances are heavy duty types, carbon discs and open wire wound resistance both which get very hot, another thought is a rheostat like the old TV dimmers used, that could be controlled again by some form of belt drive from a servo?
Post Edited (skylight) : 11/7/2007 11:12:26 PM GMT
There are two issues involved here:
1) Even small toy motors draw too much current for a Stamp (or any other microcontroller) to handle. You need some kind of driver which could be an H-Bridge if you want to be able to reverse the motor or just a transistor that can be used for just on/off action. I would get an L293D which is a quad high current driver designed for stepper motors, but it can easily be used to make a dual H-bridge for controlling two motors or you can just use half of it to control two motors in an on/off fashion. The StampWorks manual (www.parallax.com/Portals/0/Downloads/docs/books/sw/Web-SW-v2.1.pdf) has a chapter on its use with a stepper motor. Just use half of it.
2) You can control the speed of a motor by using the PWM statement to produce a "chopped" on/off signal whose average on-time can be specified in the PWM statement. This would be fed to one channel of the L293D. The problem is that the Stamp can do only one such signal at a time, so you can't control the speed of two motors if the speed is different. You can use a variety of external processors and parts to move this function out of the Stamp so you can have two or more independent channels of PWM (pulse width modulation). One easy way is to use the PWMPAL which is a separate slave microcontroller that mounts under a Stamp and is controlled by it. Have a look at the documentation off the product page on Parallax's webstore.
can the H-bridge control the speed of the motors as well as the "off/on" and direction?· I'm assuming the speed of the motor is based on how much power it receivers.· If so, I'm trying to figure out how to control the amount of current to the motor from the stamp?
·
Please read my previous post (#2). If you don't understand what I said, let me know what part doesn't make sense.
Thanks.
In regards to:
"2) You can control the speed of a motor by using the PWM statement to produce a "chopped" on/off signal whose average on-time can be specified in the PWM statement. This would be fed to one channel of the L293D. The problem is that the Stamp can do only one such signal at a time, so you can't control the speed of two motors if the speed is different. You can use a variety of external processors and parts to move this function out of the Stamp so you can have two or more independent channels of PWM (pulse width modulation). One easy way is to use the PWMPAL which is a separate slave microcontroller that mounts under a Stamp and is controlled by it. Have a look at the documentation off the product page on Parallax's webstore."
so you are saying that the·way to control the motor with the L293D is to send the power in pulses, and depending on how long the "on" pulse is, the faster the motor is going?··This doesn't sound very clean/efficient?·· Is this the best way?· Also, I will need to control multiple motors fairly simultaneously, so I'm thinking ultimately the propeller chip is the way to go. Is that what you would recommend?
Also, while I'm on the subject, can the H-Bridge control more than 1 motor?· By this I mean the on/off?· I will need to vary the speeds of different motors separately, but·the on/off will·not be unique.
thanks for your help.
·
For each motor you're controlling, you need one power switch which can be just a power transistor or a section of an L293D or equivalent. If the motor isn't too big, you could use something like a 555 timer to produce the PWM pulses (maximum current = 200mA). You could use a 555 timer with an external switching transistor for higher loads. There are digitally controlled potentiometers that the Stamp could control that can set the PWM on-time. There are lots of options.
The L293D is still a good choice for controlling either up to 4 motors in one direction or up to 2 motors in two directions with an average motor current of up to 600mA and a peak (near stall) current of up to 1.2A per motor.
Why don't you figure out how much current your motors draw, both average and under heavy load? Also decide whether you want to be able to reverse them or just vary speed in a forward direction.