Skip to content

Determine how much sensor data can be stored in memory/flash + extras #6

@curieos

Description

@curieos

I'm using an ESP32 feather from Adafruit for development. It uses an ESP WROOM 32 module with 4mb flash and 520kb ram. I'm using the Arduino framework, so information about how it slices the memory and flash is available somewhere. Currently the data is stored in a vector of SensorData structs. A SensorData struct:

struct SensorData {
float value;
char timestamp[TIMESTAMP_LENGTH];
};

The data is then written to a file in json format. I will post an example of this later. The sensors are read every 10 minutes, and each data point is kept for 12 hours. How long the vector can be is calculated based on math in the config file:

// Data Collection Settings
#define CHECK_SENSOR_PERIOD_MINUTES 10
#define DATA_MAX_AGE_HOURS 12
// Data Collection Math
#define CHECK_SENSOR_PERIOD (CHECK_SENSOR_PERIOD_MINUTES * TASK_MINUTE)
#define DATA_MAX_AGE (DATA_MAX_AGE_HOURS * TASK_HOUR)
#define DATA_MAX_SIZE (DATA_MAX_AGE / CHECK_SENSOR_PERIOD)

I need to know how much memory and flash this data takes up per data point per sensor, if using a vector vs an array or a custom datatype would make a difference, and how much flash is dedicated to SPIFFS/memory is dedicated to code. From this information, sensible defaults can be created. Remember to factor in how big the rest of the SPIFFS files are (perhaps some treeshaking can be done to minimize unused code) for flash, and for memory factor in how much is taken up by normal use as well as the initial overhead caused by loading the data after a reboot into a dynamic Json document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions