Problem with bs2p and servos
marco_94
Posts: 5
Hello, I just received my new BS2p microcontroller and I can't get it to work well with my servos. (boe bot)The servos work well when I just let the boe bot just drive forward/ left/right/backwards and so on.. but when I want them to first drive forward and then an other direction the boe bot is acting strange.
here the code:
I don't know what I'm doing wrong
the script is a standard script from this site but then with the different servo speeds
the servos are calibrated at 1825 en so the speeds are adjusted to that value
can anybody help me?
here the code:
' {$STAMP BS2p} ' {$PBASIC 2.5} counter VAR Byte DEBUG "Program Running!" ,CR DEBUG "1",CR FOR counter = 1 TO 120 PULSOUT 13, 2125 PULSOUT 12, 2125 PAUSE 20 NEXT DEBUG "2",CR FOR counter = 1 TO 124 PULSOUT 13, 1625 PULSOUT 12, 1625 PAUSE 20 NEXT DEBUG "3",CR FOR counter = 1 TO 122 PULSOUT 13, 2125 PULSOUT 12, 1625 PAUSE 20 NEXT DEBUG "4", CR FOR counter = 1 TO 122 PULSOUT 13, 1625 PULSOUT 12, 2125 PAUSE 20 NEXT DEBUG "5",CR ENDhere the debug console when executed with powerswitch on 1 (no servos)
Program Running! 1 2 3 4 5here the debug console when executed with powerswitch on 2 (with servos)
Program Running! 1 Program Running! 1 Program Running! 1 Program Running! 1 Program Running! 1 Program Running! 1 ...and this goes on and on like an infinite loop
I don't know what I'm doing wrong
the script is a standard script from this site but then with the different servo speeds
the servos are calibrated at 1825 en so the speeds are adjusted to that value
can anybody help me?
Comments
But I have already ordered an additional battery pack get some extra power.. see if this works..
But I just think it's a little strange that it can't handle 2 servo's with the 4 AA 1,5V batteries
I will let you know if the extra battery pack works
There's a jumper located between the servo connector sockets that selects between Vdd and Vin for the servo supply voltage. Make sure it's set to use Vin. Do not use an AC adapter that supplies more than 7.5V while the jumper is set that way. A 6V adapter is best, one that can supply at least 1A, preferably 2A.
Another good trick is to split the PAUSE 20 into two PAUSE 10 and alternate these with the PULSOUTs like this:
FOR counter = 1 TO 124
PULSOUT 13, 1625
PAUSE 10
PULSOUT 12, 1625
PAUSE 10
NEXT
This ensures that both servos will not try to start moving at exactly the same time and will reduce the peak currents drawn. That may be enough to keep your Stamp from resetting.
I don't have a BS2 to test it. But I securely overlooked everything and the circuits look alright to me and the script is just the script I took from the stamp in class mini project, but with adjusted speeds
Tomorrow I will buy and try a 9v battery and see if this solves the problem.
What other solutions are there to use the BS2p with 2 servos? Or was the BS2p never intended to be used with 2 servos? And should I just get a BS2.
Will the boost of an extra battery work? (I will try this as soon as I get the battery pack.)
Now I wait for the battery pack to arrive and see if it works to put that one in serie with the standard one. Otherwise I will be using the 9v one.
Don't be surprised if the 9V battery quickly becomes exhausted. It's not designed for this sort of usage.