Enquiry on hb25 programming
b0ib0i07
Posts: 33
I m currently using bs2 to program hb25 to drive a 12v dc motor.
From what i know : pulsout, pin number,duration can signal a motor to move.
I will like to know why do i need to loop this statement and how does the duration affect the movement of the motor. Like 750 is stop.
And how do i set the motor to lets say move 20 degree clockwise?
From what i know : pulsout, pin number,duration can signal a motor to move.
I will like to know why do i need to loop this statement and how does the duration affect the movement of the motor. Like 750 is stop.
And how do i set the motor to lets say move 20 degree clockwise?
Comments
To position at 20 degrees clockwise, you'll need to provide some form of feedback so the controller knows whether to move fwd or rev to get to the desired position.
You don't give much in the way of detail of what your aims are, but a servo may be better suited to your needs.
Based on the pulse-width of the PULSOUT command a servo WILL move to a particular position and hold there as long as you keep refreshing the PULSOUT command several times a second.
Cheers,
I want to ask about this comment about the PULSOUT command several times a second.
Then would I be able to run a routine using a optic sensor to keep track how far the motor has moved
So lets say : "pulsout, pin14, 850" is use to move e motor 20 degree clockwise. So if i want to hold it in the 20 degree position, do i just simply loop this single command?
Or can i use "pulsout, pin14, 750" to stop the motor after it reaches that position?
So, your code would make the motor run slowly in one direction until you told it to stop. Without independently measuring position, the Stamp will not know when to tell the hb25 to stop the motor. If you measure the position by some method, as Sam has asked, you have just made a servo.
On the other hand, those commands fed to a packaged servo would make the servo move to some definite position and stop as long as the signal was repeated a few times a second. When you send "pulsout, pin14, 750" it would return to zero as long as you kept sending that value. The feedback is built into the servo unit.
For a standard servo you would repeat the PULSOUT 850 command 20 times a second to hold that position.
If you want the HB-25 to perform like a servo you must add an encoder of some form to whatever it is you are moving. You would command the HB-25 to move in a direction and then monitor that encoder. When the time comes to stop the HB-25 base upon the feedback you have received from the encoder, you would send a PULSOUT 750 command to stop the HB-25.
Like stamptrol says, a servo may be a better fit for your need. If you were to give more detail about your project we could be more helpful.
Rich H
That the most IMPORTANT part of what I need to know
I tried. It didnt move.
for index = 0 to 250
pulsout pin14, 750 + index.
The above 2 command made it move..
But i dont understand it o.o
' {$pbasic 2.5}
for w0 = 750 to 1000
pulsout 14,w0
pause 1000
next
*correct me if i am wrong.
The above program do move the motor. However i noticed that the motor move in increasing speed. Is there any way to move the motor at constant speed?
Best,
erco
Rich H
The above program didnt move my motor
What are the possibilities that cause it to didnt move?
* I am very sure nothing wrong with the wire connections..*
Rich H
I got it.
think something wrong with the particular port.
THANKS ALL:smilewinkgrin:
I did tried.
But i miss out the pause 20 i think.
Anw, thanks for the help.
Now is I/O 7 spoiled.
Anyone gt any idea whats going on?
* I just built a particular pulsout program. The program works fine on all I/O ports initially. However port 7 and 15 suddenly stop working.... *