[SOLVED] Arduino UNO – Can’t Upload Sketches Larger than 30KB



Relating to the previous Gamby post, many people may have trouble uploading some of the game sketches to their UNO board as they are over 30KB.  The ATMEGA 328P (chip on the UNO) should allow upto 32KBytes of memory; but then people forget there is the addition of the bootloader which in older models occupies 2KB of memory. The bootloader is a special piece of software that makes reflashing (or uploading sketches) to the arduino easy and simple.  The problem is that 32KBytes of memory – 2KB of boot loader = <30KBytes of programmable memory! ?  But hang on… aren’t bootloaders meant to be small?

Optiboot is an enchanced and optimised bootloader that only requires approximately 0.5KB of space freeing up 1.5KB to allow for slightly larger sketches.  All new Arduino UNO’s ship with this optimised boot loader, but you can save yourself the £20 if you can borrow a friends UNO board for free! (Or visit your local Hackerspace ? )

Download the following code, and use the *.pde file to update your bootloader:

git clone https://github.com/WestfW/OptiLoader

How To Wire Up & Re-Program a UNO

Wire up the two Arduino’s as follows:


(Image from Arduino.cc)

Basically (Left being the programmer, Right being the programmed board (err…victim)) :

  • Wire Pin 13 -> Pin 13
  • Wire Pin 12 -> Pin 12
  • Wire Pin 11 -> Pin 11
  • Wire Pin 10 -> Reset
  • Wire GND -> GND
  • Wire 5v -> 5v

Upload the optiLoader.pde sketch, and it should automatically reprogram the boot loader on the second UNO.  Once all the lights stop flashing on the Arduino’s (usually less than a minute), your Arduino(victim) should have been successfully reprogrammed.

If you wish to help another friend and also reprogram his Arduino, simple disconnect the top UNO, rewire the new Arduino in its place and hit the “RESET” button on the programming (bottom) Arduino.

You should now be able to upload sketches less than 31.5KB, meaning you can play the awesome games developed by Team-arg like Dungeons