November 22, 2024, 04:56:09 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Using the Parallax HB-25 Motor Controller

Started by JonnyMac, March 07, 2007, 12:47:59 PM

Previous topic - Next topic

JonnyMac

The HB25 Motor Controller from Parallax is a great device for controlling big DC motors, like those surplus windshield wiper motors that are so popular with prop builders.  The connection is simple: use a 3-pin extender cable from your prop controller to the HB-25 and treat it like a servo -- the only difference is that you don't have to refresh it all the time (it's a set and forget device).

Since the HB-25 is a smart device it takes a little time to do its own initialization.  When using the HB-25 you should wait for it to be ready before sending any speed commands.  Do this at the beginning of your program when the I/O pins are still defined as inputs.  In order to read from a pin's input register, and write to its output (using LOW and PULSOUT) we actually need two definitions with the Prop-1:

SYMBOL  HB25Chk         = PIN7                  ' P7 in - no SETUP jumper
SYMBOL  HB25            = 7                     ' P7 control


Now you can watch the P7 input, waiting for it to go high (this signals that the HB-25 is ready):

Check_Motor:
  IF HB25Chk = 0 THEN Check_Motor               ' allow HB25 to initialize
  LOW HB25                                      ' set for PULSOUT
  GOSUB Stop_Motor


To make updates easy, you can encapsulate stop and movement commands into a couple subroutines:

Stop_Motor:
  PAUSE 6                                       ' command hold-off
  PULSOUT HB25, 150                             ' center = stop
  PAUSE 6                                       ' command hold-off (do not remove)
  PULSOUT HB25, 150                             ' insurance command
  RETURN

Set_Motor_Speed:
  PAUSE 6                                       ' command hold-off
  PULSOUT HB25, speed                           ' set speed/direction
  RETURN


The PAUSE 6 in the beginning of each subroutine prevents sending multiple commands to the HB-25 without the proper hold-off delay.
Jon McPhalen
EFX-TEK Hollywood Office

randyaz

March 31, 2007, 06:03:12 PM #1 Last Edit: March 31, 2007, 06:16:40 PM by randyaz
set and forget? Dont forget there is a 4 second "safety" timeout. I couldn't figure out why the motor kept quiting and finally went to the documentation... and I quote:

"The HB-25 has a selectable Timeout mode. When this mode is enabled, the HB-25 will shut off the motor
after 4 seconds if it does not receive pulses from the microcontroller...

...To toggle the state of the Timeout mode:
1. Disconnect the servo input cable from the HB-25. If there is a daisy-chained cable to a
second unit remove it as well. It makes no difference whether the Mode Jumper (J) is
installed.
2. Apply power to the HB-25.
3. With the power on change the state of the Mode Jumper by installing the jumper if it is
removed or removing it if it is installed.
4. Remove and re-apply power.
The timeout state should now be toggled. To change it back, repeat the above steps."


Sounds like a no brainer to toggle... but I can't get the @#$% thing to toggle...


JonnyMac

Well... it's supposed to be set-and-forget.  The timeout is probably not a bad idea, and four seconds in an eternity compared to the 20 ms refresh timing of a standard servo.
Jon McPhalen
EFX-TEK Hollywood Office

randyaz

April 01, 2007, 12:55:31 AM #3 Last Edit: April 01, 2007, 12:57:26 AM by randyaz
lol...thats true...

Im using a QTI to count wiper motor shaft rotations for taking up and letting out cord on a reel for a floating lantern. Trying to watch the debug counter and the motor and the how high a lantern is raised and lowered makes 4 seconds very short.... i got a crick in my neck ;D


ChrisBartram

For the more dense among us (like me :-) ) -- can you elaborate on exactly what kind of "control" the HB25 gives you with a motor?

i.e. can it control direction? variable speed (how accurately?)?

I gather from other posts it doesn't give you "servo like" control, at least not without adding your own position sensing apparatus.

Are there specific kinds of motors it supports (and doesn't)?

I've seen the specs page several times, but it sure would be nice if they expanded a little on what "control" means - in layman's terms... :-)

Thanks!

JonnyMac

The HB25 gives speed and direction control for DC motors.  It doesn't turn big motors into giant servos because that would required a feedback potentiometer on the shaft and circuitry to monitor it.  The reason that it accepts a servo-style pulse is that it allows you to connect the HB25 directly to the output of an RC receiver; this is one of the intended uses (e.g., combat robots).

The HB25 is a Parallax product, so you'll want to consult them on additional specifics.
Jon McPhalen
EFX-TEK Hollywood Office