24 C 04
24 C 04
24 C 04
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.
Table of Contents
Pin Description
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
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
Features
The EEPROM device provides bidirectional data transfer and this communication takes place through
a 2-wire serial interface
It is a highly reliable device with an endurance of 1 million write cycles and the limit of data retention
is almost 100 years.
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.
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.
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
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
#include "Wire.h"
void setup()
Wire.begin();
Serial.begin(9600);
int address = 0;
writeAddress(address, val);
Serial.println(readVal);
void loop()
{
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.write(val);
Wire.endTransmission();
delay(5);
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.endTransmission();
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.
2D diagram
Table of Contents
Pin Description
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
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
Features
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
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.
#include "Wire.h"
void setup()
{
Wire.begin();
Serial.begin(9600);
int address = 0;
byte val = 110;
writeAddress(address, val);
byte readVal = readAddress(address);
Serial.print("The returned value is ");
Serial.println(readVal);
}
void loop()
{
{
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.write((int)(address >> 8)); // MSB
Wire.write((int)(address & 0xFF)); // LSB
Wire.write(val);
Wire.endTransmission();
delay(5);
}
{
byte rData = 0xFF;
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.write((int)(address >> 8)); // MSB
Wire.write((int)(address & 0xFF)); // LSB
Wire.endTransmission();
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.
2D diagram