{"id":3900,"date":"2024-04-06T09:28:06","date_gmt":"2024-04-06T16:28:06","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3900"},"modified":"2024-04-06T09:28:06","modified_gmt":"2024-04-06T16:28:06","slug":"project-29-dfrobot-temperature-humidity-mk09","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3900","title":{"rendered":"Project #29 &#8211; DFRobot &#8211; Temperature Humidity &#8211; Mk09"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3900-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #DFRobot #SHT40 #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05a.png\" alt=\"Temperature Humidity\" width=\"720\" height=\"555\" class=\"alignnone size-full wp-image-3902\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05a-300x231.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05b.png\" alt=\"Temperature Humidity\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3903\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05c.png\" alt=\"Temperature Humidity\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3904\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/04\/DL2403Mk05c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Temperature Humidity Relationship<\/strong><\/p>\n<p>Temperature is something that tells us about the coldness or warmness of any object which is generally measured in Celsius. It determines the intensity of the heat whereas if we talk about humidity, it talks about the water content that is present in the air, or simply we can say it determines the moisture of the air. These two concepts are different but show a great impact on each other. We will see the relation between temperature and humidity further below. Before that, let&#8217;s understand more about humidity and its types.<\/p>\n<p><strong>Absolute Humidity and Relative Humidity<\/strong><\/p>\n<p>There are generally two types of humidity ie. absolute and relative. The former tells the humidity present in a parcel of air without taking temperature into consideration whereas the latter tells the humidity present in the air concerning the temperature of the air. The former defines the amount of water content by dividing the weight of the parcel by its volume whereas the latter is calculated by dividing the amount of water content present divided by the total capacity of the parcel of the air to hold multiplied by 100. The former decreases with height whereas the latter when reaching 100%, the air gets saturated.<\/p>\n<p><strong>Relation Between Relative Humidity and Temperature<\/strong><\/p>\n<p>We have already learned what is temperature and what is humidity and we have also learned two types of humidity. As we know, both these two concepts ie. Temperature and Humidity are different but they are related to each other. The relation between humidity and temperature formula simply says they are inversely proportional. If temperature increases it will lead to a decrease in relative humidity, thus the air will become drier whereas when temperature decreases, the air will become wet means the relative humidity will increase.<\/p>\n<p><strong>DL2403Mk05<\/strong><\/p>\n<p>1 x DFRobot FireBeetle 2 ESP32-E<br \/>\n1 x Fermion: SHT40 Temperature &#038; Humidity Sensor<br \/>\n1 x Fermion: BLE Sensor Beacon<br \/>\n1 x CR2032 Coin Cell Battery<br \/>\n1 x 1 x Lithium Ion Battery &#8211; 1000mAh<br \/>\n1 x Rocker Switch &#8211; SPST<br \/>\n1 x Resistor 10K Ohm<br \/>\n1 x SparkFun Serial Basic Breakout &#8211; CH340G<br \/>\n1 x SparkFun Cerberus USB Cable<br \/>\n1 x USB 3.1 Cable A to C<\/p>\n<p><strong>DFRobot FireBeetle 2 ESP32-E<\/strong><\/p>\n<p>LED &#8211; 2<br \/>\nRSW &#8211; 17<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2403Mk05p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/****** Don Luc Electronics \u00a9 ******\r\nSoftware Version Information\r\nProject #29 - DFRobot - Temperature Humidity - Mk09\r\n29-09\r\nDL2403Mk05p.ino\r\n1 x DFRobot FireBeetle 2 ESP32-E\r\n1 x Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n1 x Fermion: BLE Sensor Beacon\r\n1 x CR2032 Coin Cell Battery\r\n1 x 1 x Lithium Ion Battery - 1000mAh\r\n1 x Rocker Switch - SPST\r\n1 x Resistor 10K Ohm\r\n1 x SparkFun Serial Basic Breakout - CH340G\r\n1 x SparkFun Cerberus USB Cable\r\n1 x USB 3.1 Cable A to C\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ Bluetooth LE keyboard\r\n#include &lt;BleKeyboard.h&gt;\r\n\/\/ Arduino\r\n#include &lt;Arduino.h&gt;\r\n\/\/ BLE Device\r\n#include &lt;BLEDevice.h&gt;\r\n\/\/ BLE Utils\r\n#include &lt;BLEUtils.h&gt;\r\n\/\/ BLEScan\r\n#include &lt;BLEScan.h&gt;\r\n\/\/ BLE Advertised Device\r\n#include &lt;BLEAdvertisedDevice.h&gt;\r\n\/\/ BLE Eddystone URL\r\n#include &lt;BLEEddystoneURL.h&gt;\r\n\/\/ BLE Eddystone TLM\r\n#include &lt;BLEEddystoneTLM.h&gt;\r\n\/\/ BLE Beacon\r\n#include &lt;BLEBeacon.h&gt;\r\n\r\n\/\/ ENDIAN_CHANGE\r\n#define ENDIAN_CHANGE_U16(x) ((((x)&amp;0xFF00) &gt;&gt; 8) + (((x)&amp;0xFF) &lt;&lt; 8))\r\n\r\n\/\/ Bluetooth LE Keyboard\r\nBleKeyboard bleKeyboard;\r\nString sKeyboard = &quot;&quot;;\r\n\/\/ Send Size\r\nbyte sendSize = 0;\r\n\r\n\/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n\/\/ Temperature\r\nfloat TemperatureData;\r\nfloat Temperature;\r\n\/\/ Humidity\r\nfloat HumidityData;\r\nfloat Humidity;\r\n\/\/ In seconds\r\nint scanTime = 5;\r\n\/\/ BLE Scan\r\nBLEScan *pBLEScan;\r\n\r\n\/\/ My Advertised Device Callbacks\r\nclass MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks\r\n{\r\n\r\n    \/\/ onResult\r\n    void onResult(BLEAdvertisedDevice advertisedDevice)\r\n    {\r\n      \/\/ Advertised Device\r\n      if (advertisedDevice.haveName())\r\n      {\r\n        \/\/ Name: Fermion: Sensor Beacon\r\n        if(String(advertisedDevice.getName().c_str()) == &quot;SHT40&quot;){\r\n          \r\n          \/\/ strManufacturerData\r\n          std::string strManufacturerData = advertisedDevice.getManufacturerData();\r\n          uint8_t cManufacturerData[100];\r\n          strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0);\r\n          \r\n          \/\/ strManufacturerData.length\r\n          for (int i = 0; i &lt; strManufacturerData.length(); i++)\r\n          {\r\n\r\n             \/\/ cManufacturerData[i]\r\n             cManufacturerData[i];\r\n             \r\n          }\r\n\r\n          \/\/ TemperatureData\r\n          TemperatureData = int(cManufacturerData[2]&lt;&lt;8 | cManufacturerData[3]);\r\n          \/\/ HumidityData\r\n          HumidityData = int(cManufacturerData[5]&lt;&lt;8 | cManufacturerData[6]);\r\n   \r\n        }        \r\n      }\r\n    }\r\n};\r\n\r\n\/\/ The number of the Rocker Switch pin\r\nint iSwitch = 17;\r\n\/\/ Variable for reading the button status\r\nint SwitchState = 0;\r\n\r\n\/\/ Define LED\r\nint iLED = 2;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;29-09&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ ScanResults\r\n  isBLEScanResults();\r\n\r\n  \/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n  isSHT40();\r\n\r\n  \/\/ Read the state of the Switch value:\r\n  SwitchState = digitalRead(iSwitch);\r\n\r\n  \/\/ Check if the button is pressed. If it is, the SwitchState is HIGH:\r\n  if (SwitchState == HIGH) {\r\n\r\n    \/\/ Bluetooth LE Keyboard\r\n    isBluetooth();\r\n\r\n  }\r\n  \r\n  \/\/ Delay 2 Second\r\n  delay(2000);\r\n\r\n}\r\n<\/pre>\n<p><strong>getBLEScan.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ getBLEScan\r\n\/\/ Setup BLE Scan\r\nvoid isSetupBLEScan(){\r\n\r\n  \/\/ BLE Device\r\n  BLEDevice::init(&quot;&quot;);\r\n  \/\/ Create new scan\r\n  pBLEScan = BLEDevice::getScan();\r\n  \/\/ Set Advertised Device Callbacks\r\n  pBLEScan-&gt;setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());\r\n  \/\/ Active scan uses more power, but get results faster\r\n  pBLEScan-&gt;setActiveScan(true);\r\n  \/\/ Set Interval\r\n  pBLEScan-&gt;setInterval(100);\r\n  \/\/ Less or equal setInterval value\r\n  pBLEScan-&gt;setWindow(99);\r\n  \r\n}\r\n\/\/ BLE Scan Results\r\nvoid isBLEScanResults(){\r\n\r\n  \/\/ Put your main code here, to run repeatedly:\r\n  BLEScanResults foundDevices = pBLEScan-&gt;start(scanTime, false);\r\n  \/\/ Delete results fromBLEScan buffer to release memory\r\n  pBLEScan-&gt;clearResults();\r\n  \r\n}\r\n<\/pre>\n<p><strong>getBleKeyboard.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Ble Keyboard\r\n\/\/ Bluetooth\r\n\/\/ isBluetooth\r\nvoid isBluetooth() {\r\n\r\n  \/\/ ESP32 BLE Keyboard\r\n  if(bleKeyboard.isConnected()) {\r\n\r\n    \/\/ Send Size Length\r\n    sendSize = sKeyboard.length();\r\n\r\n    \/\/ Send Size, charAt\r\n    for(byte i = 0; i &lt; sendSize+1; i++){\r\n\r\n       \/\/ Write\r\n       bleKeyboard.write(sKeyboard.charAt(i));\r\n       delay(50);\r\n    \r\n    }\r\n    bleKeyboard.write(KEY_RETURN);\r\n\r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>getSHT40.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n\/\/ SHT40 Temperature &amp; Humidity\r\nvoid isSHT40(){\r\n\r\n  \/\/ Fermion: SHT40 Temperature &amp; Humidity Sensor\r\n  \/\/ Temperature\r\n  Temperature = (175 * TemperatureData\/65535) - 45;\r\n  \/\/ Humidity\r\n  Humidity = (125 * HumidityData\/65535) - 6;\r\n  \/\/ DFR|Version|Temperature|Humidity|*\r\n  sKeyboard = &quot;DFR|&quot; + sver + &quot;|&quot; + String(Temperature) + &quot;C|&quot; + String(Humidity) + &quot;%|*&quot;;\r\n\r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup()\r\n{\r\n\r\n  \/\/ Give display time to power on\r\n  delay(100);\r\n\r\n  \/\/ Bluetooth LE keyboard\r\n  bleKeyboard.begin();\r\n\r\n  \/\/ Give display time to power on\r\n  delay(100);\r\n\r\n  \/\/ Setup BLE Scan\r\n  isSetupBLEScan();\r\n  \r\n  \/\/ Initialize the Switch pin as an input\r\n  pinMode(iSwitch, INPUT);\r\n  \r\n  \/\/ Initialize digital pin iLED as an output\r\n  pinMode(iLED, OUTPUT);\r\n  \/\/ Outputting high, the LED turns on\r\n  digitalWrite(iLED, HIGH);\r\n\r\n  \/\/ Delay 5 Second\r\n  delay( 5000 );\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Teacher, Instructor, E-Mentor, R&#038;D and Consulting<\/strong><\/p>\n<ul>\n<li>Programming Language<\/li>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Wireless (Radio Frequency, Bluetooth, WiFi, Etc&#8230;)<\/li>\n<li>Robotics<\/li>\n<li>Automation<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Machine Learning<\/li>\n<li>Artificial Intelligence (AI)<\/li>\n<li>RTOS<\/li>\n<li>Sensors, eHealth Sensors, Biosensor, and Biometric<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<li>Consulting<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Luc Paquin \u2013 Curriculum Vitae &#8211; 2024<\/strong><br \/>\nhttps:\/\/www.donluc.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/@thesass2063<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<br \/>\n<strong>LinkedIn:<\/strong> https:\/\/www.linkedin.com\/in\/jlucpaquin\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #DFRobot #SHT40 #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Temperature Humidity Relationship Temperature is something that tells us about the coldness or warmness of any object which is generally measured in Celsius. It determines the intensity of the heat whereas if we talk about humidity, &#8230; <a title=\"Project #29 &#8211; DFRobot &#8211; Temperature Humidity &#8211; Mk09\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3900\" aria-label=\"Read more about Project #29 &#8211; DFRobot &#8211; Temperature Humidity &#8211; Mk09\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[318,50,49,317,38,80,59,115,5,287,58,82,10],"tags":[6,92,242,102,4,320,19,83,85,24,9,84,27,329,33,330,34,108],"class_list":["post-3900","post","type-post","status-publish","format-standard","hentry","category-ddfrobot","category-arduino","category-consultant","category-dfrobot","category-digitalelectronics","category-esp32","category-fritzing","category-e-mentor","category-microcontrollers","category-program","category-arduino-programming","category-program-esp32","category-projects","tag-arduino","tag-battery","tag-bluetooth","tag-components","tag-consultant","tag-dfrobot","tag-electronics","tag-esp32","tag-fritzing","tag-microcontroller","tag-programming","tag-programming-esp32","tag-projects-2","tag-sht40","tag-technology","tag-temperature-humidity","tag-video-blog","tag-vlog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3900"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3900\/revisions"}],"predecessor-version":[{"id":3905,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3900\/revisions\/3905"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}