Giuseppe Parrello

 

Temperature sensor MTI MCP9808


Introduction

This embedded sensor, measuring ambient temperature, is based on the MTI MCP9808 chipset and is compatible with the I2C serial interface. For ease we are going to connect it to the FTDI FT232H device, of which there is a dedicated page on this site - refer to the above page for installation.

 

Connection via I2C

This sensor must be connected to the FTDI FT232H development board via I2C protocol. The connection connectors are listed below:

Image Board FT232H Sensor MCP9808

FT232H - MCP9808

AD0 SCL
AD1 + AD2 SDA
+5V / +3.3V VCC
GND GND

The default hexadecimal address of this sensor is "18", but it can be changed by connecting pins A0-A2 to VDD pin. These pins must be considered as a binary number, A0 is bit 0, while A2 is bit 2, the result of these bits must be added to the hexadecimal number "18". Therefore if only jumper A0 is connected to VDD pin, the I2C address will become "19" ("hex 18" + "bin 001" = "hex 19"), while if only jumper A2 is connected to VDD pin, the I2C address will become "1C" ("hex 18" + "bin 100" = "hex 1C").

To get the hexadecimal address of this sensor, go to the PyFTDI website and download the following Python script. Once downloaded, run it via the Python interpreter. The output of the above script is as follows:

admin@RT-AC86U:/# python3 i2cscan.py

   0 1 2 3 4 5 6 7 8 9 A B C D E F
0: . . . . . . . . . . . . . . . .
1: . . . . . . . . W . . . . . . .
2: . . . . . . . . . . . . . . . .
3: . . . . . . . . . . . . . . . .
4: . . . . . . . . . . . . . . . .
5: . . . . . . . . . . . . . . . .
6: . . . . . . . . . . . . . . . .
7: . . . . . . . . .

 

Python libraries

To manage this sensor, we can use one of the following Python libraries: