Digital Data Logger Using the 24LC04B EEPROM

Digital Data Logger Using the 24LC04B EEPROM

·

7 min read

In this project, we will build a simple digital data logger using the 24LC04B EEPROM (Electrically Erasable Programmable Read-Only Memory) chip. The goal is to create a circuit that can store and retrieve data in a non-volatile manner using the 24LC04B, which is a 4Kb (512 x 8 bits) EEPROM device with an I2C interface. This project will showcase how to use the 24LC04B in a practical application for storing small amounts of data, such as sensor readings, settings, or logs, and retrieve them at a later time.

Objective

The primary objective of this project is to create a data logger system that can store data from sensors or user input on the 24LC04B EEPROM chip. We will then demonstrate how to read the stored data and display it using a simple LED or LCD screen, making the data accessible and easily interpretable.

Components Required

24LC04B EEPROM chip (I2C interface)

Microcontroller (e.g., Arduino, PIC, or any other I2C-compatible microcontroller)

I2C interface components (pull-up resistors, connections)

LED or LCD display for visualizing stored data

Push buttons or sensor module (e.g., temperature sensor or light sensor) for data input

Resistors (for current-limiting and pull-ups)

Breadboard and jumper wires for circuit assembly

Power supply (5V or 3.3V depending on the microcontroller)

Step 1: Introduction to the 24LC04B EEPROM

The 24LC04B is a small, low-power EEPROM chip with the following key features:

4Kb of memory: The 24LC04B provides 512 x 8-bit locations for storing data.

I2C interface: This chip communicates using the I2C protocol, a two-wire interface (SCL for clock and SDA for data) that simplifies the connection to microcontrollers.

Non-volatile memory: Data is retained even when the power is turned off.

Page Write: Data is written in pages of 8 bytes, allowing for efficient storage and retrieval.

This chip is ideal for applications where small amounts of data need to be stored over long periods without using battery power for backup, such as in data loggers, configuration storage, and simple sensor logging systems.

Step 2: Setting Up the Circuit

We will begin by connecting the 24LC04B EEPROM chip to the microcontroller and the necessary I2C bus components (SCL, SDA, and power lines).

1. Connecting the 24LC04B EEPROM

The 24LC04B operates with a supply voltage of 2.5V to 5.5V, so we will use a 5V supply to power the chip and microcontroller.

VCC (pin 8): Connect to +5V.

GND (pin 4): Connect to ground.

SCL (pin 6): Connect to the microcontroller's I2C clock (SCL) pin.

SDA (pin 5): Connect to the microcontroller's I2C data (SDA) pin.

WP (pin 3): Connect to ground to disable write protection.

A0, A1, A2 (pins 1, 2, 7): These are address pins for selecting different I2C addresses. For this project, we can leave them unconnected or set them to logic low for a default address.

2. I2C Communication Pull-up Resistors

The I2C bus requires pull-up resistors on the SCL and SDA lines to ensure proper communication. You will need to add two 4.7kΩ resistors:

● One resistor between the SCL line and VCC.

● One resistor between the SDA line and VCC.

These resistors are necessary for reliable communication on the I2C bus.

3. Data Input Method

For this project, we will use a simple input method to simulate data entry:

Push buttons: We will use two push buttons to simulate the process of logging data. Each press will input a value (for instance, 0 or 1), and we will store this data in the EEPROM.

Sensors: Alternatively, you could use sensors, such as a temperature or light sensor, to automatically log real-world data to the EEPROM.

4. Output Visualization

The stored data can be retrieved and displayed:

LEDs: If we use LEDs, each LED can represent a stored bit or byte from the EEPROM. This will allow us to visualize which bits are being logged.

LCD Display: A more sophisticated output method would be to use an LCD screen (such as a 16x2 LCD) to display the stored values. This would be ideal for visualizing multiple pieces of data in human-readable format.

Step 3: Writing Data to the EEPROM

Once the circuit is set up, we can begin writing data to the 24LC04B EEPROM.

1. I2C Communication Protocol

The microcontroller will communicate with the 24LC04B using the I2C protocol. When writing data to the EEPROM, we send the I2C address of the chip along with the memory location (address) where the data will be written.

For example:

● We first send a start signal to initiate communication.

● Then, we send the device address (which is determined by the A0, A1, and A2 address pins on the EEPROM, plus a fixed 7-bit address).

● Next, we specify the memory location inside the EEPROM where we want to write the data.

● Finally, we send the data byte that will be stored at that memory location.

After each write operation, the EEPROM requires a short delay (typically a few milliseconds) to ensure the data has been successfully written to memory.

2. Button Presses to Log Data

For simplicity, let’s assume we use push buttons as input. Each time a button is pressed:

● The microcontroller reads the input value from the button.

● It then writes this value to the EEPROM at the next available memory address.

● The stored data could represent anything from simple binary values (0 or 1) to more complex data (e.g., temperature readings or timestamps).

3. Example Data Logging Process

Let’s consider that we use two push buttons:

● Button 1 stores the value 0 in memory.

● Button 2 stores the value 1 in memory.

When you press Button 1, the microcontroller writes a 0 to the first memory address in the EEPROM. When Button 2 is pressed, the microcontroller writes a 1 to the next memory location. This process continues until all the desired data is logged.

Step 4: Reading Data from the EEPROM

After storing data on the EEPROM, the next step is to read and display it.

1. Reading from the EEPROM

To read data from the EEPROM, the microcontroller sends the device address and the memory address from which it wants to retrieve the data. The data is then transmitted back over the I2C bus, where it can be processed and displayed on an output device (such as an LED or LCD).

2. Displaying Data

LEDs: If you use LEDs to visualize the data, the microcontroller can read each bit from the EEPROM and light up an LED corresponding to each bit of data. For instance, if the value 0 is stored, no LED will light, and if 1 is stored, the LED will light up.

LCD Display: If using an LCD, the microcontroller can print the logged data in human-readable format. For example, a simple message like "Data: 01101011" can be shown on the LCD to represent the stored values.

Step 5: Testing and Debugging

Once the circuit is assembled, and the software is written, the next step is to test the system:

  1. Test Data Logging: Press the push buttons (or activate the sensors) and ensure that the data is being stored in the EEPROM correctly. Verify the stored data using the display method you chose (LEDs or LCD).

  2. Test Data Retrieval: Read the stored data and ensure it matches the input values. Check that the data is properly displayed on the output device.

Step 6: Enhancements and Future Work

Once the basic data logger is working, you can expand the project in several ways:

Multiple sensors: Add sensors like temperature, humidity, or light sensors and log their values over time.

Time stamps: Implement a real-time clock (RTC) to log timestamps with each data entry.

Data transmission: Add wireless communication (e.g., Bluetooth or Wi-Fi) to send logged data to a computer or mobile device.

Data compression: Store larger amounts of data by implementing data compression algorithms to optimize EEPROM space usage.

Final Thoughts

The 24LC04B EEPROM is a versatile and low-cost solution for building a simple data logger. In this project, we have demonstrated how to use this chip to store small amounts of data, such as sensor readings or user inputs, and retrieve it at a later time. By using I2C communication, we can easily interface the EEPROM with a variety of microcontrollers and sensors to create a fully functional data logging system. This project provides a great starting point for more advanced applications involving non-volatile memory storage.

www.utsource.net