Qwiic EEPROM Hookup Guide

Pages
Contributors: santaimpersonator, MAKIN-STUFF
Favorited Favorite 2

Introduction

The Qwiic EEPROM is a simple and cost effective option to add some extra storage space to any project. With 512 kilo-bits (or 64 kilo-bytes) of storage, this product is great for any microcontroller that doesn't have any EEPROM storage space, like the SAMD21.

SparkFun Qwiic EEPROM Breakout - 512Kbit

SparkFun Qwiic EEPROM Breakout - 512Kbit

COM-18355
$4.50

Maybe your project needs to store data, like a public-key, in non-volatile memory? Maybe you want to use multiple boards as configuration keys with different default settings for your project? Whatever your project needs might be, this guide will help users familiarize themselves with the Qwiic EEPROM and its operation.

Required Materials

The Qwiic EEPROM does need a few additional items for you to get started. The RedBoard Qwiic will be used for the Arduino examples. A single board computer and the Qwiic pHAT are required for the Python examples (see note below). You may already have a few of these items, including the required Qwiic cable, so feel free to modify your cart based on your needs. Additionally, there are also options that are available as well (click button below to toggle options).

SparkFun Qwiic Cable Kit

SparkFun Qwiic Cable Kit

KIT-15081
$8.95
22
SparkFun RedBoard Qwiic

SparkFun RedBoard Qwiic

DEV-15123
$21.50 $15.05
20
SparkFun Qwiic pHAT v2.0 for Raspberry Pi

SparkFun Qwiic pHAT v2.0 for Raspberry Pi

DEV-15945
$6.95
2
USB Micro-B Cable - 6 Foot

USB Micro-B Cable - 6 Foot

CAB-10215
$5.50
15
Qwiic Compatible Microcontrollers:
SparkFun Thing Plus - ESP32 WROOM (Micro-B)

SparkFun Thing Plus - ESP32 WROOM (Micro-B)

WRL-15663
$22.50
14
SparkFun Qwiic Pro Micro - USB-C (ATmega32U4)

SparkFun Qwiic Pro Micro - USB-C (ATmega32U4)

DEV-15795
$21.50 $15.05
12
SparkFun Thing Plus - SAMD51

SparkFun Thing Plus - SAMD51

DEV-14713
$21.50
2
SparkFun RedBoard Artemis

SparkFun RedBoard Artemis

DEV-15444
$21.50
10
In addition we also offer, Qwiic compatible stackable shields for microcontrollers and pHATs for single board computers (like the Raspberry Pi boards) that don't include a Qwiic connector.
SparkFun Qwiic Adapter

SparkFun Qwiic Adapter

DEV-14495
$1.60
5
SparkFun Qwiic Shield for Thing Plus

SparkFun Qwiic Shield for Thing Plus

DEV-16790
$4.95
SparkFun Qwiic Shield for Arduino Nano

SparkFun Qwiic Shield for Arduino Nano

DEV-16789
$4.95
SparkFun Qwiic Shield for Teensy

SparkFun Qwiic Shield for Teensy

DEV-17119
$4.25 $1.40
1
SparkFun Qwiic HAT for Raspberry Pi

SparkFun Qwiic HAT for Raspberry Pi

DEV-14459
$6.50
5
SparkFun Qwiic SHIM for Raspberry Pi

SparkFun Qwiic SHIM for Raspberry Pi

DEV-15794
$1.50
14
SparkFun Qwiic pHAT v2.0 for Raspberry Pi

SparkFun Qwiic pHAT v2.0 for Raspberry Pi

DEV-15945
$6.95
2
SparkFun Servo pHAT for Raspberry Pi

SparkFun Servo pHAT for Raspberry Pi

DEV-15316
$11.95
5
SparkFun Auto pHAT for Raspberry Pi

SparkFun Auto pHAT for Raspberry Pi

ROB-16328
$32.50
1

SparkFun Top pHAT for Raspberry Pi

DEV-16301
You will also need a Qwiic cable to connect to your Qwiic device, choose a length that suits your needs.
Flexible Qwiic Cable - 500mm

Flexible Qwiic Cable - 500mm

PRT-17257
$2.10
Flexible Qwiic Cable - 50mm

Flexible Qwiic Cable - 50mm

PRT-17260
$1.05
Flexible Qwiic Cable - 200mm

Flexible Qwiic Cable - 200mm

PRT-17258
$1.60
Flexible Qwiic Cable - 100mm

Flexible Qwiic Cable - 100mm

PRT-17259
$1.60

Python Example: If you don't already have them, you will need an SBC (single board computer) such as a Raspberry Pi and standard peripherals or Jetson Nano and standard peripherals. An example setup is listed below.
SparkFun Raspberry Pi 4 Basic Kit - 8GB

SparkFun Raspberry Pi 4 Basic Kit - 8GB

KIT-17980
$123.50
1
Multimedia Wireless Keyboard

Multimedia Wireless Keyboard

WIG-14271
$29.95 $19.95
5
pi-topCEED (Green)

pi-topCEED (Green)

KIT-14035
$114.95 $99.95
4

SparkFun DLI Kit for Jetson Nano 2GB

KIT-17245
Retired

SparkFun DLI Kit (without Jetson Nano)

KIT-16389
1 Retired

NVIDIA Jetson Nano Developer Kit (V3)

DEV-16271
14

NVIDIA Jetson Nano 2GB Developer Kit

DEV-17244
1

Suggested Reading

If you're unfamiliar with serial terminals, jumper pads, or I2C be sure to checkout some of these foundational tutorials.

Installing an Arduino Library

How do I install a custom Arduino library? It's easy! This tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries not linked with the Arduino IDE, we will also go over manually installing an Arduino library.

Logic Levels

Learn the difference between 3.3V and 5V devices and logic levels.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

Serial Terminal Basics

This tutorial will show you how to communicate with your serial devices using a variety of terminal emulator applications.

Reading and Writing Serial EEPROMs

EEPROM is a great way to add extra memory to your microcontroller project. Wait 'til you see how easy it is to use!

RedBoard Qwiic Hookup Guide

This tutorial covers the basic functionality of the RedBoard Qwiic. This tutorial also covers how to get started blinking an LED and using the Qwiic system.

Qwiic pHAT for Raspberry Pi Hookup Guide

Get started interfacing your Qwiic enabled boards with your Raspberry Pi. The Qwiic pHAT connects the I2C bus (GND, 3.3V, SDA, and SCL) on your Raspberry Pi to an array of Qwiic connectors.

Arduino Shields v2

An update to our classic Arduino Shields Tutorial! All things Arduino shields. What they are and how to assemble them.

Raspberry Pi SPI and I2C Tutorial

Learn how to use serial I2C and SPI buses on your Raspberry Pi using the wiringPi I/O library for C/C++ and spidev/smbus for Python.

How to Work with Jumper Pads and PCB Traces

Handling PCB jumper pads and traces is an essential skill. Learn how to cut a PCB trace, add a solder jumper between pads to reroute connections, and repair a trace with the green wire method if a trace is damaged.

Python Programming Tutorial: Getting Started with the Raspberry Pi

This guide will show you how to write programs on your Raspberry Pi using Python to control hardware.

Working with Qwiic on a Jetson Nano through Jupyter Notebooks

We created a few Jupyter Notebooks to make using our Qwiic boards with your Jetson Nano even easier!

Qwiic Connect System

The Qwiic EEPROM utilizes the Qwiic connect system. We recommend familiarizing yourself with the Logic Levels and I2C tutorials (above) before using it. Click on the banner above to learn more about our Qwiic products.

Note: First time Raspberry Pi users should also head over to the Raspberry Pi Foundation website and check out their quickstart guides:

We have also listed a few additional resources for users to familiarize themselves with the Raspberry Pi:

Hardware Overview

Board Dimensions

The Qwiic EEPROM Breakout is laid out on the standardized 1" x 1" (2.54 x 2.54 cm) Qwiic breakout board and includes the standard four 0.13" mounting holes, which are compatible with 4-40 screws.

board dimensions
Board dimensions. (Click to enlarge)

Power

There is a power status LED to help make sure that your Qwiic EEPROM is getting power. You can power the board either through the polarized Qwiic connector system or the breakout pins (3.3V and GND) provided. The Qwiic system is meant to run on 3.3V, be sure that you are NOT using another voltage when using the Qwiic system.

power
Power LED and power breakout pins. (Click to enlarge)

CAT24C512 EEPROM

The CAT24C512 IC is a 512-Kb (kilobit) EEPROM flash memory is organized as 65,536 words of 8 bits each with a 128-byte page write buffer. An on board ECC (Error Correction Code) makes this EEPROM suitable for high reliability applications. The IC also offers write protection, which inhibits write operations by pulling the WP pin High (protects the entire memory). The external address pins make it possible to connect up to eight CAT24C512 EEPROM chips on the same I2C bus.

EEPROM IC
EEPROM chip. (Click to enlarge)

For more details on how the serial EEPROM works, check out our guide below:

Reading and Writing Serial EEPROMs

August 11, 2017

EEPROM is a great way to add extra memory to your microcontroller project. Wait 'til you see how easy it is to use!

Sensor Characteristics

Below, is a table of the characteristics of the EEPROM chip. For more details, please refer to the datasheet.

Characteristic Description
Power Supply Voltage: 1.8 to 5.5V
Supply Current:
  • Read Current: 1mA
  • Write Current: 1.8mA - 2.5mA
Reliability Endurance: 1,000,000 Program/Erase Cycles
Data Retention: 100 Years
Page Write Buffer 128 bytes
Write Protection Entire Memory
I2C Address (7-bit) 1010[E2][E1][E0]
0x50 (Default), 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57

Qwiic and I2C

I2C Address

The Qwiic EEPROM’s I2C address, 0x50 (7-bit), is factory set. An alternate I2C address can be configured to 1010[E2][E1][E0] by modifying the address jumpers E0, E1, E2 (see Jumpers section below).

Qwiic Connectors

The simplest way to use the Qwiic EEPROM is through the Qwiic connect system. The connectors are polarized for the I2C connection and power. (*They are tied to the corresponding power and I2C breakout pins.)

Qwiic connectors
Qwiic connectors. (Click to enlarge)

Breakout Pins

The board also provides five labeled breakout pins.

Breakout pins
Breakout pins. (Click to enlarge)

I2C

You can connect these lines to the I2C bus of your microcontroller and power pins (3.3V and GND), for a more permanent connection.

I2C Pins
I2C Connections- The pins are tied to the Qwiic connectors.

Write Protection Pin

Pulling the WP pin high, will disable all write operations to the entire memory space.

Interrupt pins
Interrupt breakout pins. (Click to enlarge)

Jumpers

There are five jumpers on the board. Not sure how to cut or modify a jumper? Read here!

Power LED Jumper

Cutting the LED jumper will remove the 1kΩ resistors and PWR LED from the 3.3V power. This is useful for low power applications.

power LED jumper
Power LED jumper. (Click to enlarge)

Write Protection

Bridging the WP jumper will pull the pin high (to the 3.3V power) and disable any write operations.

WP jumper
Write protection jumper. (Click to enlarge)

I2C Pull-Up

Cutting the I2C jumper will remove the 2.2kΩ pull-up resistors from the I2C bus. If you have many devices on your I2C bus you may want to remove these jumpers.

I2C pullup jumper
I2C pull-up resistor jumper. (Click to enlarge)

Address Jumpers

Modifying the address jumpers (E0, E1, E2) allows users to configure the I2C address. This can be used to configure the default I2C address of the device to 1010[E2][E1][E0] (7-bit).

address jumpers
Address jumpers. (Click to enlarge)

Hardware Hookup

Arduino Examples

With the Qwiic connector system, assembling the hardware is simple. All you need to do is connect your SparkFun Qwiic EEPROM Breakout - 512Kbit to the RedBoard Qwiic with a Qwiic cable. Otherwise, you can use the I2C pins of your microcontroller; just be aware of logic levels.

Hardware assembly with RedBoard Qwiic
RedBoard Qwiic connected the Qwiic EEPROM with a Qwiic cable.

Note: This tutorial assumes users are familiar with Arduino products and are using the latest stable version of the Arduino IDE on your desktop. If this is your first time using the Arduino IDE, please review our tutorial on installing the Arduino IDE.

Python Examples

With the Qwiic connector system, assembling the hardware is simple. In addition to the SparkFun Qwiic EEPROM Breakout - 512Kbit, you will need: a Qwiic cable, a SparkFun Qwiic pHAT for Raspberry Pi, single board computer, monitor, and standard peripherals. (*If you are unfamiliar with the Qwiic pHAT, you can find the Hookup Guide here.)

There are two single board computer (SBC) options that we have tested on:

Hardware assembly with Raspberry Pi 4 with Qwiic pHAT
Raspberry Pi 4 (with Qwiic pHAT) connected the Qwiic EEPROM.
Hardware assembly with Jetson with Qwiic pHAT
Jetson connected to the Qwiic EEPROM.

Note: Don't forget to connect any necessary peripherals, such as a monitor, keyboard and mouse, and power supply to the single board computer.

Note: This tutorial assumes users are familiar with using a Raspberry Pi and have the latest version of Raspbian OS (full... with recommended software) your Raspberry Pi. You can download the latest version of the Raspbian OS from the Raspberry Pi Foundation website.

If this is your first time using a Raspberry Pi, please head over to the Raspberry Pi Foundation website to use their quickstart guides. We have listed a few of them here:

  1. Setting up your Raspberry Pi
  2. Using your Raspberry Pi
  3. Documentation:
  4. Setup Documentation
    Installation Documentation
    Raspbian Documentation
    SD card Documentation

Note: This tutorial assumes users are familiar with using a Jetson Nano and you have the latest version of L4T OS your Jetson Nano. You can download the latest version of the L4T OS from the Jetson Download Center on Nvidia's website.

If this is your first time using a Jetson Nano, please head over to the Nvidia website to use their quickstart guides. We have listed a few of them here:

  1. Getting Started With Jetson Nano Developer Kit
  2. Jetson Nano Developer Kit User Guide
  3. Documentation:
  4. Jetson Nano Getting Started Guide
    Jetson Download Center
    Wiki: Jetson Nano
    Jetpack Software Documentation
    Nvidia Jetson Tutorials

Arduino Library and Examples

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

We've written a library to easily get setup and read/write data on the SparkFun Qwiic EEPROM Breakout - 512Kbit. You can install this library through the Arduino Library Manager. Search for SparkFun External EEPROM Arduino Library and you should be able to install the latest version. If you prefer manually downloading the libraries from the GitHub repository, you can grab them here:

For more details on this Arduino library and its use, please refer to the Serial EEPROM hookup guide:

Reading and Writing Serial EEPROMs

August 11, 2017

EEPROM is a great way to add extra memory to your microcontroller project. Wait 'til you see how easy it is to use!

Python Package

Note: This tutorial assumes you are using the latest version of Python 3. If this is your first time using Python or I2C hardware on a Raspberry Pi, please checkout our tutorial on Python Programming with the Raspberry Pi and the Raspberry Pi SPI and I2C Tutorial. Jetson Nano users can check out this tutorial on Working with Qwiic on a Jetson Nano through Jupyter Notebooks.

We've written a Python package to easily get setup and read/write data on the SparkFun Qwiic EEPROM Breakout - 512Kbit. There are two methods for installing the Python package for the Qwiic EEPROM.

  1. Install the all inclusive SparkFun Qwiic Python package.
  2. Independently install the Python package for SparkFun Qwiic EEPROM.

The all inclusive SparkFun Qwiic Python package, is recommended as is also installs the required I2C driver as well.

Note: Don't forget to double check that the hardware I2C connection is enabled on your single board computer.

SparkFun Qwiic Package

This repository is hosted on PyPi as the sparkfun-qwiic package. On systems that support PyPi installation via pip3 (use pip for Python 2) is simple, using the following commands:

For all users (note: the user must have sudo privileges):

language:bash
sudo pip3 install sparkfun-qwiic

For the current user:

language:bash
pip3 install sparkfun-qwiic

Independent Installation

You can install the sparkfun-qwiic-eeprom Python package independently, which is hosted by PyPi. However, if you prefer to manually download and install the package from the GitHub repository, you can grab them here (*Please be aware of any package dependencies. You can also check out the repository documentation page, hosted on ReadtheDocs.):

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic-eeprom package. On systems that support PyPi installation via pip3 (use pip for Python 2) is simple, using the following commands:

For all users (note: the user must have sudo privileges):

language:bash
sudo pip3 install sparkfun-qwiic-eeprom

For the current user:

language:bash
pip3 install sparkfun-qwiic-eeprom

Local Installation

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line (use python for Python 2):

language:bash
python3 setup.py install

To build a package for use with pip3:

language:bash
python3 setup.py sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip3.

language:bash
cd dist
pip3 install sparkfun_qwic_eeprom-<version>.tar.gz

Python Package Operation

Before we jump into getting readings, let's take a closer look at the available functions in the Python package. Below, is a description of the basic functionality of the Python package. This includes the package organization, built-in methods, and their inputs and/or outputs. For more details on how the Python package works, check out the source code and package documentation.

Dependencies

This Python package has a very few dependencies in the code, listed below:

language:python
import math
import time
import qwiic_i2c
import smbus2
import struct

Default Variables

The default variables, in the code, for this Python package are listed below:

language:python
# qwiic_eeprom GLOBAL VARIABLES
#----------------------------------------------------------------------------------------------------
# Define the device name and I2C addresses. These are set in the class defintion 
# as class variables, making them avilable without having to create a class instance.
# This allows higher level logic to rapidly create a index of qwiic devices at 
# runtine

# The name of this device 
_DEFAULT_NAME = "Qwiic EEPROM"

# Some devices have multiple availabele addresses - this is a list of these addresses.
# NOTE: The first address in this list is considered the default I2C address for the 
# device.
_AVAILABLE_I2C_ADDRESS = [0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57]
Note: This package is different from previous packages as the local variables are declared in the object class.
language:python
# QwiicEEPROM CLASS VARIABLES
#----------------------------------------------------------------------------------------------------
memory_size_bytes = 512000 / 8
page_size_bytes = 64
page_write_time_ms = 5
poll_for_write_complete = True

I2C_BUFFER_LENGTH = 32

Class

QwiicEEPROM() or QwiicEEPROM(address)
This Python package operates as a class object, allowing new instances of that type to be made. An __init__() constructor is used that creates a connection to an I2C device over the I2C bus using the default or specified I2C address.

The Constructor

A constructor is a special kind of method used to initialize (assign values to) the data members needed by the object when it is created.

__init__(address=None, i2c_driver=None):

Input: value
The value of the device address. If not defined, the Python package will use the default I2C address (0x50) stored under _AVAILABLE_I2C_ADDRESS variable.
Input: i2c_driver
Loads the specified I2C driver; by default the Qwiic I2C driver is used: qwiic_i2c.getI2CDriver(). Users should use the default I2C driver and leave this field blank.

Functions

A function is an attribute of the class, which defines a method for instances of that class. In simple terms, they are objects for the operations (or methods) of the class. A list of all the available functions are detailed on the API Reference page of ReadtheDocs for the Qwiic_EEPROM_Py Python package.

Upgrading the Python Package

In the future, changes to the Python package might be made. Updating the installed packages has to be done individually for each package (i.e. sub-modules and dependencies won't update automatically and must be updated manually). For the sparkfun-qwiic-eeprom Python package, use the following command (use pip for Python 2):

For all users (note: the user must have sudo privileges):

language:bash
sudo pip3 install --upgrade sparkfun-qwiic-eeprom

For the current user:

language:bash
pip3 install --upgrade sparkfun-qwiic-eeprom

Python Examples

There are several examples written for the Qwiic_EEPROM_Py Python package. They can be found in the Examples folder of the GitHub repository or view on the repository documentation page, hosted on ReadtheDocs. Users can also grab them here, using the link below. (*Please be aware of any package dependencies.):

Example 1 - Basic Read and Write

This example is hosted on ReadtheDocs: Example 1.

write and read data
Write data on and read data from the EEPROM. (Click to enlarge)

In this example, various data types are written to and read from the EEPROM at different memory locations.

Note: When writting data, users need to keep in mind the size of the data and memory available at the specified location. Otherwise, users can accidentally overwrite data already stored in the memory.

More Examples

Users can also check out the more advanced examples below:

Troubleshooting

Below, we have also included some troubleshooting tips for issues that you may come across.

  1. One of our employees compiled a great list of troubleshooting tips based on the most common customer issues. This is the perfect place to start.
  2. For any Arduino IDE specific issues, we recommend starting with their troubleshooting guide.

If neither of the troubleshooting guides above were able to help, here are some resources you might have missed. (Most of this material is summarized from the tutorial.)

Raspberry Pi

For comprehensive information or troubleshooting issues, on the Raspberry Pi, users should check out the Raspberry Pi Foundation website and their forum.

As a general guideline, users should use the following resources when looking for technical information or assistance that is specifically related to the Raspberry Pi itself:

  1. Raspberry Pi FAQ
  2. Raspberry Pi Beginner's Subforum
  3. Raspberry Pi Documentation and Help Guides
  4. Raspberry Pi Forum

Nvidia Jetson Nano

For comprehensive information or troubleshooting issues, on the Nvidia Jetson, users should check out the Nvidia website and their forum.

As a general guideline, users should use the following resources when looking for technical information or assistance that is specifically related to the Jetson Nano itself:

  1. Jetson Support Resources
  2. Jetson Nano Getting Started Guide
  3. Developer Kit User Manual
  4. Jetson Nano Wiki
  5. Nvidia FAQ
  6. Jetson Forum
  7. Jetpack Documentation

For users looking for technical assistance, click on the link. There you will find, basic troubleshooting tips and instructions to get started with posting a topic in our forum. Our technical support team will do their best to assist you.

Resources and Going Further

For more information on the SparkFun Qwiic EEPROM Breakout, check out the links below:

For more sensor action, check out these other great SparkFun tutorials.

SAMD51 Thing Plus Hookup Guide

This tutorial covers the basic functionality of the SAMD51 Thing Plus and highlights the features of the new ARM Cortex-M4F development board.

Basic Servo Control for Beginners

An introductory tutorial demonstrating several ways to use and interact with servo motors!

SparkFun Qwiic Thermocouple Hookup Guide

Learn how to hook up your Qwiic Thermocouple Amplifier.
New!

Moving Beyond the Ordinary With the Qwiic Alphanumeric Display

More than just numbers, more than just letters, with a little creative coding you can do teach your alphanumeric display lots of new tricks.