Question: Can we log data on an Arduino without an SD card?

warren is asking a question about data-logging
Follow this topic

by warren | April 02, 2019 15:06 | #18936

I've been thinking about the #simple-air-sensor and how we could extend it to log without increasing the cost much -- I do think we could make a Raspberry Pi variant that'd have some advantages, but I also remembered that there is some very small amount of EEPROM memory on the Arduino -- I looked it up and it has 1024 bytes of memory.

If each reading of PM 2.5 is, say, 3 bytes (could be less, depending on how we store it) and we want to store roughly each half hour, we'd have about 166 hours of logging time. 166 hours is almost 7 days -- that is, ~6.9 days .

Note that there's no real-time clock (RTC) on the basic Arduino Nano, so we'd want to record a marker whenever it's started up, so you can see when the last "run" started (i.e. how long it's been running uninterrupted)

We could have it output the data whenever you start up the device, as fast as it can over serial, OR using #webjack, potentially. Then it'd start logging again.

When it reached the end of 166 hours, it'd start recording over old data, like a CCTV camera. When you see all the data, it'd be broken up by the markers to show each "run" of recording.

If we wanted to store PM1, PM2.5, and PM10 (all three sizes the #Plantower sensors can detect), we'd have 1/3 the storage. If we recorded every hour instead of every half hour, we'd have double.

Anyways, this'd take some coding on the Arduino to make it work, so I opened an issue here:

It's not perfect, but it would be possible without any additional cost, which is pretty nice.


Writing data to eeprom will work with the limitations you outline.

Adding a microSD card module and 128 MB SD card costs less than $2.00.

Adding a RTC costs less than $1.00.

The code to save data from a Plantower sensor using this hardware is more or less already available.

To avoid the obstacle of wiring four devices together (Nano, Plantower, SD card, RTC) you can spend $3.50 for a Nano data logging shield. Assembling the final air sensor then requires plugging the shield into the Nano and connecting the Plantower with three DuPont wires. The code already exists for operating this.

This solution will save all the measurements produced by a Plantower for a year with an accurate timestamp on each entry. People know how to retrieve the data from an SD card.

For another $2.50 you can add an LCD or OLED display for real-time display of air quality data.


Thank you so much for this detailed response!

Reply to this comment...

Ran some additional quick calculations on this:

~320 total 3-byte recordings

10s interval = ~30 minutes 1m intervals = ~3 hours 5m intervals = ~15 hours 30m interval = ~7 days

Reply to this comment...

Log in to comment