Offline
Newbie
Karma: 0
Posts: 13
|
 |
« on: December 04, 2012, 01:53:08 am » |
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
Tesla Member
Karma: 76
Posts: 6852
Arduino rocks
|
 |
« Reply #1 on: December 04, 2012, 06:27:47 am » |
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
|
|
|
|
|
Queens, New York
Online
Edison Member
Karma: 31
Posts: 1733
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #2 on: December 04, 2012, 06:36:52 am » |
Look for more compact libraries or get an ARD mega with the shield you need
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 13
|
 |
« Reply #3 on: December 04, 2012, 09:48:15 am » |
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
Online
Edison Member
Karma: 31
Posts: 1733
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #4 on: December 04, 2012, 09:54:30 am » |
Could you post your FULL code, with maybe comments.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 13
|
 |
« Reply #5 on: December 04, 2012, 10:23:44 am » |
Will post when I'm home from work. Cheers
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 13
|
 |
« Reply #6 on: December 04, 2012, 08:08:52 pm » |
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
Faraday Member
Karma: 38
Posts: 6056
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #7 on: December 04, 2012, 08:19:55 pm » |
Your code is not that long. Must be the libraries taking too much space.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Online
Edison Member
Karma: 31
Posts: 1733
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #8 on: December 04, 2012, 08:20:58 pm » |
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
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 13
|
 |
« Reply #9 on: December 04, 2012, 08:24:06 pm » |
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
Faraday Member
Karma: 38
Posts: 6056
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #10 on: December 04, 2012, 08:28:33 pm » |
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
Online
Edison Member
Karma: 31
Posts: 1733
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #11 on: December 04, 2012, 08:31:23 pm » |
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
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 13
|
 |
« Reply #12 on: December 04, 2012, 08:32:40 pm » |
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
Online
Edison Member
Karma: 31
Posts: 1733
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #13 on: December 04, 2012, 08:40:06 pm » |
If your pressed on time then go with a MEGA. You might need a new ethernet shield thou.
Ebay has both.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 13
|
 |
« Reply #14 on: December 04, 2012, 11:25:03 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
|