Writing to TI TMP175 Temperature Sensor Using I2C

17 Feb 2010

I have been playing around with a TMP175 using the mbed I2C read function and can easily get a temperature reading.

I would like to do some writing and reading the configuration and high and low temperature registers but cannot find an example after a long Google search.

Does anyone have an example using this device or can someone create a list of the byte codes for the following read/writes? I have the data sheet for the TMP175 so the individual bit settings are no problem, just a general example will be helpful.

config
low temp
high temp

I found some examples for I2C writing to an SAA1064 display driver so I have some familiarity with writing to I2C devices now.

-Johnnie

(enjoying the day - mbed!)

18 Feb 2010

I think I figured it out.

One must send an a register selection byte (0=temp, 1=config, 2=low temp, 3=high temp) to the i2c address, then the actual byte to write to it - so 2 bytes of the char array are used for writing:
chararray[0]=register select byte, chararray[1]=value to write - I2c.write(0x90,chararray,2)

And to read the values one must first send a single byte to select the register, then read the byte(s) with i2c.read()

Cool stuff. As is usually the case, experimentation brings insight.

-Johnnie

24 Feb 2010

I'm currently trying to use a SAA1064 with an MBED without much luck (although I'm completely inexperienced with the I2C protocol). Could you possibly share the code examples you mentioned? It would be a massive help!

Thanks in advance!

 

Chris

24 Feb 2010

Chris,

There is some redundancy in this code that I was using for testing, as you will notice. I was just playing around with the brightness on this last test, which was the last I saved.

I think if you get this working you'll have an understanding of the process of writing to it. I was using a I2C display from MicroResearch which I purchased from Gravitech, using a 3 AA pack for powering the display with a common ground on the mbed.

I really like I2C now and will be using it for as much IO as possible. I really would love to find a US source for some inexpensive breakout boards for I2C stuff. It would be cool to use the SAA1064 chip for 32 individual LED's, which is possible as each it bit addressable.

Also it would be cool if I could extend the mbed I2C code because there is a lot of single byte writing and reading that makes the existing interface a bit cumbersome. With I2C, programming peripheral devices is a breeze.

-Johnnie

#include "mbed.h"

I2C i2c(p28,p27);
const char  SS[10] = {63,6,91,79,102,109,125,7,127,111};

int main() {
    char cmd[7];

    while (1) {
        int i;
        for (i=1 ; i<8 ; i++) {
            cmd[0] = 0;           // instruction byte
            cmd[1] = 0x17;        // control byte              0x10,0x20,0x40 for brightness
            cmd[1] = 0x77;        // all segments turned on for test
            cmd[1] = i * 16 + 0 + 4 + 2 + 1;
            cmd[2] = SS[i];       // rightmost digit segments
            cmd[3] = SS[i];       //
            cmd[4] = SS[i];       //
            cmd[5] = 128;       // leftmost digit segments

            i2c.write(0x70,cmd,6);
            wait(1);
        }
    }
}

24 Feb 2010

Thankyou very much for the quick response - I'll run this tomorrow and let you know how I get on.

I was running some Arduino based code that I had butchered into something that compiled for the mbed but wasn't having a lot of luck, this looks like it makes much more sense.

Once again, much appreciated!

Chris

20 Aug 2010 . Edited: 20 Aug 2010

 

user avatar Johnnie Norsworthy wrote:

I have been playing around with a TMP175 using the mbed I2C read function and can easily get a temperature reading.

I would like to do some writing and reading the configuration and high and low temperature registers but cannot find an example after a long Google search.

Does anyone have an example using this device or can someone create a list of the byte codes for the following read/writes? I have the data sheet for the TMP175 so the individual bit settings are no problem, just a general example will be helpful.

config
low temp
high temp

I found some examples for I2C writing to an SAA1064 display driver so I have some familiarity with writing to I2C devices now.

-Johnnie

(enjoying the day - mbed!)

 

 

Hi Johnnie Norsworthy
I have problems to test the tmp175. Could you show the code you used.
thanks

20 Aug 2010

I can't resist a challenge. I'm going to buy a TMP175 and experiment. I'll report next week.