24C04 Two-Wire Serial EEPROM Interfacing with Arduino

24C04 is a two-wire serial EEPROM which is an abbreviation of Electrically Erasable Programmable Read-Only Memory. This EEPROM IC provides an I2C communication interface.  It is basically a memory device which stores information and retains it even when we remove the power. It has a memory capacity of 512 words. Each word has 8-bits. The memory consists of 32 pages of 16 bytes each and uses a word address of 9-bit data for random word addressing from memory. The module uses the I2C communication protocol to communicate with other microcontrollers or digital devices.

24C04 EEPROM Pinout

It consists of 8 pins. This diagram shows the pinout of 24C04

24C04 Two wire I2C EEPROM pinout diagram

Pin Description

Pin#01, 02, 03: A0, A1, A2

These three pins are address inputs. The pins A2 and A1 are for hardwire addressing. You can address four 4K devices on a single bus system whereas the A0 pin is a no connect pin and normally, we connect this pin to ground.

Pin#04: GND

Connect this terminal to the main ground.

Pin#05: SDA

The serial data pin allows the bidirectional transfer of serial data and addresses.

Pin#06: SCL

It is a clock input pin that injects the data into each EEPROM device on positive edge of a clock and on a negative transition, it sends data out on the output pin of each device.

Pin#07: WP

As the name implies, the write-protect pin protects the hardware data. It enables read/write operation by connecting it to the ground pin. Only write operation is enabled, when applied with Vcc.

Pin#08: Vcc

Apply a voltage signal in a range of 1.7V to 5.5V at this pin.


  •  Low and standard-voltage operation
  • Vcc = 1.7V to 5.5V.
  • The memory has a capacity of 512 x 8 (4K) bits.
  • The EEPROM device provides bidirectional data transfer and this communication takes place through a 2-wire serial interface
  • Schmitt triggered inputs which can suppress noise.
  • It is a highly reliable device with an endurance of 1 million write cycles and the limit of data retention is almost 100 years.
  • Maximum clock frequency = 1MHz.
  • Hardware data protection through write Protect Pin

Where to use 24C04 EEPROM?

This device is well-suited for use in applications which require low-voltage and power for operation.  Many industrial and commercial applications use this device as it provides noise immunity and you can expand it by cascading 8 similar devices. You can easily interface with other microcontrollers. Computers and other electronic devices use this device to store data and avoid data loss when the power is turned off.

How to use it?

As already mentioned above, this device uses an I2C interface which consists of two wires named SDA and SCL. As it is a bidirectional bus, therefore, it can act as a transmitter or receiver. The SDA input pin is pulled high with a microcontroller or any other device. The data on SDA pin changes on a high to low transition of the SCL signal.

24C04 EEPROM Working 1

The low to high transition of the clock pulse signal indicates a start or stop condition. When a positive transition occurs at the SDA input pin with SCL high, it is a start condition. Stop condition occurs when a negative transition of the input signal takes place at SDA with SCL input being high. It puts the device in a standby power mode.

24C04 EEPROM Working 2

The EEPROM sends or receives addresses and data words serially in the form of 8-bit words and sends a zero as an acknowledgment that it has received each word. The figure below illustrates the effect on output on changing SDA and SCL inputs. Data In is SDA input.

EEPROM Working 3

24C04 Interfacing with Arduino

This is a connection diagram of 24C04 EEPROM interfacing with Arduino UNO. Connect the SCL pin of Arduino with the SCL pin of EEPROM. Similarly, SDA pin ( Arduino ) with SDA pin of EEPROM IC. Also, connect pull-up resistors with SDA/SCL wires.

24C04 EEPROM Interfacing with Arduino

  • Copy this code and paste it in Arduino IDE
  • Upload this code to your Arduino board.
  • This code will just read a value from address 0x00

You can modify this code according to your requirements.

#include "Wire.h"

#define EEPROM_I2C_ADDRESS 0x50

void setup()
int address = 0;
byte val = 110;
writeAddress(address, val);
byte readVal = readAddress(address);
Serial.print("The returned value is ");
void loop()


void writeAddress(int address, byte val)

Wire.write((int)(address >> 8)); // MSB
Wire.write((int)(address & 0xFF)); // LSB

byte readAddress(int address)

byte rData = 0xFF;
Wire.write((int)(address >> 8)); // MSB
Wire.write((int)(address & 0xFF)); // LSB
Wire.requestFrom(EEPROM_I2C_ADDRESS, 1);
rData = Wire.read();
return rData;

Example Application

You can easily interface this device with other microcontrollers. The figure below shows the connections. The microcontroller sends the data to EEPROM 24C04 which stores the data. You can use this circuit for designing smart car parking systems. Every customer who enters the parking area enters his CNIC number through a keypad. Microcontroller stores this CNIC number into the EEPROM device.  Now, if the customer wants to open that lock, the LCD will display “Enter your CNIC number” command. If the CNIC entered is matched with the stored CNIC in the EEPROM, it will open the lock where the car of a user is parked.

24C04 EEPROM Interfacing with microcontroller


2D diagram



24C04 Datasheet

1 thought on “24C04 Two-Wire Serial EEPROM Interfacing with Arduino”

Leave a Comment