MAX6675 getting Zero degree

"I have a gasification project using three pieces of Max6675. In the first experiment, I used a type K which is not integrated with my gasification device, and the temperature readings were normal. However, when I tried to integrate it with the gasification device, the temperature reading showed 0 degrees Celsius. I don't know where the problem lies.

//#include <SPI.h>                                                                                                                                              
#include <Wire.h> 
#include "Adafruit_MAX31855.h"
#include "max6675.h"
#include <LiquidCrystal_I2C.h>
//#include <MQUnifiedsensor.h>

// Definisi Max6675
 //  #define MAXDO   23
 //  #define MAXCLK  25
 
 //  int thermoDO = 50;
 //  int thermoCLK = 52; 
 
 // int vccPin = 3;
 // int gndPin = 2;
 // CS Change
 
 //  // Gasifikasi
 //   #define MAXCS   A4
 //   Adafruit_MAX31855 thermocoupleReduksi(MAXCS);
 //  // Combustion
 //   #define MAXCS1   A5
 //   Adafruit_MAX31855 thermocoupleDrying1(MAXCS1);
 //  // Burner
 //   #define MAXCS2  A6
 //   Adafruit_MAX31855 thermocoupleDrying2(MAXCS2);


int thermoDO = 22;
int thermoCS = 2;
int thermoCLK = 23;
MAX6675 thermocoupleGasifikasi(thermoCLK, thermoCS, thermoDO);


int thermoDO1 = 24;
int thermoCS1 = 3;
int thermoCLK1 = 25;
MAX6675 thermocoupleCombustion(thermoCLK1, thermoCS1, thermoDO1);

int thermoDO2 = 26;
int thermoCS2 = 4;
int thermoCLK2 = 27;
MAX6675 thermocoupleBurner(thermoCLK2, thermoCS2, thermoDO2);

  float gasifikasiprevious = 0;
  float combustionprevious = 0;
  float burnerprevious = 0;

//  // Drying 3
 //   int thermoCS4 = 8;
 //   Adafruit_MAX31855 thermocoupleDrying3(thermoCS4);
 //  // Drying 4
 //   int thermoCS5 = 9;
 //   Adafruit_MAX31855 thermocoupleDrying4(thermoCS5);
 //  // Inlet Syngas
 //   int thermoCS6 = 10;
 //   Adafruit_MAX31855 thermocoupleInlet(thermoCS6);
 //  // Outlet Syngas
 //   int thermoCS7 = 11;
 //   Adafruit_MAX31855 thermocoupleOutlet(thermoCS7);
 //  // Demister
 //   int thermoCS8 = 12;
 //   Adafruit_MAX31855 thermocoupleDemister(thermoCS8);
 //  // Steam
 //   int thermoCS9 = 13;
 //   Adafruit_MAX31855 thermocoupleSteam(thermoCS9);

 // Pirolisis
  //   #define MAXCS   A4
  //   Adafruit_MAX31855 thermocouplePirolisis(MAXCLK, MAXCS, MAXDO);
  //  // Combustion
  //   #define MAXCS1   A5
  //   Adafruit_MAX31855 thermocoupleCombustion(MAXCLK, MAXCS1, MAXDO);
  //  // Burner
  //   #define MAXCS2  A6
  //   Adafruit_MAX31855 thermocoupleBurner(MAXCLK, MAXCS2, MAXDO);
  // reduksi
  //   int thermoCS = A7;
  //   MAX6675 thermocoupleReduksi(thermoCLK, thermoCS, thermoDO);
  //  // Drying 1
  //   int thermoCS2 = A8;
  //   MAX6675 thermocoupleDrying1(thermoCLK, thermoCS2, thermoDO);
  //  // Drying 2
  //   int thermoCS3 = A9; 
  //   MAX6675 thermocoupleDrying2(thermoCLK, thermoCS3, thermoDO); 
  //  // Drying 3
  //   int thermoCS4 = A10;
  //   MAX6675 thermocoupleDrying3(thermoCLK, thermoCS4, thermoDO);
  //  // Drying 4
  //   int thermoCS5 = A11;
  //   MAX6675 thermocoupleDrying4(thermoCLK, thermoCS5, thermoDO);
  //  // Inlet Syngas
  //   int thermoCS6 = A12;
  //   MAX6675 thermocoupleInlet(thermoCLK, thermoCS6, thermoDO);
  //  // Outlet Syngas
  //   int thermoCS7 = A13;
  //   MAX6675 thermocoupleOutlet(thermoCLK, thermoCS7, thermoDO);
  //  // Demister
  //   int thermoCS8 = A14;
  //   MAX6675 thermocoupleDemister(thermoCLK, thermoCS8, thermoDO); 
  //  // Steam
  //   int thermoCS9 = A15;
  //   MAX6675 thermocoupleSteam(thermoCLK, thermoCS9, thermoDO); 

// Definisi Keypad 10-13 pin
 #define key1 13 //connect wire 1 to pin 2
 #define key2 12 //connect wire 2 to pin 3
 #define key3 11 //connect wire 3 to pin 4
 #define key4 10 //connect wire 4 to pin 5
 int j = 1;

// Definisi LCD I2C
 LiquidCrystal_I2C lcd(0x27,20,4);

// Definisi Sensor MQ 4
 const int mq4Pin = A0;
// Definisi Sensor MQ 7
 const int mq7Pin = A1;
// Definisi Sensor MQ 8
 const int mq8Pin = A2;
// Definisi Sensor MG811
 const int mg811Pin = A3;

  
//menghirim data ke NodeMCU
String kirimdata;

// setupo
void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
  //SPI.begin();
  lcd.init();
  lcd.backlight();

  //pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
  //pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
  lcd.setCursor(2, 0);
  lcd.print("Dataloger Online");
  lcd.setCursor(0, 1);
  lcd.print("Gasifikasi Fixed Bed");
  lcd.setCursor(3, 2);
  lcd.print("Website : www.");
  lcd.setCursor(0, 3);
  lcd.print("wtegasifikasibrin");
  //delay(8000);
 // PinMode Keypad 
  pinMode(key1, INPUT_PULLUP);// set pin as input
  pinMode(key2, INPUT_PULLUP);// set pin as input
  pinMode(key3, INPUT_PULLUP);// set pin as input
  pinMode(key4, INPUT_PULLUP);// set pin as input  
 // Lcd Initialize

 // Sensor Gas
  pinMode(mq4Pin, INPUT);
  pinMode(mq7Pin, INPUT);
  pinMode(mq8Pin, INPUT);
  pinMode(mg811Pin, INPUT);

 //Data Microsoft
 Serial.println("CLEARSHEET");
 Serial.println("LABEL,Time,Gasifikasi,Combustion,Burner,Reduksi,Drying 1,Drying 2,Drying 3,Drying 4,Inlet Syngas,Outlet Syngas,Demister,Steam,CH4,CO,H2,CO2");
 delay(8000);
}

// Looping
void loop() {
 // Definisi Thermo
  float gasifikasinow = thermocoupleGasifikasi.readCelsius();
  delay(500);
  float combustionnow = thermocoupleCombustion.readCelsius();
  delay(500);
  float burnernow = thermocoupleBurner.readCelsius();
  delay(500);

  if(gasifikasinow = 0){
    gasifikasinow = gasifikasiprevious ;
  }

  if(combustionnow = 0){
    combustionnow = combustionprevious ;
  }

  if(burnernow = 0){
    burnernow = burnerprevious ;
  }

  if(abs(gasifikasinow - gasifikasiprevious) >= 3){
    gasifikasiprevious = gasifikasinow;
  }
    if(abs(combustionnow - combustionprevious) >= 3){
    combustionprevious = combustionnow;
  }
    if(abs(burnernow - burnerprevious) >= 3){
    burnerprevious = burnernow;
  }

  // gasifikasiprevious = ;
  // combustionprevious = ;
  // burnerprevious = ;

  // float reduksi = thermocoupleReduksi.readCelsius();
  // float drying1 = thermocoupleDrying1.readCelsius();
  // float drying2 = thermocoupleDrying2.readCelsius();
  // float drying3 = thermocoupleDrying3.readCelsius();
  // float drying4 = thermocoupleDrying4.readCelsius();
  // float inlet = thermocoupleInlet.readCelsius();
  // float outlet = thermocoupleOutlet.readCelsius();
  // float demister = thermocoupleDemister.readCelsius();
  // float steam = thermocoupleSteam.readCelsius();

  float reduksi = 0;
  float drying1 = 0;
  float drying2 = 0;
  float drying3 = 0;
  float drying4 = 0;
  float inlet = 0;
  float outlet = 0;
  float demister = 0;
  float steam = 0;

 // read Keypad  
  int key1S = digitalRead(key1); // read if key1 is pressed
  int key2S = digitalRead(key2); // read if key1 is pressed
  int key3S = digitalRead(key3); // read if key1 is pressed
  int key4S = digitalRead(key4); // read if key1 is presseda

 // Definisi Sensor GAs
  int sensorValueMQ4 = analogRead(mq4Pin);
  int sensorValueMQ7 = analogRead(mq7Pin);
  int sensorValueMQ8 = analogRead(mq8Pin);
  int sensorValueMG811 = analogRead(mg811Pin);

 // Konversi Nilai Analog menjadi Gas CH4
  float v1 = sensorValueMQ4 * 5.0 / 1024.0;
 // Konversi Nilai Analog menjadi Gas CO
  float v2 = sensorValueMQ7 * 5.0 / 1024.0;
 // Konversi Nilai Analog menjadi Gas H2
  float v3 = sensorValueMQ8 * 5.0 / 1024.0;
 // Konversi Nilai Analog menjadi Gas CO2
  float v4 = sensorValueMG811 * 5.0 / 1024.0;

  float Rs1 = ( 5.00 * 1000 / v1 ) - 1000;
  float ppm1 = 100 * pow(Rs1 / 300, -1.53);

  float Rs2 = ( 5.00 * 1000 / v2 ) - 1000;
  float ppm2 = 100 * pow(Rs2 /400 , -1.53);

  float Rs3 = ( 5.00 * 1000 / v3 ) - 1000;
  float ppm3 = 100 * pow(Rs3 / 230, -1.53);

  float Rs4 = ( 5.00 * 1000 / v4 ) - 1000;
  float ppm4 = 100 * pow(Rs4 / 270, -1.53);

  // float ppm1 = v1 * 100;
  // float ppm2 = v2 * 100;
  // float ppm3 = v3 * 100;
  // float ppm4 = v4 * 100;

 // Send Data to Excel
  Serial.println((String) "DATA,TIME," + gasifikasiprevious +","+ combustionprevious +","+ burnerprevious +","+ reduksi +","+ drying1 +","+ drying2 +","+ drying3 +","+ drying4 +","+ 
  inlet +","+ outlet +","+ demister +","+ steam +","+ ppm1 +","+ ppm2 +","+ ppm3 +","+ ppm4 +",AUTOSCROLL_40");
 // Send Data to NodeMCU
  String kirimdata = ('%')+ String(gasifikasiprevious) +(',')+ String(combustionprevious) +(',')+ String(burnerprevious) +(',')+ String(reduksi) +(',')+ String(drying1) +(',')+ String(drying2) +(',')+
  String(drying3) +(',')+ String(drying4) +(',')+ String(inlet) +(',')+ String(outlet) +(',')+ String(demister) +(',')+ String(steam) +(',')+ String(ppm1) +(',')+ 
  String(ppm2) +(',')+ String(ppm3) +(',')+ String(ppm4) +(',');
  Serial1.println(kirimdata);

 /* Mengirim data ke Excel
  //Serial.println("DATA,");
  //Serial.print("TIME,");
  //Serial.print(",");
  //Serial.print("Pirolisis");
  Serial.print(pirolisis);
  Serial.print(",");
  //Serial.print("Combustion");
  Serial.print(combustion);
  Serial.print(",");
  //Serial.print("Reduksi");
  Serial.print(reduksi);
  Serial.print(",");
  //Serial.print("Burner");
  Serial.print(burner);
  Serial.print(",");
  //Serial.print("Drying1");
  Serial.print(drying1);
  Serial.print(",");
  //Serial.print("Drying2");
  Serial.print(drying2);
  Serial.print(",");
  //Serial.print("Drying3");
  Serial.print(drying3);
  Serial.print(",");
  //Serial.print("Drying4");
  Serial.print(drying4);
  Serial.print(",");
  //Serial.print("Inlet Syngas");
  Serial.print(inlet);
  Serial.print(",");
  //Serial.print("Outlet Syngas");
  Serial.print(outlet);
  Serial.print(",");
  //Serial.print("Demister");
  Serial.print(demister);
  Serial.print(",");
  //Serial.print("Steam");
  Serial.print(steam);
  Serial.print(",");
  //Serial.print("CH4");
  Serial.print(ppm1);
  Serial.print(",");
  //Serial.print("Co");
  Serial.print(ppm2);
  Serial.print(",");
  //Serial.print("H2");
  Serial.print(v3);
  Serial.print(",");
  //Serial.print("Co2");
  Serial.print(ppm4);
  Serial.print("");
*/

 //Switch Case
  if(!key1S){
    j=j+1;
    delay(100);
   }
  if(!key2S){
    j=j-1;
    delay(100);
  }
  //Serial.print(j);
  switch(j){
    case 1:
     lcd.clear();
     // LCD Print Suhu Pirolisis
      lcd.setCursor(0, 0);  // start to print at the first row
      lcd.print("Gasifikasi: ");
      lcd.print(gasifikasiprevious);     // print the temperature
      lcd.print((char)223); // print ° character
      lcd.print("C");
     // LCD Print Suhu combustion
      lcd.setCursor(0, 1);  // start to print at the first row
      lcd.print("Combustion: ");
      lcd.print(combustionprevious);     // print the temperature
      lcd.print((char)223); // print ° character
      lcd.print("C");
     // LCD Print Suhu reduksi
      lcd.setCursor(0, 2);  // start to print at the first row
      lcd.print("Reduksi: ");
      lcd.print(reduksi);     // print the temperature
      lcd.print((char)223); // print ° character
      lcd.print("C");
     // LCD Print Suhu Burner
      lcd.setCursor(0, 3);  // start to print at the first row
      lcd.print("Burner: ");
      lcd.print(burnerprevious);     // print the temperature
      lcd.print((char)223); // print ° character
      lcd.print("C");
    break;
    // case 2:
    //  lcd.clear();
    //  // LCD Print Suhu drying 1
    //   lcd.setCursor(0, 0);  // start to print at the first row
    //   lcd.print("Drying 1: ");
    //   lcd.print(drying1);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    //  // LCD Print Suhu drying 2
    //   lcd.setCursor(0, 1);  // start to print at the first row
    //   lcd.print("Drying 2: ");
    //   lcd.print(drying2);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    //  // LCD Print Suhu drying 3
    //   lcd.setCursor(0, 2);  // start to print at the first row
    //   lcd.print("Drying 3: ");
    //   lcd.print(drying3);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    //  // LCD Print Suhu drying 4
    //   lcd.setCursor(0, 3);  // start to print at the first row
    //   lcd.print("drying 4: ");
    //   lcd.print(drying4);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    // break;
    // case 3:
    //  lcd.clear();
    //  // LCD Print Suhu Inlet Syngas
    //   lcd.setCursor(0, 0);  // start to print at the first row
    //   lcd.print("Inlet Syngas: ");
    //   lcd.print(inlet);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    //  // LCD Print Suhu Outlet Syngas
    //   lcd.setCursor(0, 1);  // start to print at the first row
    //   lcd.print("Outlet Syngas: ");
    //   lcd.print(outlet);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    //  // LCD Print Suhu Demister
    //   lcd.setCursor(0, 2);  // start to print at the first row
    //   lcd.print("Demister: ");
    //   lcd.print(demister);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    //  // LCD Print Suhu Steam
    //   lcd.setCursor(0, 3);  // start to print at the first row
    //   lcd.print("Steam: ");
    //   lcd.print(steam);     // print the temperature
    //   lcd.print((char)223); // print ° character
    //   lcd.print("C");
    // break;
    case 2:
     lcd.clear();
     //CH4
      lcd.setCursor(0, 0);  // start to print at the first row
      lcd.print("PPM CH4 : ");
      lcd.print(ppm1);     // print the temperature
     //CO
      lcd.setCursor(0, 1);  // start to print at the first row
      lcd.print("PPM CO : ");
      lcd.print(ppm2);     // print the temperature
     //H2
      lcd.setCursor(0, 2);  // start to print at the first row
      lcd.print("PPM H2 : ");
      lcd.print(ppm3);     // print the temperature
     //CO2
      lcd.setCursor(0, 3);  // start to print at the first row
      lcd.print("PPM CO2 : ");
      lcd.print(ppm4);     // print the temperature
    break;
    default: 
     j=1;
    break; 
  }
  delay(4500);
}

These are assignments ( = ) so you are setting these to 0. You probably want to compare ( == ) "are they 0?"

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.