Increase flash memory Arduino UNO

Hi everybody,
I have an arduino UNO and I've written a code more than 32Kb that Arduino have on his flash memory, I've buyed an arduino ethernet shield wich has a memory extender for micro SD cards, is there a way to increase it's 32 Kb or another method in order to run my code wich is greater than 32 Kb on Arduino UNO ?
Claudio

It isn't really possible with an Uno, since I don't believe it has any way of extending program memory. If you have filled up your program memory with strings and read-only data using PROGMEM, you could move these to using a micro-SD card, and read in the values when you need them, or use a i2c/spi memory expansion chip instead of the micro-Sd card. You would have to restructure the program, and move even more out to external memory, as the libraries to access these devices will take space.

A much simpler solution is to use a Mega 2560, which has 256K of program memory, instead of 32K (and 8K of SRAM memory instead of 2K).

Or if you can run your devices at 3.3v instead of 5v, the Teensy 3.1 (which uses an Arm processor instead of the AVR processors used in the Uno/Mega) also has 256K of program memory (and 64K of SRAM memory). Similarly, the Arduino Due has 512K of program memory and 96K of SRAM.

many programs can be coded more efficiently, e.g. by removing all float math from it

Is you code (partial) reviewed to see if it can be optimized?

Hi boys thanks for answers.
@MichaelMeissner I'll consider moving to Mega 2560.

@robtillaart: I don't wanna be silly, but I'm a programmer and the code unfortunately can't be optimized more I have double-checked it.

You can use a serial SPI flash and the library is already there here >GitHub - LowPowerLab/SPIFlash: Arduino library for read/write access to SPI flash memory chips

Also you do not need to definitely upgrade to a ATmega2560 arduino that has over 200kb of flash rather than you can also go for ATmega1284/1280 based designs! thats half the falsh memory soit means saving money if not much but yes saving that god damn hard earned bucks! or maybe go for ATmega644 etc.

Talk with CrossRoads a respected forum senior member you should try his boards ,they are dependable and comes in green and yellow colors!

MichaelMeissner:
It isn't really possible with an Uno, since I don't believe it has any way of extending program memory. If you have filled up your program memory with strings and read-only data using PROGMEM, you could move these to using a micro-SD card, and read in the values when you need them, or use a i2c/spi memory expansion chip instead of the micro-Sd card. You would have to restructure the program, and move even more out to external memory, as the libraries to access these devices will take space.

A much simpler solution is to use a Mega 2560, which has 256K of program memory, instead of 32K (and 8K of SRAM memory instead of 2K).

Or if you can run your devices at 3.3v instead of 5v, the Teensy 3.1 (which uses an Arm processor instead of the AVR processors used in the Uno/Mega) also has 256K of program memory (and 64K of SRAM memory). Similarly, the Arduino Due has 512K of program memory and 96K of SRAM.

Good day!
I have this kind of problem, i have sensors, and need some external space, so how can i connect micro SD card and use it? Thanks in advance for answer.

If you have a lot of big strings, integers, pics, files or files just read your code from the sd when ever possible to save space.

Else you could use the rx/tx to link another Arduino together.

What i usually do is create a dat file and read the info from the SD card on the Arduino.

robtillaart:
many programs can be coded more efficiently, e.g. by removing all float math from it

Is you code (partial) reviewed to see if it can be optimized?

while writing a program for my uno i found i can use 0 for low and 1 for high so eliminating 5 letters does not sound like much but take a blinking led for example that is 10 letters less you need to use

so instead of

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

you use

digitalWrite(13, 1); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, 0); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

it may be possible to use variables so you dont have to repeat so much.

ejonesss:
while writing a program for my uno i found i can use 0 for low and 1 for high so eliminating 5 letters does not sound like much but take a blinking led for example that is 10 letters less you need to use

so instead of

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

you use

digitalWrite(13, 1); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, 0); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

it may be possible to use variables so you dont have to repeat so much.

That doesn't save code space, just space on your screen and makes the code harder to read.

HIGH and LOW are #define to 1 and 0. So before the compiler ever sees the code they get replaced and the code that goes to the compiler ends up looking just like what you wrote here.

It's instructions that matter to code size, not letters of text. Unless, of course, those letters are part of string variables. Instructions, not lines of code, remember that one line of code often translates to many many many machine instructions.

You also could add one of these to increase your eeprom