Therm. Amp. MAX31855 with Arduino MEGA 2560

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
wolfnuka
 
Posts: 27
Joined: Mon Mar 24, 2014 3:32 pm

Therm. Amp. MAX31855 with Arduino MEGA 2560

Post by wolfnuka »

Hello guys, so i have a 20x4 rgb lcd with an I2c backpack and a MAX31855 Thermocouple amp Wired to an arduino MEGA 2560, everything works, i am having issues with the thermocouple, well, im not sure what it is really but seems like it, the display is showing the temperature being read by the thermocouple and conditioned by the amp no problem, but when i either make it read something cold like water or hot like hot water it "blinks" the temperature value, showing "T/C Problem" which is in the code, when the arduino can't read anything from the thermocouple amp it is supposed to show that, so it lets you know data is not available for whatever reason might be, but it blinks, and i know is not a bad connection because i soldered and connectorized everything, if i shake the connectors it doesnt do anything is stable, it blinks only when i read temperature with the thermocouple, also, this setup works without this issue on my arduino UNO, is doing this only on the mega, any ideas?

Image
https://drive.google.com/file/d/0B_gbUJ ... sp=sharing

User avatar
Franklin97355
 
Posts: 23940
Joined: Mon Apr 21, 2008 2:33 pm

Re: Therm. Amp. MAX31855 with Arduino MEGA 2560

Post by Franklin97355 »

Could you post your code?
Please use the code button "</>" or

Code: Select all

 tags when posting code to the forums.

User avatar
wolfnuka
 
Posts: 27
Joined: Mon Mar 24, 2014 3:32 pm

Re: Therm. Amp. MAX31855 with Arduino MEGA 2560

Post by wolfnuka »

IGNORE LAST PART OF CODE, IS COMMENTED OUT AS IS WORK IN PROGRESS

Code: Select all

#include <SPI.h>
#include "Adafruit_MAX31855.h"
#include <Wire.h>

#include <LiquidTWI.h>
//#include <LiquidCrystal.h>

LiquidTWI lcd(0);
//LiquidCrystal lcd(0);
//////////////////////////////VARIABLES//////////////////////////////////////////////////////////////////////



int thermoCLK1= 26;   //THERMOCOUPLE #1  
int thermoCS1 = 24;
int thermoDO1 = 22;

int thermoCLK2 = 27;  //THERMOCOUPLE#2
int thermoCS2 = 25;
int thermoDO2 = 23;


float Temperature = 0;    //VARIABLE WHERE THE TEMPERATURE IS STORED
float Temperature2 = 0;

Adafruit_MAX31855 thermocouple(thermoCLK1, thermoCS1, thermoDO1);  // THERMOCOUPLE VARIABLE 
Adafruit_MAX31855 thermocouple2(thermoCLK2, thermoCS2, thermoDO2);

//////////////////////////////////SETUP//////////////////////////////////////////////////////////////////////

void setup () 
{
 
 Serial.println("LABEL,Date & Time,Temp C");   //"LABEL" tells the PLX-DAQ soft, the words after "LABEL" to 
                                               //be printed on the excel file
 lcd.begin(20, 4); 
 lcd.setCursor (4, 0);
 lcd.print("ULTRA SUPER ");
 lcd.setCursor (4, 1);
 lcd.print("MEGA HEATER ");
 delay(5000);
 lcd.clear();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////MAIN LOOP///////////////////////////////////////////////////

 void loop (){ 
        
Serial.begin(9600);   //BEGINS SERIAL COMMUNICATION

////////////TEMPERATURE READ AND DISPLAY///////////////////////////////////////////////////////////////////   
   
      
//  lcd.setCursor(0, 0);
//  lcd.print("Int. Temp = ");
//  lcd.println(thermocouple.readInternal());
//  lcd.print("  "); 
 
////////////////////////////////THERMOCOUPLE #1//////////////////////////////////////////

   double c = thermocouple.readCelsius();
   lcd.setCursor(0, 0);
   if (isnan(c)) 
   {
    lcd.print("T/C Problem");
   } 
   else 
   {
     lcd.print("TEMP 1= "); 
     lcd.print(c);
     lcd.print(" ");
     lcd.print("C");
     
     delay(1000);
   }
   
 ////////////////////////////////THERMOCOUPLE #2//////////////////////////////////////////  
 
    double c2 = thermocouple2.readCelsius();
   lcd.setCursor(0, 1);
   if (isnan(c2)) 
   {
    lcd.print("T/C Problem");
   } 
   else 
   {
     lcd.print("TEMP 2 = "); 
     lcd.print(c2);
     lcd.print(" ");
     lcd.print("C");
     
     delay(1000);
   }
 
/////////////////////////////////////////////////////////////////////////////////////////



//   val =   (c);        // <TEST LINE (thermocouple.readCelsius());
   
//   Serial.print("DATA,DATE - TIME,"); // tells the plx- daq to serial print the current date & time 
//   Serial.print(" ");
 //  Temperature = (c);  
 //  Serial.println(Temperature);  //Prints the current temperature being read with a 1 second delay
   
 }
///////////////////////////////////////////////////////////////////////////////////////////////////////////
Right now im reading 2 thermocouples without problems when the thermocouple is "untouched" when i touch something hot or cold, it does change the temperature accordingly but blinks as it updates the temperature, in short, the problem persists... im confused, is like the values are getting lost on the memory or something

User avatar
Franklin97355
 
Posts: 23940
Joined: Mon Apr 21, 2008 2:33 pm

Re: Therm. Amp. MAX31855 with Arduino MEGA 2560

Post by Franklin97355 »

One thing, you should move the Serial.begin outside the loop() function and into the setup() function before you try to print anything. You might try clearing the display before printing your data and see what that does.

User avatar
wolfnuka
 
Posts: 27
Joined: Mon Mar 24, 2014 3:32 pm

Re: Therm. Amp. MAX31855 with Arduino MEGA 2560

Post by wolfnuka »

placing the lcd.clear(); before printing the data only makes it blink every one second, i moved the serial begin as well, no change really, it keeps showing the
"T/C PROBLEM" on the display at random when making readings, but when the thermocouple is just laying there, measuring room temp, is just fine, i know is not the thermocouple either, because i bought 4 of them and the problem persists, it has something to do with the arduino MEGA, because on the UNO this same setup works just fine

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”