The MAX6675 module is a digital thermocouple temperature sensor designed to measure temperatures ranging from 0°C to 1024°C. It provides a digital output via the Serial Peripheral Interface (SPI), making it an ideal choice for applications requiring precise temperature measurements. Common use cases include industrial temperature monitoring, HVAC systems, and scientific research.
Parameter | Value |
---|---|
Temperature Range | 0°C to 1024°C |
Resolution | 0.25°C |
Interface | SPI |
Supply Voltage | 3.0V to 5.5V |
Power Consumption | 1.5mA (typical) |
Accuracy | ±2°C |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (3.0V to 5.5V) |
2 | GND | Ground |
3 | SCK | Serial Clock Input |
4 | CS | Chip Select (Active Low) |
5 | SO | Serial Data Output |
#include <SPI.h>
// Define the MAX6675 module pins
const int CS_PIN = 10;
const int SCK_PIN = 13;
const int SO_PIN = 12;
void setup() {
// Initialize the Serial Monitor
Serial.begin(9600);
// Set the SPI pins
pinMode(CS_PIN, OUTPUT);
pinMode(SCK_PIN, OUTPUT);
pinMode(SO_PIN, INPUT);
// Initialize the SPI interface
SPI.begin();
// Set the Chip Select pin high
digitalWrite(CS_PIN, HIGH);
}
void loop() {
// Read temperature from MAX6675
float temperature = readTemperature();
// Print the temperature to the Serial Monitor
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
// Wait for 1 second before the next reading
delay(1000);
}
float readTemperature() {
// Select the MAX6675 module
digitalWrite(CS_PIN, LOW);
// Read 16 bits from the module
uint16_t value = SPI.transfer16(0x00);
// Deselect the module
digitalWrite(CS_PIN, HIGH);
// Check for thermocouple connection error
if (value & 0x4) {
return NAN; // Return NaN if there's an error
}
// Extract temperature data
value >>= 3; // Remove the last 3 bits
float temperature = value * 0.25; // Convert to Celsius
return temperature;
}
By following this documentation, users should be able to effectively integrate and utilize the MAX6675 module in their projects, ensuring accurate and reliable temperature measurements.