7

I would like to constantly save data coming from sensors (for an activity tracker) while consuming as less battery as possible (I'd like to have a 4/5 days autonomy on a 3000 mAh battery) but I can't find the best way to save about 2 kBytes/s on a memory large enough to contain several days of data.

Sensors would be read at a rate of 20 times per second and produce about 100 bytes each time.

What options do I have in order to:

  • store such an amount of data (hardware)?
  • ensure the system can work properly with required autonomy?
  • 2
    What options have you explored? Also, 2KB/s is a lot of data. Are you sure all of it is essential and there are no redundancies? – asheeshr Mar 16 '14 at 14:16
  • 1
    You need to clarify your needs further: what Arduino board do you use, what kinds of sensors are there, WHERETO do you need to save these 2KB/s? It is important to understand that no Arduino alone will have enough memory to store 2KB/s during days. – jfpoilpret Mar 16 '14 at 14:19
  • 1
    @AsheeshR Well, I calculated that all the data coming 20 times per second would be about that (2KB/s), well yes, it is, because since It will be some pretty hard to do activity recognition, the Arduino probably won't have such computation power, so I need to do that later, on a computer. – Trevör Mar 16 '14 at 15:05
  • 1
    SD cards are all over the place with current consumption. 5mA whilst writing is the lowest I have seen, 100mA the highest, but the spec allows for 200mA. Typical is maybe 30-50mA. They use quite a lot of power when using the SPI interface. – Cybergibbons Mar 16 '14 at 18:16
  • 1
    I think it's critical to answer the question hinted at by jfpoilpret, which is: What is the data you're storing? Is there any way to consume just the minimum amount of compute cycles on the Arduino in order to pack this data a bit more compactly. 2kB/s is a fair amount of data for a microcontroller to collect and send to storage. And yes, for data logging, SD cards are pretty much the best option, if only for the fact that the card can be physically moved off to a computer for proper data analysis. – WineSoaked Mar 16 '14 at 19:58
4

There are two constraints here, and I think it might back you into a corner. Size and then power.

2Kbyte/s is 2*60*60*24/1024 = 168.75Mbyte/day. This is a lot. The only readily available technology that can be used with a small microprocessor that can store this volume of data is an SD card. There are no serial EEPROM or flash chips this large, and the Arduino, as far as I know, can't deal with the NAND flash used in USB sticks and SD cards.

However, SD cards can be relatively power hungry. They draw between 5mA and 100mA when writing, typically around 30-50mA. The SD spec says the maximum is 200mA. Writing is also quite lengthy as they operate on blocks of data rather than individual cells. I've never done a full analysis of how much power they use, but it is not insignificant and much, much more than serial EEPROM or flash.

So your only choice, if you have to store that much, is to go with SD cards.

I would investigate compressing the data. Even very basic schemes can make a huge difference.

  • Thank you for your answer ! What do you think about saving the data on a small low power flash memory (like this one : adafruit.com/products/1564) and then, when this memory is full, saving it on the SD card ? Wouldn't it save power ? – Trevör Mar 17 '14 at 8:16
  • Yes, there is potential to save power. It is much better to write to the SD card in large blocks because even if you change a single byte, it has to update the whole block. How big that block is, I don't recall. – Cybergibbons Mar 17 '14 at 8:39
  • Actually, I think that an Arduino probably can deal with a bare NAND flash (at least if few of the pins are already used, or one is willing to add an external latch for as a demultiplexer), but one would have to consult data sheets to see if the power consumption would be lower than a carefully selected SD card. – Chris Stratton Mar 19 '14 at 21:12
1

This would be possible with a standard SD card.

Capacity

Using some simple calculations, I was able to find that writing at 2kB/s for 5 days would only consume 0.8GB. You could probably get by with a 1 or 2 GB card.

Speed

I found this benchmark, which says it is possible to write SD card data from an Arduino at 192 kB/s, which should be more than enough for your needs.

There are a lot of great tutorials and examples out there for using an SD card with an Arduino. The official documentation is always a good place to start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.