Using a Micro SD to store Arduino code, or bitmap images for an oled display?

Hi! this is my first time posting. I'm wondering if there is a way to use a Micro SD card to store code, or bitmap images for an OLED display, since the built-in memory is so small, and my project needs a lot of bitmap images, like splash, low battery, charging battery, plus color images if supported. If I could store code on a micro SD, that would be useful, as I could make a super big project.

I would use an 8GB card, SSD1351 1.5 inch color OLED, and a nano.

Thanks in advance!

Yes it's possible to store images. All you need is a micro SD card module. Arduino even comes with built-in libraries to read/write SD card. A simple internet search will bring up many tutorials on how to do it.

If by "store code" you mean like extending the program memory then no it's not possible. You can only store data such as images,sounds,videos,text,etc. in the SD card but not executable Arduino code.

More specifically, the AVR processor only fetches instructions from FLASH/PROGMEM memory. It doesn't execute from RAM. Only instructions in the bootloader segment of FLASH/PROGMEM can write into FLASH/PROGMEM. In theory, you could customize a bootloader to allow you to copy code from an SD card into FLASH/PROGMEM to execute but that is a non-trivial programming challenge. It would also be a challenge to get a large sketch divided into segments so that it can be loaded in chunks.

If you need more code than you can fit into a nano, get a more capable micro controller, such as a Feather or Teensy.

Take a look here and at some of the links for moving code from SD to flash. https://hackaday.com/2012/02/21/flash-an-arduino-from-an-sd-card/

It is common I think to read images from SD card and write them to a display. Rewriting the Flash memory, not so much.

Just be aware that the libraries for accessing the SD card typically allocate a 512 byte buffer in ram, that often is a problem when there are other devices such as an OLED display that can use a considerable amount of ram.

Thanks!

wildbill: If you need more code than you can fit into a nano, get a more capable micro controller, such as a Feather or Teensy.

Can you give me the link to buy it?

simpleprojects: Thanks! Can you give me the link to buy it?

Nevermind I got it

All these things you want to do.

Image from SC card.. Pretty straight forward IF they are .bmp images. Things like jpg images, you'll need a decoder and a bunch of time & RAM to figure out how to get it to work.

Swapping programs? You can "effectively" do that. But I doubt you'd like to tackle that one. It's a lot of code. Like, you'd really have to ENJOY writing code to accomplish that trick.

-jim lee

jimLee: Like, you'd really have to ENJOY writing code to accomplish that trick.

i ACTUALLY sorta do... but i've only been using arduino for about a year, and things tend to not work for me. (Micro - Wont upload, screen stopped working, ordered more screens, BOTH of the bottom half wouldnt display properly, DS1307 battery keeps popping out, arduino wont recognize DS1307, etc) So this 1 project probrably costed about 150-200$ when it should have been 50-75$.