2018
February Tuesday 20

Bookmark and Share

Related Articles...

MILWAUKEE WI Arduino Meet Up Make Space

WANTED: CORE TEAM MEMBER TO HELP START NON-PROFIT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Arduino Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Arduino Maker Space

Students Learning Embedded MPU Programming;

Arduino Hobbyists, Tinkers

Embedded Arduino Control Implementation Developers

- Industrial Control

- Home Automation

- Office Automation

- Smart Buildings

- Vehicle Automation

- Scientific Research

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Internet of Things (IoT) Meet Up Make Space

WANTED: START-UP CORE TEAM MEMBERS TO START A NON-PROFIT IoT DEVELOPMENT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Make Space Acquired!

Full Advanced Fabrication Facility, machine Shop, Welding, Electronics Lab Equipment Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Machine Repair, & Installation  - Tier 1 Business Support

Machine Technician Mechanic 20+ Years  Personal Experienced In Industrial Factory Machine Servicing, Rebuilding, Installation And Repair - Plus A 35+ Years Experienced Computer Engineer Service Technician Team Ready For Your Outsourced Market Advantage Needs!

Hartung Industrial - Member - CGI Science & Technology Group

Email :

COASMailBox @ gmail.com


2018 February REVIEW

 

Arduino & MAX6675 K Thermocoupler Ampilfier Temperature Measurements & Data Logger
| Gene's Quick Lab Ref

2017 | by Gene Casanova

Senior Systems/Network/Internet Engineer; Senior Technical Writer/Author/Editor


Arduino Thermocoupler Library

The Arduino Thermocoupler Library has been developed as an Arduino interface to K-type thermocouples, using the MAX6675
Cold-Junction-Compensated K-Thermocouple-to-Digital Converter IC from Maxim Integrated Products.

BEWARE

The MAX6675 IC can only read down to 0°C (32°F).


Keynots

  1. The MAX6675 is an SPI device.  The Arduino thermocoupler library uses the standard SPI interface.  The Arduino SPI library must be included in an Arduino sketch to use.
  2. One or more MAX6675 IC chips can be connected on a bus to interface multiple K thermocouples.
    1. This library makes it easy to instantiate as many thermocouple
      objects as needed.
    2. Connect all MAX6675 Serial Out (SO) pins together, and
      connect them to Arduino pin 12 (MISO).
    3. Connect all the MAX6675 Serial Clock (SCK) pins together, and connect them to Arduino pin 13.
    4. The Chip Select (CS) pin of each MAX6675 IC, must go to a dedicated Arduino I/O pin; any I/O pin can be used.
    5. BEWARE - the electronic-industry standard "SO" - (Serial Out) is sometimes not used on products.  There are "thermocoupler modules" using "DO" (Data Out) in place of "SO".  Sometimes "CLK" is used, instead of the standard "SCK" (Serial Clock) as an indicator to the serial clock input pin.
  3. Create a thermocouple object, using the Arduino I/O pin number where the MAX6675 (CS) chip select output is connected. Example sketch source code:
    #define csTC1 10  // Define a variable and pin on an Arduino UNO, for connection of the (CS) Chip Select pin.
    Thermocouple tc1 = Thermocouple(csTC1); // Create the thermocouple object; naming it "tc1". 
  4. Read the thermocouple, using the function readC() or readF().
    1. Both functions return the temperature as a FLOAT value. Example sketch source code; create a variable to hold incomming data from MAX6675, then get a reading (measurement):
      float tc1Temp;
      tc1Temp = tc1.readC();
    2. The MAX6675 will detect if the thermocouple circuit is open (not connected).   In this case, readC() or readF() will return a negative number.   This does not cause confusion with temperature readings, since the MAX6675 only reads down to 0°C (32°F).
  5. BEWARE - The temperature value returned by readC() or readF() is a moving average of the last six consecutive readings.
    1. MAX6675 has a 220 millisecond Conversion Time
    2. This technique is useful to smooth short-term variations in reading.
    3. The assumption is, the read function will be executed on a repeative loop.   Do not execute readC() or readF() more than about four times per second, as the MAX6675 has a 220 millisecond conversion time.

Example Sketch Using 1 Thermocoupler

/* Arduino "Thermocoupler.h" library
 * Demonstration Sketch - REVIEWED 2017
 * Using a MAX6675 K Thermocoupler Interface.
 * 
 * Read a MAX6675 IC using the Arduiono Thermocouple.h library.
 *
 * Functions readF() and readC() return a six-sample average.
 * This works well to smooth out short-term variations.
 * This source code excutes a read function every 10 seconds.
 *
 * The MAX6675 conversion time should not exceed 0.22 seconds.
 * The read function can be executed up to four times per second.
*/
#include <SPI.h>
#include <Thermocouple.h>
// MAX6675 SPI pin define:
#define csTC1  10 // CS MAX6675 to Arduino UNO CS (Chip Select) pin 10.  

// Connect the MAX6675 as follows:
// MISO Arduino pin 12          // 'Master In Slave Out' (MISO) SPI port.
// SCK  Arduino pin 13          // Serial Clock

Thermocouple tc1 = Thermocouple(csTC1);    // Create a thermocouple object

void setup() {
    Serial.begin(115200);       // Create a Serial communication port.
}

void loop() {
    Serial.print("tc1: ");
    displayTemp(tc1.readF());   // read temperature data
    Serial.println();			// Output data to serial port.
    delay(10000);			// delay processing.
}

void displayTemp(float fTemp) {
    if (fTemp < 0.0) {
        Serial.println("Open thermocouple circuit");
    }
    else {
        Serial.print(fTemp, 0);
        Serial.println("\260F");    // Octal 260 = Degree Symbol
    }
}

Multiple Thermocouplers Data Reading:

/* Arduino "Thermocoupler.h" library
 * Demonstration Sketch - REVIEWED 2017
 * Using a MAX6675 K Thermocoupler Interface.
 * 
 * Read a MAX6675 IC using the Arduiono Thermocouple.h library.
 *
 * Functions readF() and readC() return a six-sample average.
 * This works well to smooth out short-term variations.
 * This source code excutes a read function every 10 seconds.
 *
 * The MAX6675 conversion time should not exceed 0.22 seconds.
 * The read function can be executed up to four times per second.
*/
#include <SPI.h>
#include <Thermocouple.h>
// MAX6675 SPI pin define:
#define csTC1  9 // CS MAX6675 #1 to Arduino UNO pin 9.  
#define csTC2  10 // CS MAX6675 #2 to Arduino UNO  CS (Chip Select) pin.

// Connect MAX6675 pins as follows:
// MISO Arduino pin 12          // 'Master In Slave Out' (MISO) SPI port.
// SCK  Arduino pin 13          // Serial Clock

Thermocouple tc1 = Thermocouple(csTC1);    // Create a thermocouple object
Thermocouple tc2 = Thermocouple(csTC2);

void setup() {
    Serial.begin(115200);       // Create a Serial communication port.
}

void loop() {
    Serial.print("tc1: ");
    displayTemp(tc1.readF());   // read #1 temperature data.
    Serial.print("tc2: ");
displayTemp(tc2.readF()); // read 2nd TC temperature data.
Serial.println();
delay(10000); } void displayTemp(float fTemp) { if (fTemp < 0.0) { Serial.println("Open thermocouple circuit"); } else { Serial.print(fTemp, 0); Serial.println("\260F"); // Octal 260 = Degree Symbol } }

 


Use The Technology Wisely & Keep It Simple

- Cheers!

Gene Casanova


Need More?   Need Help? ........Software, Network, System & Data Center Builder & Developer | Development Services Available - Freelance Small Jobs; To Outsourced Long Term Service Provider Contract Labor Available.

CGI Computer Wares | EST 1979

Send E-MailCONTACT: [click]@CGIComputerWares.com