TMP102 — различия между версиями

Материал из roboforum.ru Wiki
Перейти к: навигация, поиск
(Новая страница: «== Description == The TMP102 is a two-wire, serial output temperature sensor available in a tiny SOT563 package. Requiring no external components, the TMP102 is cap…»)
 
м
Строка 1: Строка 1:
== Description ==
+
== Описание ==
  
 
The TMP102 is a two-wire, serial output temperature sensor available in a tiny SOT563 package. Requiring no external components, the TMP102 is capable of reading temperatures to a resolution of 0.0625°C.
 
The TMP102 is a two-wire, serial output temperature sensor available in a tiny SOT563 package. Requiring no external components, the TMP102 is capable of reading temperatures to a resolution of 0.0625°C.
Строка 12: Строка 12:
 
Note that the TMP102 is a 3.3V device and will require a [[Logic Level Converter]] ([http://www.sparkfun.com/commerce/product_info.php?products_id=8745 Sparkfun]) to connect it to a 5V Arduino.
 
Note that the TMP102 is a 3.3V device and will require a [[Logic Level Converter]] ([http://www.sparkfun.com/commerce/product_info.php?products_id=8745 Sparkfun]) to connect it to a 5V Arduino.
  
== Wiring ==
+
== Подключение ==
  
 
The TMP102 is a 3.3V device and therefore it is connected to the Arduino board through a [[Logic Level Converter]]<ref>http://forum.sparkfun.com/viewtopic.php?f=8&t=20938&p=97163</ref>:
 
The TMP102 is a 3.3V device and therefore it is connected to the Arduino board through a [[Logic Level Converter]]<ref>http://forum.sparkfun.com/viewtopic.php?f=8&t=20938&p=97163</ref>:
Строка 36: Строка 36:
 
[[Image:TMP102-footprint.png|150px]]
 
[[Image:TMP102-footprint.png|150px]]
  
== Example Code ==
+
== Пример кода ==
  
 
The following [[Category:Arduino|Arduino]] code snippet reads the temperature from the TMP102, converts the raw value to degrees Celsius and Fahrenheit, prints it on an LCD display and sends it to the serial port.
 
The following [[Category:Arduino|Arduino]] code snippet reads the temperature from the TMP102, converts the raw value to degrees Celsius and Fahrenheit, prints it on an LCD display and sends it to the serial port.
Строка 107: Строка 107:
 
<references/>
 
<references/>
  
* Data sheet: [[Image:TMP102.pdf|Datasheet]]
+
* Источник
* Breakout board schematics: [[Image:TMP102_Breakout.pdf]]
+
* Описание: [[Image:TMP102.pdf|Datasheet]]
* Connect to Arduino using the [http://www.sparkfun.com/commerce/product_info.php?products_id=8745 Sparkfun Logic Level Converter]: http://forum.sparkfun.com/viewtopic.php?f=8&t=20938&p=97163
+
* Схема отладочной платы: [[Image:TMP102_Breakout.pdf]]
* Available from [http://www.sparkfun.com/commerce/product_info.php?products_id=9418 Sparkfun], [http://www.coolcomponents.co.uk/catalog/product_info.php?cPath=36&products_id=478 Coolcomponents] and many others.
+
* Подключение к Arduino(5v) используя преобразователь уровней  [http://www.sparkfun.com/commerce/product_info.php?products_id=8745 Sparkfun Logic Level Converter]: http://forum.sparkfun.com/viewtopic.php?f=8&t=20938&p=97163
* Used in [[Arduino Weather Station]], [[LNC Thermostat]]
+
* Где купить [http://www.sparkfun.com/commerce/product_info.php?products_id=9418 Sparkfun], [hhttp://test.roboforum.ru/index.html 4Robots] и другие.
 
 
  
 
[[Category:Arduino]]
 
[[Category:Arduino]]
 
[[Category:Справочник решений]]
 
[[Category:Справочник решений]]

Версия 16:25, 3 сентября 2010

Описание

The TMP102 is a two-wire, serial output temperature sensor available in a tiny SOT563 package. Requiring no external components, the TMP102 is capable of reading temperatures to a resolution of 0.0625°C.

The TMP102 features SMBus and two-wire interface compatibility, and allows up to four devices on one bus. It also features an SMB alert function.

The TMP102 is ideal for extended temperature measurement in a variety of communication, computer, consumer, environmental, industrial, and instrumentation applications. The device is specified for operation over a temperature range of –40°C to +125°C.

TMP102PinConf.png TMP102Diagram.png

Note that the TMP102 is a 3.3V device and will require a Logic Level Converter (Sparkfun) to connect it to a 5V Arduino.

Подключение

The TMP102 is a 3.3V device and therefore it is connected to the Arduino board through a Logic Level Converter[1]:

  • LV to the 3.3V pin of the Arduino
  • HV to the 5V pin of Arduino
  • HV Channel 1 TXO to the SDA pin (analog 4)
  • HV Channel 2 TXO to the SCL pin (analog 5)
  • Low voltage Channel 1 TXI to the SDA pin of TMP102
  • Low voltage Channel 2 TXI to the SCL pin of TMP102
  • The RX pins of the Logic Level Converter are not used
  • V+ of TMP102 connected to 3.3V
  • ADD0 of TMP102 connected to ground
  • ALT of TMP102 not connected
  • All grounds connected together.

TMP102-top.jpg TMP102-bottom.jpg

TMP102-perspective.jpg

Component side with test overlay:
TMP102-footprint.png

Пример кода

The following code snippet reads the temperature from the TMP102, converts the raw value to degrees Celsius and Fahrenheit, prints it on an LCD display and sends it to the serial port.

 #include <LiquidCrystal.h>
 #include <Wire.h>
 
 // initialize the library with the numbers of the interface pins
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
 byte res;
 byte msb;
 byte lsb;
 int val;
 float tC;  // temperature in Celsius
 float tF;  // temperature in Fahrenheit
 
 void setup()
 {
   // set up the LCD's number (col,row): 
   lcd.begin(20, 2);
   lcd.print("Temp");
 
   Serial.begin(9600);
   Wire.begin();
 }
 
 void loop()
 {
   lcd.clear();
   
   /* get new value from TMP102 */
   res = Wire.requestFrom(72,2);
   
   if (res == 2) {
     msb = Wire.receive(); /* Whole degrees */ 
     lsb = Wire.receive(); /* Fractional degrees */ 
     val = ((msb) << 4);   /* MSB */
     val |= (lsb >> 4);    /* LSB */
     
     /* calculate temperature */
     tC = val*0.0625;
     tF = (tC * 9/5) + 32;
     
     /* show temperatures on display */
     lcd.print(tC);
     lcd.print("\xdf""C");
 
     lcd.setCursor(0, 1);
     lcd.print(tF);
     lcd.print("\xdf""F");
 
 
     Serial.print(tC);
     Serial.print("C   ");
     Serial.print(tF);
     Serial.println("F");
 
   }
   else {
     lcd.print("ERR");
     Serial.println("ERROR");
   }
   
   delay(1000);
 }

References