Brooke's World The life and ramblings of Brooke.

May 6, 2017

Testing MCP9808 with Bus Pirate

Filed under: Contextual Electronics — Brooke @ 3:55 pm

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
Initalize the Bus Pirate
m 4 1 Mode, I2C, Speed 5khz
W Turn power on
P Turn on pull ups

 

Command What it does Output
Find the I2C address
(1) Find the slave address 0x30(0x18 W) 0x31(0x18 R)

 

Command What it does Output
Working with the Config register
[ 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
Working with the Manufacturer register
[ 0x30 0x06 [ 0x31 r:2 ] Read the register 0x00 0x54  (default)

 

Command What it does Output
Working with the Device register
[ 0x30 0x07 [ 0x31 r:2 ] Read the register 0x04 0x00  (default)

 

Command What it does Output
Working with the Resolution register
[ 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
Working with the Ambient temperature register
[ 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
0x40 0x00, TA>TUPPER
0x20 0x00, TA<TLOWER
0x10 0xBE ( after upper&1F ), TA < 0C, Celsius = d256 – ((( 10 & 0F ) * d16) + (BE/d16))= -245?

 

Click image for full size

 

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress