{"id":3731,"date":"2025-05-29T14:54:35","date_gmt":"2025-05-29T14:54:35","guid":{"rendered":"https:\/\/iotthinghub.com\/?p=3731"},"modified":"2025-05-29T15:41:07","modified_gmt":"2025-05-29T15:41:07","slug":"esp01-thingspeak-channel-bme280-sensor-data-update","status":"publish","type":"post","link":"https:\/\/iotthinghub.com\/?p=3731","title":{"rendered":"ESP01 ThingSpeak Channel: BME280 Sensor Data Update"},"content":{"rendered":"\n<p class=\"has-text-color has-link-color wp-elements-1 wp-block-paragraph\" style=\"color:#5c5c5c\">In this article we interface I<sup>2<\/sup>C temperature, humidity &amp; pressure sensor BME280 with esp01. We already interface esp01 with STM32 in AT command mode previously. Since esp01 along can handle I<sup>2<\/sup>C device so no need for an external microcontroller. We use OLED display for display sensor data on screen &amp; store value in ThingSpeak Server. Go to thingSpeak website &amp; create a channel after successful registration. Since we only write data to thingSpeak cloud, after successfully creating a channel with fields you can have-<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-2 wp-block-paragraph\" style=\"color:#252525\">Write a Channel Feed<\/p>\n\n\n\n<p class=\"has-text-align-center has-text-color has-link-color wp-elements-3 wp-block-paragraph\" style=\"color:#252525\">GET https:\/\/api.thingspeak.com\/update?api_key=={API key}&amp;field1=0<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-4 wp-block-paragraph\" style=\"color:#5c5c5c\">Since it is a GET method we can check it directly into a browser for updating the value without Postman Application. Let\u2019s continue with our project. Here<\/p>\n\n\n\n<ul style=\"color:#252525\" class=\"wp-block-list has-text-color has-link-color wp-elements-5\">\n<li>Field 1 : temperature : Temperature BME280 : Celsius (\u00b0C)<\/li>\n\n\n\n<li>Field 2 : humidity : Humidity BME280 : %<\/li>\n\n\n\n<li>Field 3 : pressure : Air pressure BME280 : hPa<\/li>\n\n\n\n<li>Field 4 : altitude : Altitude BME280 : m<\/li>\n\n\n\n<li>Field 5 : heatIndex : Heat Index : Celsius (\u00b0C)<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-6 wp-block-paragraph\" style=\"color:#5c5c5c\">Now it times to download some driver for our project. Let\u2019s begin with some settings-&nbsp;<\/p>\n\n\n\n<ul style=\"color:#252525\" class=\"wp-block-list has-text-color has-link-color wp-elements-7\">\n<li>Install the latest version of Arduino : <a href=\"https:\/\/www.arduino.cc\/en\/software\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.arduino.cc\/en\/software\/<\/a><\/li>\n\n\n\n<li>In Arduino: File>Preferences>Setting<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <a href=\"http:\/\/arduino.esp8266.com\/stable\/package_esp8266com_index.json\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/arduino.esp8266.com\/stable\/package_esp8266com_index.json<\/a><\/p>\n\n\n\n<ul style=\"color:#252525\" class=\"wp-block-list has-text-color has-link-color wp-elements-8\">\n<li>In Arduino Install: Tools>Board>  esp8266<\/li>\n\n\n\n<li>In Arduino: Tools>Board>esp8266>Generic ESP8266 Module<\/li>\n\n\n\n<li>In Arduino Install: Library Manager\n<ul class=\"wp-block-list\">\n<li>Adafruit SSD1306<ul><li>Adafruit GFX Library<\/li><\/ul><ul><li>Adafruit BusIO<\/li><\/ul>\n<ul class=\"wp-block-list\">\n<li>Adafruit BME280<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"798\" height=\"487\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BMP280-IC.jpg\" alt=\"\" class=\"wp-image-3735\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BMP280-IC.jpg 798w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BMP280-IC-300x183.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BMP280-IC-768x469.jpg 768w\" sizes=\"(max-width: 798px) 100vw, 798px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"673\" height=\"348\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BMP280-pin.jpg\" alt=\"\" class=\"wp-image-3736\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BMP280-pin.jpg 673w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BMP280-pin-300x155.jpg 300w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-9 wp-block-paragraph\" style=\"color:#5c5c5c\">BME280 can operate in 3 different modes, i.e. sleep mode, normal mode &amp; forced mode. The I\u00b2C slave BMP280 has 7-bit device address of 111011x. The 6 MSB bits are fixed. The last bit is changeable by SDO value and can be changed during operation. Connecting SDO to GND results in slave address 1110110 (0x76); connection it to V<sub>DDIO<\/sub> results in slave address 1110111 (0x77). The Adafruit BME280 library handles all the parameter.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: arduino; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\n#include &lt;Wire.h&gt;\n#include &lt;Adafruit_Sensor.h&gt;\n#include &lt;Adafruit_BME280.h&gt;\n\/\/ Use ESP-01 available pins for I2C\n#define SDA_PIN 0          \/\/ GPIO0 for SDA\n#define SCL_PIN 2          \/\/ GPIO2 for SCL\n\/\/ BME280 sensor\nAdafruit_BME280 bme;\n\/\/ Set I2C to use GPIO0 (SDA) and GPIO2 (SCL)\nWire.begin(SDA_PIN, SCL_PIN);\n\/\/ Init BME280 SDO connected to GND\nif (!bme.begin(0x76)) { \n    display.println(&quot;BME280 error&quot;);\n    display.display();\n    while (1);\n  }\n\/\/ the parameters \nfloat temperature = bme.readTemperature();\nfloat humidity = bme.readHumidity();\nfloat pressure = bme.readPressure() \/ 100.0F;\nfloat altitude = bme.readAltitude(1013.25);\n<\/pre><\/div>\n\n\n<p class=\"has-text-color has-link-color wp-elements-10 wp-block-paragraph\" style=\"color:#5c5c5c\">Since we want to display data in OLED, the controlling of OLED as-<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: arduino; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\n#include &lt;Wire.h&gt;\n#include &lt;Adafruit_GFX.h&gt;\n#include &lt;Adafruit_SSD1306.h&gt;\n\/\/ Use ESP-01 available pins for I2C\n#define SDA_PIN 0          \/\/ GPIO0 for SDA\n#define SCL_PIN 2          \/\/ GPIO2 for SCL\n\/\/ OLED display\n#define SCREEN_WIDTH 128   \/\/ Adjust Width\n#define SCREEN_HEIGHT 64   \/\/ Adjust Height\n#define OLED_RESET -1      \/\/ Since No Reset Pin\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);\n\/\/ Set I2C to use GPIO0 (SDA) and GPIO2 (SCL)\n  Wire.begin(SDA_PIN, SCL_PIN);\n  \/\/ Initialize OLED\n  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {\n    Serial.println(&quot;OLED init failed&quot;);\n    delay(10000);\n    while (1);\n  }\n<\/pre><\/div>\n\n\n<p class=\"has-text-color has-link-color wp-elements-11 wp-block-paragraph\" style=\"color:#5c5c5c\">The final step is to send data to ThingSpeak Cloud. The program for sending data-<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: arduino; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\nconst char* host = &quot;api.thingspeak.com&quot;;      \nconst char* writeAPIKey = &quot;Your_API_Key&quot;; \/\/ provide your Write API Key\nWiFiClient client;\n\/\/ ThingSpeak\n  if (client.connect(host, 80)) {\n    String url = String(&quot;\/update?api_key=&quot;) + writeAPIKey +\n                 &quot;&amp;field1=&quot; + tStr +\n                 &quot;&amp;field2=&quot; + hStr +\n                 &quot;&amp;field3=&quot; + pStr +\n                 &quot;&amp;field4=&quot; + aStr +\n                 &quot;&amp;field5=&quot; + hiStr;\n\n    client.print(String(&quot;GET &quot;) + url + &quot; HTTP\/1.1\\r\\n&quot; +\n                 &quot;Host: &quot; + host + &quot;\\r\\n&quot; +\n                 &quot;Connection: close\\r\\n\\r\\n&quot;);\n\n    Serial.println(&quot;Sent to ThingSpeak&quot;);\n    display.setCursor(0, 56);\n    display.println(&quot;Sent to ThingSpeak&quot;);\n    display.display();\n  } else {\n    Serial.println(&quot;Send failed&quot;);\n    display.setCursor(0, 56);\n    display.println(&quot;Send failed&quot;);\n    display.display();\n  }\n<\/pre><\/div>\n\n\n<p class=\"has-text-color has-link-color wp-elements-12 wp-block-paragraph\" style=\"color:#5c5c5c\">Here we introduce another term Heat Index. The heat index, also known as the apparent temperature, is what the temperature feels like to the human body when relative humidity is combined with the air temperature. This has important considerations for the human body&#8217;s comfort<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img decoding=\"async\" width=\"763\" height=\"683\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/HeatIndex.jpg\" alt=\"\" class=\"wp-image-3747\" style=\"width:373px;height:auto\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/HeatIndex.jpg 763w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/HeatIndex-300x269.jpg 300w\" sizes=\"(max-width: 763px) 100vw, 763px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: arduino; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\nfloat computeHeatIndex(float tempC, float humidity) \n{\n  \/\/ Convert Celsius to Fahrenheit\n  float tempF = tempC * 9.0 \/ 5.0 + 32.0;\n  float hiF = -42.379 + 2.04901523 * tempF + 10.14333127 * humidity\n              - 0.22475541 * tempF * humidity - 0.00683783 * tempF * tempF\n              - 0.05481717 * humidity * humidity + 0.00122874 * tempF * tempF * humidity\n              + 0.00085282 * tempF * humidity * humidity\n              - 0.00000199 * tempF * tempF * humidity * humidity;\n\n  \/\/ Convert back to Celsius\n  return (hiF - 32) * 5.0 \/ 9.0;\n}\n<\/pre><\/div><\/div>\n<\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"951\" height=\"567\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/ESP8266-Project-3.jpg\" alt=\"\" class=\"wp-image-3750\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/ESP8266-Project-3.jpg 951w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/ESP8266-Project-3-300x179.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/ESP8266-Project-3-768x458.jpg 768w\" sizes=\"(max-width: 951px) 100vw, 951px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"ESP01 ThingSpeak Channel: BME280 Sensor Data Update \ud83d\udcf1 OLED Display\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/ejG8Gixp4sQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-3e41869c wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-text-align-left wp-element-button\" href=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BME280_ESP01.rar\" target=\"_blank\" rel=\"noreferrer noopener\">download<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-13 wp-block-paragraph\" style=\"color:#252525\"><a href=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/05\/BME280_ESP01.rar\">BME280_ESP01_ThingSpeak.rar<\/a><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article we interface I2C temperature, humidity &amp; pressure sensor BME280 with esp01. We already interface esp01 with STM32 in AT command mode previously. Since esp01 along can handle I2C device so no need for an external microcontroller. We use OLED display for display sensor data on screen &amp; store value in ThingSpeak Server. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-3731","post","type-post","status-publish","format-standard","hentry","category-esp01esp8266"],"_links":{"self":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/3731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3731"}],"version-history":[{"count":13,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/3731\/revisions"}],"predecessor-version":[{"id":3757,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/3731\/revisions\/3757"}],"wp:attachment":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}