Shop OBEX P1 Docs P2 Docs Learn Events
DC Motor Pulsing Problem — Parallax Forums

DC Motor Pulsing Problem

David HandyDavid Handy Posts: 11
edited 2013-02-19 15:58 in BASIC Stamp
I am trying to use the BASIC Stamp along with a motor controller to run a DC motor. First, I tried a SyRen 25 in Simplified Serial mode. However, that yielded poor results. The motor turned in small pulses, rather than moving continuously. Next, I tried the R/C Input mode, using the PULSOUT command. The same problem occurred with that method.

So, I decided to purchase the HB-25 because it was made by Parallax so I figured it would yield improved results. Now, the motor will not even turn. I have the motor controller connected to pin 12 (where the servos normally connect) as I am using the PULSOUT command. I have also tried pin 13.

As suggested in other threads, I have turned on the the Stamp prior to giving power to the HB-25.

My program is as follows:

' {$STAMP BS2}
' {$PBASIC 2.0}

DO
PAUSE 20
PULSOUT 12, 200
LOOP

Thanks in advance for any assistance you can provide.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-02-16 11:23
    What are you using as a power supply? Does the BS2 and the motor share the same supply? If not do they share a common ground connection?

    Can you give more information about the motor?
  • David HandyDavid Handy Posts: 11
    edited 2013-02-16 11:35
    The HB-25 is powered by a 6V battery, while I'm using a 9V battery to run the BS2. Therefore, they do not share a ground, although the "servo ground" (B) is connected from the BS2 to the HB-25.

    I am currently trying to power a bilge pump motor, but I have also tried some small DC motors from RadioShack. With each of them I encounter the same problem.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-02-16 12:22
    Could your 6V battery be the problem? What is its capacity? Do you know if it has a good charge?

    I see from the HB-25 page, 6V is at the controller's lower voltage limit. If the battery has a low charge the voltage may have dropped below 6V. Also just because a battery shows one voltage with a DMM doesn't mean it has the same voltage when it's under load.

    Sorry if I'm suggesting stuff you've already tried. I do not know what your experience level is.
  • David HandyDavid Handy Posts: 11
    edited 2013-02-16 12:33
    That's a good suggestion. I would try it right now, but the project is at school and I won't be there until Tuesday. When I was using the SyRen, I had checked the voltage and it was around 6V. However, that controller accepted lower voltages, so this might be the problem (although it would not explain the pulsing problems I experienced with the SyRen).
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-02-16 13:07
    David,

    Again, I don't know how much experience you have so I'll just say this anyway.

    We see a lot of servo/motor problems here on the forum where the servo or motor just seems to pulse or jitter. Very frequently the problem ends up being the power supply. When the motor (or servo) first starts to move it draws a lot of current. If the power supply can't keep up with this current, the voltage will drop causing problems like resetting the microcontroller (either the BS2 or the uC used by the motor controller PCB).

    So not only would it be helpful to know what the voltage of the battery is but also how much current it can supply. Many "wall wart" type supplies also have trouble providing enough current for motor and servos.

    It's not guaranteed that his is a power supply problem but I think the odds are pretty high that it is.
  • David HandyDavid Handy Posts: 11
    edited 2013-02-16 13:55
    I'll see what happens if I connect two of those 6V batteries in series. However, I will say that when hooked directly to the battery alone, the motor runs at full power. Does the motor controller sap that much energy?
  • garyggaryg Posts: 420
    edited 2013-02-16 16:19
    It would seem that you are using BS1 code to drive your motor.
    If you check the timing of the PULSOUT on page 347 of the Basic Stamp syntax and Reference Manual
    PULSOUT timing is 2us instead of 10us
    A PULSOUT count of 200 with the BS2 should give a pulse of approx 400 Microseconds.
    You may see a different result if you change the PULSOUT 12, 200 to something like PULSOUT 12, 900
    That should give you a 1.8ms pulse, which I believe should drive the motor.

    I hope this helps you.
  • David HandyDavid Handy Posts: 11
    edited 2013-02-16 17:24
    I noticed that the example in the documentation for the HB-25 was written in BS1 code, but I was unaware of the change regarding the PULSOUT command. I'll try changing the value on Tuesday, and will let you know how it turns out.

    Thanks!
  • garyggaryg Posts: 420
    edited 2013-02-16 20:33
    It will definitely pay for you to look at the timings of the different Basic Stamp controllers.
    It appears to me that each model of the Basic Stamp controllers were faster than the one before.
    It's important in that you can select a controller that will have the speed and features you need without breaking the bank.

    Of course your difficulty could also be power supply or circuit related also as others have mentioned.
    Voltage drops, poor batteries and Miswired circuits have kept me scratching my head in the past and it's always one of these things I check
    out when things seem to be getting whacky.
  • David HandyDavid Handy Posts: 11
    edited 2013-02-19 15:58
    I have finally achieved full speed as well as variable speed control of the motor. The problem was the PULSOUT command (as suspected). 750 stops the motor, while 650 is full power in one direction and 850 is full power in the other. Thanks for all the help.
Sign In or Register to comment.