|
I am using what I believe to be an extremely old Thermistor. Perhaps 60+ years old. The pot models a Thermistor (for those that don't know it is a resistor that changes resistivity when heat is added) and 5V is from an arduino. The voltmeter is where the arduino reads the output voltage across the thermistor. Simple arduino program included.
For those that are interested, I am using a Western Electric 50k Negative Temperature Coefficient Thermistor part# 37 A 4-72. I could not find any datasheet or even references to this thermistor on the internet. The thermistor is contained within a narrow and long glass tube. Judging by the packaging, and where I got it from (an old building at a college) it could be as old as 60 years. Along with this device I had found tons of other stuff, including old hand made circuit boards with 1964 stamped on the PCB material (this is how I know some of the stuff is so old). If anyone knows something about thermistors, perhaps you could help me learn a little more about this device.
Calculate B (thermistor constant, beta) using B = ln(R1/R2)/(1/T1 - 1/T2) or find the value on the datasheet.
B = thermistor beta value
T = temperature in kelvin
To = 293.0K
Rdel = thermistor resistance
R1 = 56k
Vs = voltage source
Vo = voltage across thermistor
The output is measured using:
T = To*B/(To*ln(Rdel/Ro) + B)
Where Rdel = R1/(Vs/Vo - 1)
Arduino code below:
int pin = 0;
float res = 0.0046138807;
float To = 293.00;
float Ro = 50000.0;
float beta = 5066.0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(pin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
//if(Serial.available() > 0) {
// int dump = Serial.read();
float volt = analogRead(pin)*res;
float Rdel = 54000.0/((4.72/volt)-1);
float tempKel = (To*beta)/(To*log(Rdel/Ro)+beta);
float tempFar = (9.0/5.0)*(tempKel-273) + 32;
Serial.println(tempFar);
delay(1000);
// }
}
If anyone cares to take it a step further, download InfluxDB (real time database) and Grafan (graphing utility), and perhaps a few more things. I currently have this setup up with InfluxDB, Grafana, Mosquitto MQTT, Raspberry Pi, Arduino and Xbee radios. Pretty cool.
*UPDATED
Arduino code with averaging and xbee radio
#include <AltSoftSerial.h>
int pin = 0;
const float res = 0.0046138807;
const float To = 293.00;
const float Ro = 50000.0;
const float beta = 5066.0;
const float numSample = 1000.0;
bool flag = false;
float tempFarAvg = 0;
int i = 0;
//AltSoftSerial xbeeRadio(8, 9);
float getTempFar();
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
//xbeeRadio.begin(9600);
pinMode(pin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(flag == false) {
tempFarAvg = 0;
i = 0;
}
while(i < numSample && flag == false) {
tempFarAvg += getTempFar();
i++;
delay(60);
//Serial.print("Sample: "); Serial.print(i); Serial.print(" of "); Serial.println(int(numSample));
if(i == numSample - 1) {
flag = true;
tempFarAvg = tempFarAvg/numSample;
}
}
if(Serial.available() > 0 && flag == true){
int dump = Serial.read();
flag = false;
Serial.println(tempFarAvg);
}
//if(xbeeRadio.available() > 0 && flag == true){
// int dump = xbeeRadio.read();
// flag = false;
// xbeeRadio.println(tempFarAvg);
//}
}
float getTempFar() {
float volt = analogRead(pin)*res;
float Rdel = 54000.0/((4.72/volt)-1);
float tempKel = (To*beta)/(To*log(Rdel/Ro)+beta);
float tempFar = (9.0/5.0)*(tempKel-273) + 32;
return(tempFar);
}
##This code sends measurements from
##the arduino to telegraf, the server agent.
##Then telegraf sends this to the
##database InfluxDB.
import paho.mqtt.client as mqtt
import random, time, serial
mqtt = mqtt.Client()
mqtt.connect('localhost', port = 1883)
arduino = serial.Serial('/dev/ttyACM0', 9600)
time.sleep(3)
topic = 'test'
payload = 'tempSmple600m,location=office temperature='
try:
while True:
arduino.write(b'1')
temp = arduino.readline().decode()
temp = temp.strip('\n')
temp = temp.strip('\r')
mqtt.publish(topic, payload + str(temp))
print(temp)
time.sleep(60)
except KeyboardInterrupt:
mqtt.disconnect()
arduino.close()
exit()
|