Grove I2C Temperature Sensor –

For a long time, I have been wanting to make a better temperature sensor module with an I2C interface, and although I have a few issues to take care of, the main thing holding me back is my monetary fund. A while back, I came across some cheap I2C temperature sensor modules from China and thought it was worth buying one from any web store to test out some ideas. However, by luck I got a “Grove-I2C Temperature Sensor (MCP9808)” module from Seeed Studio ( as a gift, and I was greatly pleased!

Grove – I2C Temperature Sensor (MCP9808) Module

The Grove – I2C High Accuracy Temperature Sensor (MCP9808) is a pretty cute module based on MCP9808. In addition to high-precision temperature measurements, the module also offers a programmable temperature alert.

This is the pin map of the module:

Working voltage of the module is in 3.3V to 5V range, and the digital interface is I2C (400kHz). Default I2C address of the module is 0x18, but since the module has a set of pads on the back of the PCB, you can cut those pads and solder them to the other side (High level) to change the 7bits I2C address. Furthermore, you can see the ALE Pad on the back of the module. The alert signal output from this pad can be used as an external interrupt signal for other controllers. The default output is high (3.3V) but when the condition is met the output becomes low(0V).

This is the replicated partial schematic of the module:

As you can see, there is a low dropout (LDO) 3.3V voltage regulator, and a bi-directional logic-level shifter circuit. The I2C bus of this module uses 3.3V, so in order to interface with the I2C bus of a 5V microcontroller, this improver will be required.

Microchip Digital Temperature Sensor MCP9808

According to Microchip Technology Inc.’s datasheet, MCP9808 digital temperature sensor chip converts temperatures between -20°C and +100°C to a digital word with ±0.25°C/±0.5°C (typical/maximum) accuracy. This sensor has an industry standard 400 kHz, 2-wire, SMBus/I2C compatible serial interface, allowing up to eight or sixteen sensors to be controlled with a single serial bus. Moreover, the chip comes with user-programmable registers that allow user-selectable settings such as Shutdown or Low-Power modes and the specification of temperature Alert window limits and critical output limits. When the temperature changes beyond the specified boundary limits, the chip outputs an Alert signal. The user has the option of setting the Alert output polarity signal as an active-low or active-high comparator output for thermostat operation, or as a temperature Alert interrupt output for microprocessor-based systems. The Alert output can also be configured as a critical temperature output only.

Note that VDD is the power pin, and GND is the system ground pin. The SCL is a clock input pin. All communication and timing are relative to the signal on this pin (the clock is generated by the host or master controller on the bus). The SDA is a bidirectional input/output pin, used to serially transmit data to/from the host controller (this pin requires a pull-up resistor). The Alert is an open-drain output pin which delivers a signal when the ambient temperature goes beyond the user-programmed temperature limit.

The Address Pins (A0, A1, A2) are device address input pins. As mentioned before, the default device address is 0x18 and the address can be calculated by ‘adding’ the A0/A1/A2 to the base of 0x18. A0 sets the lowest bit with a value of 1, A1 sets the middle bit with a value of 2 and A2 sets the high bit with a value of 4. The final address is 0x18 + A2 + A1 + A0.

So, it seems:

  • If only A0 is tied to VDD, the address is 0x18 + 1 = 0x19
  • If only A1 is tied to VDD, the address is 0x18 + 2 = 0x1A
  • If only A2 is tied to VDD, the address is 0x18 + 4 = 0x1C
  • If A2 and A0 are tied to VDD, the address is 0x18 + 4 + 1 = 0x1D
  • By the same token, if A2-A1-A0 all are tied to VDD, then the address is 0x1F

The I2C address range from 0x18 to 0x1F, among them. We can choose whatever we want!

Measuring Temperature with Arduino

Now we are going to look at how to use the temperature sensor module with an Arduino. It is quite easy as there’re several Arduino libraries available for playing with them. I used the library provided by Seeed Studio. Yes, Seeed Studio saves the day again with an excellent library, which is not surprising as I am using a Grove-Sensor module. Their library makes working with the MCP9808 module very simple. No matter what your application you are sure to find that it will do the job quickly and neatly.

It’s quite easy to connect the module to an Arduino or any similar microcontroller, as the device only has a 2-wire (I2C) serial interface. Since the module has an onboard voltage regulator (and a logic level translator) it operates on a supply voltage of 3.3 to 5.0 volts, making it suitable for use with most microcontrollers. Obviously, the sensor module would be good when you want to save some I/O pins and when you already are using I2C interface. Pretty great stuff if you ask me!

My first thought was to use an Arduino Nano to test the sensor module through a special Nano I2C shield lying around.

But later I decided to try the Seeeduino Nano as it provides a dedicated I2C connector onboard, makes hooking up with the sensor module very simple.

And then, I simply loaded a simple Arduino sketch to the Seeeduino Nano.

Next, I opened the serial monitor and observed the readings. They are very precise.

I also gave mine a second test with my trusty infrared digital thermometer to verify the serial monitor readout.

If you want to experiment with the Alert output, you will then need to prepare a new code, or use the simple demo (MCP9808_demo_with_limit) included in the aforesaid library. I will not be using the Alert function in my tests. Likewise, if you want to change the device address, just note that you will also need to change the I2C address in the file “Seed_MCP9808.h” in the library (see below).

This is the code I used to display temperature on the serial monitor:




 * Quick Test/Demo Code

 * Arduino Hardware - Seeeduino Nano v1

 * Author - T.K. Hareendran / 2020


/* Default I2C Address = 0x08 - See Text */

#include "Seeed_MCP9808.h"

MCP9808  sensor;

void setup()





        Serial.println("sensor Init FAILED!");


    Serial.println("Sensor READY!");

    Serial.println("Reading Temperature...");


void loop()


    float temp=0;

    //get temperature ,a float-form value.


    Serial.print("Temperature *C =  ");





If you do not have a Seeeduino Nano handy, do not worry, you can use other common Arduino models with this precision temperature sensor module. However, note that the SDA and SCL connections for I2C are different between Arduino boards. I have put together a table to help you get it figured out.

Arduino Board/Chip SDA SCL
Uno A4 A5
Nano A4 A5
Pro Mini A4 A5
Mega2560 20 21
Leonardo 2 3
ATmega328P 27 28

Some Arduino Uno models have separate SDA and SCL pins and you can use them instead of the two analog pins if you wish.

On a side note, I incidentally noted that MCP9808 is available in two address flavors – 0011xxx and 1001xxx. The MCP9808 chip used in the Grove-sensor module presented here has the 0011xxx (factory-set) address code, so with the default configuration (A2 =0/A1 =0/A0 =0) the I2C address is 0011000 in Binary ie 18 in Hexadecimal.

In the below figure, however, you can see a different MCP9808 model with 0x48 (0b1001000) I2C start address!

A successful leap…

In this short article the interfacing of the Grove-MCP9808 sensor module with Seeeduino Nano has been demonstrated. To read the temperature values, I simply use Arduino IDE’s inbuilt serial monitor.

I put the quick test setup into my lawn a couple of hours after it was built, and in my tests so far, it delivers sensible readings, which bodes well for using it in my next agricultural electronics project. Please stay tuned if you also get interested in this incredibly stable temperature sensor like me and want to investigate/learn further. Meanwhile, if you have found this post useful please share it to help others discover it. Thanks!

Related Resources

MCP6808 Datasheet

Seeed Studio Wiki

Arduino Nano Project

Adafruit Guide

Raspberry Pi Project

Leave a Comment