BOE Bot servo question
rpl3000
Posts: 2
I'm going through the "Robotics with the BOE-Bot" book and I reached a glitch or there is something that I don't understand.
I'm at the point of making the two continuous servos run for three seconds and then reverse. When I first loaded and ran the code the servos would run for three seconds, then reverse direction for a instant and then rotate the initial direction for three seconds.... repeat. Also the debug window continuously displays "program running" so it seems that the program is being reset w/o finishing.
Can anyone offer any insight? I'm using a USB and the USB to 232 adapter.
When I comment out one PULSOUT in the seconf FOR loop sometimes it works as expected. Sometimes it resets the program w/o finishing.
' {$STAMP BS2}
' {$PBASIC 2.5}
' make the servo's run for a fixed time
' ControlServoRunTimes.bs2
DEBUG "program running", CR
counter VAR Byte
FOR counter = 1 TO 122
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
FOR counter = 1 TO 122
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
END
edit:
I can repeat the glitch.
When I load it from the editor, it resets. If I turn off the board, then turn it to position 1 and run it, the LEDs go out after 6 seconds, as expected. Then I switch the position 2 and run, it reverses as expected. When I then run it from the editor, the reverse glitch happens.
I'm at the point of making the two continuous servos run for three seconds and then reverse. When I first loaded and ran the code the servos would run for three seconds, then reverse direction for a instant and then rotate the initial direction for three seconds.... repeat. Also the debug window continuously displays "program running" so it seems that the program is being reset w/o finishing.
Can anyone offer any insight? I'm using a USB and the USB to 232 adapter.
When I comment out one PULSOUT in the seconf FOR loop sometimes it works as expected. Sometimes it resets the program w/o finishing.
' {$STAMP BS2}
' {$PBASIC 2.5}
' make the servo's run for a fixed time
' ControlServoRunTimes.bs2
DEBUG "program running", CR
counter VAR Byte
FOR counter = 1 TO 122
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
FOR counter = 1 TO 122
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
END
edit:
I can repeat the glitch.
When I load it from the editor, it resets. If I turn off the board, then turn it to position 1 and run it, the LEDs go out after 6 seconds, as expected. Then I switch the position 2 and run, it reverses as expected. When I then run it from the editor, the reverse glitch happens.
Comments
The batteries were at 5.2V. I checked but thought that this was OK voltage. The "pause 1000" also worked great even at 5.2V
Now can someone please explain what happened? The servos reverse drawing more current than usual for an instant, so what happens that makes the chip reset? Which pin drops in voltage or is it something else?
Yes, the motors and Stamp are all powered by the same batteries. Instant reverse (without the pause) briefly draws so much current through the servos that the battery voltage drops below the minimum that the electronics (regulator & Stamp) need, so the Stamp resets like you just turned it on. The pause 1000 reduces the current spike and voltage drop.
5.2 volts is pretty marginal! 4 new AA batteries are closer to 6.4V initially.
Hey man, so this is like a post 3 years in the future, but thanks, this helped. It was like a, I quote "Magic School Bus experience." Thanks again, even if you didn't realize it.