|
Project Information
Featured
Downloads
Links
|
Project Moved to GitHubPlease See the GitHub page for all future updates and development. 06/19/2011 - Project moved to https://github.com/ryanjmclaughlin/MAX6675-Library and Version 2.0 beta released!! InfoArduino Library for Interfacing a MAX6675 Thermocouple to Temperature Chip. See http://www.arduino.cc/playground/Main/MAX6675Library for more details! Updates06/19/2011 - Project moved to GitHub and Version 2.0 beta released!! https://github.com/ryanjmclaughlin/MAX6675-Library 10/5/2009: Updated the library to V1.0. I have also added the code to SVN for updates, changes, and allow others to contribute if they wish. 12/18/2009: Updated the library to V1.1. Default pins have changed slightly to coordinate with the new version of the breakout boards. Code has been added in the examples to control a status LED that is on when a thermocouple is broken or not connected. The library was also updated to return -1 instead of 999.9 when there is an error reading the chip, as 999.9 was potentially a valid reading. Breakout Boards & ChipsI now have breakout boards for the MAX6675 chip for sale on my site. These make it easy to interface the chip as well as provide a standard thermocouple connector on the board. They are available in kit and assembled. Contact me if you just need chips or TC connectors. I will be stocking thermocouples soon too. http://ryanjmclaughlin.com/arduino/thermocouple-interface-board/ DetailsDownload and install the library. There is examples for both a Single Temp and Multi Temp! Example
/*
Single_Temp.pde - Example using the MAX6675 Library.
Created by Ryan McLaughlin <ryanjmclaughlin@gmail.com>
*/
#include <MAX6675.h>
int LED1 = 9; // Status LED Pin
int CS = 10; // CS pin on MAX6675
int SO = 12; // SO pin of MAX6675
int SCK = 13; // SCK pin of MAX6675
int units = 0; // Units to readout temp (0 = ˚F, 1 = ˚C)
float error = 0.0; // Temperature compensation error
float temperature = 0.0; // Temperature output variable
// Initialize the MAX6675 Library for our chip
MAX6675 temp0(CS0,SO,SCK,units,error);
// Setup Serial output and LED Pin
// MAX6675 Library already sets pin modes for MAX6675 chip!
void setup() {
Serial.begin(9600);
pinMode(LED1, OUTPUT);
}
void loop() {
temperature = temp0.read_temp(5); // Read the temp 5 times and return the average value to the var
if(temperature == -1) { // If there is an error with the TC, temperature will be -1
Serial.println("Thermocouple Error!!"); // Temperature is -1 and there is a thermocouple error
digitalWrite(LED1, HIGH); // Turn on the status LED
} else {
Serial.print("Current Temperature: ");
Serial.println( temperature ); // Print the temperature to Serial
digitalWrite(LED1, LOW); // Turn on the status LED
}
delay(1000); // Wait one second before reading again
}
|