目录

Arduino - 温度传感器( Temperature Sensor)

温度传感器LM35系列是精密集成电路温度设备,输出电压与摄氏温度成线性比例。

LM35器件优于以开尔文校准的线性温度传感器,因为用户无需从输出中减去大的恒定电压以获得方便的摄氏度。 LM35器件无需任何外部校准或微调即可在室温下提供±¼°C的典型精度,在-55°C至150°C的整个温度范围内提供±¾°C的典型精度。

LM35设备

技术规格

  • 直接在摄氏度(摄氏)校准
  • 线性+ 10-mV /°C比例因子
  • 0.5°C确保精度(25°C时)
  • 额定温度范围为-55°C至150°C
  • Suitable for remote applications

组件的要求 (Components Required)

您将需要以下组件 -

  • 1 × Breadboard
  • 1×Arduino Uno R3
  • 1×LM35传感器

过程 (Procedure)

按照电路图并连接面包板上的组件,如下图所示。

温度传感器电路连接

草图 (Sketch)

在您的计算机上打开Arduino IDE软件。 用Arduino语言编码将控制你的电路。 单击“新建”打开新的草图文件。

草图

Arduino代码 (Arduino Code)

float temp;
int tempPin = 0;
void setup() {
   Serial.begin(9600);
}
void loop() {
   temp = analogRead(tempPin);
   // read analog volt from sensor and save to variable temp
   temp = temp * 0.48828125;
   // convert the analog volt to its temperature equivalent
   Serial.print("TEMPERATURE = ");
   Serial.print(temp); // display temperature value
   Serial.print("*C");
   Serial.println();
   delay(1000); // update sensor reading each one second
}

Code to Note

LM35传感器有三个端子--V s ,V out和GND。 我们将按如下方式连接传感器 -

  • 在Arduino板上将+ V s连接到+ 5v。
  • 将V 输出连接到Arduino板上的Analog0或A0。
  • 在Arduino上连接GND和GND。

模数转换器(ADC)根据公式ADC值=采样* 1024 /参考电压(+ 5v)将模拟值转换为数字近似值。 因此,使用+5伏参考,数字近似将等于输入电压* 205。

结果 (Result)

您将在串口监视器上看到温度显示,每秒更新一次。

↑回到顶部↑
WIKI教程 @2018