Data store options on arduino uno

I'm looking for some guidance on data storage, I need to record some values, possibly in an array, in an array and spit them back out when the user enters a certain serial input.

I'm having trouble deciding how best to store all the values, does anyone know if The Uno has enough memory to do this or if I need to move on to EEPROM.

The values are currently float values in the form of X.X and will always be 1 single digit with 1 decimal place. I suppose I could store them and manipulate them as I return them if it makes a difference.

If anyone has any advice it would be greatly appreciated.

Values from 0.0 to 1.9… Multiply by 10 and store as byte will give place for 4x the number of data. An UNO has some 2000 of RAM mnus the need if the code.

Katsuki: I'm looking for some guidance on data storage, I need to record some values, possibly in an array, in an array and spit them back out when the user enters a certain serial input.

I'm having trouble deciding how best to store all the values, does anyone know if The Uno has enough memory to do this or if I need to move on to EEPROM.

The values are currently float values in the form of X.X and will always be 1 single digit with 1 decimal place. I suppose I could store them and manipulate them as I return them if it makes a difference.

If anyone has any advice it would be greatly appreciated.

Do you think that the number of data points might be relevant? It would certainly help answer the question about whether or not you have enough memory.

Delta_G: Do you think that the number of data points might be relevant? It would certainly help answer the question about whether or not you have enough memory.

Yes, I reckon I need a maximum of 4000

Here is a link to the capacity of the different Arduino boards: https://www.arduino.cc/en/Products/Compare

Railroader: Here is a link to the capacity of the different Arduino boards: https://www.arduino.cc/en/Products/Compare

Thanks, and right in saying that only the SRAM and EEPROM can be used for storing data, the flash memory is for program only?

It is relatively easy to interface an SD card module. Then you can have access to Gigabytes of storage. There is a way to store data in flash (program memory) on some Arduinos, but a special bootloader is required. Also, there are external memory chips that can hold your data. Intefaced with I2C or SPI, volatile and non-volatile.

One more thing that we need to know is the rate at which data needs to be written (bytes per second).

groundFungus: The Uno has 2K bytes of SRAM and 1K bytes of EEPROM so neither type of memory will work to store 4K bytes. It is relatively easy to interface an SD card module, though. Then you can have access to Gigabytes of storage. There is a way to store data in flash (program memory), but a special bootloader is required. Also, there are external memory chips that can hold your data. Intefaced with I2C or SPI, volatile and non-volatile.

Thanks for this

groundFungus: One more thing that we need to know is the rate at which data needs to be written (bytes per second).

Not very fast at all, assuming it doesn't stop the program from running while the write takes place it would be close to 1 value per second as they come in

Katsuki:
The values are currently float values in the form of X.X and will always be 1 single digit with 1 decimal place. I suppose I could store them and manipulate them as I return them if it makes a difference.

With the values on an 8-bit cpu with no fpu you have the option to count in tenths where 3.4 would be 34.
If I want to work meters to 3 places my working unit may be micrometers so that round-offs and dropped digits are below my 3 places, my variables would be type long which is good to 9 places. Call it fixed point if you want, it’s integer working-units to me. I can use type int to store 4 place trig values and divide by 10000 if need be later.

X.X only varies from 0.0 to 9.9, a single byte could store any of those.

Edit= Errrr — this part is for data you know before runtime.

On an Uno you have whatever of the 32K flash the bootloader and your sketch don’t fill to store constant data; prompts, labels, values, tables, etc. It would take a big sketch to leave < 20K for const data, be sure! A table of 4000 bytes… you could go more data points and higher precision and likely not run out of space.

What you want to learn about is PROGMEM. Bytes from flash take 3 cycles to fetch, only 1 more than bytes from RAM.

Here is what’s at the heart of the Arduino compiler: AVR Libc Home Page

Here is the program space library: avr-libc: <avr/pgmspace.h>: Program Space Utilities
With that an a good forum thread on PROGMEM you should have enough to get there from here.

Pre-calculation tables can speed the heck outta calculation-heavy code.

Bigger data, look to SD (which you do not treat like a HD unless you like to wear SD cards out early) or bigger AVR chips like the 1284P with 16K RAM, 128K flash, 4K EEPROM or the mega2560 board that can take external RAM.

If you want to do floats, get an ARM chip board. They’re 32-bit and maybe allow 64-bit floats while for AVR-duinos the floats are 32-bit (6 places) only. The Teensy 3.6 has an M4F chip with an FPU and 256K RAM for starts.

SD card is probably easiest. It is certainly fast enough to record 1 byte or float value per second. Once the data is recorded you can pop the card out an plug it into a PC to retrieve the data. Or leave the card and have a routine to transfer the data over serial to the PC.

SD tutorial.

I like the Adafruit SD card module because the MISO line is not passed through the level shifter. Modules that pass the MISO line through the level shifter mess with the functionality of the SPI bus rendering the SPI bus useless for other SPI devices.