As part of the CE Header project from the CE Skills course , I picked an additional temp sensor to test with, the MCP9808. I used a Bus Pirate (Dangerous Prototypes) and probes, from Seeed Studio, to iteratively poke at it until I understood how to talk to it via I2C.
Once I soldered the MCP9808 to a small carrier board from Adafruit, I placed it on a breadboard and wired it up to the Bus Pirate. Please note, the cable and connectors in the image below are from the Seeed probe cable. Some of the other probe cables have the colors in a different order on the connectors.
I used putty to connect to the Bus Pirate via a mini usb cable.
Command | What it does |
m 4 1 | Mode, I2C, Speed 5khz |
W | Turn power on |
P | Turn on pull ups |
Command | What it does | Output |
(1) | Find the slave address | 0x30(0x18 W) 0x31(0x18 R) |
Command | What it does | Output |
[ 0x30 0x01 [ 0x31 r:2 ] | Read the register | 0x00 (default) |
[ 0x30 0x01 0x00 0x08 ] | Enable Alert Stat | |
[ 0x30 0x01 0x00 0x08 [ 0x31 r:2 ] | Enable Alert Stat and read back current config | 0x00 0x08 |
Command | What it does | Output |
[ 0x30 0x06 [ 0x31 r:2 ] | Read the register | 0x00 0x54 (default) |
Command | What it does | Output |
[ 0x30 0x07 [ 0x31 r:2 ] | Read the register | 0x04 0x00 (default) |
Command | What it does | Output |
[ 0x30 0x08 [ 0x31 r:1] | Read the register | 0x03 (default) |
[ 0x30 0x08 0x00 [ 0x31 r:1] | Set register to 0x00 or 1 bit resolution and read back | 0x03 |
Command | What it does | Output |
[ 0x30 0x05 [ 0x31 r:2 ] | Read the register | ex: 0xC1 0xBC
Celsius = (C1BC & FFF)/16 = 24C or 75F, see P25 of MCP9808 Datasheet |
Special result values
0x80 0x00, TA>TCRIT |