EEPROM: everything you need to know about this memory


If you are a maker and you are doing some DIY projects in which you have to work with memory, surely you already know how the different memories that Arduino integrates work, such as flash (non-volatile where the sketch and bootloader are stored), SRAM ( a fast and volatile memory where program variables remain during processing), and the EEPROM (non-volatile and can be used to store reboot information).

Well, in addition to the EEPROM included in Arduino, you can also use external chips of this kind of memoryAs one more component. They are not complicated to understand, nor to interact with them to generate accesses (writing and reading) or updates of the stored information. Here you will find everything you need to know to start working with these types of memories ...

What is EEPROM?

STMicroelectronics EEPROM

STMicroelectronics EEPROM

La EEPROM (Electrically Erasable Programmable Red-Only Memory) It is a type of ROM memory, that is, non-volatile memory in which data will be stored permanently, even if the power supply is removed. That puts them on the other side of RAMs (Random Access Memory), which lose all their data when they are not powered.

In the case of EEPROM, it is not a memory like ROM, in which data is recorded and can no longer be altered. EEPROM, like flash, admits to being altered as needed. That is, some data can be stored and erased to store different ones.

In fact, as its acronyms indicate, it is a electrically erasable memory (electrically erasable) for reprogramming. This differs from other types of ROM, which are also erasable like EPROMs, but in this case electricity is not used to erase the memory cells, instead they had a quartz "window" on the chip to be able to project a UV light. with which it was erased.

That characteristic of EPROM it made them somewhat uncomfortable, having to project those rays to erase them. And, worst of all, they could be accidentally erased if exposed to this type of radiation. In EEPROMs, it is allowed to do it through voltages, in a more comfortable and safe way.

Internal structure

EEPROM diagram


In order for EEPROM to work, very particular memory cells are needed. They are built using MOS type transistors, but have a floating gate compared to traditional MOSFETs. These new transistors follow a structure known as SAMOS, and its normal state is cut off and the output will always provide a logical 1.

These EEPROM cells can be read an unlimited number of times, but it is limited in the number of times they can be erased and reprogrammed, as it happens to many others. This also happens to flash, which is why there has been so much talk about the durability of SSD hard drives, pen drives, etc.

In the case of SAMOS, this limit is between the 100.000 and 1.000.000 times. After that, they will fail. By the way, some structures that were created by an old acquaintance, one of the greats: Dr. Fujio Masuoka from Toshiba (1984), who has also created other important memories and semiconductor structures ... However, the first chip launched on the market was Intel's from 1988, a NOR type EEPROM.

In addition, you have to know that this type of memory is usually linked to CPUs or controllers through bus with protocols like SPI, I2C, etc. In the case of MCUs (microcontrollers), it is usually integrated inside, as in some DSPs, to achieve greater speed.

As can be seen in the image above, the SAMOS transistors that form the memory cells, are grouped in that case in pairs. One of the lines attached to the gates of some transistors acts as a choice line, to mark or signal that line for accesses (reading and writing), and the other will be the one that stores the information bit (0 or 1).

The transistors are aligned to form the required word lengths (4-bit, 8-bit, 16-bit, ...) and as many words as capacity you want to have the EEPROM (eg: there can be 64-bit word lengths and with 16 lines = 1024 bits, that is, 1kb).

How does an EERPOM work?

As you can see on the side, to perform the different tasks, the voltage of your gate, source and drain must be a concrete one:

  • Door at 20v and Drain at 20v = programming (writing) of the memory cell to store the desired bit.
  • Door at 0v and Drain at 20v = clear the stored bit so that it can be reprogrammed with another value.
  • Gate at 5v and Drain at 5v = read the stored bit. As the gate voltage is lower than that of the writing, the stored value will not be altered. The same happens with the drain voltage, being lower, the stored bit will not be erased.

Conclusion, EEPROMs use a few voltages "High" for erasing and writing, while using lower voltages for reading ...

Buy EEPROM and work with it

STMicroelectronics, the French manufacturer of microelectronics, is number one in this type of EEPROM chips, although there are many other manufacturers, such as Microchip. These chips are usually quite cheap.

If you decide to use one of these chips, you should see the manufacturer and model and look for its datasheet to see all the manufacturer's recommendations, as they may vary from one to another. For example, they will specify the voltages with which it works, the pinout, etc. So you can configure your project properly.

Depending on the size and model, it may have more or less pines. But to give you an idea, a typical 24LC512 EEPROM IC chip, could be composed of:

  • Pins 1 (A0), 2 (A1), and 3 (A3) used in the configuration are the selection pins.
  • Pin 4 (Vss / GND) connected to ground.
  • Pin 5 (SDA), for serial data for I2C communication.
  • Pin 6 (SCL), for the clock for I2C.
  • Pin 7 (WP), write-protect or write protection. If it is connected to GND, writing will be enabled. If it connects to Vcc it is disabled.
  • Pin 8 (Vcc), connected to power.

As for the Technical specifications of this chip:

  • 512K (64 × 8)
  • 128-byte buffer for writing
  • Operational voltage: 1.8v to 5.5v
  • Reading current: 40uA
  • Communication bus: I2C
  • Write cycle: 5ms
  • Clock compatibility: 100-400Khz
  • Durability: 10.000.000 cycles
  • Can be cascaded up to 8 devices
  • Packaging: 8-pin DIP, SOIJ, SOIC and TSSOP.

Dónde comprar

For, buy EEPROM chips, you can take a look at these recommendations:

Using the Arduino EEPROM

Screenshot of Arduino IDE

If you want to start working with the EEPROM, you can also try the one on your board Arduino. It can be programmed in a simple way to understand at a logical and programming level how it can work.

Example to save a variable

//Almacenar un valor en la EEPROM
#include <EEPROM.h>
float sensorValue;
int eepromaddress = 0;
//Función para simular lectura de un sensor o pin
float ReadSensor()
  return 10.0f;
void setup()
void loop()
  sensorValue = ReadSensor(); //Lectura simulada del valor
  EEPROM.put( eepromaddress, sensorValue );  //Escritura del valor en la EEPROM
  eepromaddress += sizeof(float);  //Apuntar a la siguiente posición a escribir
  if(eepromaddress >= EEPROM.length()) eepromaddress = 0;  //Comprueba que no existe desbordamiento 
  delay(30000); //Espera 30s

Example to read data from EEPROM

//Leer una variable de coma flotante
#include <EEPROM.h>
struct MyStruct{
  float field1;
  byte field2;
  char name[10];
void setup(){
  float f;
  int eepromaddress = 0; //La lectura comienza desde la dirección 0 de la EEPROM    
  EEPROM.get( eepromaddress, f );
  Serial.print( "Dato leído: " );
  Serial.println( f, 3 );  
  eepromaddress += sizeof(float);
void loop()

Example to update values, reschedule

//Actualizar valor de la EEPROM escribiendo el dato entrante por la A0
#include <EEPROM.h>
int eepromaddress = 0;
void setup()
void loop()
   int val = analogRead(0) / 4;
   EEPROM.update(eepromaddress, val);
  eepromaddress += sizeof(int);
  if(address == EEPROM.length()) eepromaddress = 0;
  delay(10000);  //Espera de 10 segundos

More information - Free Arduino course

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.