Account Navigation

Account Navigation

Currency - All prices are in AUD

Currency - All prices are in AUD
 Loading... Please wait...
CuteDigi

I2C EEPROM for Arduino - 256kbit

$1.60

I2C EEPROM for Arduino - 256kbit

$1.60
SKU:
24LC256_DA1
Weight:
0.01 LBS
Share

Product Description

2 Wire Serial Communication (I2C) 256kbit (32kbyte) EEPROM. It can be used for mass storage.

A good tutorial:

http://www.ghettohax.com/2009/02/i2c-eeprom-for-arduino.html

 The Arduino is a nifty little board as most of you probably know already. I was doing a school project on it and found that I needed some external storage. Now, there are a lot of storage options available. SD cards and EEPROM on the SPI bus seem to be a popular choice, but I couldn't sacrifice 4 I/O pins just for storage.

I found code and tutorial for using I2C EEPROMs on the Arduino which was perfect since it would only take up 2 pins (pin 4 and 5) and I could put up to 8 EEPROMs on a single bus. The problem was that the tutorial was in Portuguese, (and I found another one in Spanish) so I ended up just fumbling through it myself. For the rest of you, here's the English guide.

Wiring it together is super easy. To save everyone the trouble, I'll lay it out simple and straight forward:

EEPROM

Pin 1 2 and 3 determine the address of the chip; I2C uses 7 bit addresses + 1 control bit. With the code available on the Arduino Playground link above, you don't have to worry about the control bit. The EEPROM chip's address in binary will be 1010XXX where XXX is Address 2, Address 1, and Address 0 in that order. For example, if Pin 1 2 3 are Low Low High in that order, the binary address will be 1010001, or Hex 0x50.

For simplicity, I connected them all to Ground, thus giving me address of 1010000, or hex 0x50. It is important to remember to pull SDA and SDL up to 5V using a 1K resistor since those pins aren't pulled up internally at either end. Failing to pull them up will result in garbage when communicating. The picture below shows how I wired up my EEPROM:

he last part is actually using the code in your software. Since the creator for the functions linked above hasn't created a .h file for his stuff, you will simply have to copy and paste the entire snippit to the beginning of your code. Click here to get the code from Arduino Playground.

The code includes four functions i2c_eeprom_write_byte, i2c_eeprom_write_page, i2c_eeprom_read_byte, and i2c_eeprom_read_buffer. They are self explanatory if you read the code; for example, to write the data byte "0xAB" to the 1st block (remember a 256kbit EEPROM has 32708 blocks available) of the EEPROM whose address is 0x50, you would use:

i2c_eeprom_write_byte( 0x50, 1, 0xAB );

And to read the data you would write:

temp = i2c_eeprom_read_byte( 0x50, 1 );

That's it for this simple tutorial, those who want more information can read the EEPROM's datasheet and the details of the code provided.

Download:

  Datasheet

Product Reviews

Find Similar Products by Category