Recent changes
Slingshot user guide
tag Guide, user
NFCLamp user guide
tag Guide, user
Homepage
MPL115A2
Compiler Error 42
From the mbed microcontroller Cookbook.  

TMP102 Temperature Sensor

The TMP102 is an I2C digital temperature sensor in a small SOT563 package, with a 0.0625C resolution and 0.5C accuracy.

/media/uploads/chris/tmp102_crop.jpg

Hello World!

TMP102mbed
1 - Vcc (square pad)Vout
2 - SDAp9
3 - SCLp10
4 - GndGnd

» Import this program

00001 #include "mbed.h"
00002 
00003 #include "TMP102.h"
00004 
00005 TMP102 temperature(p9, p10, 0x90); //A0 pin is connected to ground
00006 
00007 int main()
00008 {
00009   printf("Temperature: %f\n", temperature.read());
00010   return 0;
00011 }

Library

» Import this library into a programTMP102

TMP102 published as a library that can be imported independent




calendar Page history
Last modified 3 weeks, 6 days ago, by   user Chris Styles   tag TMP102 | 5 comments  

5 comments on TMP102 Temperature Sensor:

29 Oct 2010
14 Feb 2011

Hi, I want to use two sets of TM102 sensors and I am using the second 12C bus on pins 28,27 however I added an additional class see below with pin numbers changed but the code hangs when attempting to read from the second I2C bus. Main - see code files

/media/uploads/pmr1/tmp102_2.zip

15 Feb 2011

Hi Paul,

There should be no need to create new code to connect to two of these (i.e. no need for TMP102 and TMP102_2 classes), just instance it twice. So instead of:

Code

TMP102 temperature0(p9, p10, 0x90); //A0 pin is connected to ground, Clock is P10
TMP102_2 temperature1(p28, p27, 0x90);

just do:

Code

TMP102 temperature0(p9, p10, 0x90); 
TMP102 temperature1(p28, p27, 0x90);

In fact, the TMP102 can be configured to have different I2C addresses, so you could even put them on the same bus, and just change the address (i.e both use p9, p10).

Simon

07 Mar 2011

Hi I'm seeing my .read() statement hang the MBED. i.e it does not return from the call now and again over long periods of time.

I'm sampling about once a second i.e

temperature.read(); wait(1);

This hanging happens every few hours and does not seem to have a pattern.

I have a watchdog routine set to 30 seconds and it then resets the system and all is well again for a period of time. Anyone else see this? and any possible solutions?

06 Apr 2011

Please note that the example doesn't work with the Cool Components LPC1768 Workshop Development Board (version 2):

http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=608

This is because p9 is tied to 3.3V by the SD socket. You can work around this by using pins 28 and 27:

Code

TMP102 temperature(p28, p27, 0x90);   //A0 pin is connected to ground

As the comment implies, you also need to tie the ADD0 pin on the breakout board to GND.

Please login to post comments.