How to calculate EEPROM memory size for sensor data?

Hello,

I can say that I am noob in electronics and programming. But little by little I want to learn a new things, so I'm sorry to you for my misunderstanding of things.

I want to ask, how I can calculate and select the required external eeprom memory size for Ambient Light Photo Sensor data? For example would it be possible if I read the sensor and store its data to a float data type variable, and leave at least three decimal places? Then I will try to read the recorded data and display it on the LCD display.

Thank you for your answers.

EEPROM size = data type size * required number of readings.

Lets see what we know. Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information. Floats have only 6-7 decimal digits of precision. That tells us each float needs 4 bytes of EEPROM. Next divide the number of bytes in the eEPROM by 4, that tells you how many numbers you can store. The number of bytes of EEPROM is determined by the micro you are using. If this data does not need to be kept after it is displayed, it might be best to save it in RAM as the EEPROM has a limited number of write cycles. This should get you started, if you need to know more we need more information. You might do a bit of reading on EEPROM and RAM, this will help clarify what I just said.

For example would it be possible if I read the sensor and store its data to a float data type variable, and leave at least three decimal places? Then I will try to read the recorded data and display it on the LCD display.

It could be simpler (and more economical in memory) to store the raw readings, and only do the floating point conversion when they’re due to be displayed.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.