Serial.print causing random resets

I'm using the Arbotix Robocontroller to read a light sensor and drive two servos. My program resets at random times while executing Serial.print debug statements. If I turn off my print statements, the program runs correctly. I have ruled out noise on the reset line by disconnecting the reset jumper. I am thinking that the problem may be a voltage drop, causing the resets. Any help is much appreciated.

How many debug prints do you have, how large is the program, and which Arduino?

It's possible that you are corrupting the stack.


Rob

I have some debug statements in a loop, so the program is constantly printing out statements. I moved the print statements in flash, and moved them to a buffer before printing, per a suggestion on the forum. I am using Arduino 0022 and the current program size is 5.3 k. The program loop moves the servos, reads analog port 0, and prints out the analog port 0 readings.

Well it doesn't sound like the common "program too large, too many prints" problem then.

Maybe post the code.

Also try adding just a single print to see if it's the print itself or the quantity of them.


Rob

Thanks for the help. The program is pretty simple and it does get better with a smaller number of prints. The attached code has most of the original print statement commented out to minimize the number of prints and it tends to fail at the end of the tracking loop or in the lock loop.

I am thinking that the problem may be a voltage drop, causing the resets.

If you are perhaps powering the servos via the arduino, then that may be the problem.

I used the following function to see how much SRAM I had during runtime in each loop and it returns 2K consistantly. It doesn't appear to be a stack overflow issue.

int availableMemory()
{
int size = 4096;
byte *buf;
while ((buf = (byte *) malloc(--size)) == NULL);
free(buf);
return size;
}

I am powering the servos off of the Arbotix Robocontroller cable power converter that generates 12v from 120v. I shortened the cable to see if I was having a voltage drop across the power cable, but it still fails.

Digging this up here, but did you ever figure out a solution? I'm seeing random resets from print statements on my arbotix-M robocontroller... :confused:

apollokit:
Digging this up here, but did you ever figure out a solution? I'm seeing random resets from print statements on my arbotix-M robocontroller... :confused:

Start a new thread. That person won't be around and following this after 5 years. Did you PM them?