HB25 speed
Hello,
I am trying to get my two drive motors ( the parallax aluminum cased ones) to operate at a very slow speed. Seems they are too fast and very dangerous to use while indoors.
I need them to operate at a "snails pace". I am use the motors with the HB25, and the controller is a BS2. I cant seem to find the right code using the pulsout command as in the
HB25 demo code to get it to always operate slow whether moving forward o backwards. Any help here would be great, thank you!
I am trying to get my two drive motors ( the parallax aluminum cased ones) to operate at a very slow speed. Seems they are too fast and very dangerous to use while indoors.
I need them to operate at a "snails pace". I am use the motors with the HB25, and the controller is a BS2. I cant seem to find the right code using the pulsout command as in the
HB25 demo code to get it to always operate slow whether moving forward o backwards. Any help here would be great, thank you!
Comments
Can you post the code you are trying to use? it will help to see what is happening to your HB25.
-Tommy
I edited your title since I assume you wanted to say "Speed", not "Spped".
'
[ Variables ]
'index VAR Word ' Counter For Ramping
'
[ Initialization ]
DO : LOOP UNTIL HB25 = 1 ' Wait For HB-25 Power Up
LOW HB25
LOW HB25A ' 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 HB25A, 750 ' Stop Motor 2 (If Connected)
' The Above 2 Lines May Be Removed
' If You Are Using Single Mode
'
[ Program Code ]
'Reverse motiom
PULSOUT HB25, 650
PAUSE 1
PULSOUT HB25A, 650
PAUSE 2000
'Stop motion
PULSOUT HB25, 750
PAUSE 1
PULSOUT HB25A, 750
PAUSE 2000
'Forward motion
PULSOUT HB25, 850
PAUSE 1
PULSOUT HB25A, 850
PAUSE 1000
'STOP
I plan on using a remote control to make the robot go forward, backwards, turns.....
But bear in mind that at too slow of a PWM to the motors they just may not function. You will find that at certain very slow speeds there's not enough power to move the robot's weight.
I did some testing and found the best values t use are like 850 for a slow forward, 650 for a slow reverse and of curse 750 to stop. But when I run the forward and reverse, it only runs for a short time
then stop. I'd need them to keep running until I tell them to stop . The idea is.. push a button to move forward or reverse (slowly) , and immediately stop when I release button.
We so seldom get stray BS2 questions in the Robot Forum,..Please, have some cookies...:)
-Tommy
The HB25 should run indefinitely with a single pulse command. The exceptions are - if it receives an invalid pulse or if the timeout mode has been enabled. If it is stopping after four seconds then you have likely enabled the timeout mode.
The code you posted runs the motors in each direction for a few seconds. It's a demonstration.
Post the code you're using that shows your problem.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
HB25 PIN 7 ' I/O Pin For HB-25
HB25A PIN 6
'
[ Initialization ]
DO : LOOP UNTIL HB25 = 1 ' Wait For HB-25 Power Up
LOW HB25 ' Make I/O Pin Output/Low
LOW HB25A ' 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 HB25A, 750 ' Stop Motor 2
PAUSE 1
'---RF Dongle Inputs--
RFKEYS: '4-channel RF TX/RX module
IF IN12=1 THEN FWD:
IF IN11=1 THEN RV:
IF IN10=1 THEN LFT:
IF IN9=1 THEN RT:
GOTO RFKEYS
'---Operation
FWD: 'Foward motion
PULSOUT HB25,850
PAUSE 1
PULSOUT HB25A,850
PAUSE 1
GOTO RFKEYS
RV: 'Reverse motion
PULSOUT HB25,650
PAUSE 1
PULSOUT HB25A,650
PAUSE 1
GOTO RFKEYS
LFT: 'Left turn
PULSOUT HB25,650
PAUSE 1
PULSOUT HB25A,850
PAUSE 1
GOTO RFKEYS
RT: 'Right turn
PULSOUT HB25,850
PAUSE 1
PULSOUT HB25A,650
PAUSE 1
GOTO RFKEYS
Also note the pause of 1.1 ms between sequential pulses.
But wait! there's more!, You might have to fiddle with your pause times, and see if that helps.
I got that information from here: http://www.parallax.com/downloads/hb-25-motor-controller-product-documentation
-Tommy
The stopping after a couple of seconds thing really sounds like "Communication Timeout Mode" setting being not where you want it.
This was mentioned in post #8, but it was pretty easy to miss.
The link in Post #18 will get you the manual for the HB25. Please consider re-reading the Communication Timeout Mode portion of the document.
It's near the end of the document.
I had similar troubles with my HB-25's, but once I understood the Communication Timeout thing, I was able to have great success in controlling my
motors.
Just a couple of thoughts.
Gary
Apart from any other issues -- a bad HB25, etc. -- your program isn't helping much. If you just want to test the motor, just send ONE of them a single command, say
PULSOUT HB25,850
PAUSE 1
and that's it. Don't try to read your RF input, don't try to handle multiple motors, and so on.
The secret to troubleshooting is to simplify to the bare minimum. Who knows where the problem is with the motors. You're testing both motors at a time, and you trying to integrate a control interface that may also be an issue. To test a motor all you need is to set up an HB25, give it a pulse and a pause, and if the Mode jumper is set correctly, it should continue with that speed and direction until you tell it otherwise, or remove power.
You don't mention how you're powering the motor(s). Trying to run largish motors off the same power supply as the one powering the BS2 is a good way to lose hair. Your motors could be drawing excessive current, and if the power supply can't handle it, and the BS2 is connected to the same one, the poor board will constantly get reset. You can check for this by connecting up an LED or little piezo speaker, and upon initial start of your program you run a little "tada!" routine -- blink the LED or sound a short tone. If that routine keeps re-running, you know the BS2 is going into brownout, and is resetting itself over and over.
Thanks for all the input. Yes I am aware of the communication timeout feature already. I have unable to correct the issue with the one HB25, which I have also
tested it by itself with a simple command as indicated above. This in turn proved to me that the other HB25 that I have is now working just fine. So now I have one
fully working one and one no so. For power to these I have used either a 12V 7A battery as well as a hefty bench power supply. I still suspect that one faulty one is
really bad because at one point during a test, I had the motors switching directions rather violently. No smoke, but I'm sure one of them got damaged somehow. At least I now have one good one to work with.
Eventually, the next phase is to get the RF input connected again,and finally to add the sonar sensor for the forward motion safety sensor.
Please send (to my attention) the one that isn't working, and email me your shipping address. My email is mattg@parallax.com.
-MattG
Here is what Ive got working mostly... any other ideas will be great. You will note each HB25 is on a separate pin. This does seem to work fine.
' {$STAMP BS2}
' {$PBASIC 2.5}
'
HB25 PIN 7 ' I/O Pin For HB-25
HB25A PIN 6
'
[ Initialization ]
DO : LOOP UNTIL HB25 = 1 ' Wait For HB-25 Power Up
LOW HB25 ' Make I/O Pin Output/Low
LOW HB25A ' 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 HB25A, 750 ' Stop Motor 2
PAUSE 1
'---RF Dongle Inputs--
RFKEYS: '4-channel RF TX/RX module
IF IN12=1 THEN FWD:
IF IN11=1 THEN RV:
IF IN10=1 THEN LFT:
IF IN9=1 THEN RT:
GOTO RFKEYS
'---Operation
FWD: 'Foward motion
PULSOUT HB25,850
PAUSE 1
PULSOUT HB25A,850
PAUSE 1
GOTO RFKEYS
RV: 'Reverse motion
PULSOUT HB25,650
PAUSE 1
PULSOUT HB25A,650
PAUSE 1
GOTO RFKEYS
LFT: 'Left turn
PULSOUT HB25,650
PAUSE 1
PULSOUT HB25A,850
PAUSE 1
GOTO RFKEYS
RT: 'Right turn
PULSOUT HB25,850
PAUSE 1
PULSOUT HB25A,650
PAUSE 1
GOTO RFKEYS