AT24C256 I2C EEPROM Memory Module Documentation
The AT24C256 is a 256KB (256K x 8) I2C EEPROM memory module that provides a reliable and non-volatile storage solution for IoT devices. It operates on a 2.5V to 5.5V power supply and has a low standby current of 1 A. This module is ideal for storing configuration data, calibration values, and other parameters in IoT devices.
256KB (256K x 8) EEPROM memory
I2C Bus Interface (100 kHz and 400 kHz compatible)
2.5V to 5.5V power supply
Low standby current: 1 A
Operating temperature range: -40C to 85C
Pb-free and RoHS compliant
VCC: Power supply (2.5V to 5.5V)
GND: Ground
SCL: I2C Clock
SDA: I2C Data
### Example 1: Arduino Basic Write and Read
This example demonstrates how to use the AT24C256 I2C EEPROM memory module with an Arduino board to store and retrieve data.
#define EEPROM_ADDRESS 0x50 // I2C address of the AT24C256
void setup() {
Wire.begin(); // Initialize I2C
Serial.begin(9600);
}
void loop() {
// Write data to EEPROM
byte data[] = {0x01, 0x02, 0x03, 0x04, 0x05};
Wire.beginTransmission(EEPROM_ADDRESS);
Wire.write((byte)0x00); // Write to address 0x00
Wire.write(data, 5);
Wire.endTransmission();
// Read data from EEPROM
byte readData[5];
Wire.beginTransmission(EEPROM_ADDRESS);
Wire.write((byte)0x00); // Read from address 0x00
Wire.endTransmission();
Wire.requestFrom(EEPROM_ADDRESS, 5);
for (int i = 0; i < 5; i++) {
readData[i] = Wire.read();
}
Serial.print("Data: ");
for (int i = 0; i < 5; i++) {
Serial.print(readData[i], HEX);
Serial.print(" ");
}
Serial.println();
delay(1000);
}
```
### Example 2: Python (Raspberry Pi) Write and Read
This example demonstrates how to use the AT24C256 I2C EEPROM memory module with a Raspberry Pi board to store and retrieve data.
```python
import smbus
import time
# I2C bus and address
bus = smbus.SMBus(1)
address = 0x50
# Write data to EEPROM
data = [0x01, 0x02, 0x03, 0x04, 0x05]
bus.write_i2c_block_data(address, 0x00, data)
time.sleep(1)
# Read data from EEPROM
read_data = bus.read_i2c_block_data(address, 0x00, 5)
print("Data:", read_data)
```
### Example 3: CircuitPython (Microcontrollers) Write and Read
This example demonstrates how to use the AT24C256 I2C EEPROM memory module with a microcontroller board (e.g., ESP32, ESP8266) running CircuitPython to store and retrieve data.
```python
import busio
import time
# I2C bus
i2c = busio.I2C(scl=board.SCL, sda=board.SDA)
# Write data to EEPROM
address = 0x50
data = bytearray([0x01, 0x02, 0x03, 0x04, 0x05])
i2c.writeto(address, bytes([0x00]) + data)
time.sleep(1)
# Read data from EEPROM
read_data = bytearray(5)
i2c.writeto(address, bytes([0x00]))
i2c.readfrom_into(address, read_data)
print("Data:", read_data)
```
These examples demonstrate the basic write and read operations using the AT24C256 I2C EEPROM memory module. The I2C address, write, and read functions may vary depending on the specific development board and programming language used.