Wa Koodu

Bí Ọ̀ṣẹ̀ Lílò MAX6675 K-Type Thermocouple Sensor pẹ̀lú Arduino

Bí Ọ̀ṣẹ̀ Lílò MAX6675 K-Type Thermocouple Sensor pẹ̀lú Arduino

Ìfáàwọ́

Wíwọ̀n ìwọ̀n-òtútù ní ìpéye jẹ́ àbùdá pàtàkì nínú ọ̀pọ̀lọpọ̀ àwọn iṣẹ́ ẹ̀rọ oníná, láti kọ́ ilé ìkórè fún PCB soldering sí àbójútó ìwọ̀n-òtútù ti 3D printer hotend tàbí ẹ̀rọ ìparun ẹran (BBQ smoker). Bí ó tilẹ̀ jẹ́ pé àwọn thermistor àti àwọn sẹ́nsọ̀ onínọ́ńbà bíi DS18B20 ṣiṣẹ́ dáradára fún àwọn ìwọ̀n-òtútù tí kò ga, wọ́n kùnà nígbà tí ohun gbígbóná yóò gbóná gan-an. Èyí ni ibi tí K-type thermocouple ti wọlé. Ó jẹ́ sẹ́nsọ̀ tí ó lágbára, tí kò gbowó lórí, tí ó lè wọn àwọn ìwọ̀n-òtútù tí ó ga gan-an, ṣùgbọ́n ó nílò ẹ̀yà chip àkànṣe láti túmọ̀ àmì iná rẹ̀ tí kéré sí iye onínọ́ńbà tí a lè kà.

Ìtọ́sọ́nà yìí ṣàfihàn bí a ṣe le lo MAX6675 breakout board pẹ̀lú K-type thermocouple sẹ́nsọ̀ àti Arduino láti kà àti láti fi hàn àwọn ìwọ̀n-òtútù ní méjèèjì Celsius àti Fahrenheit lórí serial monitor (nínú fídíò ní 00:00). MAX6675 module ṣe àkóso ìdàpọ̀ àmì iná tí ó díjú àti ìsún-ìwọ̀n-òtútù lórí fún ọ, tí ó ń jáde ní onínọ́ńbà tí ó mọ́ nípasẹ̀ SPI protocol. Ètò yìí pípé fún àwọn iṣẹ́ tí nílò ìwọ̀n-òtútù gíga, bíi:

  • Àbójútó ìwọ̀n-òtútù ti 3D printer hotend tàbí ibùsùn tí a gbóná.
  • Kíkọ́ thermometer onínọ́ńbà fún BBQ grill tàbí ìléèrè ìdáná.
  • Ṣíṣẹ̀dá olùdarí ìwọ̀n-òtútù fún DIY reflow oven tàbí ibùdó soldering.
  • Wíwọ̀n ìwọ̀n-òtútù eefin ẹ̀rọ nínú àwọn iṣẹ́ ọkọ̀ ayọ́kẹ́lẹ́ tàbí robotics.

Àwọn Ẹ̀yà Ohun-èlò

Láti tẹ̀lé ìtọ́sọ́nà yìí, ìwọ yóò nílò àwọn ẹ̀yà wọ̀nyí. Wíwọ́n okun rọrùn, àti kóòdù náà bá àwọn ẹ̀yà Arduino gbogbo mu (nínú fídíò ní 00:47).

  • Arduino board (Uno, Mega, Nano, àti bẹ́ẹ̀ bẹ́ẹ̀ lọ)
  • MAX6675 module (breakout board)
  • K-type thermocouple sẹ́nsọ̀ (irú probe èyíkéyìí)
  • Jumper wires

MAX6675 module fúnra rẹ̀ kéré gan-an. Gẹ́gẹ́ bí a ṣe fi hàn nínú fídíò, àwọn ìwọ̀n rẹ̀ jẹ́ 32.1mm ní gígùn, 15.6mm ní fífẹ̀, àti 16.3mm ní jíjìn (nínú fídíò ní 02:35). Module náà ní terminal block kékeré kan fún ìsopọ̀ thermocouple àti ọ̀nà àwọn pin fún agbára àti SPI ìbánisọ̀rọ̀. K-type thermocouple sopọ̀ mọ́ module pẹ̀lú polarity tí ó tọ́; okun pupa (positive) lọ sí ibi '+' àti okun ofeefee (negative) lọ sí ibi '-' (nínú fídíò ní 01:27).

Àwọn Ìwọ̀n-Ẹ̀rọ

Kí a tó wọ inú wíwọ́n okun, ó ṣeé ṣe láti lóye agbára MAX6675 chip. Gẹ́gẹ́ bí datasheet láti ọ̀dọ̀ Maxim Integrated, module náà lè wọn ọ̀pọ̀lọpọ̀ ìwọ̀n-òtútù, tí ó mú un dára fún àwọn ohun èlò ilé-iṣẹ́ àti àwọn olùfẹ́ ẹ̀rọ (nínú fídíò ní 01:44).

  • Ìwọ̀n-Ìwọ̀n: 0°C sí +1024°C
  • Ìpinnu: 12-bit (0.25°C)
  • Ìbánisọ̀rọ̀: SPI (Serial Peripheral Interface)
  • Agbára Ìṣiṣẹ́: 3.0V sí 5.5V

Ìtọ́sọ́nà Wíwọ́n Okun

Wíwọ́n okun fún MAX6675 rọrùn, nílò ìsopọ̀ agbára àti àwọn pin onínọ́ńbà mẹ́ta fún ìbánisọ̀rọ̀ SPI. Nínú àpẹẹrẹ yìí, a óò lo àwọn pin Arduino 4, 5, àti 6 fún àwọn ọ̀nà data (nínú fídíò ní 03:28). Àwọn ìsopọ̀ náà ni wọ̀nyí:

  • VCC (Okun ọsàn): Sopọ̀ sí pin 5V ti Arduino (nínú fídíò ní 02:56).
  • GND (Okun ofeefee): Sopọ̀ sí pin GND ti Arduino (nínú fídíò ní 02:51).
  • SO - Serial Out (Okun aláwọ̀ ewé): Sopọ̀ sí pin onínọ́ńbà 4 ti Arduino (nínú fídíò ní 03:01).
  • CS - Chip Select (Okun àwọ̀ ewú): Sopọ̀ sí pin onínọ́ńbà 5 ti Arduino (nínú fídíò ní 03:08).
  • SCK - Serial Clock (Okun funfun): Sopọ̀ sí pin onínọ́ńbà 6 ti Arduino (nínú fídíò ní 03:14).

Àlàyé Kóòdù

Kóòdù tí a pèsè nínú ìtọ́sọ́nà yìí jẹ́ èyí tí a ṣe láti rọrùn àti láti ṣàtúnṣe. Ó gbára lé library kan tí a ń pè ní max6675.h, èyí tí o nílò láti fi sílẹ̀ kọ́kọ́. O lè gba library náà gẹ́gẹ́ bí fáìlì ZIP àti fi kún un sí Arduino IDE rẹ nípa lílọ sí Sketch -> Include Library -> Add .ZIP Library. Lẹ́yìn ìfisílẹ̀, o gbọ́dọ̀ pa Arduino IDE náà àti tún un sí fún library náà láti lè mọ̀ ọ́n (nínú fídíò ní 04:14).

Ní kété tí a bá ti fi library sílẹ̀, o lè da kóòdù tí a pèsè kọ́pọ̀ sí inú sketch rẹ. Ìgbésẹ̀ àkọ́kọ́ ni láti fi library fáìlì sílẹ̀, èyí tí ó fún Arduino ní ààyè sí àwọn iṣẹ́ tí a nílò láti bá MAX6675 chip sọ̀rọ̀ (nínú fídíò ní 03:55). Lẹ́yìn náà, ìwọ yóò ṣàlàyé àwọn pin tí module sopọ̀ sí. Àwọn wọ̀nyí ni àwọn ìlà kóòdù kan ṣoṣo tí o nílò láti yí padà bí o bá pinnu láti lo àwọn pin ọ̀tọ̀ọ̀tọ̀ lórí Arduino rẹ (nínú fídíò ní 04:52).


int soPin = 4;// SO=Serial Out
int csPin = 5;// CS = chip select CS pin
int sckPin = 6;// SCK = Serial Clock pin

Lẹ́yìn ṣíṣàlàyé àwọn pin, a ṣẹ̀dá àpẹẹrẹ kan ti MAX6675 class. Ìtòlẹ́sẹ̀ àwọn àríyànjiyàn nínú ìlà yìí ṣe pàtàkì; wọ́n gbọ́dọ̀ wà ní ìtòlẹ́sẹ̀ sckPin, csPin, àti soPin. Yíyí wọ́n padà yóò ṣèdíwọ́ fún sẹ́nsọ̀ náà láti ṣiṣẹ́ dáradára (nínú fídíò ní 05:21).


MAX6675 robojax(sckPin, csPin, soPin);// create instance object of MAX6675

Ninu iṣẹ́ setup(), a ṣe ìbẹ̀rẹ̀ serial monitor ní ìwọ̀n baud 9600 kí a lè wo àwọn ìwọ̀n ìgbóná lórí kọ̀ǹpútà wa (ní fídíò ní 05:41). Ìṣe pàtàkì wà nínú iṣẹ́ loop(). Níhìn-ín, a pe àwọn ọ̀nà readCelsius() àti readFahrenheit() ti ohun-èlò robojax láti gba ìwọ̀n ìgbóná kí a sì tẹ̀ ẹ́ sí serial monitor. A fi ìdúró 1000 milliseconds (ìṣẹ́jú kan) sí ìparí loop láti ṣètò ìwọ̀n ìmúdọ̀tí (ní fídíò ní 05:54). Bí o bá fẹ́ ìmúdọ̀tí tó yára, o lè dín ìdúró yìí kù sí 100 milliseconds tàbí kéré sí i (ní fídíò ní 08:44).


Serial.print("C = "); 
Serial.print(robojax.readCelsius());
Serial.print(" F = ");
Serial.println(robojax.readFahrenheit());
delay(1000);

Kóòdù yìí jẹ́ ìdánwò kíkà ìpìlẹ̀. O lè gbòòrò rẹ̀ ní rọrùn láti mú àwọn ìgbésẹ̀ ṣẹlẹ̀ dá lórí àwọn ìpele ìwọ̀n ìgbóná. Fún àpẹẹrẹ, o lè lo gbólóhùn if láti ṣàyẹ̀wò bí ìwọ̀n ìgbóná bá ju iye kan lọ, kí o sì tan afẹ́fẹ́ láti tutu ẹ̀rọ kan, tàbí tan ẹ̀rọ ìgbóná bí ìwọ̀n ìgbóná bá kéré jù (ní fídíò ní 06:42).

Ìfihàn Iṣẹ́-ìṣe Láàyè

Láti fi agbára ẹ̀rọ-ìwọ̀n hàn, fídíò náà fi thermocouple hàn tí wọ́n ń fi ẹ̀rọ ìgbóná gbóná. Bí ìgbóná ṣe ń lọ, ìwọ̀n ìgbóná lórí serial monitor ń pọ̀ sí i ní kíákíá. Ìfihàn náà fi hàn pé ìwọ̀n ìgbóná dé ọ̀kànlélọ́ọ̀dúnrún (125) degrees Celsius, pẹ̀lú iye Fahrenheit tó bá a mu ní ẹ̀gbẹ́ rẹ̀ (ní fídíò ní 08:25). Nígbà tí wọ́n bá yọ ẹ̀rọ ìgbóná kúrò, o lè rí i pé ìwọ̀n ìgbóná ń dín kù díẹ̀díẹ̀, tí ó fi ìpéye àti ìmúdáradára ẹ̀rọ-ìwọ̀n hàn. Ìdáhùn gbàràgbà yìí jẹ́ kí module MAX6675 jẹ́ àṣàyàn tó dára fún èyíkéyìí iṣẹ́-ìṣe tó nílò ìwọ̀n ìgbóná gíga tó péye.

Àwọn Abala Fídíò

  • [00:00] Ìfihàn àti àkópọ̀ iṣẹ́-ìṣe
  • [01:15] Àlàyé ohun-èlò
  • [02:41] Àlàyé ìsopọ̀
  • [03:28] Àlàyé kóòdù
  • [07:26] Ìfihàn wíwọ̀n ìwọ̀n ìgbóná

Aworan

MAX6675 Thermocoupler module
MAX6675 Thermocoupler module
K-Type Thermocoupler module with wire
K-Type Thermocoupler module with wire
K-Type thermocoupler connector
K-Type thermocoupler connector
Arduino wiring for MAX6675 Thermocoupler module
Arduino wiring for MAX6675 Thermocoupler module
MAX6675 Thermocoupler module
MAX6675 Thermocoupler module
171-How to use a MAX6675 thermocouple K-type sensor with Arduino
Ede: C++
// Original library source:
// www.ladyada.net/learn/sensors/thermocouple
 /*
 * Arduino code to read temperature using MAX6675 chip and K-type thermocouple
 * and display it on the serial monitor
 * 
 * Watch video instructions for this code: https://youtu.be/VGqONmUinqA
 * Download this code from Robojax.com
 *  
 * Updated by Ahmad Shamshiri for Robojax.com on Saturday, November 23, 2018 
 * at 21:25 in Ajax, Ontario, Canada
 * 
 
 * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.
 * This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

 
#include "max6675.h" // max6675.h file is part of the library that you should download from Robojax.com

int soPin = 4;// SO=Serial Out
int csPin = 5;// CS = chip select CS pin
int sckPin = 6;// SCK = Serial Clock pin

MAX6675 robojax(sckPin, csPin, soPin);// create instance object of MAX6675


void setup() {

          
  Serial.begin(9600);// initialize serial monitor with 9600 baud
  Serial.println("Robojax MAX6675"); 

}

void loop() {
  // Basic readout test, just print the current temperature
  // Robojax.com MAX6675 temperature reading on serial monitor
   Serial.print("C = "); 
   Serial.print(robojax.readCelsius());
   Serial.print(" F = ");
   Serial.println(robojax.readFahrenheit());

             
   delay(1000);
}

Ohun ti o le nilo

Orisun & itọkasi

Fáìlìs📁

Awọn faili miiran