7

我是 arduino 编程的新手。而且几乎没有经验。

我正在寻找对我的 arduino Uno 板进行编程以读取 PT100 RTD 传感器的 2/3/4 线配置(精度至少为 0.5°C)。温度范围为 0 至 400°C 和 -50 至 100°C。

由于我对这个领域完全陌生,因此我会很欣赏带有电路、图像和代码的描述性信息。

我对这个主题进行了很多研究,但找不到任何有用或实质性的东西来解决我的问题。

此外,由于安装了 RTD 的机器具有 PID,我无法使用热敏电阻或任何 IC 来读取温度,但我想创建一个可以在计算机本身上获取温度的数据记录器。

4

2 回答 2

5

克里斯,尽管您的解决方案有效,但仍有改进的余地。

1)220欧的上拉太小了。pt100 中不断有明显的电流流过,这会干扰精度。一种非常简约的方法是增加上拉电阻以降低此电流,并放大分压器上的电压,请参阅http://www.avrfreaks.net/sites/default/files/pt100.JPG

2)一旦有明显的电缆运行和标准的工业环境,您可能会决定采用标准的测量桥布局。这使用四根电线,其中两根用作恒流源。(与上拉电阻不同,恒流源可确保在整个范围内稳定读数,并应具有更好的温度稳定性。简单的上拉本身可能会有很大的漂移。另外两根线用作差分输入。这些线上没有电流流过,因此传感器的实际接线距离不会影响精度。此方法显示在这里:https ://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/4wire2.svg/286px-4wire2.svg .png实际上所有的工业传感器都基于这个原理工作。

3)您可能更喜欢使用模拟前端而不是滚动自己的模拟电路。AD7714 http://www.seekic.com/circuit_diagram/Measuring_and_Test_Circuit/Temperature_measurement_circuit_composed_of_the_AD7714_and_Pt100.html以及更多专业解决方案:http: //www.ti.com/europe/downloads/2-%203-%204-Wire% 20RTD%20测量.pdf

于 2016-03-29T23:15:14.623 回答
5

PT100 在加热时会增加其电阻。pt100 电阻表中描述了温度与电阻特性

Arduino 可以读取模拟输入的电压。要获得摄氏度读数,我们必须:

  1. 将模拟输入读取为电压
  2. 计算电阻值(分压器)
  3. 根据电阻从表中查找摄氏度

分压器

Vin 是来自 arduino 的 5 伏特 R1 是我程序中已知值的电阻它是 220 欧姆实际上 R2 是 pt 100 Vout 必须连接到 arduino 模拟输入引脚(例如 A0)

R2 = R1 * 1 / ( Vin / Vout - 1)

电路可以根据上图完成,相当简单。

我写的草图包含从 0C - 80C 的电阻数据(可以轻松扩展)为了从电阻值获取度数,我使用的 MultiMap 函数版本,它使用一个浮点数组作为电阻值并使用线性插值来计算精确度数

float in[] = { 100.00, 100.39, 100.78, 101.17, 101.56, 101.95, 102.34, 102.73, 103.12, 103.51,
               103.90, 104.29, 104.68, 105.07, 105.46, 105.85, 106.24, 106.63, 107.02, 107.40,
               107.79, 108.18, 108.57, 108.96, 109.35, 109.73, 110.12, 110.51, 110.90, 111.29,
               111.67, 112.06, 112.45, 112.83, 113.22, 113.61, 114.00, 114.38, 114.77, 115.15,
               115.54, 115.93, 116.31, 116.70, 117.08, 117.47, 117.86, 118.24, 118.63, 119.01,
               119.40, 119.78, 120.17, 120.55, 120.94, 121.32, 121.71, 122.09, 122.47, 122.86,
               123.24, 123.63, 124.01, 124.39, 124.78, 125.16, 125.54, 125.93, 126.31, 126.69,
               127.08, 127.46, 127.84, 128.22, 128.61, 128.99, 129.37, 129.75, 130.13, 130.52 };

// known resistance in voltage divider
int R1 = 217;

float MultiMap(float val, float* _in, uint8_t size)
{
  // calculate if value is out of range 
  if (val < _in[0] ) return -99.99;
  if (val > _in[size-1] ) return 99.99;

  //  search for 'value' in _in array to get the position No.
  uint8_t pos = 0;
  while(val > _in[pos]) pos++;  

  // handles the 'rare' equality case
  if (val == _in[pos]) return pos;

  float r1 = _in[pos-1];
  float r2 = _in[pos];
  int c1 = pos-1;
  int c2 = pos;

 return c1 + (val - r1) / (r2-r1) * (c2-c1);
}

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);

}
void loop() {
  // put your main code here, to run repeatedly:
   int pt100 = analogRead(A0);


   float Vout = pt100 * (5.0 / 1023.0);
   float R2 = R1 * 1/(5.0/Vout - 1);

float c =  MultiMap(R2,in,80);

Serial.print("Resistance: ");
Serial.print(R2);
Serial.println(" Ohm");

Serial.print("Temperature: ");
Serial.print(c);
Serial.println(" C");


delay(400);
}
于 2016-02-09T21:34:20.790 回答