Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Adafruit MCP2221A USB to GPIO-I2C-ADC-DAC breakout: Examples, Pinouts, and Specs

Image of Adafruit MCP2221A USB to GPIO-I2C-ADC-DAC breakoutDesign with Adafruit MCP2221A USB to GPIO-I2C-ADC-DAC breakout in Cirkit Designer

Introduction

The Adafruit MCP2221A breakout board is a versatile and compact electronic component that bridges USB connectivity with various other common interfaces and functionalities. It serves as a USB to GPIO, I2C, ADC, and DAC converter, enabling communication between a computer and various external devices or sensors. This breakout is particularly useful for prototyping, testing, and integrating I2C devices, reading analog signals, controlling peripherals, and generating analog outputs without the need for a full microcontroller setup.

Explore Projects Built with Adafruit MCP2221A USB to GPIO-I2C-ADC-DAC breakout

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Raspberry Pi 4B with I2C Current Sensing and OLED Display: A project utilizing Adafruit MCP2221A USB to GPIO-I2C-ADC-DAC breakout in a practical application
Raspberry Pi 4B with I2C Current Sensing and OLED Display

This circuit features a Raspberry Pi 4B as the central processing unit, interfaced with an Adafruit ADS1115 16-bit I2C ADC for analog-to-digital conversion and a 0.96" OLED display for visual output. The ADC is connected to a current sensor for measuring electrical current, with the sensor's output connected to the ADC's AIN0 pin and the burden resistor connected to AIN1. The Raspberry Pi communicates with both the ADC and the OLED display over the I2C bus, using GPIO2 (SDA) and GPIO3 (SCL) for data exchange.

Open Project in Cirkit Designer
Image of Raspberry Pi 4B-Based Current Monitoring System with I2C OLED Display: A project utilizing Adafruit MCP2221A USB to GPIO-I2C-ADC-DAC breakout in a practical application
Raspberry Pi 4B-Based Current Monitoring System with I2C OLED Display

This circuit features a Raspberry Pi 4B as the central processing unit, interfaced with an Adafruit ADS1115 16-bit I2C ADC for analog-to-digital conversion and a 0.96" OLED display for visual output. The ADS1115 is connected to a current sensor for measuring electrical current, with the sensor's output and burden pins connected to the ADC's analog input channels. The Raspberry Pi communicates with both the ADC and the OLED display over the I2C bus, using its GPIO2 and GPIO3 pins for data (SDA) and clock (SCL) lines, respectively.

Open Project in Cirkit Designer
Image of Raspberry Pi 4B with I2C Sensor Data Acquisition and OLED Display: A project utilizing Adafruit MCP2221A USB to GPIO-I2C-ADC-DAC breakout in a practical application
Raspberry Pi 4B with I2C Sensor Data Acquisition and OLED Display

This circuit features a Raspberry Pi 4B as the central processing unit, interfaced with an Adafruit ADS1115 16-bit ADC for analog-to-digital conversion, a current sensor, and a ZMPT101B voltage sensor for electrical parameter measurement. The Raspberry Pi communicates with the ADC and a 0.96" OLED display via I2C (using GPIO2 and GPIO3 for SDA and SCL lines, respectively), allowing for the monitoring and display of current and voltage readings. The ADC is connected to the current sensor and voltage sensor to digitize the analog signals for processing by the Raspberry Pi.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 GP0 Configurable as GPIO, ADC0, or DAC1
2 GP1 Configurable as GPIO or ADC1
3 GP2 Configurable as GPIO or ADC2
4 GP3 Configurable as GPIO or I2C SCL
5 SDA I2C Data Line
6 VDD 3.3V Power Supply Input
7 GND Ground Connection
8 USB USB Interface Connector

Usage Instructions

How to Use the Component in a Circuit

  1. Powering the Device:

    • Connect the VDD pin to a 3.3V power supply.
    • Ensure the GND pin is connected to the common ground of your system.
  2. USB Communication:

    • Connect the USB interface to a computer using a micro-USB cable.
    • Install necessary drivers and Adafruit's MCP2221A library for communication.
  3. I2C Communication:

    • Connect SDA and SCL pins to your I2C device.
    • Use the Adafruit MCP2221A library to initialize and communicate with I2C devices.
  4. Using GPIO Pins:

    • Configure the desired pins as input or output using the library functions.
    • Read or write digital values to the GPIO pins as required.
  5. Analog-to-Digital Conversion (ADC):

    • Connect an analog signal to one of the ADC-capable GP pins.
    • Use the library functions to read the analog value.
  6. Digital-to-Analog Conversion (DAC):

    • Configure GP0 as DAC output.
    • Use the library functions to output an analog voltage.

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues Users Might Face

Solutions and Tips for Troubleshooting

Example Code for Arduino UNO

Below is an example code snippet for initializing the I2C communication using the Adafruit MCP2221A with an Arduino UNO. Ensure you have installed the Adafruit MCP2221A library before uploading the code to the Arduino.

#include <Wire.h>
#include <Adafruit_MCP2221A.h>

// Initialize the MCP2221A
Adafruit_MCP2221A mcp;

void setup() {
  Serial.begin(9600);
  // Wait for serial port to open on native USB devices
  while (!Serial) {
    delay(1);
  }

  if (!mcp.begin()) {
    Serial.println("Failed to find MCP2221A chip");
    while (1) {
      delay(10);
    }
  }
  Serial.println("MCP2221A found!");
  
  // Set I2C speed
  mcp.setI2Cspeed(400000); // 400 KHz
  // Start I2C
  Wire.begin();
}

void loop() {
  // Your I2C communication code here
}

Remember to keep the code comments concise and within the 80 character line length limit. This example demonstrates how to initialize the MCP2221A and prepare it for I2C communication. Additional functionality such as GPIO control, ADC reading, and DAC output can be implemented using the library's functions and following the usage instructions provided above.