Parts
24C02 EEPROM (24LC02B, AT24C02): pinout, I2C address and pull-ups
By Bulan Sarkar
The 24C02 is a 2 Kbit (256-byte) EEPROM on the I2C bus. Pin 5 is SDA, pin 6 SCL, pin 7 WP, pin 8 VCC and pin 4 ground. Its 7-bit address is 0x50, so the first byte after Start is 0xA0 to write and 0xA1 to read.
The two common versions differ on pins 1 to 3. On Microchip's 24LC02B they are not connected, so only one fits on a bus. On Atmel's AT24C02 they are address inputs and up to eight can share the two wires. The figures here come from Microchip's 24AA02/24LC02B sheet (DS21709J) and Atmel's AT24C02 sheet (0180Z1).
Datasheet: Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J) (PDF)
Pinout by package
Top view, notch up: pin 1 is top left. SDA on 5, SCL on 6, WP on 7, VCC on 8.
A0, A1 and A2 have no internal connection. Leave them open or tie them to VSS or VCC.
Source: Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 1 (package types, PDIP top view); Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 5 (Table 2-1 pin function table; section 2.4, A0 to A2 not used); Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 12 (package marking, 8-lead PDIP example 24LC02B I/P)
Top view, pin 1 at the dot. Same pin order as the DIP.
Source: Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 1 (package types, SOIC top view); Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 5 (Table 2-1, SOIC column); Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 12 (package marking, 8-lead SOIC example 24LC02BI)
Top view, notch up. Same pins as the 24LC02B, but A0 to A2 set the address.
Atmel marks the AT24C02 not recommended for new designs and points to the AT24C02B.
Source: Atmel (now Microchip) AT24C01A/02/04/08A/16A Two-wire Serial EEPROM (0180Z1), p. 1 (Table 1 pin configuration, 8-lead PDIP); Atmel (now Microchip) AT24C01A/02/04/08A/16A Two-wire Serial EEPROM (0180Z1), p. 3 (pin description: A2, A1, A0 hard-wired device address inputs, up to eight 2K parts per bus); Atmel (now Microchip) AT24C01A/02/04/08A/16A Two-wire Serial EEPROM (0180Z1), p. 14 (ordering information: AT24C02-10PU-2.7, 8P3 PDIP)
Which one do you have?
"24C02" is a generic name. Shops sell Microchip's 24LC02B and 24AA02, the Atmel AT24C02 and its later C and D versions, and unbranded copies under it. The pins, the 1010 control code, the 8-byte page and the 5 ms write time are the same on both sheets read for this page; the A0 to A2 pins are not.
The 24LC02B runs from 2.5 V to 5.5 V; the 24AA02 on the same sheet goes down to 1.7 V but drops to 100 kHz below 2.5 V. The AT24C02-2.7 runs from 2.7 V to 5.5 V. Atmel now marks the original AT24C02 not recommended for new designs, so new stock carries a later letter.
The I2C address, and the A0 to A2 pins
The first byte of every transfer is the control byte: 1010, three more bits, then R/W. On the 24LC02B the three middle bits are "don't care" and the A pins have no internal connection, so the part answers at 0x50 whatever you wire to them. On the AT24C02 those bits must match the A2, A1 and A0 pins, so tying all three to ground gives 0x50 and other combinations give 0x51 to 0x57.
Absolute maximum ratings
| Parameter | 24LC02B-I/PDIP-8 | 24LC02B-I/SNSOP-8 | AT24C02-10PU-2.7DIP-8 |
|---|---|---|---|
| Supply voltage, absolute maximum VCC | 6.5 V | 6.5 V | 6.25 V max operating; 7.0 V on any pin |
| Supply voltage, operating VCC | 2.5 to 5.5 V | 2.5 to 5.5 V | 2.7 to 5.5 V (-2.7 part) |
| Input voltage | −0.3 V to VCC + 1.0 V | −0.3 V to VCC + 1.0 V | −1.0 to +7.0 V |
| ESD protection | 4 kV | 4 kV | not stated |
| Operating temperature TA | −40 to +85 °C (I) | −40 to +85 °C (I) | −40 to +85 °C (industrial) |
Both parts run from a 5 V or a 3.3 V board. The 24LC02B takes 6.5 V on VCC before damage, and no input may go more than 1.0 V above VCC, so a 5 V signal must not reach a 24LC02B powered from 3.3 V.
Timing, current and wear
| Parameter | 24LC02B-I/PDIP-8 | 24LC02B-I/SNSOP-8 | AT24C02-10PU-2.7DIP-8 |
|---|---|---|---|
| Clock frequency fSCL | 400 kHz max | 400 kHz max | 400 kHz max (2.7 V and 5 V) |
| Output low voltage VOL | 0.40 V max at 3.0 mA | 0.40 V max at 3.0 mA | 0.4 V max at 2.1 mA, VCC 3.0 V |
| Input high / low VIH / VIL | 0.7 VCC min / 0.3 VCC max | 0.7 VCC min / 0.3 VCC max | 0.7 VCC min / 0.3 VCC max |
| SDA and SCL rise time tRVCC 2.5 V (Atmel 2.7 V) to 5.5 V | 300 ns max | 300 ns max | 0.3 µs max |
| Write cycle time, byte or page tWC / tWR | 5 ms max | 5 ms max | 5 ms max |
| Page buffer | 8 bytes | 8 bytes | 8 bytes (32 pages) |
| Supply current, read | 1 mA max | 1 mA max | 1.0 mA max (5 V, 100 kHz) |
| Standby current ICCS | 1 µA max (I grade) | 1 µA max (I grade) | by supply voltage, see sheet |
| Endurance | 1,000,000 cycles (25 °C) | 1,000,000 cycles (25 °C) | 1,000,000 cycles (5 V, 25 °C) |
| Data retention | more than 200 years | more than 200 years | 100 years |
A write is not finished when the Stop bit goes out. The chip then spends up to 5 ms programming the cells and ignores the bus while it does. Writing a page of 8 bytes costs the same 5 ms as writing one byte, so filling all 256 bytes takes 32 page writes, 160 ms, against 1.28 s one byte at a time.
A page write that runs past the end of its 8-byte page wraps round to the start of the same page and overwrites it. Pages start at addresses that are multiples of 8, so split writes on those boundaries.
Which pull-up resistor?
SDA is open drain: the chip can only pull it low, and a resistor to VCC brings it back up. The resistor has two limits. Too small, and the chip cannot pull the line under 0.4 V: at 3 mA that sets the floor at (5 V − 0.4 V) / 3 mA = 1.53 kΩ on 5 V, 967 Ω on 3.3 V. Too large, and the line rises too slowly. The 24LC02B sheet allows 300 ns from 30 % to 70 % of VCC, and an RC edge takes 0.8473 × R × C to do that. With 100 pF of bus capacitance the ceiling is 3.54 kΩ.
2.2 kΩ sits in the middle: a 186 ns rise, and 2.09 mA for the chip to sink on 5 V (1.32 mA on 3.3 V). Microchip's pin section suggests 10 kΩ for 100 kHz and 2 kΩ for 400 kHz. On 100 pF, 10 kΩ gives 847 ns, which meets the 300 ns figure only on a bus under 35.4 pF: one chip and short wires. Count the pull-ups already on the bus, too. Many sensor modules carry their own, and they add in parallel.
SCL gets the same resistor. The pull-up and pull-down resistors lesson covers the general case.
Worked example in numbers
- Address
- 0x50
- Pull-up, 5 V
- 2.2 kΩ
- Write time, max
- 5 ms
- Fill 256 bytes
- 160 ms
Worked example: how long before it wears out?
1. The limit. Both sheets give 1 million write cycles per byte, at 25 °C.
2. The habit. A sketch saves a counter to the same address once a minute: 1,440 writes a day.
3. The answer. 1 million / 1,440 = 694 days, under two years. Save only when the value changes, or rotate the counter through 32 different addresses so each one takes a thirty-second of the writes, and the chip lasts 32 times longer.
Tips and checks
- After a write, poll for the acknowledge instead of waiting a fixed 5 ms: send Start and the write control byte until the chip answers. Microchip's sheet describes this as acknowledge polling.
- Tie WP to ground to write. Tied to VCC, the whole array is read-only; reads still work.
- An I2C scanner that finds nothing at 0x50 usually means missing pull-ups or SDA and SCL swapped, not a dead chip.
- Fit 100 nF from VCC to ground at the package.
- Do not write in a loop without a delay or a change check. It is the fastest way to use up the million cycles.
Substitutes
Any 24C02 or 24LC02B drops into the same socket. With A0 to A2 tied to ground, an AT24C02 answers at the same address as a 24LC02B, so the same code works for both.
| Part | Pins | Verdict |
|---|---|---|
| AT24C02 | 1-3 A0-A2, 4 GND, 5 SDA, 6 SCL, 7 WP, 8 VCC | Same pins, same 8-byte pages and 5 ms writes. Its A0 to A2 pins are real address inputs, so tie all three to GND for address 0x50.Atmel (now Microchip) AT24C01A/02/04/08A/16A Two-wire Serial EEPROM (0180Z1), p. 3; Atmel (now Microchip) AT24C01A/02/04/08A/16A Two-wire Serial EEPROM (0180Z1), p. 9 |
| 24AA02 | 1-3 NC, 4 VSS, 5 SDA, 6 SCL, 7 WP, 8 VCC | The low-voltage twin of the 24LC02B on the same sheet. It runs down to 1.7 V, but below 2.5 V the clock limit drops to 100 kHz.Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 1; Microchip 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J), p. 3 |
Bench check: is it working?
- Wire VCC, ground, SDA and SCL, with 2.2 kΩ from each line to VCC, and A0 to A2 and WP to ground.
- Run an I2C scanner. The chip should show up at 0x50.
- Write one byte, poll for the acknowledge, then read it back.
- Tie WP to VCC and write a different value. The read-back should still show the first one.
The logic levels lesson explains the 0.7 VCC and 0.3 VCC input thresholds in the table above.
What we'd do
Buy the Microchip 24LC02B for a new board, tie A0 to A2 and WP to ground, and fit 2.2 kΩ pull-ups on a short 5 V or 3.3 V bus. Write in 8-byte pages on page boundaries, poll for the acknowledge, and save only when a value changes.
Questions people ask
What is the I2C address of a 24C02?
0x50 as a 7-bit address, which is 0xA0 to write and 0xA1 to read. On an AT24C02 with A0 to A2 not all grounded it can be anywhere from 0x50 to 0x57.
How many 24C02 chips can share one bus?
Up to eight AT24C02 parts, each with a different A0 to A2 setting. Only one 24LC02B, because its A pins are not connected.
How long does a 24C02 write take?
Up to 5 ms after the Stop bit, for one byte or a full 8-byte page.
Does a 24C02 need pull-up resistors?
Yes, on SDA and SCL. On a short 5 V bus, 2.2 kΩ works; the limits are 1.53 kΩ and 3.54 kΩ for 100 pF.
What does the WP pin do?
Tied to VCC it blocks every write to the chip. Tied to ground, reads and writes work normally.
Buying a 24C02 in India
Shops list the 24C02 in DIP-8 and SOIC-8, often without a maker named. If the code has to work with more than one chip on the bus, buy a branded AT24C02 or check the A pins with the bench test first. Our guide to buying electronic components in India compares ten online sellers and covers how to spot fakes.
One email a month from the bench
New circuits, lessons, part guides and calculators, on the first Sunday of each month.
Used in these lessons
Lessons that go deeper
Datasheets this page was checked against
- Microchip, 24AA02/24LC02B 2K I2C Serial EEPROM (DS21709J) (DS21709J, revision J, February 2009)
- Atmel (now Microchip), AT24C01A/02/04/08A/16A Two-wire Serial EEPROM (0180Z1) (0180Z1, May 2007)
Makers revise datasheets. If the copy you download has a newer revision and a number here disagrees with it, the datasheet wins, and we would like to hear about it.