I have two servo motors and an MPU 6050 6-axis gyro hooked up to Arduino Uno 5v. The servos move based on the MPU6050 readings. However, the servos keep freezing about 5 seconds after being turned on. The Arduino is powered by a 7.4 V lipo battery. What could be happening?
Is the battery connected to the Uno Vin? Are you powering the servos from the Uno 5V? If so, that is probably be the problem. Powering the Uno through Vin means that the 5V is coming from the onboard 5V regulator. The regulator is not heat sinked so can supply limited current before the voltage is pulled so low that the servos cannot operate or it overheats and shuts down. Servos draw considerable current and so need external power supply capable of supplying sufficient current. Budget 1A for each small servo and more for larger servos. See the servo data sheet and choose a supply that can supply the cumulative stall current for the servos.
If you need further help, post a schematic and provide data sheets for the servos.
Post your test code. Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
You can't get enough power from the internal regulator and 5V pin to safely drive even one micro servo. Certainly not 2 servos of indeterminate size. This is the sort of thing that may seem to work when powering the Arduino via USB but then stops working when you try to power it via Vin.
Steve
Yes, I was powering the Arduino through Vin. I will try using external power for the servos to see if that works. Thanks!