Pages: [1] 2   Go Down
Author Topic: Need more code space? Running low with 32kb  (Read 824 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11672
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)?
Logged

[ I won't respond to messages, use the forum please ]

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look for more compact libraries or get an ARD mega with the shield you need
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. =)

Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you post your FULL code, with maybe comments.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Will post when I'm home from work. Cheers
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

http://pastebin.com/k0M47Ym4
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
http://code.google.com/p/fat16lib/
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3417
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Ebay has both.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

http://www.freetronics.com/products/ethermega-arduino-mega-2560-compatible-with-onboard-ethernet#.UL7Ma4PAeSo

Logged

Pages: [1] 2   Go Up
Jump to: