كود البحث

Using Melexis Non-Contact MLX90614 Infrared Thermometer with ESP32 over Bluetooth

Using Melexis Non-Contact MLX90614 Infrared Thermometer with ESP32 over Bluetooth

In this tutorial, you will learn how to display temperature on a mobile phone over Bluetooth using an ESP32 Arduino board with an MLX90614 infrared non-contact temperature sensor.

🔴Infrared non-contact temperature sensor

337-Arduino Code to measure Temperature using MLX90614 with ESP32
اللغة: C++
/*
 * //*
 */
 *
 *
 * This is Arduino code to Measure Temperature over Bluetooth using
 MLX90614 with ESP32

 * Watch video instruction for this code: https: // youtu.be/HpsvNIAtjm4

 * Written/updated by Ahmad Shamshiri for Robojax Video channel www.Robojax.com
 * Date: July 01, 2020, in Ajax, Ontario, Canada

 Related Videos:
 Related videos:
Introduction to MLX90614 Non-Contact https: // youtu.be/cFDSqiEIunw
Display Temperature on LCD from MLX90614: https: // youtu.be/_iO2L4P_irw
Measure temperature using MLX90614 Over WiFi:

 * this code has been downloaded from https: // robojax.com

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

****************************
Get early access to my videos via Patreon and have  your name mentioned at end of very
videos I publish on YouTube here: http: // robojax.com/L/?id=63 (شاهد حتى نهاية هذا الفيديو لمعرفة قائمة رعاتي)
****************************

or make donation using PayPal http: // robojax.com/L/?id=64

 *  * 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 download 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 <Wire.h>
#include <Adafruit_MLX90614.h>
char *typeName[]={"Object: ","Ambient: "};
float tempC, tempF, tempK, tempCA, tempFA, tempKA;
int type=1; // 1=ج، 2=و، 3=ك،
int showAmbient =1; // 1=نعم، 0=لا

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

BluetoothSerial SerialBT;
int inData;

char receivedChar; // سيتم تخزين القيمة المستلمة كـ CHAR في هذا المتغير

void setup() {
  Serial.begin(115200);
  SerialBT.begin("ESP32_Robojax"); // اسم جهاز البلوتوث
  Serial.println("The device started, now you can pair it with bluetooth!");
  Serial.println("Search for ESP32_Robojax device and Pair your phone to ESP32_Robojax");

     mlx.begin();
 // Robojax.com MLX90614 مع ESP32 بلوتوث

}

void loop() {
   getTemp();
 // Robojax.com MLX90614 مع ESP32 بلوتوث
  if (Serial.available()) {
 // SerialBT.write(Serial.read());

  }
  while (SerialBT.available() ) {
    receivedChar =(char)SerialBT.read();
    inData += receivedChar;
        if (receivedChar == '\n')
        {
 // SerialBT.print("تم الاستلام:");// الكتابة على تطبيق BT
 // SerialBT.println(inData);// الكتابة على تطبيق BT

 // Serial.print("تم الاستلام:");//الطباعة على Serial Monitor
 // Serial.println(inData); //الطباعة على Serial Monitor

    type = inData;
    sendTemp();

           inData = 0; // مسح المخزن المؤقت المستلم

        } // إذا (تم استلام الحرف


  } // بينما

 // التسلسلي.println(servo1Angle)؛
        delay(20);
 // Robojax.com MLX90614 مع ESP32 بلوتوث
} // تنتهي الحلقة هنا

void sendTemp()
{

 // Robojax.com MLX90614 مع ESP32 بلوتوث
    if(type ==24)
    {
      SerialBT.print(typeName[0]);
      SerialBT.print(tempC); // درجة حرارة الجسم
      SerialBT.println("°C");
      Serial.print("Temperature:"); // الطباعة على الشاشة التسلسلية
      Serial.println(tempC); // الطباعة على الشاشة التسلسلية
      if(showAmbient)
      {
        SerialBT.print(typeName[1]);
        SerialBT.print(tempCA); // درجة الحرارة المحيطة
        SerialBT.println("°C");
      }
    }
    if(type ==25)
    {
      SerialBT.print(typeName[0]);
      SerialBT.print(tempF); // درجة حرارة الجسم
      SerialBT.println("°F");
      if(showAmbient)
      {
        SerialBT.print(typeName[1]);
        SerialBT.print(tempFA); // درجة الحرارة المحيطة
        SerialBT.println("°F");
      }
    }
    if(type ==26)
    {
      SerialBT.print(typeName[0]);
      SerialBT.print(tempC); // درجة حرارة الجسم
      SerialBT.println("°K");
      if(showAmbient)
      {
        SerialBT.print(typeName[1]);
        SerialBT.print(tempKA); // درجة الحرارة المحيطة
        SerialBT.println("°K");
      }
    }
 // Robojax.com MLX90614 مع ESP32 بلوتوث
} // ينتهي sendTemp هنا



/*
 * @brief تُرجع درجة الحرارة أو الرطوبة النسبية
 * @return تُرجع إحدى القيمتين أعلاه
 * الاستخدام: للحصول على فهرنهايت، النوع: getTemp('F')
 * لطباعتها على الشاشة التسلسلية Serial.println(getTemp('F'));
 * كتبه أحمد شمشيري في ٣٠ مارس ٢٠٢٠.
 * في أجاكس، أونتاريو، كندا
 * www.Robojax.com
 */
void getTemp()
{
 // رمز Robojax.com MLX90614

    tempC = mlx.readObjectTempC(); // في كائن C
    tempCA = mlx.readAmbientTempC();

    tempF = mlx.readObjectTempF(); // فاه. كائن
    tempFA = mlx.readAmbientTempF(); // فاه أمبينت

    tempK = tempC + 273.15; // كائن كلفن
    tempKA =  tempCA + 273.15; // كلفن المحيط

 // رمز Robojax.com MLX90614
} // الحصول على درجة الحرارة

الموارد والمراجع

لا توجد موارد حتى الآن.

ملفات📁

لا توجد ملفات متاحة.