Stufin
Home Quick Cart Profile

AT24C256 I2C EEPROM Memory Module

Buy Now

Pin Configuration

  • AT24C256 I2C EEPROM Memory Module Pinout Explanation
  • The AT24C256 I2C EEPROM Memory Module is a 256KB electrically erasable programmable read-only memory (EEPROM) device that operates on the I2C protocol. It has a total of 8 pins, which are explained below:
  • Pinout Structure:
  • Pin 1: GND (Ground)
  • + Function: Provides a ground connection for the module
  • + Connection: Connect to the ground pin of your microcontroller or development board
  • Pin 2: VCC (Power Supply)
  • + Function: Provides power to the module
  • + Connection: Connect to the VCC pin of your microcontroller or development board (typically 3.3V or 5V)
  • Pin 3: SCL (Serial Clock)
  • + Function: Serial clock input for I2C communication
  • + Connection: Connect to the SCL pin of your microcontroller or development board
  • Pin 4: SDA (Serial Data)
  • + Function: Serial data input/output for I2C communication
  • + Connection: Connect to the SDA pin of your microcontroller or development board
  • Pin 5: WP (Write Protect)
  • + Function: Write protect input for memory protection
  • + Connection: Typically connected to GND to enable write operations, or connected to VCC to protect the memory from writing
  • Pin 6: A0 (Address 0)
  • + Function: Address input for I2C communication (LSB)
  • + Connection: Typically connected to GND or VCC to set the device address
  • Pin 7: A1 (Address 1)
  • + Function: Address input for I2C communication (MSB)
  • + Connection: Typically connected to GND or VCC to set the device address
  • Pin 8: NC (No Connection)
  • + Function: Not connected internally
  • + Connection: Leave unconnected
  • Notes:
  • The AT24C256 has a total of 8 pins, but only 7 pins are used for communication and power supply.
  • The WP pin can be used to protect the memory from unintended writes. When connected to GND, the memory can be written to. When connected to VCC, the memory is protected from writing.
  • The A0 and A1 pins are used to set the device address for I2C communication. Typically, these pins are connected to GND or VCC to set the address.
  • Make sure to connect the pins correctly to avoid any damage to the module or the microcontroller.

Code Examples

AT24C256 I2C EEPROM Memory Module Documentation
Overview
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.
Features
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
Pinout
VCC: Power supply (2.5V to 5.5V)
 GND: Ground
 SCL: I2C Clock
 SDA: I2C Data
Example Code
### 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.
```c++
#include <Wire.h>
#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();
delay(1000);
// 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.