Expanding Arduino RAM?

A friend and I are planning some animatronics projects for Halloween/Christmas. These animatronics would be outdoors for at least a couple weeks at a time, so running from a laptop probably isn't appropriate.

I wrote an Arduino program that records servo movements from a joystick, and allows playback. It's working well. So far, I've allotted 3K for the storage array for a single servo, which would give me a minimum of 5 minutes recording at 10 ticks/second, and should handle the length of a normal song. I've built in compression to record ticks where the servo doesn't move. It's working well.

But we want to be able to record/playback at least 4 servos. This means I would need 12kb RAM + overhead.

So, is there a way to increase Arduino RAM? Specifically, I'm testing using a Mega 2560, but same would be asked for the UNO.

An SD card reader might help. Using the EEPROM of the Uno. Using an EEPROM from a RTC module.

When I searched for ways to expand the Uno's RAM, I ran into the RaspberryPi and the ESP32 which I selected for my desired RAM expanded MCU's.

The RAM in an 8 bit Arduino is fixed. You need to do something else, such as external SD card or other flash memory and read in the data as needed.

ATMega1284p has eight times the RAM as the 328p, and twice as much RAM as the ATMega2560

Or just use an ESP8266 such as a WeMOS D1 Mini.

Cheap and powerful. :+1:

And WIFI :+1:

https://www.youtube.com/watch?v=vpiuc9c7dzE

An basic Uno/Nano has 32k Flash to store fixed patterns.
Seems there could be someting wrong with your code.
Leo..

2 Likes

Watch this:

An option:

You can get "Serial SRAM" chips that will connect to an AVR by SPI (or I2C); or FRAM, which is actually non-volatile (but more expensive.)
EEPROM or Serial Flash might be another option, if you're more careful about how often they are written.

Also, the atmega2560 has an external RAM bus that you can connect to parallel RAM chips "relatively easily" (uses up a bunch of pins, though.) A couple of RAM upgrade boards and/or designs exist. For example QuadRAM — Rugged CircuitsRugged Arduino and Arduino MEGA 2560 32Kb RAM shield | Hackaday.io

If you don’t want to use SD card use ESP32 with PSRAM

If you use an ESP32, you have about 290k of RAM, and probably won't need additional memory. (Still the modules with extra PSRAM aren't much more expensive, so...)
(an ESP32 actually has about 384k of data ram, but ~100k is used by the internal IP and BT stacks.) (Where is my RAM ?, i want more ! - ESP32 Forum )
OTOH, most ESP32 boards may be pretty short on pins when it comes to driving multiple motors and joysticks/etc.

No, it does not neccessarily mean that.

If you declare an array and initialise it with a large amount of data, then that data gets stored in the Arduino's flash memory when the sketch is uploaded. When the sketch begins, before setup() runs, the data is copied from flash to ram memory ready for use by the sketch. This is done on the assumption that the data might need to change as the sketch runs. That's not the case with your sketch, I suspect. If so, it's possible to prevent the data getting copied to ram, and have your sketch read it directly from flash memory. It's slightly trickier to code, but we can help you get it right. The keyword PROGMEM and functions like pgm_read_word_near() need to be used.

Even if you declare it static const?

Yes, I believe so. At least on AVR based Arduino, which have Harvard architecture, so accessing data stored in program memory requires the use of those special functions. The compiler won't take care of all that for you if your data is const, unfortunately. I don't know why. It would be nice.

deleted. info previously posted.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.