hb25 motor in fwd and reverse
Let's Go!
Posts: 124
how does one make the motor go in reverse?. i can only get fwd. any ideas? thanks
' =========================================================================
' 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 ' Stop Motor 2 (If Connected)
' The Above 2 Lines May Be Removed
' If You Are Using Single Mode
'
[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
' =========================================================================
' 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 ' Stop Motor 2 (If Connected)
' The Above 2 Lines May Be Removed
' If You Are Using Single Mode
'
[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
Comments
The test program should turn the motor(s) one way, pause for 3 seconds, and then turn the motor(s) in the other direction. Depending on the pulse you provide the HB-25 will determine how the motor will rotate.
In the future, please use the attachment manager for sample code; as that makes it easier to load into the BASIC Stamp Editor. Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Joshua Donelson
www.parallax.com
make sure its a - after the 750 -
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
What is the power source for your HB25, and what is the current demand of your motors? I have seen what you describe if the HB25 was inadequately powered.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
What do you mean by "inadequately powered"? Are you refering to the power to the motors "posts" or the power to the pins?
I am having problems with inconsistancy whereas the same code produces different results.
I have read the documentation and can't figure out how to troubleshoot this.
Thanks,
Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything is working so why do we pay him?"
"Nothing is working so why do we pay him?"
I had a long wire running from a BS2p40 pin to the HB-25 control pin. It worked fine. Eventually, I changed robot brains (five Stamps for one SX48) and hooked everything back up. The HB-25 did not respond. I remembered reading about bypass capacitors. So, I stuck one between each HB25 control line, I have two·HB-25s·on my machine·(the wire from the SX48 to the HB-25 control pin), and ground.
All problems disappeared.
Now, I am dedicated to using bypass capacitors. Many folks say it is good practice. Here is a nice, short article on their use.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
What I meant was... The HB25 is designed to handle a decent amount of current. Don't feed it something like a 9V battery and expect it to perform, it needs more oomph than that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I thought it could handle 6-16Volts? I am using the Parallax 7.2v power plug and connecting the input side of the HB25 to VIN. Is that not enough.
I did notice that the HB25 worked better at higher speed.
Thanks,
Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything is working so why do we pay him?"
"Nothing is working so why do we pay him?"
"I thought it could handle 6-16Volts?" - It can, I'm talking current here... if your current is not adequate then the HB25 might have a difficult time doing what you tell it to do.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Obviously I don't have a lot of experience with this so could you tell me what the voltage and current should be to make tis work?
I have attached a schematic of my setup.
The voltage applied to the HB25(s) is 6-12V at 2Amps
The motors I am driving are small hobby motors.
Tamiya FA-130
Voltage: 1.5-3V (1.5V Recommended) (4.5 V max)<!--mstheme--><!--msthemelist-->
RPM: 6990-9100 (6990 Max. Efficiency)
Amperage: .66A
Thanks,
Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything is working so why do we pay him?"
"Nothing is working so why do we pay him?"
Nice schematic.
Do you have the HB-25s set up in "Mode 1?" (Page 2.) That is the mode necessary for one HB-25 to control one motor. The jumper "J", must be in place. See the data.pdf, as I'm sure you have a thousand times, by now.
I use a lot of HB-25s. I cannot say I know a lot about them because they are so easy to use. You might disconnect one of the HB-25/motor sets and work with a single set until you get everything ironed out. Cut the test code down so that it just runs a single HB-25. Forget about ramping (for now). Use something like this: PULSOUT HB25, 870 after the HB-25 is "ready."
On the off-chance that one of your HB-25s is bad, try the other one.
I run mine off a 12 volt, lead-acid battery. I have never tried anything else.
When you get the bug(s) out of your setup, you will like these motor controllers.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Thanks, I have the jumper on both and am currently trying to use them seperately. I have tried what you said about disconnecting them and only using one then the other with very simple code but I still can't predict the behavior.
Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything is working so why do we pay him?"
"Nothing is working so why do we pay him?"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering