cactus.io logo

How to Hookup Microchip MCP9808 Temperature Sensor to Arduino Board

Overview

The MCP9808 digital temperature sensor converts temperatures between -20°C and +100°C to a digital word with ±0.5°C (max.) accuracy. It is I2C compatible and supports up to 16 devices on the bus. We do not require pullup resistors on the data or clock signals as they are already installed on the breakout board.

The MCP9808 is available in a discrete component form but it is much easier to use it mounted on a breakout board. We used the Adafruit breakout board.

In this hookup we are only connecting one device to the Arduino. It reads the temperature and displays it on the console.

Images

Microchip MCP9808 Temperature Sensor Details
Adafruit MCP9808 Temperature Sensor Breakout Board
Note: Images shown on this page are not to scale.

Hardware and Software Parts List


Data Sheets


Wiring up Microchip MCP9808 Temperature Sensor


The MCP9808 requires 2 wires for the I2C bus plus power and ground. The power can be either 5V or 3.3V.

We connect the Data and clock wires to Analog ports A4 and A5 which is the I2C pins on the Arduino.

Hookup Diagram for connecting the MCP9808 breakout board to a Arduino Board

Connect Arduino to MCP9808 Temperature Sensor Hookup

Software

The hookup and Arduino Sketch is for connecting a single Adafruit MCP9808 breakout board.

You will need to download the cactus.io MCP9808 library to work with this sample sketch. The library supports reading the temperature from the sensor.

Limitations
  • The sketch Supports only one sensor connected to the I2C bus.
  • Its blocking code.
Microchip MCP9808 Sample Sketch
Download as (Arduino Sketch) (Text File)
1
/* This is a demo for the Microchip MCP9808 Temperature Sensor. We used the Adafruit
2
MCP9808 breakout board. Click on this link to go to the Adafruit website for more
3
details about this board.
4
http://www.adafruit.com/products/1782
5
6
For information about hooking up this board to the Arduino then click on this link
7
to visit the hookup guide on the cactus.io website.
8
http://cactus.io/hookups/sensors/temperature-humidity/mcp9808/hookup-arduino-to-mcp9808-temperature-sensor
9
*/
10
11
#include <Wire.h>
12
#include "cactus_io_MCP9808.h"
13
14
// Create a MCP9808 sensor object
15
MCP9808 mcp = MCP9808();
16
17
void setup(){
18
Serial.begin(9600);
19
Serial.println("Microchip MCP9808 Temperature Sensor | cactus.io");
20
Serial.println("Temp (C)\tTemp (F)");
21
22
// Check if sensor is found
23
if (!mcp.begin()) {
24
Serial.println("Couldn't find MCP9808!");
25
while (1);
26
}
27
}
28
29
void loop(){
30
31
// wake up MSP9808
32
mcp.sensorPowerUp();
33
34
mcp.readSensor();
35
36
Serial.print(mcp.getTemperature_C()); Serial.print(" *C\t");
37
Serial.print(mcp.getTemperature_F()); Serial.println(" *F\t");
38
delay(250);
39
40
// Shutdown MCP9808 to reduce power consumption
41
mcp.sensorPowerDown();
42
43
// Add a 2 second delay.
44
delay(2000);
45
}

Sketch Console Output

Arduino Microchip MCP9808 Temperature Sensor Sketch

Other Resources

Adafruit MCP9808 Tutorial


License