Getting Started with the MCP9808 High Accuracy i2c Temperature Sensor

#1
The MCP9808 from Microchip is in many ways an i2c equivalent to the ubiquitous DS18B20 and just as easy, if not easier, to use.

Attached is my "Getting Started" tutorial and Basic program file (example using the PICAXE 18M2) for those who wish to try the MCP9808.


Edit: 30Jan16
Slight amendment in the program and pdf files -to fix a typo in the comments
also recompiled the pdf with PDFCreator rather than the Microsoft pdf creation tool that comes with Win10 which brought size of pdf down from 220+ kB to 27 kB in size.
 

Attachments

Last edited:
#2
Getting Started with the MCP9808 High Accuracy i2c Temperature Sensor - Part 2

For those with multiple MCP9808 temperature sensors, attached are some words and PICAXE BASIC program to read and compare the temperature readings from 1 x DS18B20 and 2 x MCP9808 devices.

There are comments in the words reflecting the changes in the requirement for the Hi2cSETUP command and also demonstrating how the device register/location can be embedded in the Ji2cIN command removing the need for a prior Hi2cOUT command.
 

Attachments

#3
The final program in this series showing how to use the MCP9808 Temperature Sensors.

In the attached program, two MCP9808 devices are being used.
For the second MCP9808, the lower, upper and critical alarms are being set together with the Alarm/Event output being enabled and connected back into pin C.0 of the PICAXE 18M2.
Note that the Event/Alert pin is open collector and needs a pull-up resistor (4.7K or 10k will suffice)
The program displays the temperatures from both the MCP9808 Temperature Sensors. If the PICAXE detects that the Alert pin is taken low then it also indicates on the PE terminal window what type of temperature alarm event has occured.

In the program I have used a low setpoint of 28, a high setpoint of 30 and a critical setpoint of 31 degC. Those values will allow you to see the effect of passing through the three setpoints by placing your finger on and removing from the MCP9808 chip.

Have fun in a PICAXE world :)



EDIT:
I should also mention that Microchip has several other temperature sensors in the MCP9800 series.
Some such as the MCP9801 and MCP9803 are available in the slightly larger SOIC8 package which it is possible to hand solder such as to a SOIC8 to DIP8 adapter board if desired.
The MCP9800 and MCP9802 are available in the SOT23-5 package (slightly larger pin spacing again) but these versions have no address pins so a max of 1 per i2c network or some other selection scheme.
 

Attachments

Last edited:
#4
Thanks for the useful information Westaust.

Out of interest, how did your readings on the three sensors compare? I have an MCP9808 and a DS18B20 and they are about a degree C apart (DS18B20 is higher), which isn't very reassuring. Possibly self-heating or poor manufacturing tolerance?
 
Last edited:

hippy

Technical Support
Staff member
#5
Both the MCP9808 and DS18B20 have a +/- 0.5C specification so a difference of almost a degree could be expected.

As the old saying goes; "a man with two watches never knows what the time is". That equally applies to temperature and most other sensors.
 
Top