Arduino与Proteus仿真实例-TC74温度传感器驱动仿真

TC74温度传感器驱动仿真

1、TC74介绍

TC74 是一款可串行访问的数字温度传感器,特别适合低成本和小尺寸应用。 温度数据从板载热传感元件转换而来,并以 8 位数字字的形式提供。 与 TC74 的通信是通过一个简单的 2 线 SMBus/I2C™ 兼容串行端口完成的。 该总线还可用于实现多点/多区域监控。 CONFIG 寄存器中的 SHDN 位可用于激活低功耗待机模式。 温度分辨率为 1°C。 转换率为标称 8 个样本/秒。 功耗仅为 200 µA(5 µA 待机)。 小尺寸、低安装成本和易用性使 TC74 成为在各种系统中实施热管理的理想选择。

TC74有如下特性:

  • 采用 SOT-23-5 封装的数字温度传感
  • 将温度输出为 8 位数字字
  • 简单的串口接口
  • ±2°C 精度从 +25°C 到 +85°C
  • ±3°C 精度从 0°C 到 +125°C
  • 2.7V 至 5.5V 的电源电压
  • 200 µA(典型值)工作电流
  • 5 µA(典型值)待机模式电流

在这里插入图片描述

TC74的引脚功能如下:

在这里插入图片描述

2、仿真电路原理图

在这里插入图片描述

3、仿真代码实现

本次实例使用了如下开源库:

演示代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/\*
SerialTemp.ino

Example for Microchip TC74 temperature sensor using the TC74\_I2C library

The sketch reads the TC74 sensor via I2C at a 2 second interval and outputs the data to the serial port
See the info directory for more information

Created May 2011
By Mario H https://github.com/Mario-H/TC74\_I2C
\*/


#include <Wire.h>
#include <TC74\_I2C.h>

TC74_I2C TC74(TC74_A5); // set the TC74 address to TC74\_A5 (= 0x4D defined in TC74\_I2C.h)

int temperature; // Define variable to hold the temperature

byte usepowersave = 0; // set to 1 to use powersave during the delay at the end of the loop
// In powersave mode the TC74 draws a current of 5 �A instead of 200 �A when in normal mode


void setup(){
Serial.begin(9600); // Initialize the serial port
TC74.Init(); // Initialize the TC74 sensor in normal mode
}


void loop(){

if(usepowersave){
TC74.NoPowersave(); // Make sure the sensor is not in powersave mode
}

temperature = TC74.ReadTemp(); // Get temperature from sensor

Serial.print ("Temperature= ");
if(temperature != 128){ // default the library returns a temperature of 128 degrees
// Since the max temperature the TC74 can measure is 127 degrees this way
// we can check if we got valid data from the sensor
Serial.println(temperature); // Write temperature to serial port
}else{ // We received an invalid reading of 128 degrees indicating an error
Serial.println("No data received"); // Write Error message to output
}

if(usepowersave){
TC74.Powersave(); // If configured: put the sensor in powersave mode
}

delay(1000); // Wait 1 seconds
}

4、仿真结果

在这里插入图片描述

文章来源: https://iotsmart.blog.csdn.net/article/details/121436902