Hello,
I am using a K-Type Thermocouple, wired into an AD595AQ Amplifier for testing the air temperature of a room. It will later be used for water temperature. It is a simple two-wire thermocouple.
I have wired the thermocouple according to the following:
As you can see here in the Serial Monitor, the temperature is all over the place. As low as 19, and as high as 35:
It is a very simple program. But if the temperature is varying so widely, it is not any use to me. I eventually need to closely monitor the temperature of water. If it makes any difference, I was originally using the 36GZ Temperature Sensor that Arduino supplies, and that sensor had a good accurate reading of the room, within a degree or two. This Thermocouple is so widely off, I don't know what is going on.
Thank you for any input anyone has!
The code used is here:
const int TempSensorPin = A0;
const float baselineTemp = 22.0;
const int ledPinR = 6;
const int ledPinB = 7;
const int ledPinG = 8;
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
Serial.begin(9600);
lcd.begin (16, 2);
lcd.print("Temperature");
lcd.setCursor (0, 1);
lcd.print("Initializing..");
pinMode(ledPinR, OUTPUT);
pinMode(ledPinB, OUTPUT);
pinMode(ledPinG, OUTPUT);
delay(1000);
}
void loop() {
int TempSensorVal = analogRead(TempSensorPin);
Serial.print("Temp Sensor Value: ");
Serial.print(TempSensorVal);
Serial.print(", Degrees C: ");
float temperature = ( ((TempSensorVal * 4.88) - 0.0027 ) / 10.0 );
Serial.println(temperature);
if (temperature < baselineTemp - 1.5) {
lcd.clear ();
lcd.print("Air Temp: LOW!");
lcd.setCursor(6, 1);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(1, 1);
lcd.print(temperature);
digitalWrite(ledPinB, HIGH);
digitalWrite(ledPinG, LOW);
digitalWrite(ledPinR, LOW);
}
else if (temperature >= baselineTemp - 1.5 && temperature < baselineTemp + 1.5) {
lcd.clear ();
lcd.print("Air Temp: OK");
lcd.setCursor(6, 1);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(1, 1);
lcd.print(temperature);
digitalWrite(ledPinG, HIGH);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinR, LOW);
}
else if (temperature >= baselineTemp + 1.5) {
lcd.clear ();
lcd.print("Air Temp: HIGH!");
lcd.setCursor(6, 1);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(1, 1);
lcd.print(temperature);
digitalWrite(ledPinR, HIGH);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinG, LOW);
}
delay(1000);
}