Basic stamp servo control problem
buggy
Posts: 6
Hi,
I am working on a replica industrial robot arm. It uses normal servo's as the joint motors, and I was hoping to program it with·my basic stamp2.
I have fully build the actual arm itself but I have run into a problem controlling the servos. Just for a test i hooked up one servo to the stamp using the code below:
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR word
FOR x = 1 TO 150
PULSOUT 0, 750
PAUSE 20
NEXT
END
Nothing is happening. I know that the servo is getting power, as it moves a little when i plug it into my 6 volt battery supply, but it does not center itself. I happened to have a continuous rotation servo on hand, and tried attaching it for a comparison; it worked perfectly.I am fairly sure that my wiring is not the problem as the other servo worked but past that I am lost. I plugged this same servo into an rc reciver, and was able to control it with my transmitter just fine. This makes me think that it is not a problem with the servo itself. The continuous rotation servo was from parallax, as was the non-working servo. I am also using some Fubata servos on the arm itself, and none of them work either.
If anyone could help me i would be very grateful as my deadline is only a few days away!
Thanks a bunch!
I am working on a replica industrial robot arm. It uses normal servo's as the joint motors, and I was hoping to program it with·my basic stamp2.
I have fully build the actual arm itself but I have run into a problem controlling the servos. Just for a test i hooked up one servo to the stamp using the code below:
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR word
FOR x = 1 TO 150
PULSOUT 0, 750
PAUSE 20
NEXT
END
Nothing is happening. I know that the servo is getting power, as it moves a little when i plug it into my 6 volt battery supply, but it does not center itself. I happened to have a continuous rotation servo on hand, and tried attaching it for a comparison; it worked perfectly.I am fairly sure that my wiring is not the problem as the other servo worked but past that I am lost. I plugged this same servo into an rc reciver, and was able to control it with my transmitter just fine. This makes me think that it is not a problem with the servo itself. The continuous rotation servo was from parallax, as was the non-working servo. I am also using some Fubata servos on the arm itself, and none of them work either.
If anyone could help me i would be very grateful as my deadline is only a few days away!
Thanks a bunch!
Comments
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Word
DO
FOR x = 500 TO 1050 STEP 10
PULSOUT 0, x
PAUSE 20
NEXT
PAUSE 1000
LOOP
you may want t be careful with this program as in my case it runs my standard hobby servo 90 degrees. Good luck.
Post Edited (rage404) : 3/19/2008 2:51:19 AM GMT
my servo is now moving, but I am having trouble choosing the position. I modified your code a little bit by removing the x after the pulsout and replacing it with multible different numbers trying to change the position, but it is still fighting against its limits. If you could show me how to get it to move and hold at a different position that would be great. I thought that any between 500-1000 detirmined the angle of the horn, but it will not adust.
Thanks again!
PS: I think that the 3 pin connectors that i was using to connect the servo to the breadboard may have been a little short creating a bad connection
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Did you mechanically center the servo first? Also, my experience indicates that the numbers in Parallax's example are good starting points, but your servos could vary quite a bit. I have one servo whose counter-clockwise limit seems to be 1070 and clockwise is 210
Your original code was close, but needs DO... LOOP, as rage404 mentioned. I wouldn't suggest deviating from the number of pulses (150) because doing so could cause "duration" numbers to be misleading...
It's also a good idea to "sneak up" on the limits by changing the duration in steps of 10, as rage404 did.
For what it's worth,
Terry
I think its working now, but i will know for sure in a few days.
Thanks again!
Turns out im still having trouble. I have now managed to get some servo's working but have a new problem. I cannot seem to control the directon of the servo. I have put in a variety of numbers but it still will only turn in one direction.
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
All of the numbers that you listed have the same effect. It always moves in the same direction.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
What do you mean by doing them in the opposite order?
Because the BS2's servo control pulse is referenced to the BS2's ground. That ground should be connected to the Servo power supply ground (if you have a separate Servo power supply) to insure the control signal has a good reference ground.