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

HB-25 Simulated BRAKE

Bill ChennaultBill Chennault Posts: 1,198
edited 2008-02-22 07:28 in BASIC Stamp
All--

(There are two boldfaced questions at the very bottom with which I need help.)

You might know that I have been torturing the HB-25, people on the forum, and the folks at Parallax trying to make the HB-25 motor controller do something it was probably not designed to do. My best effort, which I had up and running last night, MIGHT be good enough for my application.

But, as I looked at alternatives today and added up the costs, it quickly became apparent that a motor joint that would do the simple things I want it to do might cost a thousand dollars! (It still might . . . the code I show below has only worked in my lab, but it worked very well.)

Think about the HB-25 connected to a BS-2. Full forward is 1000. Neutral is 750. Full reverse is 500. Anything between these extremes and neutral will cause the HB-25 to output a duty cycle proportionate (I think) to that number's absolute distance from neutral (750 for the BS2). If you have played with the HB-25 you well know that there is a range which lies on either side of neutral--no matter which processor you use--that causes the HB-25 to output a PWM duty cycle I will hereby christen the "Dead Zone."

The Dead Zone is useful. Pick the right number and you will force your geartrain to BRAKE. (Actually, a hard reverse that goes no where depending on·the selection of the correct Dead Zone number.) If you have ramped down or if your speed is low enough, a forced stop is not harmful. (Common sense applies: If you have a large amount of inertia, a BRAKE command can be harmful to your geartrain.)

My application is a knee or elbow joint. The speed is very slow. I only move the foreleg or forearm through 15* to 165*. Inertia is minimal, however I still must contend with it. The code below implements a BRAKE command in my lab using my BS2 and one of my HB-25s . . .

'
[noparse][[/noparse] Compiler Directives ]
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] Program Name ]
' Simulated BRAKE.bs2
'
[noparse][[/noparse] Program Description ]
' This program demonstrates a simulated "BRAKE" command added to the HB-25. It
' functions by causing the HB-25 to very briefly reverse the motor at a speed which
' is below that which would cause the motor to move.
'
[noparse][[/noparse] I/O Definitions ]
HB25··········· PIN···· 15
'
[noparse][[/noparse] Constants ]

'
[noparse][[/noparse] Variables ]

'
[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
'
[noparse][[/noparse] Program Code ]
DO
· PULSOUT HB25, 900···················· ' Forward at 900
· PAUSE 5······························ ' Let the HB-25 settle a bit
· PAUSE 1000··························· ' Wait a second
· ' Simulated BRAKE . . .
· PULSOUT HB25, 735···················· ' Reverse . . . just barely!
· PAUSE 1······························ ' And very briefly!
· PULSOUT HB25, 750···················· ' Neutral
· PAUSE 1000··························· ' Wait a second
LOOP

This code seems to work ALMOST perfect. Now and then, it will ignore the simulated BRAKE and freewheel to a stop. Can you tell me why? Does it have something to do with the length of the delay after a PULSOUT command?

Thanks!

--Bill

EDIT: I changed the maxium degrees I move the leg from 75* to a more correct 165*.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.

Post Edited (Bill Chennault) : 2/20/2008 1:05:56 AM GMT

Comments

  • LarryLarry Posts: 212
    edited 2008-02-20 00:31
    Bill Chenault said...


    This code seems to work ALMOST perfect. Now and then, it will ignore the simulated BRAKE and freewheel to a stop. Can you tell me why? Does it have something to do with the length of the delay after a PULSOUT command?

    Don't forget that if the delay is shorter than 5.25 mS, the controller may think the subsequent pulse is for the second HB-25 daisy chained with the first. How have you set the jumper?

    In single mode, the hold-off time is 5.25 mS.

    In mode 2 the holdoff is 1 mS, then the second pulse, then 5.25 Ms.

    You send 2 pulses with only a PAUSE 1 in there--- not strictly OK

    Post Edited (Larry) : 2/20/2008 12:39:44 AM GMT
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2008-02-20 01:02
    Larry--

    Got'cha. Each of my HB-25s is controlled by a dedicated Stamp. The jumpers are set correctly for a single HB-25. But, it looks like I need to change the PAUSE from 1 to PAUSE 5. (?)

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • LarryLarry Posts: 212
    edited 2008-02-20 01:30
    yeah, the statement takes a little time to interpret, so you might even be able to shorten the pause up a little shorter than 5.

    The only way to really tell is with a 'scope - or maybe another Stamp reading the output. use Pulsin.

    Post Edited (Larry) : 2/20/2008 1:38:36 AM GMT
  • kelvin jameskelvin james Posts: 531
    edited 2008-02-22 07:28
    Bill

    The problem you are having with the hb25 missing a control pulse may be the " floating pin " issue. I am not 100% about this, but a lot of things seem to point this way. Yes, the pulse command delay is important, but it was doing the same thing when you were using a 20 ms delay in a previous program. The manual states that if the hb25 gets an invalid pulse, then it will shut the controller off, this is probably why you are seeing the motor freewheel to a stop. I had a problem a while back using pulsout to drive the step input on a stepper controller, it turned out that i had to make sure that the output pin was in the proper state ( high or low ), before i could reliably send out another pulsout sequence. The pulsout command changes the pin to an output, but does not dictate a high or a low. It just inverts the signal from its present state. The hb25 needs the output set to a low by the documentation. It could be some noise coming from the hb25 on to the control line, and possibly a resistor to ground from the line might work. Hopefully, someone with some more electronics knowledge than i have, might step in and elaborate on this. I could be way off here, but it has me wondering.
Sign In or Register to comment.