I2C EEPROM - 256k Bit (24LC256)

This is an I2C, 256Kbit, Serial Electrically Erasable PROM (EEPROM), capable of operation across a 2.5V to 5.5V range. It has been developed for advanced, low-power applications such as personal communications or data acquisition. This PTH IC also has a page write capability of up to 64 bytes of data and is capable of both random and sequential reads up to the 256K boundary. Its functional address lines allow up to eight devices on the same bus, for up to 2Mbit address space.

These 8-pin chips can be the back bone of any microprocessor project, only need two wires to communicate, and retain their data even with power failure.


Need a custom board? This component can be found in SparkFun's À La Carte board builder. You can have a custom design fabricated with this component - and your choice of hundreds of other sensors, actuators and wireless devices - delivered to you in just a few weeks.

I2C EEPROM - 256k Bit (24LC256) Product Help and Resources

Raspberry Pi SPI and I2C Tutorial

October 29, 2015

Learn how to use serial I2C and SPI buses on your Raspberry Pi using the wiringPi I/O library for C/C++ and spidev/smbus for Python.

Reading and Writing Serial EEPROMs

August 11, 2017

EEPROM is a great way to add extra memory to your microcontroller project. Wait 'til you see how easy it is to use!

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

2 Soldering

Skill Level: Rookie - The number of pins increases, and you will have to determine polarity of components and some of the components might be a bit trickier or close together. You might need solder wick or flux.
See all skill levels


Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

3 Programming

Skill Level: Competent - The toolchain for programming is a bit more complex and will examples may not be explicitly provided for you. You will be required to have a fundamental knowledge of programming and be required to provide your own code. You may need to modify existing libraries or code to work with your specific hardware. Sensor and hardware interfaces will be SPI or I2C.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

3 Electrical Prototyping

Skill Level: Competent - You will be required to reference a datasheet or schematic to know how to use a component. Your knowledge of a datasheet will only require basic features like power requirements, pinouts, or communications type. Also, you may need a power supply that?s greater than 12V or more than 1A worth of current.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • baum / about 12 years ago / 3

    What about the larger 512k or 1024k versions?

  • Alvinx / about 14 years ago / 3

    hello,
    Couple of things I would like to clear up before you guys go scratching your head like i did to get it working with arduino.
    1. Pull up resistors NOT required.
    2. Pins 4 & 5 are Analog pins NOT digital!
    3. Dont forget to include Wire.begin() in void Setup() function.
    4. try pastebin.com/f3a36644b code (thanks shinmai for the link! Saved me a ton!) and check for any output before you code your own!
    Thanks and hope these tips help. Good luck on your projects.
    -Alvin

  • Hexadecimal / about 9 years ago * / 2

    I will not be using a full arduino board with this, I will instead be using a bare atting85 or 84 I read that the buffer length should be shortened due to smaller RAM size so I changed:

    ifndef twi_h

    define twi_h

    #include <inttypes.h>

    //#define ATMEGA8

    #ifndef TWI_FREQ #define TWI_FREQ 100000L #endif

    #ifndef TWI_BUFFER_LENGTH #define TWI_BUFFER_LENGTH 32 //note this is the value I changed

    endif

    #define TWI_READY 0 #define TWI_MRX 1 #define TWI_MTX 2 #define TWI_SRX 3 #define TWI_STX 4

    void twi_init(void); void twi_setAddress(uint8_t); uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t); uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t); uint8_t twi_transmit(const uint8_t*, uint8_t); void twi_attachSlaveRxEvent( void ()(uint8_t, int) ); void twi_attachSlaveTxEvent( void (*)(void) ); void twi_reply(uint8_t); void twi_stop(void); void twi_releaseBus(void);

    endif

    To this:

    ifndef twi_h

    define twi_h

    #include <inttypes.h>

    //#define ATMEGA8

    #ifndef TWI_FREQ #define TWI_FREQ 100000L #endif

    #ifndef TWI_BUFFER_LENGTH #define TWI_BUFFER_LENGTH 6 //note this is what I changed it to

    endif

    #define TWI_READY 0 #define TWI_MRX 1 #define TWI_MTX 2 #define TWI_SRX 3 #define TWI_STX 4

    void twi_init(void); void twi_setAddress(uint8_t); uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t); uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t); uint8_t twi_transmit(const uint8_t*, uint8_t); void twi_attachSlaveRxEvent( void ()(uint8_t, int) ); void twi_attachSlaveTxEvent( void (*)(void) ); void twi_reply(uint8_t); void twi_stop(void); void twi_releaseBus(void);

    endif

    Should this small edit make this compatible with the attiny? The file changed is located in arduino\libraries\wire\utility/twi (header file) I kept a copy of the original in case this has messed anything up.

  • http://www.hobbytronics.co.uk/arduino-external-eeprom is also a nice tutorial in english and I'm writing one in my arduino book; http://cprogrammingforarduino.com

  • Volkemon / about 14 years ago / 2

    Love the chip, has a few quirks. The biggest is the 'page wrap', where if you overwrite the end of a 'page' in memory on the chip, it will overwrite the data at the beginning of that 'page'.
    http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1280095224

    • baum / about 12 years ago / 1

      What he said. Easier to write individual bytes instead of a page read unless you are concerned about speed.

  • TigPT / about 15 years ago / 2

    Nice ic, it helps a lot managing lot of data, and you can configure the i2c addr so you can use 8 of these in the same bus.
    Best chip to controle my bitmaps for the nokia lcd with the arduino.

  • chip / about 16 years ago / 2

    Great little ic, got it working with my basic stamp in no time. Works well for data logging.

  • Just an FYI...searching for 24LC256 shows no results, might want to update the search index...unless you have a policy to not list chips directly :)

  • I don't know if this is just me, or if I did something wrong, but I am unable to write more than 30 bytes to a page at a time, like this:

    void formatEEPROM(int deviceaddress) {
        for (int p = 0; p < 1067; p++) {
            Wire.beginTransmission(deviceaddress);
            Wire.write((int)((p*30) >> 8));   // MSB
            Wire.write((int)((p*30) & 0xFF)); // LSB
    
            for (int i = 0; i < 30; i++) {
                Wire.write(0x00);
            }
            Wire.endTransmission();
    
            delay(5);
        }
    }
    

    If I try to write 32 bytes at a time and print the first 64 bytes, gaps appear on bytes 31, 32, 63, and 64. Does anyone know what I did wrong?

    • Just in case anyone else sees this and thinks it's odd, it's because the Wire library used here only supports a 32 byte buffer

  • MrAureliusR / about 11 years ago / 1

    For anyone who thinks these are cheap here, they are 44 cents apiece over at Newark/element14... just sayin'

  • bbotany / about 11 years ago / 1

    This product should include the word "memory" somewhere in the product description. Not for those of us reading it, but for those trying to find it. If you search for "memory", this doesn't show up at all. Product 301 has the same problem.

  • Member #183815 / about 12 years ago / 1

    So, just to make sure, this chip has 256,000 places it can store a number in the form 0bXXXXXXXX ?

    • Member #183815 / about 12 years ago / 1

      Nevermind: 32,000 places it can store 0bXXXXXXXX, right?

  • Arron Chapman / about 12 years ago / 1

    I wrote a .Net Micro Framework that I've confirmed works with the 512 and 1024 bit versions of this chip, as far as I can tell (I only looked quickly) this uses the same protocol. All of that is to say that my driver should work for this part too;

  • godofcode / about 12 years ago / 1

    If you're having trouble with this IC, check out this tutorial.

  • Member #197750 / about 12 years ago / 1

    Question - I've heard that these things will 'page wrap' around to the beginning of the page if you try and write too much data to 'em. If you write it, like, one bit at a time, will it still wrap around to the next page? Or will it go onto the next one? Thanks!

  • devil2005 / about 12 years ago / 1

    Example : http://lusorobotica.com/index.php/topic,461.msg2738.html

    if eeaddress was 1101 1101 1100 0111

    eeaddress >> 8 = 0000 0000 1101 1101 and wire.send() which sends bytes would truncate it to 1101 1101 which is perfect. its sent the high byte. but i dont understand this. eeaddress & 0xFF = 1101 1101 0000 0000 so wire.send() would send 0000 0000 which fails to send the low byte. is the code wrong in the exmaple?

    • devil2005 / about 12 years ago / 1

      nvm. i worked it out. apparently there is attenuation on the MSB and the LSB is masked when masking 16bit int with 8bit mask.

  • baum / about 12 years ago / 1

    Confused about the page write... note on page 9 says that pages start at integer multiples of the page size (64) and end at integer multiples of the page size - 1 (63). So the pages would be: 1st page starts at 0, ends at 63 2nd page starts at 64, ends at 126? 126 is a multiple of 63... then the third page would start at 64*2 = 128? what happened to address 127? Anyone from sparkfun know?

    • sdb / about 12 years ago / 1

      not multiples of 63. always multiples of 64. arithmetic precedence: (multiples of page size) - 1

      thus:

      page size = 64
      integer multiples of the page size = N * 64
      start page M = M*64
      start page M+1 = (M+1)*64
      end page M = (M+1)*64 - 1
      

      • baum / about 12 years ago / 1

        Of course that is what makes sense, and what I though originally. But from the datasheet:

        Physical page boundaries start at addresses that are integer multiples of the page buffer size >(or ‘page size’) and end at addresses that are integer multiples of [page size – 1]

        So are we wrong, or are they wrong?

  • Awesome!

  • Shahab / about 13 years ago / 1

    Is there a limitation in number of write cycles as it is for internal EEPORMs on Arduino boards ?

    • Cjhazdroid / about 12 years ago / 1

      RTFM says : "1,000,000 erase/write cycles"

      • baum / about 12 years ago / 1

        100,000 for the arduino; 1M for this chip. But it is most likely more. John Boxall @ Tronixstuff tried to destry his Arduino's EEPROM and, after 2 months, saw the first read error after 1230163 cycles. So if the Arduino can last 10x as long, maybe you could even get 10M cycles out of this one.

  • baum / about 13 years ago * / 1

    Nice looking chip... cheap, too! Note that it is only 32kB, but you can put a few of these on an I2C bus.

  • itsthemedication / about 13 years ago / 1

    Unfortunately, I can't seem to get to RyanD's write-up anymore, but it was a good one. Here is a slight modification of his code. These are great little storage devices.
    https://sites.google.com/site/measuringstuff/data-storage-retrieval#TOC-Storing-Stuff-To-External-EEPROM-24

  • Have a ZIF socket on your led matrix game board and have a few different games on each memory chip

    • I Dream of JNE / about 11 years ago / 1

      I thought about this, but how would you load code stored on the EEPROM into a microcontroller? I'm not sure this idea is feasible, but if it is, I would love to know the mechanism by which I could implement this. Most microcontrollers (MSP430s, Atmels) are

  • somebloke / about 14 years ago / 1

    windows app. link ends up with a corrupt rar file, would've been nice to try it...

  • Sabre00 / about 14 years ago / 1

    Any chance that you guys plan to bring this in an SOIC pinout?

  • Chiel / about 15 years ago / 1

    no matter what i try i cant seem to get these eeproms to work. i followed the tutorial for my arduino. hooked everything up (1->4&7 to gnd,8 to 5v,4&5 to the i2c pins)
    yet i cant receive any data. ive folowed the code,tried other eeproms(in case of a broken one),other codes on the net,various pull-up resistors,various device adresses and yet it wont work. am i doing something wrong or is there something wrong with the wire lib?
    im using the latest arduino software(0017).
    any help would be very appreciated.

    • SteveP / about 14 years ago / 1

      A couple of things to look for. The tutorial refers to pins 4 & 5 on the Arduino. These are the analog 4 & 5 pins, not digital.
      One of the tutorials mentions a 5ms delay between reads and writes. I added delay(5) in the loop and then the code started working.

    • shinmai / about 15 years ago / 1

      @Chiel:
      I'm also using arduino IDE 0017, this chip and a duemilanove. I didn't need any pull-up resistors (all I've got are eight jumper wires, a bread board and the IC), and used the code from pastebin.com/f3a36644b which is a complete sketch using the functions from arduino playground.
      Could it be you've got the I2C pins reversed, or have other I2C devices hooked up (I had a blinkM and a Wii Nunchuk on the same bus, all up and working, but later removed the blinkm initialization code from my sketch, but left the device connected to the breadboard which also broke functionality with the eeprom, just unplugging the smart led made everything fine)?

Customer Reviews

5 out of 5

Based on 1 ratings:

Currently viewing all customer reviews.

2 of 2 found this helpful:

Small, cheap, works

This cheap EEPROM adds an additional 32kB of non volatile memory. A typical Arduino has between 1kB-4kB of EEPROM, so it is a big help.

The non-english demo worked out of the box!

I run an Arduino Mega-based dial up BBS called "The 8th Bit", and I plan on upgrading my message board capacity from 4kB to 32kB. It'll probably help wonders!