Posted on

วัดอุณหภูมิด้วยเทอร์โมคัปเปิล Thermocouple Type K MAX6675

วัดอุณหภูมิด้วยเทอร์โมคัปเปิล Thermocouple Type K MAX6675

  • Thermocouple Type K สามารถวัดอุณหภูมิในช่าง 0-800 C
  • MAX6675 ตัวแปลง K-Thermocoupleto 0°C ถึง +1024°C เป็น Digital ข้อมูล
    เป็นเอาต์พุตในความละเอียด 12 บิต รองรับ การสื่อสาร SPI
  • https://datasheets.maximintegrated.com/en/ds/MAX6675.pdf

การติดตั้ง Library 

 

 

การเปิดตัวอย่างโค้ด 

/*
  Average Thermocouple

  Reads a temperature from a thermocouple based
  on the MAX6675 driver and displays it in the default Serial.

  https://github.com/YuriiSalimov/MAX6675_Thermocouple

  Created by Yurii Salimov, May, 2019.
  Released into the public domain.
*/
#include <Thermocouple.h>
#include <MAX6675_Thermocouple.h>

#define SCK_PIN 3
#define CS_PIN 4
#define SO_PIN 5

Thermocouple* thermocouple;

// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(9600);

  thermocouple = new MAX6675_Thermocouple(SCK_PIN, CS_PIN, SO_PIN);
}

// the loop function runs over and over again forever
void loop() {
  // Reads temperature
  const double celsius = thermocouple->readCelsius();
  const double kelvin = thermocouple->readKelvin();
  const double fahrenheit = thermocouple->readFahrenheit();

  // Output of information
  Serial.print("Temperature: ");
  Serial.print(celsius);
  Serial.print(" C, ");
  Serial.print(kelvin);
  Serial.print(" K, ");
  Serial.print(fahrenheit);
  Serial.println(" F");

  delay(500); // optionally, only to delay the output of information in the example.
}