Shop OBEX P1 Docs P2 Docs Learn Events
Could use some help with DC motor control — Parallax Forums

Could use some help with DC motor control

HeronbladeHeronblade Posts: 3
edited 2013-04-12 10:54 in BASIC Stamp
My team is considering a class project in which we would use a motor for the sake of automated turret-like rotation. Slow and controllable movement for set periods of time. We would simply use the standard parallax servos we are already familiar with, but they are far too weak for this application. The next step up available to us is a mid size DC motor, this one to be exact, which if anything goes too far the other way in terms of speed and torque. We have stepped it down using gears, and we do have a speed controller on hand. Unfortunately, that is where we are stuck for the moment. We are at present novices at BASIC Stamp programming, and none of us know how to program for a motor like this, the few examples we have found all appear to be set for continuous high speed motion.

Suggestions? examples? resources we've overlooked?

Comments

  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-04-10 22:45
    So you did not get the ESC with the motor??? I would say an HB-25 should work for your project. They are prgrammed and controlled just like a Servo. The price is the same with or without the mount. If you decide to go that route let me know. I wrote a BS2 program that will control one or two HB-25's with a standard Sony compatible remote control.
  • HeronbladeHeronblade Posts: 3
    edited 2013-04-11 05:43
    We do have a speed controller as I mentioned. I'm suddenly wishing I had written down model numbers to be certain, but this one appears to be the same unit.

    In any event, you say that it is controlled just like a servo? Is it the same pulsout 650-850 range?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-11 12:03
    The HB-25 is indeed controlled just like a servo. It has a few other features, but they're transparent (you can ignore them). You can substitute an HB-25 and DC motor for a continuous motion servo and it should "just work". The PULSOUT range is the same. The link that you posted seems to be for a very different speed controller. It may behave the same, but it certainly doesn't look the same. Your unit does look like it's supposed to respond to standard R/C servo control pulses and the usual PULSOUT should work.
  • HeronbladeHeronblade Posts: 3
    edited 2013-04-12 09:53
    Simply treating it as a servo unfortunately did not work. After digging through spec documents and experimenting a bit I eventually solved the issue. That particular ESC is apparently incredibly picky, badly enough that I wonder why my school is bothering with them. I strongly suspect that they were originally designed principally with RC in mind, rather than control via program. Just in case someone else runs across this:

    -pulsout range is 560-960, with 760 as neutral
    -Within a few seconds of initial "boot", (ie being connected to the battery), the ESC needs to receive an initialization signal on the channel you intend to use, or it will dead end and require a "reboot" (disconnect power source for 2-3 seconds, reconnect)
    -After the initialization signal, the ESC requires at least some kind of input every 500 ms, or it will once again dead end and require a "reboot"
    -Accelerating too quickly between pulsout values will, you guessed it, cause it to dead end

    As a result, the test program that eventually worked looked like this (result: brief period of inactivity followed by several seconds of steady rotation):

    MOTOR CON 12
    X VAR Word

    FOR X = 1 TO 100 'init signal
    PULSOUT MOTOR, 760
    PAUSE 20
    NEXT

    FOR X = 760 TO 800 'accellerate
    PULSOUT MOTOR,X
    PAUSE 20
    NEXT

    FOR X = 1 to 250 'rotate at constant V
    PULSOUT MOTOR,800
    PAUSE 20
    NEXT
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-12 10:54
    The PULSOUT range you mentioned is about right. R/C servos generally respond to a pulse 1ms to 2ms in width with some responding to a range as wide as 0.5ms to 2.5ms. For a BS2, the corresponding PULSOUT ranges are 500 to 1000 and 250 to 1250 (at 2us per PULSOUT unit). Neutral is generally around 1.5ms which is a PULSOUT value of 750.

    The HB-25 is much more forgiving than your unit, but that's what you have to work with. Good that you got it working.
Sign In or Register to comment.