Shop OBEX P1 Docs P2 Docs Learn Events
HB-25 — Parallax Forums

HB-25

ericbong84ericbong84 Posts: 9
edited 2008-09-10 19:24 in BASIC Stamp
Hi, everyone

I'm eric from malaysia. I have just bought 2 HB-25 motor drivers but i have encountered some problem with it. I might need some help·from the members·help on this.

·I have tested out both·of them using my BS2p40. As for the code, i just copy paste it from the HB-25 Motor Controller (#29144) pdf for the test run. The result is that HB-25 (no.1) can only response to forward rotation. It doesn't response to the rest of the code. Not only that, HB-25 (no.2) is not responding at all to the DC motor.

Both of the cooling fan of HB-25 are working fine and so is the green power LED.

Can anyone help me on this? Thank you.

Regards
Eric

Comments

  • Dave-WDave-W Posts: 94
    edited 2008-09-07 03:08
    Eric,
    You MUST include your code and how they are connected to the BS2 for us to help. Give it some more facts and I am sure someone here can help.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave W.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-09-07 04:13
    Hi Eric, bear in mind that the units for the Pulsout instruction are different for a BS2p (0.8 microseconds) and a BS2 (2 microseconds) and that the signal to the HB25 should fall between 0.8 mS and 2.2 mS

    Here is a portion of how it should look for a BS2p

    PULSOUT HB25, 1875 ' Stop Motor 1

    FOR index = 0 TO 875 ' Ramp Up To Full Speed
    PULSOUT HB25,· 1875 + index ' Motor 1 Forward

    Jeff T.
  • ericbong84ericbong84 Posts: 9
    edited 2008-09-07 09:55
    Hi, Dave. There's the code from the pdf i mentioned earlier.

    ' =========================================================================
    ' File...... HB-25 Motor Test.bs2
    ' Purpose... Tests One Or Two HB-25's Connected To P15
    ' Author.... Parallax, Inc.
    ' E-mail.... support@parallax.com
    ' Updated... 01-18-2006
    '
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    [noparse][[/noparse] Program Description ]
    ' This program tests the HB-25 by waiting for it to power up, then pulsing
    ' the output to ramp the motors up in opposite directions, wait 3 seconds
    ' then ramp them back down to a stopped position. While the code is
    ' written for two HB-25/motors you can use it with just one by commenting
    ' out or removing the lines for the second motor, commented below. If you
    ' have two HB-25/motors connected, remember to remove the jumper block from
    ' the second HB-25.
    '
    [noparse][[/noparse] I/O Definitions ]
    HB25 PIN 15 ' I/O Pin For HB-25
    '
    [noparse][[/noparse] Variables ]
    index VAR Word ' Counter For Ramping
    '
    [noparse][[/noparse] Initialization ]
    DO : LOOP UNTIL HB25 = 1··· ' Wait For HB-25 Power Up
    LOW HB25··· ' Make I/O Pin Output/Low
    PAUSE 5··· ' Wait For HB-25 To Initialize
    PULSOUT HB25, 750 ' Stop Motor 1
    PAUSE 1··· ' 1 mS Delay
    PULSOUT HB25, 750

    '
    [noparse][[/noparse] Program Code ]
    Main:
    PAUSE 20··· ' Wait 20 mS Before Ramping
    FOR index = 0 TO 250··· ' Ramp Up To Full Speed
    PULSOUT HB25, 750 + index··· ' Motor 1 Forward
    PAUSE 1··· ' 1 mS Delay For Motor 2 Pulse
    PULSOUT HB25, 750 - index··· ' Motor 2 Reverse
    PAUSE 20··· ' 20 mS Smoothing Delay
    NEXT
    PAUSE 3000··· ' Wait 3 Seconds
    FOR index = 250 TO 0··· ' Ramp Back Down
    PULSOUT HB25, 750 + index··· ' Motor 1 Forward Slowing
    PAUSE 1··· ' 1 mS Delay For Motor 2
    PULSOUT HB25, 750 - index··· ' Motor 2 Reverse Slowing
    PAUSE 20··· ' 20 mS Smoothing Delay
    NEXT
    STOP··· ' Use STOP To Prevent State Change
  • ericbong84ericbong84 Posts: 9
    edited 2008-09-07 10:10
    Hi, Jeff.T

    Thank you for your help on this.·It really helped me a lot.·It seems that BS2p has different resolution compared to the BS2. I have found some posting regarding this from this forum http://forums.parallax.com/forums/pr.aspx?f=10&m=130692

    So, the·stop position should be PULSOUT HB25, 1875 rahter than 750. How about for the rotation of clockwise (500) and counterclockwise (1000)?

    Just my assumption:

    1000/0.8 = 1250 (clockwise)

    2000/08 = 2500··(counterclockwise)

    Thank you

    Regards
    Eric
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-09-07 10:31
    Eric -

    Take a look at the PULSOUT command in the PBASIC Reference Manual, or the PBASIC Help File. In either place you will learn that the "time" argument supplied is in timer units (TU). The reason for this is that various models of the Stamp operate at different speeds. The value of the TU's for each of the Stamps is listed with the PULSOUT command. Mathematically, you can change from one model Stamp to the other thusly:

    Old time parameter·············· X (new time parameter)
    =
    Old timer unit value··············· New timer unit value

    I hope that unveils the mystery smile.gif

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON

    Post Edited (Bruce Bates) : 9/7/2008 10:41:36 AM GMT
  • ericbong84ericbong84 Posts: 9
    edited 2008-09-07 11:32
    Hi, Bruce.

    Thank you for the assistance. I have read the manual regarding the pulsout. A bit uncertain·for now·but i know what you mean. I will give it a try and see how it goes.

    Regards
    Eric
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-09-07 14:49
    ericbong84 said...
    Just my assumption:

    1000/0.8 = 1250 (clockwise)

    2000/08 = 2500··(counterclockwise)
    Hi eric, that is correct. The pulse to the HB25 should be 0.8 mS for full speed reverse and 2.2 mS for full speed forward the mid point is the motor stop point which is 1.5 mS. The units of time for the pulsout instruction are 0.8 microseconds so your pulsout instruction should be a value containing multiples of that value.

    Full speed forward = 2.2 mS / Units of time = 0.0022 / 0.0000008 = 2750
    Full speed reverse = 0.8 mS / Units of time = 0.0008 / 0.0000008 = 1000
    Motor stop = 1.5 mS / Units of time = 0.0015 / 0.0000008 = 1875

    There are 875 units of time either side of the midway point.

    Jeff T.
  • ericbong84ericbong84 Posts: 9
    edited 2008-09-07 15:00
    Hi, eveyone

    I have tested out the code and everything seems working good now. Thanks to all of you helping me out on this. I apprieciate it. My sincere gratitude to you all.

    Here's my main program

    Main:
    PAUSE 20
    FOR index = 0 TO 625
    PULSOUT HB25, 1875 + index
    PAUSE 20
    NEXT
    PAUSE 5000
    FOR index = 0 TO 500
    PULSOUT HB25, 1875 - index
    PAUSE 20
    NEXT
    STOP

    Unfortunately, when i tested out the other HB-25 (no.2) there's a minor problem occuring. It was working normal but it doesn't stop rotating. It continue on and on. It is as if it doesn't execute the STOP command.

    Regards
    Eric
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-07 15:29
    The HB-25 is not exactly the same as a servo in that it doesn't need a continuous stream of control pulses to maintain motor speed.
    Once it gets a pulse, it doesn't need another one until the speed changes. There is a timeout mode in the HB-25 that can be enabled
    (see the HB-25 documentation, page 5, for how to enable/disable it). It may have been enabled in one of your HB-25s and disabled
    in the other one.

    You can also put a PULSOUT statement just before the STOP that puts out a stop pulse (PULSOUT HB25,1875).
  • ericbong84ericbong84 Posts: 9
    edited 2008-09-08 12:58
    Hi, Mike.

    Thank you for pointing out timeout mode. I have enable it and that HB-25 is once again working nice.·The PULSOUT HB25, 1875 also works well too.

    I apprieciate all the help i'm getting from this forum. Thank you very much, guys smilewinkgrin.gif

    This is just the beginning of my project. Might have to ask for·more pointers·from you guys in near future.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-09-09 17:19
    Hi Eric, glad to see you got your question addressed.

    Take care,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • denodeno Posts: 242
    edited 2008-09-09 17:47
    In reading the above post about full speed for the HB25...I thought that full speed pulse was/is 2.0 mSeconds.· In fact, is the full speed pulse for forward/reverse 2.2 mSeconds?

    Also, the protection circuits in the HB25 are for over temperature, over voltage, and over current.· If you exceeded the "over current", won't the fuse blow?

    Thanks deno·
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-09-09 18:51
    Hi deno, this is from the PDF for the HB25
    Pulse time can be anywhere from 0.8 ms to 2.2 ms. If the HB-25 receives a pulse outside of
    this range, it will temporarily shut off the motor until it receives a valid pulse.
    I don't know what the actual difference in speed would be , if any , between the 0.2mS of the extremities.
    With regard to overcurrent protection I see the fuse as motor protection which can be sized at a smaller value than the HB25 rating, and I see the internal overcurrent protection as being for the HB25 itself, which being electronic would act faster than the fuse. These are only assumptions.
    Jeff T.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-09-10 19:24
    Unsoundcode said...(trimmed)
    Pulse time can be anywhere from 0.8 ms to 2.2 ms. If the HB-25 receives a pulse outside of
    I don't know what the actual difference in speed would be , if any , between the 0.2mS of the extremities.

    Jeff,

    ·· Actually there wouldn't be any difference for the HB-25...The deviation is only there to allow for a margin in error of the output signal.· For example, what if your microcontroller sent .8mS instead of 1.0mS?· We don't want the HB-25 to shut down for a small degree of innacuracy.··Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.