Arduino I2C with the MCP9808 Temperature Sensor

The Microchip MCP9808 is a high precision temperature sensor with an I2C interface – making it easy to interface with microcontroller or embedded Linux electronics. The chip has a very small form-factor: available as either an 8-pin DFN package – or an 8-pin MSOP package. For hobbiest purposes DFN is almost impossible to use due to the complexity of having to reflow solder under the contacts; and MSOP is quite challenging (though it can be done with care). If you want something easy to use with a breadboard however, the good folks at Adafruit can come to the rescue – as they sell the device pre-soldered to a SIP breakout board. (Also available from Makersify in the UK).

Adafruit MCP9808 Breakout board
Adafruit MCP9808 Breakout board

If all you want to do is get something up and running quickly – then you can’t do better than to use the Adafruit Aurduino library (or if you prefer a Python library for BeagleBone or RPi).

Adafruit have done a great job with these libraries and most users will be delighted that “it just works”; but I want to explore how it all works: how to actually communicate with chip directly – using I2C. This guide written from the point of view of an Arduino; but you should be able to follow along from any other device if you’re reasonably familiar with I2C and low-level coding.

Continue reading “Arduino I2C with the MCP9808 Temperature Sensor”