AL5D with botboarduino stops suddenly and restarts again?

Hi folks,
I am new to electronics and robots. I am new to this forum as well.
I have bought al5d with botboarduino and finaly got it working after 15 days.
I have created a program in arduino which works but after 3 loops robot fall down(I mean stops) and restart itself automatically…
I don’t know what is happening. Please help me with this.

Below is my code : -

[code]#include <Servo.h>

Servo Base;
Servo Shldr;
Servo Elbow;
Servo Wrist;
Servo Gripper;
Servo WristR;

#define BasePin 2
#define ShldrPin 3
#define ElbowPin 4
#define WristPin 11
#define GripperPin 12
#define WristRPin 10

void setup()
{
Base.attach(BasePin);
Shldr.attach(ShldrPin);
Elbow.attach(ElbowPin);
Wrist.attach(WristPin);
Gripper.attach(GripperPin);
WristR.attach(WristRPin);
Serial.begin(9600);

WarmUp();
}

void loop()
{
//picking
MoveServo(Base,Base.read(),45);
MoveServo(Elbow,Elbow.read(),45);
MoveServo(Shldr,Shldr.read(),60);
MoveServo(Elbow,Elbow.read(),85);
MoveServo(Wrist,Wrist.read(),157);
MoveServo(Gripper,Gripper.read(),90);
MoveServo(Wrist,Wrist.read(),90);
MoveServo(Shldr,Shldr.read(),90);

//dropping
MoveServo(Base,Base.read(),135);
MoveServo(Elbow,Elbow.read(),45);
MoveServo(Shldr,Shldr.read(),60);
MoveServo(Elbow,Elbow.read(),85);
MoveServo(Wrist,Wrist.read(),157);
MoveServo(Gripper,Gripper.read(),0);
MoveServo(Wrist,Wrist.read(),90);
MoveServo(Shldr,Shldr.read(),90);
}

void WarmUp()
{
MoveServo(Shldr,90,90);
MoveServo(Elbow,90,90);
MoveServo(Base,90,90);
MoveServo(Wrist,180,180);
MoveServo(Gripper,0,0);
}

void MoveServo(Servo &servo, int startpos, int endpos)
{
if(startpos > endpos)
{
for(int pos = startpos; pos>=endpos; pos-=1)
{
servo.write(pos);
delay(15);
}
}
else if(startpos < endpos)
{
for(int pos = startpos; pos<=endpos; pos+=1)
{
servo.write(pos);
delay(15);
}
}
servo.write(endpos);
}

[/code]

With things like this, my first assumption is power. Are you using one or two batteries? IE is the voltage power separate from the servo power? If not you might want to try that. Plug in 9V battery to logic terminal and remove jumper. Also are the servos 3 pin headers configured to use VS and not +5v? What voltage are you supplying to VS and VL?

Note: A picture showing your processor board with it’s wiring would also help in cases like this. For example it would help us to verify that the servo power jumpers are correct. If for example one or more of the servos are hooked up to +5v, it uses the power from the voltage regulator on the board, which is not setup to handle powering servos. (Maybe 1 or 2 servos with nothing hooked up for testing), but for sure would not properly power the servos for the arm.

If it turns out that it is not a power issue, then I would start adding debug information, to see what is going on…
For example at the start of the function MoveServo, maybe add some prints, like:

Serial.print(startpos, DEC);
Serial.print(" ");
Serial.println(endpos, DEC);

Would probably also have printed something about which servo the call was for, but not sure if you can get which servo is attached to a servo object. Obviously could always pass another parameter… Then you can see if it is always resetting after/during the same call. I would also probably sprinkle more Serial prints
in other key places, like at the start of setup, WarmUp and loop.

If it always dies at same place than zero in. If at random places than suspect again power, or some form of corruption…

Kurt

Hi ajmera_cp,

Your code looks great and I can’t see any problems. I am suspecting the same thing as kurte, that their may be power issues : if the servos are drawing too much power, the voltage could sag to levels below what is acceptable for the BotBoarduino’s microcontroller.

If this is not the case, let us know!

Thanks,

Thanks a lot for the suggetions…
Ok let me try that i will post you in few mins…

Now its not running after i removed jumper for vl=vs.

I can not see everything in your picture, but probably enough… You are running the servos with +5v, which implies it is now trying to get everything from your 9v battery, which could be dead now…

Look at the Botboarduino guide: lynxmotion.com/images/html/build185.htm. Look at where 7 is marked on the drawing. This is the jumpers I mentioned. I can see that at least some of them are +5v. At least for pins 2-5 and 6-9. I can not tell what 10-13 are set to as the jumper is not seen in your picture as it is covered up by the wires, but suspect also +5v. Try moving those three jumpers, such that the center pin and the one nearest what says VS is shorted to each other instead of the center with the +5v.

Kurt

P.S - You may need a new +9v battery as well

Thanks for the quick reply

Yep, that jumper is off as well. Try changing jumpers, fresh battery and see if it now work for you.

Kurt

I have changed jumpers of point 7 to vs but now nothing works i have checked battery which is giving 9v dc with digital multimeter…

Ok, now take your multimeter and check the voltages on the board.
If you test the voltage to the two larger wires toward the upper right of your picture (Servo), what voltage do you have there? Should be 6+ volts, do you have a valid +9 volts to the next two terminals VL? I normally test it at the top screws of the power terminal. Are there any leds lit on the board?

If you don’t have the proper voltages at the screws, check that the switches are turned on. Likewise that they are wired in properly and no visible shorts.

Kurt

Hey Kurt,
Thanks to pointing me into the right direction. I was completely lost :frowning: before… you are right for checking the battery voltage while it is connected. However the battery was correct but the problem was the + node of the battery is slightly covered by plastic. I tried after removing that it got working perfectly fine. :smiley:
Thanks a lot for your support. You are damn genius…