This guide will show you how to use an MCP2221(A) to connect to I2C sensors and breakouts from your desktop PC running Windows, Mac OSX, or Linux. The MCP2221 also allows for general purpose digital input and output (GPIO) for things like buttons and LEDs, analog to digital conversion (ADC), and digital to analog (DAC).
The cool part about this is that you can then use any of the CircuitPython Libraries that have been written for the numerous I2C sensors and breakouts. You can bring that data directly into your PC for any kind of powerful analysis or presentation.
As you are going through this guide, keep in mind the difference between CircuitPython and CircuitPython Libraries:
- CircuitPython - a microprocessor specific implementation of Python written in C. Here's the source code. And here's the main CircuitPython guide.
- CircuitPython Libraries - sensor and breakout specific code written in Python using the CircuitPython hardware API. There are a lot of these - check out the bundle.
There are various hardware combinations that allow for running CircuitPython and CircuitPython Libraries. In this guide we will not be using the actual CircuitPython firmware. But we will be using CircuitPython Libraries.
This is essentially the same idea as discussed in the FT232H Guide. How can we directly connect common hardware items like buttons and I2C breakouts to a PC?
The MCP2221 provides another way to do this by utilizing the USB bus. The MCP2221 just makes different trade offs relative to the FT232H. The biggest being no hardware SPI support. But you do gain ADC and DAC support. Also, it's much cheaper than the FT232H.
So you end up with something like this:
Great! Let's get everything setup so we can actually do some fun stuff.