This tutorial may be outdated. It is no longer recommended for beginners, and may need modifications to code or hardware that is not indicated in the tutorial.

Overview

Note this guide was written for MicroPython.org firmware and not Adafruit CircuitPython firmware. This guide is not maintained and is probably no longer working! We're only maintaining CircuitPython libraries at this time, but you can run CircuitPython libraries on MicroPython using Adafruit_Blinka - check that out here https://github.com/adafruit/Adafruit_Blinka

The I2C protocol is a way for multiple devices to talk to each other using just two wires, a clock and data line.  Typically you use I2C to talk to devices like sensors, small displays, PWM or motor drivers, and other devices.  Each device shares the same clock and data line and the I2C protocol allows them to talk to each other without interferance.  With MicroPython you can talk to I2C devices with a few lines of Python code!

This guide will explore how to read data from a MCP9808 I2C temperature sensor using MicroPython.  You'll learn about basic I2C operations and how to perform them with MicroPython.  Using this knowledge you can talk to any I2C device and build interesting MicroPython-powered projects!

Before you get started you'll want to be familiar with the basics of using MicroPython by reading these guides:

This guide was first published on Sep 14, 2016. It was last updated on Oct 05, 2018. This page (Overview) was last updated on Aug 11, 2018.