Shop OBEX P1 Docs P2 Docs Learn Events
Help, I just want to make a motor spin — Parallax Forums

Help, I just want to make a motor spin

vla7vla7 Posts: 79
edited 2007-11-10 00:09 in BASIC Stamp
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

  • azmax100azmax100 Posts: 173
    edited 2007-11-07 04:00
    Hi vla7,

    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.
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-11-07 04:04
    via7,
    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
  • vla7vla7 Posts: 79
    edited 2007-11-07 12:15
    Why can't I just connect the motor directly to the homework board and program it to send current through the motor?
  • DgswanerDgswaner Posts: 795
    edited 2007-11-07 14:29
    The Homework board can't supply enough amperage to run a motor, with a few components you could connect one of several types of circuits to control a motor. the voltage, amperage and use of the motor dictate which circuit is best. if you have a servo like what is found in R/C cars. you could connect it directly the board and control it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-07 16:10
    Please, if you haven't already, read the "What's a Microcontroller?" tutorial (download link is near the bottom of the page
    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
  • D FaustD Faust Posts: 608
    edited 2007-11-07 19:47
    Has anyone noticed how often this question comes up?· I think somebody should make a thread that has the answer to this question so it can be posted as a link in every new thread about this topic.· (I can't now, but maybe later.)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
  • FranklinFranklin Posts: 4,747
    edited 2007-11-07 20:09
    Perhaps a sticky post titled READ THIS FIRST!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • D FaustD Faust Posts: 608
    edited 2007-11-07 20:16
    Yeah!!!!!!!! Or something titled: "DC Motors With Stamps"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
  • FranklinFranklin Posts: 4,747
    edited 2007-11-07 20:21
    I was thinking of a more general "what's a microcontroller" type of reference (link to the PDF) General info.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • D FaustD Faust Posts: 608
    edited 2007-11-07 20:27
    OK

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
  • vla7vla7 Posts: 79
    edited 2007-11-07 22:33
    Thanks everyone,
    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.
  • skylightskylight Posts: 1,915
    edited 2007-11-07 22:54
    If it's for a car then it's going to have to be a hefty controller maybe even a carbon pile device (very smooth acceleration from stationary)·which could be compressed by a small servo controlled by a stamp? consider the weight of the car, passenger/s and the lead acid batteries. what size motor are you thinking of driving?

    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
  • vla7vla7 Posts: 79
    edited 2007-11-07 23:48
    Wait, I don't mean a real car, just a toy car that I want to put together with a small dc motor. I'm thinking 2 motors, that way I can make the car turn buy spinning one wheel faster than the other. If anyone knows of any example tutorials that don't use servo motors or stepper motors please let me know.
  • zemkaczzemkacz Posts: 19
    edited 2007-11-08 00:27
    dude, i know what u mean, u gonna need an h-bridge or a motor controller, i wanted to do the same thing u want to do but the hw board dosent give enought power to give a dc motor enought power to go forwaord under a really tiny load, get an h-bridge or make one, plus when i used servo's the 9v battery ran out in under 30 min of operation. I wish you luck
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-08 01:46
    vla7,
    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.
  • J.T.J.T. Posts: 31
    edited 2007-11-09 21:02
    Hi, I'm new to working with motors also and have a related question on the H-bridge...

    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?



    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-09 21:15
    J.T.,
    Please read my previous post (#2). If you don't understand what I said, let me know what part doesn't make sense.
  • J.T.J.T. Posts: 31
    edited 2007-11-09 23:23
    Mike,

    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.

    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-10 00:09
    We're talking about digital switching here which is all on/off. It's possible to provide variable voltage to a motor, but power is wasted in whatever power transistor you're using to do this. Something has to use up the extra energy from the power source. By switching the power on and off quickly, the average power is what the motor sees, yet the efficiency remains high because the power is either on or off and relatively little is wasted in the control circuit.

    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.
Sign In or Register to comment.