Arduino Randomly Resets

Hello,

When I run my program on my Uno, it just restarts the program at random times (even if the program has been running for a long time). I'm running 2 servos and an LCD screen with the backlight off. I'm powering the Uno through the USB port which is attached to a 5V 2A wall adapter via USB cable. The LCD is running of of the 5V on the Uno and the servos are being run off of the 5V from the USB plug directly. They have a common ground. I'm not printing anything to Serial in my program, just printing to the LCD.

What would cause my Uno to restart at random times, regardless of how long the program has been running??

Thanks

Current surges in the servo dragging the 5V down.

Ok. Any suggestions on how to fix this issue? I also have a 1000uF cap in between GND and 5V of the servos.

Don't power the Arduino from the same rail as servos or motors, its always asking for trouble
like this.

What would cause my Uno to restart at random times,

Lack of decoupling.

I also have a 1000uF cap in between GND and 5V of the servos.

You also need the smaller 0.1uF caps as well to handle the high frequency interference.

I would also recommend having a Pi circuit decoupling each servo, like the last circuit in this link.

http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

All this assumes that your power supply can supply the peak current demanded of it.

Use a separate power supply. And connect the grounds.