Hi,
Am working on a project to control the temperature of an oven used for curing powder coating. Due to the temperatures involved, had to go to a thermocouple. Have the TC and the MAX31855 working nicely and giving me a readout on the LCD.
Now I would like to turn the heat source on and off depending on temperature. I have a 110 relay operated switch and just need the 5v out from a digital pin. If I define that pin:
int RelayPin = 7
and then:
pinMode(RelayPin,Output)
I then need to "read" the output from the TC and am not sure how to do that. (have looked at other temperature sensor sketches but their output is different than the TC)
Not sure what the (isnan(c)) means but assume (c) = TC output, isnan = ?????
Would this then work:
if(c<177) digitalWrite(RelayPin, HIGH)
if (c>204) digitalWrite(RelayPin,LOW) ??
TIA
High temp (400^F) temperature sensor
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: High temp (400^F) temperature sensor
How are you reading the TC to do the LCD readout?ljh34481 wrote:I then need to "read" the output from the TC and am not sure how to do that. (have looked at other temperature sensor sketches but their output is different than the TC)
isnan() is a test to see if c is a valid floating point numberljh34481 wrote:Not sure what the (isnan(c)) means but assume (c) = TC output, isnan = ?????
Don't see why not, assuming c, 177, and 204 are all temperatures in the same temperature scale. Since c is apparently floating point, it would probably be better to express 177 and 204 as floating point as well:ljh34481 wrote:Would this then work:
if(c<177) digitalWrite(RelayPin, HIGH)
if (c>204) digitalWrite(RelayPin,LOW) ??
Code: Select all
if(c<177.0) digitalWrite(RelayPin, HIGH)
if (c>204.0) digitalWrite(RelayPin,LOW)
-
- Posts: 23
- Joined: Fri Sep 07, 2012 5:12 pm
Re: High temp (400^F) temperature sensor
Hey, Driverblock, thanks for the response.
I am a total noob just getting my feet wet. I think this is the part of the code showing the reading of the TC for LCD:
What was tough for me is that the little TC amplifier speaks a "foreign" language for me - I think it is PSI which did not give me, what I would call, an obvious value to read, especially since this is about my second project
Will try it soon and let you know
Thanks again - appreciate the info
I am a total noob just getting my feet wet. I think this is the part of the code showing the reading of the TC for LCD:
And yes, the temps are both Celsiusvoid loop() {
// basic readout test, just print the current temp
lcd.setCursor(0, 0);
lcd.print("Int. Temp = ");
lcd.println(thermocouple.readInternal());
lcd.print(" ");
double c = thermocouple.readCelsius();
lcd.setCursor(0, 1);
if (isnan(c))
{
lcd.print("T/C Problem");
}
else
{
lcd.print("C = ");
lcd.print(c);
lcd.print(" ");
}
delay(1000);
What was tough for me is that the little TC amplifier speaks a "foreign" language for me - I think it is PSI which did not give me, what I would call, an obvious value to read, especially since this is about my second project
Will try it soon and let you know
Thanks again - appreciate the info
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: High temp (400^F) temperature sensor
thermocouple.readInternal() gives you the internal "cold junction" temperature of the amplifier.
thermocouple.readCelsius() takes a reading from the thermocouple itself and converts it to Celsius.
So you want to use thermocouple.readCelsius() for controlling your relay
thermocouple.readCelsius() takes a reading from the thermocouple itself and converts it to Celsius.
So you want to use thermocouple.readCelsius() for controlling your relay
-
- Posts: 23
- Joined: Fri Sep 07, 2012 5:12 pm
Re: High temp (400^F) temperature sensor
Many thanks to Driverblock and to Adafruit support. I got my second Arduino project up and running. I am using the UNO to turn the heat source for a powder coating oven on and off at specific temperatures using a thermocouple and amplifier. This controls a digital pin output that operates a 5 volt relay controlling the 110v source. Works like a charm and the LCD shield kit with the 16-2 display, shows current temperature in the oven.
So, FWIW, here is the code (slight mod of Ladyada's) (and thanks again to everyone that helped along the way):
So, FWIW, here is the code (slight mod of Ladyada's) (and thanks again to everyone that helped along the way):
/***************************************************
This is an example for the Adafruit Thermocouple Sensor w/MAX31855K
Designed specifically to work with the Adafruit Thermocouple Sensor
----> https://www.adafruit.com/products/269
These displays use SPI to communicate, 3 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include "Adafruit_MAX31855.h"
#include <LiquidCrystal.h>
#include <Wire.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
int thermoCLK = 3;
int thermoCS = 4;
int thermoDO = 5;
int RelayPin = 7;
//These #defines make it easy to set the backlight color
#define RED 0x1
#define Yellow 0x3
#define Green 0x2
#define Teal 0x6
#define Blue 0x4
#define Violet 0x5
#define White 0x7
// Initialize the Thermocouple
Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
// initialize the library with the numbers of the interface pins
void setup() {
pinMode (RelayPin,OUTPUT);
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.print("MAX31855 test");
// wait for MAX chip to stabilize
delay(500);
}
void loop() {
// basic readout test, just print the current temp
lcd.setCursor(0, 0);
lcd.print("Int. Temp = ");
lcd.println(thermocouple.readInternal());
lcd.print(" ");
double c = thermocouple.readFarenheit();{
//outputs to RelayPin for temperature control
if (c<360.0)digitalWrite (RelayPin, HIGH);
if (c>395.0)digitalWrite (RelayPin, LOW);}
lcd.setCursor(0, 1);
if (isnan(c))
{
lcd.print("T/C Problem");
}
else
{
lcd.print("F = ");
lcd.print(c);
lcd.print(" ");
}
delay(1000);
}
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: High temp (400^F) temperature sensor
Good job!
Please be positive and constructive with your questions and comments.