Go Down

Topic: Need more code space? Running low with 32kb (Read 1 time) previous topic - next topic


I have a project that I'm working on that uses several libraries and I'm starting to think that I just need more code space to do what I need to do. I'm trying to use the 32kB on an Arduino Ethernet but I don't think it's cutting it. The Arduino Ethernet is cheap compared to a Mega with Ethernet shield, and I will be producing more than just one of these, so it's important to minimize cost as much as possible.  Let me explain in a nutshell what I need the Arduino to do:

-Always keep track of time, syncing with NTP server
-Datalog onto SD card
-Process Data from SD card (area under the curve of particular data points)
-Upload data to COSM
-Utilize one byte of eeprom incase of shutdown event.

I have looked at other sketches that utilize SD and web (SDWebServer) and the sketches are quite small (20kB) for what they do. There may be something I'm overlooking in my code that is making it so high, around 31kB, so let me know if I should post away.

Thank you much.


Which libraries are you using - there may be more compact versions (I'm thinking primarily of the SD library here, as
there are several alternative ones around).

Are you aware that constant strings can be moved to PROGMEM which might help (or hinder)?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Look for more compact libraries or get an ARD mega with the shield you need
My GitHub:


Thanks for the replies.

I am running the following libraries, full-fledged, and am definitely not aware that smaller ones exist. That gives me more hope. =)

#include <SPI.h>
#include <SD.h>
#include <EEPROM.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <Time.h>

MarkT - I have some constant strings, but mostly every string is being generated within a subroutine, used, and then thrown away. At least that's what I am hoping it does. =)


Could you post your FULL code, with maybe comments.
My GitHub:


Will post when I'm home from work. Cheers


Here the beast is! (Too big to post on the forum in a code space, funny).



Your code is not that long. Must be the libraries taking too much space.


Oh, that is big, ok what type of board do you have? If you have the UNO, then you might need to upgrade to a MEGA.
My GitHub:


One person saying its long, and another saying not that bad. lol

I have the Arduino Ethernet.

Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM   2 KB (ATmega328)
EEPROM 1 KB (ATmega328)

I am curious on how much space the other SD library, Fat16lib, will save me:


I have programs that are over 3,000 lines and only take about 30KB. I included many of my own libs. Compared with my programs your 300 line project is short but takes so much space, must be the libs you used.


If my code gets too long, then I see what I can maybe re-use in another program and just write a library, that way I have it,the code is short, and I don't need to rewrite it.
My GitHub:


I don't really have the skill to modify that many libraries because I'm just short on time these days. I would have loved to but it's nice to work with something already made.

Maybe a Mega is worth the money vs. my lack of time to dive into modifying libraries.


If your pressed on time then go with a MEGA. You might need a new ethernet shield thou.

Ebay has both.
My GitHub:


Have any personal opinions with the Freetronics Ethermega?  I like the all-in-one aspect.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131