Thermocouple

Note: most K-Type thermocouples have about ±2°C to ±6°C accuracy

Thermocouples

AF thermocouple tutorial

 

Custom Option

   

Custom FeatherWing that accepts the mounting of either a Adafruit K-Type Thermocouple AD8495 Breakout, or a Adafruit MAX31856 Universal Thermocouple Amplifier This board allows you to connect a Type K thermocouple to the AD8495 Breakout and output to an analog input, or connect a Type K, J, N, R, S, T, E, or B type thermocouple to the MAX31856 Universal breakout and output to 4-wire SPI.  

 

Adafruit K-Type Thermocouple AD8495 Breakout

Adafruit K-Type Thermocouple AD8495 Breakout $12/ea.   Sensing Accuracy Range: ± 1°C around room temperature, ± 2°C for −25°C to +400°C.   Requires at lease one analog pin.   AF tutorial

 

Adafruit MAX31856 Universal Thermocouple Amplifier

Adafruit Universal Thermocouple Amplifier MAX31856 Breakout -210°C to +1800°C; $17.50/ea; SPI data output to any 4 digital I/O pins.   AF tutorial

 

Feather M0 Code


			/*
			  Adafruit MAX31856 Universal Thermocouple Amplifier
			  Product #3263

			  
			*/

			// M0  (Feather M0)
			// Make sure Arduino IDE board = "Adafruit Feather M0"

			//////////////////////////////////////////////////////////////////////////////
			// 300000 ms = 5 min
			// 60000 ms = 1 min
			// 10000 ms = 10 sec = 0.1 Hz 
			// 1000 ms = 1 sec = 1 Hz
			// 100 ms = 0.1 sec = 10 Hz
			// 10 ms = 0.01 sec = 100 Hz
			const unsigned long timerInterval = 1000;  
			unsigned long timerLast = 0;  // timer
			//////////////////////////////////////////////////////////////////////////////


			//////////////////////////////////////////////////////////////////////////////
			// Adafruit MAX31856 Universal Thermocouple Amplifier
			// Library: Adafruit_MAX31856   https://github.com/adafruit/Adafruit_MAX31856
			#include 
			// Adafruit_MAX31856(CS, MOSI/SDI, MISO/SDO, SCK)
			// Below for Feather M0 Basic
			//Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(A1, 23, 22, 24);
			//Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(A1);
			Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(A1, A4, A2, A5);
			// Below works on Arduino Uno  (must connect all wires)
			//Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(10, 11, 12, 13);
			//Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(10); // 11, 12, 13 hardware SPI
			//Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(4, 5, 6, 7);
			// Particle Argon/Boron:
			//Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(A1, D3, D4, D2);
			//////////////////////////////////////////////////////////////////////////////


			void setup() {  
			  Serial.begin(9600);
			  while (!Serial) {
				delay(1);
			  }

			  //////////////////////////////////////////////////////////////////////////////
			  // Adafruit MAX31856 Universal Thermocouple Amplifier
			  while (! Thermocouple.begin()) {
				delay(1);
			  }  
			  Thermocouple.setThermocoupleType(MAX31856_TCTYPE_K);
			  //////////////////////////////////////////////////////////////////////////////
			  
			  
			  Serial.println("Setup complete\n");
			} // setup()


			void loop() {

				
			  if (timerLast > millis())  timerLast = millis();
			  if ((millis() - timerLast) > timerInterval) {
				// Check and print any thermocouple faults
				uint8_t fault = Thermocouple.readFault();
				if (fault) {
				  if (fault & MAX31856_FAULT_CJRANGE) Serial.println("Cold Junction Range Fault");
				  if (fault & MAX31856_FAULT_TCRANGE) Serial.println("Thermocouple Range Fault");
				  if (fault & MAX31856_FAULT_CJHIGH)  Serial.println("Cold Junction High Fault");
				  if (fault & MAX31856_FAULT_CJLOW)   Serial.println("Cold Junction Low Fault");
				  if (fault & MAX31856_FAULT_TCHIGH)  Serial.println("Thermocouple High Fault");
				  if (fault & MAX31856_FAULT_TCLOW)   Serial.println("Thermocouple Low Fault");
				  if (fault & MAX31856_FAULT_OVUV)    Serial.println("Over/Under Voltage Fault");
				  if (fault & MAX31856_FAULT_OPEN)    Serial.println("Thermocouple Open Fault");
				  Serial.println(" ");
				} else {
				  // NOTE:  You can still have a wiring fault that is not detected, and
				  //        the temperature will be reported as 0.00
				  Serial.print("Thermocouple Temp: "); 
				  Serial.print(Thermocouple.readThermocoupleTemperature());
				  Serial.println(" C");     
				}
				timerLast = millis();
			  }
			  
			  // The yield() function allows ESP8266 microcontroller to run a 
			  // number of utility functions in the background, without causing 
			  // the ESP8266 to crash or reset. Include it within any 
			  // while() + digitalRead() and other loops;
			  yield();
			  
			} // loop()

			

 

Argon / Boron Code


			/*
				particle.io Argon
				device name: Argon_A
			 */

			// Create a timer executed every 25 seconds.
			const unsigned long timerA = 25000;  // 25000 ms = 25 seconds
			unsigned long timerAlap = millis();  // timer


			//////////////////////////////////////////////////////////////////////////////
			// Adafruit MAX31856 Universal Thermocouple Amplifier
			// Library: Adafruit_MAX31856   https://github.com/adafruit/Adafruit_MAX31856
			#include 
			// Adafruit_MAX31856(CS, MOSI/SDI, MISO/SDO, SCK)
			Adafruit_MAX31856 Thermocouple = Adafruit_MAX31856(A1, D3, D4, D2);
			double tempC = 0.0;
			//////////////////////////////////////////////////////////////////////////////

			int pinLEDWhite = A0; // A0 = D19


			void setup() {
			  pinMode(pinLEDWhite, OUTPUT);

			  //////////////////////////////////////////////////////////////////////////////
			  // Adafruit MAX31856 Universal Thermocouple Amplifier
			  while (! Thermocouple.begin()) {
				digitalWrite(pinLEDWhite, HIGH);
				delay(1);
				digitalWrite(pinLEDWhite, LOW);
			  }
			  Thermocouple.setThermocoupleType(MAX31856_TCTYPE_K);
			  //////////////////////////////////////////////////////////////////////////////

			  // Publish the value of tempC as a Particle variable.
			  // The frequency of publishing is managed by Particle. 
			  Particle.variable("tempC",tempC);

			  blinkLED(pinLEDWhite);
			  timerAlap = millis(); // reset the timer
			}   // setup()

			void loop() {
			  
			  if (timerAlap > millis())  timerAlap = millis(); 
			  if (millis() - timerAlap > timerA) {  
				 uint8_t fault = Thermocouple.readFault();
				if (fault) {
				  digitalWrite(pinLEDWhite, HIGH);
				} else {
				  tempC = Thermocouple.readThermocoupleTemperature();
				}
				
				blinkLED(pinLEDWhite);
				timerAlap = millis(); // reset the timer
			  }


			}   // loop()


			void blinkLED(byte ledPIN){
			  //  consumes 300 ms.
			  for(int i = 5; i>0; i--){
				digitalWrite(ledPIN, HIGH);
				delay(30);
				digitalWrite(ledPIN, LOW);
				delay(30);
			  }    
			} // blinkLED()

			

 

K-Type Thermocouple - Grove Option

-50 to 600°C, and the accuracy is ±(2.0% + 2°C).   Operating range -40 to +125 °C.  

Grove K-Type Thermocouple details from Seeed

Interface the Grove sensor with the Particle IoT device using either the Grove Shield FeatherWing - Wio Lite or the Grove Shield FeatherWing.  

 

 


Do you need help developing or customizing a IoT product for your needs?   Send me an email requesting a free one hour phone / web share consultation.  

 

The information presented on this website is for the author's use only.   Use of this information by anyone other than the author is offered as guidelines and non-professional advice only.   No liability is assumed by the author or this web site.