કોડ શોધો

પાઠ 47: રિલે સાથે થર્મોસ્ટેટ તરીકે K-Type MAX6675 નો ઉપયોગ | Arduino સ્ટેપ બાય સ્ટેપ કોર્સ

પાઠ 47: રિલે સાથે થર્મોસ્ટેટ તરીકે K-Type MAX6675 નો ઉપયોગ | Arduino સ્ટેપ બાય સ્ટેપ કોર્સ

આ પ્રોજેક્ટ તમને Arduino, MAX6675 K-પ્રકાર થર્મોકપલ અને રિલેનો ઉપયોગ કરીને તાપમાન નિયંત્રણ સિસ્ટમ બનાવવા માટે માર્ગદર્શન આપે છે. આ સિસ્ટમ ઇચ્છિત તાપમાન શ્રેણી જાળવી શકે છે, જે તેને વિવિધ એપ્લિકેશનો માટે યોગ્ય બનાવે છે. તમે આનો ઉપયોગ આ બનાવવા માટે કરી શકો છો:

  • નાજુક પ્રયોગો અથવા રોપાઓ માટે તાપમાન-નિયંત્રિત ઇન્ક્યુબેટર.
  • સતત વોર્ટ તાપમાન જાળવવા માટે સ્વચાલિત ઉકાળવાની સિસ્ટમ.
  • સરિસૃપ અથવા અન્ય તાપમાન-સંવેદનશીલ પ્રાણીઓ માટે આબોહવા-નિયંત્રિત બિડાણ.
  • નાની જગ્યા માટે સરળ ગરમી અથવા ઠંડક સિસ્ટમ.
  • robojax_course_47_MAX6675_temperature-0

સિસ્ટમ MAX6675 નો ઉપયોગ K-પ્રકાર થર્મોકપલમાંથી તાપમાન વાંચવા માટે કરે છે, જે વિશાળ શ્રેણીમાં સચોટ તાપમાન રીડિંગ્સ પ્રદાન કરે છે (થર્મોકપલ પ્રકાર પર આધાર રાખીને, 1000°C અથવા વધુ સુધી). Arduino આ રીડિંગ્સ પ્રોસેસ કરે છે અને ગરમી અથવા ઠંડક તત્વને ચાલુ અથવા બંધ કરવા માટે રિલેને નિયંત્રિત કરે છે, વપરાશકર્તા-વ્યાખ્યાયિત શ્રેણીમાં તાપમાન જાળવી રાખે છે. (વિડિઓમાં 00:32 પર)

robojax_course_47_MAX6675_temperature-1
robojax_course_47_MAX6675_temperature-2-cool

હાર્ડવેર/ઘટકો

આ પ્રોજેક્ટ બનાવવા માટે, તમારે નીચેના ઘટકોની જરૂર પડશે:

  • Arduino બોર્ડ (Uno, Nano, વગેરે)
  • MAX6675 થર્મોકપલ એમ્પ્લીફાયર
  • K-પ્રકાર થર્મોકપલ
  • રિલે મોડ્યુલ
  • AC બલ્બ (અથવા અન્ય લોડ, જેમ કે પંખો અથવા હીટર)
  • જમ્પર વાયર
  • બ્રેડબોર્ડ (વૈકલ્પિક, પરંતુ ભલામણ કરેલ)

વાયરિંગ માર્ગદર્શિકા

વાયરિંગ વિડિઓમાં વિગતવાર સમજાવવામાં આવ્યું છે. (વિડિઓમાં 03:28 પર) દ્રશ્ય માર્ગદર્શિકા માટે વિડિઓનો સંદર્ભ લો. મુખ્ય જોડાણોમાં MAX6675 ને Arduino સાથે (પિન 2-6), રિલે મોડ્યુલને Arduino સાથે (પિન 8 અને પાવર), અને રિલે મોડ્યુલને AC લોડ સાથે જોડવાનો સમાવેશ થાય છે. એક નિર્ણાયક પાસું એ છે કે તમારા AC લોડના લાઇવ અને ન્યુટ્રલ વાયરને રિલે સાથે જોડતા પહેલા તેને યોગ્ય રીતે ઓળખવું. ખોટું વાયરિંગ જોખમી પરિસ્થિતિઓ તરફ દોરી શકે છે.

robojax_course_47_MAX6675_relay_wiring

કોડ સમજૂતી

Arduino કોડ (નીચે સ્નિપેટ્સમાં બતાવેલ) થર્મોકપલમાંથી તાપમાન મૂલ્યો વાંચવા માટે MAX6675 લાઇબ્રેરીનો ઉપયોગ કરે છે. કોડના વપરાશકર્તા-રૂપરેખાંકિત ભાગો છે:

  • relayPin: રિલે મોડ્યુલ સાથે જોડાયેલ Arduino પિન (ડિફોલ્ટ: 8). (વિડિઓમાં 07:35 પર)
  • relayON અને relayOFF: આ સ્થિરાંકો રિલેને ચાલુ અને બંધ કરવા માટે લોજિક સ્તરો વ્યાખ્યાયિત કરે છે. આ સામાન્ય રીતે LOW અને HIGH હોય છે, પરંતુ તમારા રિલે મોડ્યુલના આધારે તેને સમાયોજિત કરવાની જરૂર પડી શકે છે. (વિડિઓમાં 07:35 પર)
  • TEMPERATURE_UNIT: તાપમાન રીડિંગ્સ માટે એકમ સેટ કરે છે (1 સેલ્સિયસ માટે, 2 ફેરનહીટ માટે, 3 કેલ્વિન માટે). (વિડિઓમાં 08:21 પર)
  • START_TEMPERATURE અને STOP_TEMPERATURE: આ ચલો નિયંત્રણ સિસ્ટમ માટે તાપમાન શ્રેણી વ્યાખ્યાયિત કરે છે. જ્યારે તાપમાન START_TEMPERATURE થી નીચે જાય ત્યારે સિસ્ટમ રિલે ચાલુ કરશે અને જ્યારે તાપમાન STOP_TEMPERATURE સુધી પહોંચે ત્યારે તેને બંધ કરશે (અથવા તેનાથી વિપરીત, તમે હીટર કે કૂલર નિયંત્રિત કરી રહ્યા છો તેના આધારે). (વિડિઓમાં 08:31 પર)
  • CONTROL_TYPE: એક ચલ જે નક્કી કરે છે કે સિસ્ટમ હીટર (1) તરીકે કાર્ય કરે છે કે કૂલર (2) તરીકે. (વિડિઓમાં 08:36 પર)

કોડમાં readTemperature(), printTemperature(), loadControl(), અને relayControl() જેવા કાર્યો શામેલ છે જે તાપમાન વાંચન, પ્રદર્શન અને રિલે કામગીરીને સંભાળે છે. આ કાર્યો વિડિઓમાં સ્પષ્ટ રીતે વ્યાખ્યાયિત અને સમજાવવામાં આવ્યા છે. (વિડિઓમાં 09:37, 10:00, 10:43, 11:30 પર)


const int relayPin =8;
const int relayON = LOW;// બદલશો નહીં
const int relayOFF = HIGH; //બદલશો નહીં 
int relayState = relayOFF;//રિલેની પ્રારંભિક સ્થિતિ

const int TEMPERATURE_UNIT =1;//1=સેલ્સિયસ, 2=ફેરનહીટ, 3=કેલ્વિન
const float START_TEMPERATURE = 80.0;//ઉપરનું એકમ
const float STOP_TEMPERATURE = 100.0;//ઉપરનું એકમ
const int CONTROL_TYPE = 1;// 1= હીટર, 2=કૂલર

લાઇવ પ્રોજેક્ટ/પ્રદર્શન

વિડિઓ ગરમી અને ઠંડક બંને પરિસ્થિતિઓ માટે તાપમાન નિયંત્રણ સિસ્ટમની કામગીરી દર્શાવે છે. (વિડિઓમાં 13:15 અને 15:28 પર) પ્રદર્શન સ્પષ્ટપણે દર્શાવે છે કે સિસ્ટમ જરૂર મુજબ રિલે ચાલુ અને બંધ કરીને સેટ શ્રેણીમાં તાપમાન કેવી રીતે જાળવી રાખે છે.

પ્રકરણો

  • [00:00] પરિચય
  • [00:55] હીટર/કૂલર નિયંત્રણ સમજૂતી
  • [03:28] વાયરિંગ ડાયાગ્રામ
  • [06:26] કોડ સમજૂતી
  • [13:15] હીટર નિયંત્રણ પ્રદર્શન
  • [15:28] કૂલર નિયંત્રણ પ્રદર્શન
  • [17:29] નિષ્કર્ષ

છબીઓ

Robojax course 47 MAX6675 temperature 0
Robojax course 47 MAX6675 temperature 0
Robojax course 47 MAX6675 temperature 2 cool
Robojax course 47 MAX6675 temperature 2 cool
Robojax course 47 MAX6675 temperature 1
Robojax course 47 MAX6675 temperature 1
Robojax course 47 MAX6675 relay wiring
Robojax course 47 MAX6675 relay wiring
25-Arduino code for a MAX6675 K-type thermocouple with relay (no display)
ભાષા: C++
/*
 * This is the Arduino code for MAX6675 Thermocouple K-Type with Relay and Display
 * The output pin 10 is connected to the relay.
 * When the temperature reaches the desired value, pin 10 turns the 
 * relay ON.

 * This code has been explained in our video at https://youtu.be/cD5oOu4N_AE

 * 
 * Written by Ahmad Nejrabi for Robojax Video
 * Date: December 9, 2017, in Ajax, Ontario, Canada
 * Permission granted to share this code given that this
 * note is kept with the code.
 * Disclaimer: This code is "AS IS" and for educational purposes only.
 * 
 */

 // This example is public domain. Enjoy!
// www.ladyada.net/learn/sensors/thermocouple

#include "max6675.h"


int thermoDO = 4;
int thermoCS = 5;
int thermoCLK = 6;


MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int vccPin = 3;
int gndPin = 2;
  
void setup() {
  Serial.begin(9600);
  // Use Arduino pins 
  pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
  pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
    pinMode(10, OUTPUT);// set pin 10 as output
	
  Serial.println("Robojax: 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());

   // If temperature goes above 80.0C, turn the relay ON
   if(thermocouple.readCelsius() > 80.00){
    digitalWrite(10, LOW);// set pin 10 LOW
   }else{
    digitalWrite(10, HIGH);// set pin 10 HIGH
   }
    
 
   delay(1000);
}
757-Arduino code to measure a MAX6675 K-type thermocouple
ભાષા: C++
++
/*
 * Library from: // www.ladyada.net/learn/sensors/thermocouple
 * 
 * This is Arduino code to measure MAX6675 Thermocouple K-Type sensor
 * and control relay as heater or cooler
 * 
 * Watch Video instruction for this code: https://youtu.be/dVh77wT-4Ao
 * 
 
 * Written by Ahmad Shamshiri on May 20, 2020 in Ajax, Ontario, Canada
 * www.robojax.com
 * 

 * Get this code and other Arduino codes from Robojax.com.
Learn Arduino step by step in a structured course with all material, wiring diagrams, and libraries
all in one place. Purchase My course on Udemy.com http://robojax.com/L/?id=62

If you found this tutorial helpful, please support me so I can continue creating 
content like this. 

or make a donation using PayPal http://robojax.com/L/?id=64
Related videos:
Introduction to MAX6675 K-Type: https://youtu.be/VGqONmUinqA
Using MAX6675 K-Type thermocouple with LED display: https://youtu.be/cD5oOu4N_AE
Using MAX6675 K-Type thermocouple with LCD1602-I2C: https://youtu.be/BlhpktgPdKs
Using 2 or more MAX6675 K-Type thermocouples: https://youtu.be/c90NszbNG8c
Using MAX6675 K-Type thermocouple as heater or cooler controller: [this video]
 *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been downloaded from Robojax.com
    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"
//Robojax.com heater/cooler with MAX6675 Thermocoupler
int GNDpin = 2;
int VCCpin =3;
int thermoCLK = 4;
int thermoCS = 5;
int thermoDO = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);


const int relayPin =8;
const int relayON = LOW;// do not change
const int relayOFF = HIGH; //do not change 
int relayState = relayOFF;//initial state of relay

const int TEMPERATURE_UNIT =1;//1=Celsius, 2=Fahrenheit, 3=Kelvin
const float START_TEMPERATURE = 80.0;//unit above
const float STOP_TEMPERATURE = 100.0;//unit above
const int CONTROL_TYPE = 1;// 1= heater, 2=cooler
float temperature;

void setup() {
  //Robojax.com heater/cooler with MAX6675 Thermocoupler
  Serial.begin(9600);
  Serial.println("MAX6675 test with relay");
  // use Arduino pins 
  pinMode(relayPin, OUTPUT);//pin for relay
  digitalWrite(relayPin, relayState);
  
  pinMode(VCCpin, OUTPUT);
  digitalWrite(VCCpin, HIGH);

  pinMode(GNDpin, OUTPUT);
  digitalWrite(GNDpin, LOW);

  // wait for MAX chip to stabilize
  delay(500);
//Robojax.com heater/cooler with MAX6675 Thermocoupler  
}

void loop() {
  //Robojax.com heater/cooler with MAX6675 Thermocoupler
   readTemperature();
   printTemperature();
   loadControl(); 
   if(temperature >=89.5)
   {
    ///
   }
   delay(1000);
//Robojax.com heater/cooler with MAX6675 Thermocoupler   
}//loop



/*
 * loadControl()
 * @brief controls the load based 
 * @param state can be either : relayON or relayOFF

 * @return returns none
 * Written by Ahmad Shamshiri for robojax.com
 * on May 20, 2020 at 15:23 in Ajax, Ontario, Canada
 */
void loadControl()
{
//Robojax.com heater/cooler with MAX6675 Thermocoupler  
     // Serial.print("Start: ");
     // Serial.print(START_TEMPERATURE);
     // Serial.print(" Stop: ");
      //Serial.println(STOP_TEMPERATURE);      
  if(CONTROL_TYPE ==1)
  {
    if(START_TEMPERATURE >= temperature && STOP_TEMPERATURE >=temperature)
    {
      relayControl(relayON);
    }
    if(STOP_TEMPERATURE <=temperature)
    {
      relayControl(relayOFF);
    }
  }else{
    if(START_TEMPERATURE >= temperature && STOP_TEMPERATURE >=temperature)
    {
      relayControl(relayOFF);
    }
    if(STOP_TEMPERATURE <=temperature)
    {
      relayControl(relayON);
    }
  }
    
//Robojax.com heater/cooler with MAX6675 Thermocoupler
}//loadControl()


/*
 * relayControl(int state))
 * @brief turns the relay ON or OFF
 * @param state is "relayON" or "relayOFF" defined at the top of code
 * @return returns none
 * Written by Ahmad Shamshiri for robojax.com
 * on May 20, 2020 at 15:23 in Ajax, Ontario, Canada
 */
void relayControl(int state)
{
  //Robojax.com heater/cooler with MAX6675 Thermocoupler
  if(state ==relayON)
  {
    digitalWrite(relayPin, relayON);
    Serial.println("Relay ON");   
  }else{
   digitalWrite(relayPin, relayOFF);    
    Serial.println("Relay OFF");   
  }
  //Robojax.com heater/cooler with MAX6675 Thermocoupler  

}//relayControl()


/*
 *  readTemperature()
 * @brief reads the temperature based on the TEMPERATURE_UNIT
 * @param average temperature

 * @return returns one of the values above
 * Written by Ahmad Shamshiri for robojax.com
 * on May 20, 2020 at 15:23 in Ajax, Ontario, Canada
 */
void readTemperature()
{
 //Robojax.com heater/cooler with MAX6675 Thermocoupler 

  if(TEMPERATURE_UNIT ==2)
   {
   temperature = thermocouple.readFahrenheit();//convert to Fahrenheit 
   }else if(TEMPERATURE_UNIT ==3)
   {
    temperature = thermocouple.readCelsius() + 273.15;//convert to Kelvin
   }else{
    temperature = thermocouple.readCelsius();// return Celsius
   }    
 //Robojax.com heater/cooler with MAX6675 Thermocoupler 
}// readTemperature()

/*
 * printTemperature()
 * @brief prints  temperature on serial monitor
 * @param charact type
 * @param "type" is character
 *     C = Celsius
 *     K = Kelvin
 *     F = Fahrenheit
 * @return none
 * Written by Ahmad Shamshiri for robojax.com
 * on May 08, 2020 at 02:45 in Ajax, Ontario, Canada
 */
void printTemperature()
{
//Robojax.com heater/cooler with MAX6675 Thermocoupler
   Serial.print(temperature);
    printDegree();    
  if(TEMPERATURE_UNIT ==2)
   {
     Serial.print("F");
    }else if(TEMPERATURE_UNIT ==3)
   {
     Serial.print("K");
   }else{
     Serial.print("C");
   }    
  Serial.println();
//Robojax.com heater/cooler with MAX6675 Thermocoupler  
}//printTemperature()

/*
 * @brief prints degree symbol on serial monitor
 * @param none
 * @return returns nothing
 * Written by Ahmad Shamshiri on July 13, 2019
 * for Robojax Tutorial Robojax.com
 */
void printDegree()
{
    Serial.print("\\xC2"); 
    Serial.print("\\xB0");  
}

તમને જોઈતી વસ્તુઓ

સંસાધનો અને સંદર્ભો

ફાઇલો📁

કોઈ ફાઇલો ઉપલબ્ધ નથી.