Close

EEPROM and SD write times

A project log for µPower (beehive) SD logger

Let's observe an emerging beehive throughout the year 2018! (And create an logger from scratch for that purpose)

JanJan 07/28/2018 at 15:100 Comments

My new program takes shape slowly. After all it's quite hot here with some days over 35°C, which we don't get too often in Germany...

Anyway, I switched from putting together the CSV string directly in EEPROM to a struct which has all the values in it. This saves a lot of space. With my 512Kb 24LC512 I can save 3120 log entries with 21 bytes each. This is more than a whole month without switching on the SD card while still taking 4 readings per hour. As there's space for two EEPROMS on the PCB, I theoretically could put two M24M02 2Mbit chips which would give me >4 months of data storage. These are quite expensive though...

The human readable strings are put together on the fly when the EEPROM is full and everything needs to be written to the SD. I tried two methods:

  1. writing each value, separator, value, separator...
  2. making a whole string from it before writing to the SD

Method 2 is much faster, so I used that.

Writing to the EEPROM is between 3 and 5 milliseconds per LOG, which is not of interest to me as this doesn't need much power and is done only 96x/day as part of the sensor-reading, wake-up etc routine.

What is of interest are SD write times:

It takes close to 18 seconds to read the (whole) EEPROMs content, convert it to CSV and save it to the SD card. I do not use optimized write routines like writing full blocks/raw data.

I don't care about that at this point, because writing to the SD for say 20 seconds once a month is perfectly fine. The logger is off @ 75 to 85µA idle power consumption for 99.88% of the day anyway!

Using totally conservative numbers, I should get way over one year of battery life:

Oregon embedded battery calculator

I have a post about using C++ structs and unions as a draft, but it's not yet ready. Stay tuned!

Discussions