这个模块,
防水,可以放在水里测量温度,
耐高温,测量范围 0℃ ---- 600 ℃
MAX6675 热电偶温度传感器模块
实验效果
C为摄氏度
F为华氏
BOM表
Arduino Uno *1
MAX6675 热电偶温度传感器模块 *1
面包版
引脚
GND 共地GND
VCC 3-5.5V电
SCK 为串行时钟
CS 为片选,低电平为由效
S0 数据串行输出
接线
Arduino Uno MAX6675
PIN 3 <-----> GND
PIN 2 <-----> VCC
PIN 6 <-----> SCK
PIN 5 <-----> CS
PIN 4 <-----> S0
程序
本实验,需要下载MAX6675库 ,下载地址为
https://github.com/adafruit/MAX6675-library
// this example is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple
#include "max6675.h" //加载max6675库
int thermoDO = 4; //S0
int thermoCS = 5; //CS
int thermoCLK = 6; //SCK
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO); //建立MAX6675 对象实例
int vccPin = 3; //VCC
int gndPin = 2; //GND
void setup() {
Serial.begin(9600); //串口波特率9600
// use Arduino pins
pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);//vccPin设置为输出
pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);//gndPin设置为输出
Serial.println("MAX6675 test"); //串口输出
// wait for MAX chip to stabilize
delay(500);
}
void loop() {
// basic readout test, just print the current temp
Serial.print("C = ");
Serial.println(thermocouple.readCelsius()); //串口输出摄氏度
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());//串口输出华氏温度
delay(1000);
}
程序思路讲解
1,
#include "max6675.h" //加载max6675库
2,设置各种接线口
int thermoDO = 4; //S0
int thermoCS = 5; //CS
int thermoCLK = 6; //SCK
供电可以直接选择板子上的5v与GND,又或者像实例一样,使用IO口,用输出模式控制
int vccPin = 3; //VCC
int gndPin = 2; //GND
pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);//vccPin设置为输出
pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);//gndPin设置为输出
3
thermocouple.readCelsius() //串口输出摄氏度
thermocouple.readFahrenheit() //串口输出华氏温度