Arduino Mega 2560 and multiple Servos


I am working on my first project which has Six servos connected to Arduino Mega 2560. I have a simple code that rotates the Six servos in different directions with different speeds.

The problem is that when I upload the sketch, I get the famous error message [avrdude: stk500v2_ReceiveMessage(): timeout]. I have seen many responses to this issue in this forum.

1) When I just connect ONE servo, the sketch upload just works fine without the error. 2) When I connect the SIX servo, the sketch upload gives me the error.

I have re-updated drivers, checked the circuit , etc but no luck. One thing I noticed is that when I upload the sketch when the SIX servos are connected the Device Manager keeps showing/hiding the COM port.

I would appreciate any help if anyone has an idea how to fix the problem.

Thank you

Where is the "sixth" servo connected to? I hope it's not on pins 0 and 1.

I have connected the six servos as follow:

void setup() {
myservo1.attach(1); // attaches the servo on pin 9 to the servo object

So, yes it is connected to Pin 1… could that be the problem!!

Thanks for your help.

So…. I changed the sequence to connection to Pins. I am starting all over with the circuit part by part. Here is what is happening.

1) Made circuit for connecting (1ST) Servo to Pin No.2 --- tested and worked

2) Then Made circuit for connecting (2ND) servo to Pin No.3 --- tested and worked.

3) Now, I made circuit for connecting (3RD) servo to Pin No.4 --- I get the error (Problem uploading to board) and (avrdude: ser_send(): write error: sorry no info avail).

I also have the Device Manager window opened and I noticed that the [Arduino Mega 2560 (COM13)] keeps disappearing and showing interrupting the sketch upload process. I have updated/installed the driver many times.

Is it problem with my laptop USB port or power supply!!! I am connecting my arduino to the laptop thru the USB and also have external power supply adaptor (12v) connected to the Arduino.

Thank you

Why not disconnect everything, upload code, turn off board. Connect everything, then power on?

Hi Codelink…

I cannot believe that I wasted almost two nights troubleshooting and apparently the problem was because I had a bad or loose USB cable interrupting the communication from my laptop USB to the Arduino board.

Problem fixed. I bought a new USB cable and the sketch upload seems to be working fine, so far :-)

I appreciate your help…

No problem, it's usually the simplest thing that breaks a project. Thanks for letting us know what the issue was.