Do I need external memory?

Hi there,

I am developing a wearable which connects to a mobile app over BLE. Data is sent every 10 seconds and includes a timestamp, a step value, and a heart rate and other data (total of 32 bytes).

I am looking to find a way to store this data on the board when not connected to a mobile device. What is the best way of doing this? Should I store the data in the MCU internal flash?

I am using a SAM D21.

The device is small (35 x 35 mm).

Thanks

32 bytes every 10 seconds is 192 bytes per minute. 6 minutes of this will fill the Arduino UNO's EEPROM memory.

On the SAM D21 (Arduino Zero) the EEPROM library will allow you to use up to 16KB of the flash memory as if it was an EEPROM. That gives you 85 minutes of logging. Maybe if you cut down the logging rate in this mode? Maybe store a summary every 2 minutes, then you can stretch it out to many hours. I highly recommend using the EEPROM library to start with as it will insulate you from all of the weird things required by the flash memory.

You are right on the corner of several different technologies. Most people trying to log data on an Arduino are using much more memory and then the solution is obvious: use an SD card. The SD card is easy to use for moderate amounts of data (not megabytes per second) and easy to pop out and feed into a full-size PC for analysis.

For a mobile device, you do worry a little about the SD card remaining secure in its slot. If it has to endure impacts while logging data then a hard-soldered FRAM chip is desirable. But in every other case the convenience and simplicity of the SD card are winners.

Hi MorganS,

Thanks for the response.

I forgot to mention, in this mode, I am only writing data every minute.

Unfortunately, due to PCB space, I am unable to use a SD card. However, I do like your idea about using the EEPROM library.

Are there any alternatives which would allow to expand my memory such as using a SPI flash chip?

Thanks

I've used one SPI flash chip and I would not recommend it. If I was going to do it again I would use an FRAM based chip.

If you can't fit a micro-SD card then you don't have much space for a chip either.

ddesousa:
I forgot to mention, in this mode, I am only writing data every minute.

Unfortunately, due to PCB space, I am unable to use a SD card. However, I do like your idea about using the EEPROM library.

Using processor Flash memory as EEPROM might seem attractive, but Flash memory tends to have a very limited write life, say 10,000 writes, so at one write a minute you could wear it out in 7 days.

A FRAM is a very good idea.

A Fujitsu 2k byte FRAM costing around £1, has a write endurance of 10,000,000,000 times.

The Cypress FRAMs of the same size and cost claim a write endurance of 100,000,000,000,000 times.

These FRAMs are typically 8pin SOIC devices.

Hi all,

Thank you for all the reccomendations.

I do have space for a chip as they are much smaller than an SD card and can be placed in the middle of the PCB.

I also need more than 2KB of RAM.

Is it good to retain a large array which fills up as I store data instead?

ddesousa:
Is it good to retain a large array which fills up as I store data instead?

Assuming that you're talking about internal memory, there are no problems with that. However, power loss will result in data loss.

ddesousa:
I also need more than 2KB of RAM.

A quick google for 'fram datasheet' shows a 512K x 8. For how long do you need recordings? Few minutes, few hours, few days?

I have seen EEPROM or falsh (emulated EEPROM) burned out after a few weeks when project specifications were change from updateding every few months to evey few minutes. I would use FRAM which also has the advantage of retaining informaton after power loss

I am using a SAM D21.

I also need more than 2KB of RAM.

Don't forget that the the SAMD21 has up to 32k of RAM which you can use to buffer data, as long as you have power.

ddesousa:
I also need more than 2KB of RAM.

Can you reveal how much RAM you need ?

Look at Adafruit's Itsybitsy M0 Express SAMD21 breakout board. It's got a 2MB flash chip in addition to the 256K/32K onboard flash/ram. I'm using it to hold arrays of light intensity data in a light meter application.

Hi everyone,

It can be assumed that the memory may be volatile (I rather not) but I should be able to write at least a couple days worth of data.

I will look into FRAM as it seems like a suitable option.

MorganS, does this chip allow me to read and write to it many times (not just a 1000)?

If it refers to FRAM, the answer was given in reply #4.

Thanks everyone,

I have decided to go with a 32 KB FRAM as seen:

Thanks!

ddesousa:
Thanks everyone,

I have decided to go with a 32 KB FRAM as seen:

Adafruit I2C Non-Volatile FRAM Breakout - 256Kbit / 32KByte : ID 1895 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Thanks!

Thats an OK product, but a micro SD card is around the same size.

Hi srnet,

The problem is that I cannot fit the uSD card in the middle of the board.

Since you mentioned that its "OK", is there anything else you would recommend besides an SD card?