Is there any reason why you can't connect the servos that come with the Boe-Bot to ports 14 and 15 instead of 12 and 13? Note that I'm talking about the four sets of three prongs above the bread board.
No reason, except many of the examples are written with those as the pin assingments. If you download code written for the Boe-Bot, just remember to edit it to assign the new pin values for the servos.
This is one of the reasons it's a good coding practice to use names for the pins. All you have to do is change the name definition to match the physical configuration.
Okay.........let me explain everything. I'm working on an engineering project in college and we are trying to use the Boe-Bot for our prototype and possibly for the final product. We are designing a automated leveling system for trailers, such as an RV. For the prototype, we're using the parallax servos to power the prototype jacks. I wrote a simple program that "expands" the jacks and another program that "contracts the jacks. When I tried to expand this program to simply do all four at once, the four servos start to turn in the correct direction and then seconds later all stop and then only the servos connected to port 14 and 15 spin but spin in the wrong direction. This is a pretty simple program, see below, so I don't know what to think other than there's something different about the other two accessory ports (port 14 and 15). Help would be appreciated.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
FOR counter = 1 TO 5000
PULSOUT 12, 650
PULSOUT 13, 650
PULSOUT 14, 650
PULSOUT 15, 650
PAUSE 20
NEXT
END
The piece of code looks like it should work so the problem might be your power supply.
If you add a DEBUG statement, something like DEBUG " Program Started", before you declare your counter variable you will be able to see if your program is restarting. A brownout will restart your program from the beginning.
nab014 said...
I'm running the servos off of the on board AA power pack.
Like others have suggested, you're probably not getting enough power to all servos simultaneously with a small battery pack (which in turn is probably causing the microprocessor to reset).
Try the suggestions made earlier.
As for running in reverse, fix the first problem first, and see if the other one disappears too.
Just to clarify.....I have a wall adapter from parallax available, is the suggestion to use it or to power the servos completely separate from the Boe-Bot?
Servos can draw up to 1A peak current and an average current when moving of around 1/4A. You should power your 4 servos from a source that can supply up to 4A peak, 1A average current at something in the range of 6V to 7.2V. Ideally, a rechargable battery pack with 5 or 6 cells in series would work nicely as long as the cells have a capacity of at least 2AH. That would give you an operating time of 1 to 1.5 hours. Several manufacturers make AA cells with at least 2300mAh capacity. You could also use larger cells with a higher capacity for more operating time.
If you're using larger batteries, you could power the BOE off the same power source. The issue is that the power source has to supply at least 6V under full load (of all the servos at peak). If not, you want a separate supply for the BOE itself so the Stamp doesn't reset.
I'm a little confused on how to power the servos separately from the Boe-Bot.....I saw in the basic stamp manual a diagram of how to do it on Boe-Bots without the ports but am unsure if those diagrams will suffice. I'm also still a little confused about whether plugging the wall adapter into the Boe-Bot would solve the power issues or not. Thanks for all the input so far!
See the program above.......I don't know what else the problem could be. The boe-bot works properly with other programs that both utilize and don't utilize the servos.
nab014,
I don't know what kind of wall adapter you have. You can run some servos off the 7.5V adapter, but it will only supply 1 Amp continuously. Four servos draw more than that at peak. If you start more than one servo running simultaneously within a short time (a few hundred milliseconds), you might attempt to draw more than the wall adapter can supply. If you're trying to run the BOE off the same supply, it might reset due to low voltage.
If you attempt to run servos off a higher supply voltage, you can damage them.
You may be running the servos off the +5V regulator on the BOE. This can only produce about 1 Amp and will shut itself off if you attempt to draw more than that.
Read the section of the Robotics with the Boe-Bot manual on servos. You'll see that there are three wires coming out of a servo. One (black) is the ground connection and needs to be connected to the negative side of any power source for the servo as well as the ground of the BOE. One (yellow or white) is the control pulse and needs to be connected to a Stamp pin that you're program uses to control the servo. The third (red) is the positive power connection and needs to be connected to the positive pole of a battery or wall adapter that can supply 4.8V to 7.2V at currents up to 1 Amp per servo (peak).
I tried it with the debug statement in the beginning, see below, and the problem persisted. I believe you guys are on target about the system "browning out" and restarting. I'm still a little confused as to why the servos would reverse directions after the brown out and even more confused about a new issue I just discovered. When the Boe-Bot was in position 2 on the power switch I tried pushing the reset button to restart the program to test the debug idea. My understanding though is that the system should not operate as long as the reset button is being held down, however, the servos continued to turn even though the button was pushed and held. Any ideas about that?
Unless the reset pushbutton is defective, pressing and holding the reset pushbutton should force the Stamp into reset mode and hold it there until the pushbutton is released. In reset, all I/O pins are forced to input mode. It may be that electrical noise is masquerading as control pulses. One way to tell for sure would be to put pull-down resistors on the servo control lines. Something like 10K or 4.7K would work. That would reduce any noise, but not affect the normal use of those I/O pins.
Just to clarify your suggestion Mr. Green, I need to add either a 10K or 4.7K resistor to the power line, I assume the only way to do so would be to cut into the white line and solder one in place. Before I do that though, I will try the connections on a different Boe-Bot and see if the problem persists (test for a defective reset button). Thanks for the help so far guys!
No, man.· A "pull-down" on the control pins (each pin 1 of each of the "three-prong" connectors is also connected to an I/O pin.)··Don't hack at your connectors.
Don't you have the BoE schematic?
One pull-down resistor should go from P12 to Vss, another from P13 to Vss, another from P14 to Vss, and another from P15 to Vss.
PJ Allen :: how exactly would I run a resistor like that, I'm still a little confused.
We connected the external supply to the Boe-Bot and it solved the "brown out" issue I believe, but we still have rogue servos. The servo connected to port 15 runs at random times and even when the reset button is pushed. I moved everything to another Boe-Bot but the problem persisted. I'm attaching the code, perhaps the problem lies in there. I'm sure there are some errors in the program, any help would be appreciated. The system should read a value from the accelerometer and then move certain servos to correct the system from being un-level. Once the system determines it to be level, the program should just sit there. Thanks again for the help so far.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
x VAR Word
y VAR Word
xlevel VAR Word
ylevel VAR Word
FOR counter = 1 TO 2
PULSOUT 12, 650
PAUSE 2
NEXT
FOR counter = 1 TO 2
PULSOUT 13, 650
PAUSE 2
NEXT
FOR counter = 1 TO 2
PULSOUT 14, 650
PAUSE 2
NEXT
FOR counter = 1 TO 2
PULSOUT 15, 650
PAUSE 2
NEXT
DO
PULSIN 15, 1, x
DEBUG CRSRXY, 0, 0, DEC x, " "
IF x < 2475 THEN
GOSUB xleft
ELSEIF x > 2525 THEN
GOSUB xright
ENDIF
PULSIN 14, 1, y
DEBUG CRSRXY, 0, 1, DEC y, " "
IF y < 2475 THEN
GOSUB ytop
ELSEIF y > 2525 THEN
GOSUB ybottom
ENDIF
IF x < 2550 AND x > 2450 AND y > 2450 AND y < 2550 THEN
GOSUB level
ENDIF
LOOP
xleft:
FOR counter = 1 TO 10
PULSOUT 14, 650
PULSOUT 15, 650
NEXT
RETURN
xright:
FOR counter = 1 TO 10
PULSOUT 13, 650
PULSOUT 12, 650
NEXT
RETURN
ytop:
FOR counter = 1 TO 10
PULSOUT 13, 650
PULSOUT 14, 650
NEXT
RETURN
ybottom:
FOR counter = 1 TO 10
PULSOUT 12, 650
PULSOUT 15, 650
NEXT
RETURN
level:
DO
HIGH 0
PAUSE 10
LOW 0
LOOP
It looks like something is sending pulses to P14 and P15, and your code is measuring it before it attempts to control the servos. Servo ports 14 and 15 are controlled by I/O pins P14 and P15. If you also have a sensor that is sending pulses to those I/O pins, that sensor could well be controlling the servos connected to ports 14 and 15.
Comments
This is one of the reasons it's a good coding practice to use names for the pins. All you have to do is change the name definition to match the physical configuration.
The piece of code looks like it should work so the problem might be your power supply.
If you add a DEBUG statement, something like DEBUG " Program Started", before you declare your counter variable you will be able to see if your program is restarting. A brownout will restart your program from the beginning.
Brad
Try the suggestions made earlier.
As for running in reverse, fix the first problem first, and see if the other one disappears too.
PAR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
If you're using larger batteries, you could power the BOE off the same power source. The issue is that the power source has to supply at least 6V under full load (of all the servos at peak). If not, you want a separate supply for the BOE itself so the Stamp doesn't reset.
Have you determined the power supply to be the problem?
Brad
I don't know what kind of wall adapter you have. You can run some servos off the 7.5V adapter, but it will only supply 1 Amp continuously. Four servos draw more than that at peak. If you start more than one servo running simultaneously within a short time (a few hundred milliseconds), you might attempt to draw more than the wall adapter can supply. If you're trying to run the BOE off the same supply, it might reset due to low voltage.
If you attempt to run servos off a higher supply voltage, you can damage them.
You may be running the servos off the +5V regulator on the BOE. This can only produce about 1 Amp and will shut itself off if you attempt to draw more than that.
Read the section of the Robotics with the Boe-Bot manual on servos. You'll see that there are three wires coming out of a servo. One (black) is the ground connection and needs to be connected to the negative side of any power source for the servo as well as the ground of the BOE. One (yellow or white) is the control pulse and needs to be connected to a Stamp pin that you're program uses to control the servo. The third (red) is the positive power connection and needs to be connected to the positive pole of a battery or wall adapter that can supply 4.8V to 7.2V at currents up to 1 Amp per servo (peak).
Did you try it with the DEBUG statement, that should tell you if power is your problem. I can't think of what else it could be.
Don't you have the BoE schematic?
One pull-down resistor should go from P12 to Vss, another from P13 to Vss, another from P14 to Vss, and another from P15 to Vss.
We connected the external supply to the Boe-Bot and it solved the "brown out" issue I believe, but we still have rogue servos. The servo connected to port 15 runs at random times and even when the reset button is pushed. I moved everything to another Boe-Bot but the problem persisted. I'm attaching the code, perhaps the problem lies in there. I'm sure there are some errors in the program, any help would be appreciated. The system should read a value from the accelerometer and then move certain servos to correct the system from being un-level. Once the system determines it to be level, the program should just sit there. Thanks again for the help so far.
It looks like something is sending pulses to P14 and P15, and your code is measuring it before it attempts to control the servos. Servo ports 14 and 15 are controlled by I/O pins P14 and P15. If you also have a sensor that is sending pulses to those I/O pins, that sensor could well be controlling the servos connected to ports 14 and 15.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
Priceless.
That last submittal is quite a bit different from all of the previous.