Arduino Uno 水里水里去火里火里去 可高温防水 MAX6675热电偶温度传感器

这个模块,

防水,可以放在水里测量温度,

耐高温,测量范围   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()   //串口输出华氏温度

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值