As in the title, I’m trying to read two thermocouples through two MAX31855 amps into Photon.
Problem is it usually reports 0.0F 95% of the time or something close to reality the other 5%.
Unfortunately the zeros are happening quite often…
Keep sampling until I get a good read and meanwhile toss out anything = 0???
3v3 to the amps from photon
5.15v to photon
Here’s my code if it would help:
// This #include statement was automatically added by the Particle IDE.
#include "Adafruit_MAX31855.h"
// This #include statement was automatically added by the Particle IDE.
#include "SimpleTimer.h"
SimpleTimer timer;
int T_DO = D5;
int T_CS = D4;
int T_CLK = D3;
int B_DO = D2;
int B_CS = D1;
int B_CLK = D0;
int top_relay = D6;
int bot_relay = D7;
int SETPOINT = 300; //TEMP IN F
volatile double TOP_T;
volatile double BOT_T;
typedef enum stateType_enum{
top_on, top_off, bot_on, bot_off
} stateType;
stateType topState = top_off;
stateType botState = bot_off;
Adafruit_MAX31855 TopThermo(T_CLK, T_CS, T_DO);
Adafruit_MAX31855 BotThermo(B_CLK, B_CS, B_DO);
void setup()
{
//timer.setInterval(1 * 60 * 1000, publishData);
Time.zone(-7);
pinMode(top_relay,OUTPUT);
digitalWrite(top_relay,LOW); // OFF
pinMode(bot_relay,OUTPUT);
digitalWrite(bot_relay,LOW); // OFF
}
void loop() {
timer.run();
TOP_T = TopThermo.readFarenheit();
BOT_T = BotThermo.readFarenheit();
switch(topState){
case top_on:
if (TOP_T >= SETPOINT)
{
digitalWrite(top_relay,LOW);
topState = top_off;
}
else {}
break;
case top_off:
if (TOP_T <= SETPOINT)
{
digitalWrite(top_relay,HIGH);
topState = top_on;
}
else {}
break;
}
switch(botState){
case bot_on:
if (BOT_T >= SETPOINT)
{
digitalWrite(bot_relay,LOW);
botState = bot_off;
}
else {}
break;
case bot_off:
if (BOT_T <= SETPOINT)
{
digitalWrite(bot_relay,HIGH);
botState = bot_on;
}
else {}
break;
}
Particle.publish("TOP",String(TOP_T,1));
Particle.publish("BOTTOM",String(BOT_T,1));
delay(10 * 1000);
}
void publishData(){
// Particle.publish("TOP",String(TOP_T,1));
// Particle.publish("BOTTOM",String(BOT_T,1));
}