Prepare the header strip:

Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down

Add the breakout board:

Place the breakout board over the pins so that the short pins poke through the breakout pads

And Solder!

Be sure to solder all pins for reliable electrical contact.

(For tips on soldering, be sure to check out our Guide to Excellent Soldering).
You're done! Check your solder joints visually and continue onto the next steps

Arduino Wiring

You can easily wire this sensor to any microcontroller, we'll be using an Arduino
  • Connect VIN (Vdd) (red wire on the STEMMA QT version) to the power supply, 3V or 5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
  • Connect GND (black wire on the STEMMA QT version) to common power/data ground
  • Connect the SCL pin to the I2C clock SCL pin on your Arduino (yellow wire on STEMMA QT version). On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
  • Connect the SDA pin to the I2C data SDA pin on your Arduino (blue wire on STEMMA QT version). On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2

The MCP9808 has a default I2C address of 0x18 but you can set the address to any of 8 values between 0x18 and 0x1F so you can have up to 8 of these sensors all sharing the same SCL/SDA pins.

Download Adafruit_MCP9808

To begin reading sensor data, you will need to download the Adafruit MCP9808 library from the Arduino library manager.

Open up the Arduino library manager:

Search for the Adafruit MCP9808 library and install it

We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

Load Demo

Open up File->Examples->Adafruit_MCP9808->mcp9808test and upload to your Arduino wired up to the sensor
Thats it! Now open up the serial terminal window at 9600 speed to see the temperature in real time. You can try touching your finger to the sensor to see the temperature rise.

This guide was first published on Apr 03, 2014. It was last updated on Mar 13, 2024.

This page (Arduino Code) was last updated on Mar 08, 2024.

Text editor powered by tinymce.