

The Adafruit MCP9808 is a precision digital temperature sensor that offers high accuracy and easy interfacing, making it suitable for a wide range of temperature monitoring applications. Its high resolution and accuracy are ideal for environmental monitoring, data logging, HVAC systems, and other scenarios where precise temperature readings are crucial.








| Pin Number | Name | Description |
|---|---|---|
| 1 | VDD | Power supply (2.7V to 5.5V) |
| 2 | GND | Ground connection |
| 3 | SDA | I2C Data line |
| 4 | SCL | I2C Clock line |
| 5 | A0 | Address pin 0 |
| 6 | A1 | Address pin 1 |
| 7 | A2 | Address pin 2 |
| 8 | Alert | Alert/Interrupt output |
#include <Wire.h>
#include <Adafruit_MCP9808.h>
// Create MCP9808 temperature sensor object
Adafruit_MCP9808 tempsensor = Adafruit_MCP9808();
void setup() {
Serial.begin(9600);
Serial.println("MCP9808 test");
// Begin communication with the sensor
if (!tempsensor.begin()) {
Serial.println("Couldn't find MCP9808!");
while (1);
}
}
void loop() {
// Read and print out the temperature
Serial.print("Temp: ");
Serial.print(tempsensor.readTempC());
Serial.println("*C");
// Delay between readings
delay(1000);
}
#include <Wire.h>: Includes the I2C library for communication.#include <Adafruit_MCP9808.h>: Includes the library for the MCP9808 sensor.Adafruit_MCP9808 tempsensor: Creates an object for the temperature sensor.tempsensor.begin(): Initializes the sensor and checks for its presence.tempsensor.readTempC(): Reads the temperature in Celsius from the sensor.delay(1000): Pauses the loop for 1 second between temperature readings.Q: Can the MCP9808 be used with a 3.3V system? A: Yes, the MCP9808 operates between 2.7V and 5.5V, making it compatible with both 3.3V and 5V systems.
Q: How many MCP9808 sensors can be connected on the same I2C bus? A: Up to eight MCP9808 sensors can be connected on a single I2C bus by configuring the address pins (A0, A1, A2) to different settings.
Q: What is the purpose of the Alert pin? A: The Alert pin can be used to trigger an interrupt on the host microcontroller when the temperature exceeds a programmed limit.
Q: How do I calibrate the sensor? A: The MCP9808 is factory-calibrated and typically does not require additional calibration. However, you can perform software calibration by comparing and adjusting readings against a known temperature standard if necessary.