I admit it: I'm a total geek. I love electronics, programming, 3D art, vintage Apple hardware, and whisky. I'm always juggling half a dozen projects. I also enjoy documenting it all: my successes, my failures, my experiences... and everything geeky along the way.

Seeed Studio Fusion - $9.90 for 10pcs 2 layer 10x10cm boards


Arduino Mega 2560 | Kevin Rye.net - Main

Kevin Rye

Geek Extraordinaire. Yeh, I said it.

Arduino Mega 2560

With the weekend upon me, I was eager to continue writing the code for my GPS clock. I had already identified the need to continue developing on an Arduino Mega 2560, but I’d need to order one if I was to move forward. Rather than order one from SparkFun, I grabbed a Mega 2560 from RadioShack on the way home from work. Of course, I paid an extra $10 bucks “going retail”, but it’s a small price to pay to have it in hand for the weekend rather than waiting a week for it to arrive via snail-mail.

I’m a sucker for an unboxing, so here goes:

Arduino2560_0141 1

Arduino2560_0144 4

What a snazzy looking poster. That would look cool hanging up. Too bad it’s all folded.


And there is it! The Mega!

Arduino2560_0145 5

Although it’s a lot bigger than the Arduino Uno, it’s still smaller than I though it would be. I guess everything looks bigger in photos.

Arduino2560_0146 6

Arduino2560_0149 9

To put things into perspective, here’s a size comparison between the Uno and the Mega.


Another thing that’s great about the Mega is that it’s shield compatible with the Uno. The Mega is a Uno and then some.


I connected the Mega to my Mac and it immediately powered up and started running the Blink sketch.


I fired up the IDE, changed the Blink sketch to a faster rate, and uploaded the sketch. Boom. It totally works. This is so easy!

Or is it?

I launched the sketch for my GPS clock and attempted to write it to the board.
Screen Shot 2013-11-02 at 12.57.52 PM
What is “avrdude: stk500v2_ReceiveMessage(): timeout“? Whatever it is, the board isn’t being programmed.

I tried uploading the Blink sketch again. It worked. I tried a few other examples, as well as some of my older projects. I just can't seem to upload anything other than the Blink sketch. Very strange, and very frustrating. If the board was DOA, I’d just return it to RadioShack for another one, but I can load the Blink sketch. The board can’t be dead. Something else is at work here.

I jumped online and did a few searches. It seems that there’s a bug in the bootloader that causes it to hang if you have “!!!” in your code somewhere. I don’t have “!!!” in my code anywhere. Nor is it in any of the other sketches I tried that don’t work. I even went as far as check the libraries I imported, but they don’t have it either.

This can’t be another Mavericks bug because my UNO works flawlessly on my Mac with IDE 1.0.5 and OSX 10.9. So it's not the computer or configuration.

I even tried a loopback test and that passed OK, so there’s definitely nothing wrong with my Mac, the IDE, or my cable.

I've reset the board.
I've deleted my Preferences file.
I've rebooted.
I’ve tried everything. This dog just won’t hunt!

I did a little more searching online and found out that the bootloader built into the new Arduino 1.0.5 IDE fixes the “!!!” bug as well as some other things. I figured as a last ditch effort before returning it to the store, I’d go ahead a reburn the bootloader and hope that it fixes things.

I slaved the Mega off my Uno, uploaded the “ArduinoISP” sketch to my Uno and set the Mega as my target. (For more details on burning a bootloader check out some of my previous posts.)


I then selected “Burn Bootloader” and crossed my fingers.
Screen Shot 2013-11-02 at 2.23.31 PM
After a minute or two, it completed without errors. I disconnected the Mega from the Uno, opened my GPS Clock sketch, and uploaded it.

Screen Shot 2013-11-02 at 2.37.07 PM
Awesome! No errors. I think I fixed it. It was a shoddy bootloader after all!

I then dropped the Mega into my circuit and powered it up. Boom.

Arduino2560_0016 16

I’m so happy that I got it working. I’m glad I didn’t just wimp out and return it. All the time spent going back and forth to the store would have been a complete waste of time because a new unit would have probably done the same thing. If I had only just pulled the trigger 4 hours ago and just burned the bootloader from the start! Think of how much code I could have written already!

See this project from start to finish:
GPS Clock Prototyping, Part I
GPS Clock Prototyping, Part II
Arduino Mega 2560
GPS Clock Prototyping, Part III
GPS Clock Prototyping, Part IV
GPS Clock Prototyping, Part V
GPS Clock Assembly, Part I
GPS Clock Assembly, Part II
GPS Clock Assembly, Part III
GPS Clock Assembly, Part IV
GPS Clock Rework - Ditching the Joystick, Part I
GPS Clock Rework - Ditching the Joystick, Part II
GPS Clock Rework - Ditching the Joystick, Part III