Shop OBEX P1 Docs P2 Docs Learn Events
Controlling DC motors with basic stamp — Parallax Forums

Controlling DC motors with basic stamp

NubyNuby Posts: 18
edited 2013-04-03 09:41 in BASIC Stamp
·I must be·totally nuts treying to use a basic stamp to run a DC motor. Please let me know where·I can get information to do that.

Thanks
Nuby·

Comments

  • PrettybirdPrettybird Posts: 269
    edited 2009-08-22 10:21
    They also have H bridge chips that will work if you have some electronics experience and can build your own. LM 298 is a good one for small motors. I haven't got around to testing it yet.
  • mechanomechano Posts: 8
    edited 2009-08-23 13:31
    dear friend

    try to use (AD5220 10K Digital Potentiometer) & NPN transsister with high current support like 20Amp or more

    the connection is very easy i did it already and i'm controlling small car speed through this

    one important note that the volt range will be 0 - 5 volts because of the basic stamp output is 5 volts only

    if you are using a DC motor required more to work better to go for the ( HB-25 Motor Controller )



    if you have any problem for this let me know please

    may be i can help you


    regards
  • dev/nulldev/null Posts: 381
    edited 2009-08-23 15:00
    I would recommend not to use a potentiometer to control a DC motor. It is possible, but you waste a lot of energy doing it that way. And if the motor stalls, you could end up burning your circuit. The best way to control a DC motor, is to use PWM (Pulse Width Modulation) and an H-Bridge. There are numerous examples on this on the Internet.

    The H-Bridge is responsible for sourcing/sinking current to the motor. You can use a chip (like L293) that have an H-Bridge built into it, or you can build your own with four power transistors or MOSFETs, depending on how much current you need. You can control the MOSFETs with opto-transistors or general transistors coming from the Stamp (also depending on how much current you need). With lots of current and voltage to the motor, use opto-transistors.

    The motor is controlled by the duty cycle of the PWM signal. When the duty cycle is 0%, the motor is OFF, when it's 100% the motor is fully ON. The frequency is not critical, but should not be too high as the MOSFETs and transistors need time to switch (anywhere from 50-10000 Hz is OK).

    You can generate the PWM signal with a 555 circuit, your Stamp, or some other PWM cabable circuit. There are many circuits available where you control the duty cycle by adjusting a (digital) potentiomer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • dev/nulldev/null Posts: 381
    edited 2009-08-23 15:13
    Have a look here:
    1) discovercircuits.com/H/hbridge.htm
    2) www.mcmanis.com/chuck/robotics/tutorial/h-bridge/index.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • dev/nulldev/null Posts: 381
    edited 2009-08-24 00:38
    For your convenience, here is a nice little DC motor circuit, using TIP darlingtons. You should understand the circuit before you use it. If you send the wrong HIGH and LOW to the wrong pins, there will be a short circuit and the transistors will blow. You can exchange 2N4400 with 2N3904 or similar. The TIP's also come in a variety of versions. If you're the nervous type, or use transistors (you can exchange the TIP's with a BC547 for example) put rectifiers (1N4001) across the power transistors with the band facing upwards. This circuit will run 2A without heat sinks, and about 5A with. You adjust the duty cycle and frequency by varying PULSOUT and PAUSE.

    dc3.jpg

    If you need lots of current, here is a similar circuit with MOSFETs which uses a potentiometer to control the PWM signal. This circuit can provide up to 50A to a motor.
    dc1.jpg

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • mechanomechano Posts: 8
    edited 2009-08-26 13:34
    dear dev/null

    you are right, these circuits are the best to control a DC motor

    but i used a simple potentiometer with two transistors because it was difficult to get the electrical components in my area

    and it gave me good result too

    at any how i prefer your method because it is more safe on the BASIC STAMP and with low power waste
  • dev/nulldev/null Posts: 381
    edited 2009-08-26 15:47
    I'll post a nice little circuit for two small DC motors soon, which can be controlled by a Stamp, a 74HC595 and four BC547 transistors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • CuriousOneCuriousOne Posts: 931
    edited 2013-04-03 06:42
    If I properly understood, TIP127 based circuit is also PWM compatible, so with PWMOUT it will be possible to adjust the speed of motor also?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-03 07:12
    Not really. The PWM statement is intended for producing an analog voltage using an RC filter (see the manual for details). It doesn't really produce variable width pulses. What it does is produce a series of very brief pulses of fixed width that average out to the "on" time expected. This works for charging up a capacitor, but the pulses are really too short for driving an H-bridge like the one shown. A lot of power is wasted (dissipated as heat) in the power transistors and the motor windings. PULSOUT and PAUSE can be used to vary the motor speed as shown in Post #7.
  • CuriousOneCuriousOne Posts: 931
    edited 2013-04-03 09:41
    Hm, I'm learning picbasic pro at same time, and there PWM command is fully functional. Anyways, thanks for help :)
Sign In or Register to comment.