Any simplified SD/GPS/OLED libraries?

Hi,

I have just about finished the physical design on a compact GPS module using an ATmega328 when I realised that the blnking thing doesn't have enough memory to hold all 3 SD/GPS/OLED libraries.

It has just enough program storage space but the dynamic storage is at 144%!

Are there any simplified (smaller) libraries for these components that I could use?

Components:

  • ATmega 328
  • Adafruit Ultimate GPS
  • Catalex MicroSDcard adapter (with a 4GB HC card)
  • 4 pin OLED display

Thanks in advance!

My guess is that the OLED display Library is using most of it. Try using only one Font.

To test, use two Fonts and compile, then remove one Font and compile again. Compare the difference in memory use and it will give you a rough idea of how much each Font is taking up. Either that or get a Mega256. :slight_smile:

I have a good GPS/SD.LCD system running fine on a Uno at 85% Flash and 76% SRAM and using these libraries for a 20x4 LCD display. Not OLED I know. :slight_smile:

#include <SPI.h>
#include <SD.h>
#include <Time.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

That was my first Arduino project, more or less. I had a couple of sensors as well. I did a lot of things to reduce the size of the RAM which was the biggest problem when I started. But in the end nearly half the RAM was empty.

The biggest savings (1K) was switching to a text only OLED library. I took an existing one and modified it. I think it's pretty good but Bill Greiman recently updated his text only library (SSD1306Ascii) and it's better than mine, documented and he'll support it.

I also switched from SD to SdFat which saved me about 65 bytes of RAM up front and another similar amount in stack space. SD has changed somewhat since then, as has SdFat, so my comparison may not be valid any more. But SdFat has other advantages so it's still worth considering.

I wrote my own GPS code to fit the specific needs of my project. It's much smaller and uses less memory than TinyGPS. There is another library that is worth looking at (NeoGPS). It's specifically designed to be configurable to allow for a maximum of memory savings.

All of this took a lot longer than it would have if I'd just started with a Mega. But I learned a lot along the way. That's at least half the reason I built the thing in the first place.

YMMV.

I have a good GPS/SD.LCD system...

@WaitSome, did you ever post that anywhere? I know you asked us where you could put it... :wink: Wait, are you using TinyGPS++? I thought you wrote your own...

Cheers,
/dev,
Official Blame-Taker for NeoGPS

It usually goes like this: you have some success with arduino uno and start adding more libraries then before you know it, there is not enough space on UNO. Unfortunately the next board up is MEGA2560. It is bigger and more expensive. I believe you did your best optimizing already. Now you can decide what to do. You can just upgrade to MEGA, or if you want to learn more, try running the GPS and sensors off another ATMEGA328 chip and have two ATMEGA328 talk to each other.

I believe you did your best optimizing already.

For the GPS part, he could save 285 bytes of RAM. That still leaves him at 130%, though. :frowning:

@CallanMackay, you should post/attach your sketch so we can review it. Are you using the F macro for string literals? Are you using the String class? etc.

Cheers,
/dev

Thanks guys!

The text only OLED library worked a peach! Down to the right size now. I will try using the NeoGPS library too some time, I left it out just now because the examples were a bit confusing.

Glad it worked for you, Maria.

the examples were a bit confusing.

Even this one? :cry:

I recently simplified the examples, on Oct 6th. If you haven't seen them yet, they might be easier to understand. And please feel free to ask a question. It helps me to improve the library, examples and docs tremendously.

Thanks,
/dev