1

I have recently come across some 8-pin 128-byte EEPROM chips. I've seen those USB EEPROM chip programmer units, but I was wondering if there is any way I could manually store data on the chip with my Arduino.

I don't have any application for the chips yet, but I would just like to see if I can read / write data on the chips.

Here's the data sheet for the chips.

1

enter image description here

You wire your chips on a breadboard, with the +/- left rail for Vcc/GND, and the right +/- rail for SCL/SDA, plus a little acrobatics to connect everything.

Your chips can have 8 addresses, 0x50 to 0x57, set up with the A0/1/2 pins: all low = 0x00, all high = 0x07. The you read and write to the EEPROM of your choice with:

char i2c_eeprom_read_char(int deviceaddress, unsigned int eeaddress) {
  char rdata = 0xFF;
  Wire.beginTransmission(deviceaddress);
  Wire.write((int)(eeaddress >> 8)); // MSB
  Wire.write((int)(eeaddress & 0xFF)); // LSB
  Wire.endTransmission();
  Wire.requestFrom(deviceaddress,1);
  if (Wire.available()) rdata = Wire.read();
  return rdata;
}

void i2c_eeprom_write_char(int deviceaddress, unsigned int eeaddress, char data) {
  int rdata = data;
  Wire.beginTransmission(deviceaddress);
  Wire.write((int)(eeaddress >> 8)); // MSB
  Wire.write((int)(eeaddress & 0xFF)); // LSB
  Wire.write(rdata);
  Wire.endTransmission();
}

If you have more than 8 chips (well throw them away and get larger ones, but anyway, for completeness sake): wire all of them with A1/A2 to GND, and each A0 to a different digital pin. When you need to access a chip, set all A0s to LOW, except the one you want to HIGH, and use 0x51 as the address. By doing this you're setting all chips except the one you want to address 0x50 (which doesn't matter) leaving only one at 0x51. That enables you to have as many chips as you have free digital pins...

  • When I use the I2C Scanner, I see 8 addresses 0x50..0x57with only one connected to the I2C bus, I have A0..A2+GND connected to ground (LOW). Any ideas? Before I had no connections made and saw this article so I thought this could be the solution but for me it is not. I can read the EEPROM and write it but only first 256 bytes. – Codebeat Dec 15 '17 at 2:07
  • A0/A1/A2 connected to ground means address 0x50. Do you have anything else connected to the I2C bus? Maybe write a question, explaining your setup. Easier than in comments. – dda Dec 15 '17 at 3:11
  • Hi dda, there is nothing else on the bus. I posted a question yesterday about the capacity and the adresses on stackoverflow: stackoverflow.com/questions/47823243/… About the capacity, read documention wrong, capacity is in bits and not in bytes so there is only 256 bytes available. Why manufacturers use bits instead of bytes to specify the capacity? All capacity is always measured in bytes, very confusing and explains my error. – Codebeat Dec 15 '17 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.