There will come a point where you will want to store data which isn’t lost when your microprocessor loses power. This is particularly handy for storing calibration or configuration values, to save you having to re-calibrate some piece of hardware (e.g., IMUs, and servos) every time the power cycles. One solution for Arduino boards is using EEPROM (Electrically Erasable Programmable Read-Only Memory).
EEPROM is a type of non-volatile ROM that enables individual bytes of data to be erased and reprogrammed. It is used to store small amounts of data which are written occasionally and then read multiple times.
EEPROM is often contained within the microprocessor, and different boards will have different amounts. For example, the ATMega328P used in the UNO R3 and Nano, has 1024 bytes (1KB) of EEPROM. It is organized as a separate data space, and the EEPROM data bytes are addressed linearly between 0 and 1023.
Volatile memory is temporary and loses data when power is lost,
while non-volatile memory retains data even when the power is off.
Both types of memory serve critical roles in computing systems,
with volatile memory providing the working space for active processes
and non-volatile memory providing long-term data storage and program
The following Arduino boards all have some form of EEPROM:
- UNO R4 Minima
- UNO R4 WiFi
- UNO Rev.3
- UNO WiFi Rev.2
- Mega 2560 Rev.3
- Nano Every
Static RAM (SRAM) and Dynamic RAM (DRAM) are two common types of
volatile computer memory with key differences:
SRAM uses flip-flops to store each bit of data. These flip-flops are
stable and do not need constant refreshing to retain data.
DRAM uses a capacitor to store each bit of data. Capacitors discharge
over time, so DRAM requires periodic refreshing to maintain data
Speed and Access Time:
SRAM is faster and has a shorter access time compared to DRAM. It
provides rapid access to stored data, making it suitable for cache memory
and high-speed applications.