MCP9808
Works with
Any CircuitPython board with I2C
What it does
The MCP9808 is a precision I2C temperature sensor with ±0.25°C accuracy across a -40°C to +125°C range. Its tight accuracy makes it a good choice when you need reliable temperature readings rather than rough estimates. Common applications include room climate monitoring, thermal management for electronics, and any project where temperature precision matters. Up to 8 MCP9808 sensors can share a single I2C bus by setting the three address pins on each breakout.
Installing the library
Copy adafruit_mcp9808.mpy from the Adafruit CircuitPython Bundle to your board's lib/ folder. Also copy adafruit_bus_device/ if it is not already present.
Quick start
import board
import busio
import adafruit_mcp9808
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_mcp9808.MCP9808(i2c)
print(sensor.temperature)
Key things you can do
| What you want | How to do it |
|---|---|
| Read temperature (°C) | sensor.temperature |
| Set measurement resolution | sensor.resolution = 3 (0 = fastest/least precise, 3 = slowest/most precise) |
| Use multiple sensors on one bus | Wire address pins and pass address= to constructor, e.g. MCP9808(i2c, address=0x19) |
Reading the official docs
https://docs.circuitpython.org/projects/mcp9808/en/latest/
The API reference lists the temperature property and the resolution property. The resolution constants are defined at the top of the module — look there first if you want to understand the tradeoff between measurement speed and precision.
Projects using this library
- Adafruit MCP9808 Precision I2C Temperature Sensor Guide — full wiring and usage walkthrough. Credit: Adafruit Learning System
- Temperature Lamp — changes LED color based on ambient temperature. Credit: This wiki