“温度传感器 - LM35”的版本间的差异
来自YFRobotwiki
| 第1行: | 第1行: | ||
| − | [[Image: | + | [[Image:LM35模块.jpg|400px|thumb|LM35模块]] |
| 第30行: | 第30行: | ||
=== 引脚说明 === | === 引脚说明 === | ||
<br> | <br> | ||
| − | *1. Gnd | + | *1. G -- Gnd(地) |
| − | *2. Vcc | + | *2. V -- Vcc(电源+5V) |
| − | *3. Sign | + | *3. S -- Sign(信号) |
| 第38行: | 第38行: | ||
=== 应用示例 === | === 应用示例 === | ||
<br> | <br> | ||
| + | :'''电路连接示意图''' | ||
| + | <br> | ||
| + | ::'''LM35模块'''的 G、V、S分别连接 '''Arduino UNO'''的GND、VCC(+5V)、A0引脚。 | ||
| + | |||
| + | <!--[[Image: LED模块.jpg|400px|center|LED模块接线图]]--> | ||
| + | |||
| + | :'''示例代码''' | ||
| + | |||
| + | <pre> | ||
| + | //thermometer - Measuring temperature, record temperature fluctuations | ||
| + | |||
| + | int lm35Pin = A0; | ||
| + | |||
| + | int temp = 0; | ||
| + | int tempMin = 100; | ||
| + | int tempMax = -100; | ||
| + | |||
| + | void setup() { | ||
| + | // put your setup code here, to run once: | ||
| + | Serial.begin(9600); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | // put your main code here, to run repeatedly: | ||
| + | for (int i = 0; i <= 9; i++) { | ||
| + | int signVal = analogRead(lm35Pin); | ||
| + | temp += (signVal * 5 * 100) / 1024; | ||
| + | signVal = 0; | ||
| + | delay(80); | ||
| + | } | ||
| + | temp = temp / 10; | ||
| + | |||
| + | if (temp > tempMax) { | ||
| + | tempMax = temp; | ||
| + | } | ||
| + | if (temp < tempMin) { | ||
| + | tempMin = temp; | ||
| + | } | ||
| + | |||
| + | Serial.print("Temp:"); | ||
| + | Serial.print(temp); | ||
| + | Serial.print(" Cels,"); | ||
| + | Serial.print(" Min:"); | ||
| + | Serial.print(tempMin); | ||
| + | Serial.print(" Max:"); | ||
| + | Serial.println(tempMax); | ||
| + | temp = 0; | ||
| + | delay(500); | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | |||
| + | :'''串口监视结果''' | ||
| + | <br> | ||
| + | [[Image:LM35串口监视结果.png|center|LM35串口监视结果]] | ||
2015年8月29日 (六) 09:07的版本
产品简介
温度传感器 - LM35模块是基于由美国国家半导体公司生产的线性半导体温度传感器而设计的模块,可用来对环境温度进行检测。
温度测量常用的传感器包括热电偶,铂电阻,热敏电阻和半导体测温芯片,其中热电偶常用于高温测量,铂电阻用于中温测量(到摄氏800度左右),而热敏电阻和半导体温度传感器适合于100-200度以下的温度测量,其中半导体温度传感器的应用简单,有较好的线性度和较高的灵敏度。
LM35有多种不同封装型式。在常温下,LM35 不需要额外的校准处理即可达到 ±1/4℃的准确率。其电源供应模式有单电源与正负双电源两种,其引脚如图一所示,正负双电源的供电模式可提供负温度的量测;两种接法的静止电流-温度关系,在静止温度中自热效应低(0.08℃),单电源模式在25℃下静止电流约50μA,工作电压较宽,可在4—20V的供电电压范围内正常工作非常省电。
目前,已有两种型号的LM35可以提供使用。LM35DZ输出为0℃~100℃,而LM35CZ输出可覆盖-40℃~110℃,且精度更高,两种芯片的精度都比LM35高,不过价格也稍高。我们使用的就是LM35DZ,左移测温范围为0℃~100℃。
规格参数
- 供电电压:DC4~30V
- 灵敏度:10mV/℃
- 精度:0.5℃ (在+25℃时)
- 测量温度范围:0℃ ~ 100℃
- 安装孔径:3MM
- 模块尺寸:28*21*1.6MM (长*宽*高)
- 孔间距:15MM
- 模块重量:2.2g
引脚说明
- 1. G -- Gnd(地)
- 2. V -- Vcc(电源+5V)
- 3. S -- Sign(信号)
应用示例
- 电路连接示意图
- LM35模块的 G、V、S分别连接 Arduino UNO的GND、VCC(+5V)、A0引脚。
- 示例代码
//thermometer - Measuring temperature, record temperature fluctuations
int lm35Pin = A0;
int temp = 0;
int tempMin = 100;
int tempMax = -100;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i <= 9; i++) {
int signVal = analogRead(lm35Pin);
temp += (signVal * 5 * 100) / 1024;
signVal = 0;
delay(80);
}
temp = temp / 10;
if (temp > tempMax) {
tempMax = temp;
}
if (temp < tempMin) {
tempMin = temp;
}
Serial.print("Temp:");
Serial.print(temp);
Serial.print(" Cels,");
Serial.print(" Min:");
Serial.print(tempMin);
Serial.print(" Max:");
Serial.println(tempMax);
temp = 0;
delay(500);
}
- 串口监视结果
参考资料
更多建议和问题欢迎反馈至 YFRobot论坛
购买方式:YFRobot 电子工作室

