{"id":88781,"date":"2019-09-05T11:20:43","date_gmt":"2019-09-05T11:20:43","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=88781"},"modified":"2023-03-27T10:32:28","modified_gmt":"2023-03-27T10:32:28","slug":"esp32-sim800l-publish-data-to-cloud","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-sim800l-publish-data-to-cloud\/","title":{"rendered":"ESP32 Publish Data to Cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)"},"content":{"rendered":"\n<p>This project shows how to connect the TTGO T-Call ESP32 SIM800L board to the Internet using a SIM card data plan and publish data to the cloud without using Wi-Fi. We&#8217;ll program this board with Arduino IDE.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-TTGO-T-Call-GPS-GPRS-f.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TTGO T-Call ESP32 SIM800L: Publish Data to Cloud without Wi-Fi\" class=\"wp-image-89030\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-TTGO-T-Call-GPS-GPRS-f.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-TTGO-T-Call-GPS-GPRS-f.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-TTGO-T-Call-GPS-GPRS-f.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-TTGO-T-Call-GPS-GPRS-f.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Watch the Video Tutorial<\/h2>\n\n\n\n<p>You can watch the video tutorial or continue reading for the complete project instructions.<\/p>\n\n\n<p style=\"text-align:center\"><iframe width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/aCeVsySh-v4?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introducing the TTGO T-Call ESP32 SIM800L<\/h2>\n\n\n\n<p>The TTGO T-Call is a new ESP32 development board that combines a SIM800L GSM\/GPRS module. <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/ttgo-t-call-esp32-sim800\/\" target=\"_blank\">You can get if for approximately $11<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/SIMCOM-SIM800L-ESP32.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TTGO T-Call ESP32 SIM800L GPS GPRS Board\" class=\"wp-image-88991\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/SIMCOM-SIM800L-ESP32.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/SIMCOM-SIM800L-ESP32.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Besides Wi-Fi and Bluetooth, you can communicate with this ESP32 board using SMS or phone calls and you can connect it to the internet using your SIM card data plan. This is great for IoT projects that don\u2019t have access to a nearby router.<\/p>\n\n\n\n<p class=\"rntbox rntcred\"><strong>Important: <\/strong> the SIM800L works on 2G networks, so it will only work in your country, if 2G networks are available. Check if you have 2G network in your country, otherwise it won\u2019t work. <\/p>\n\n\n\n<p>To use the capabilities of this board you need to have a nano SIM card with data plan and a <a href=\"https:\/\/makeradvisor.com\/tools\/usb-c-data-charging-cable\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"USB-C cable (opens in a new tab)\">USB-C cable<\/a> to upload code to the board.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/USB-C.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 SIM800L Board USB-C cable for charging and data\" class=\"wp-image-88989\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/USB-C.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/USB-C.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>The package includes some header pins, a battery connector, and an external antenna that you should connect to your board. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/TTGO-T-Call-ESP32-Package.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 SIM800L Board Package\" class=\"wp-image-88990\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/TTGO-T-Call-ESP32-Package.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/TTGO-T-Call-ESP32-Package.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>However, we had some issues with that antenna, so we decided to switch to another type of antenna and all the problems were solved. The following figure shows the new antenna.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"420\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800-another-antenna.jpg?resize=750%2C420&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 SIM800L Board alternative antenna\" class=\"wp-image-88992\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800-another-antenna.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800-another-antenna.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Project Overview<\/h2>\n\n\n\n<p>The idea of this project is to publish sensor data from anywhere to any cloud service that you want. The ESP32 doesn\u2019t need to have access to a router via Wi-Fi, because we\u2019ll connect to the internet using a SIM card data plan.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-Publish-Data-to-Cloud-Project-Overview.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"521\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-Publish-Data-to-Cloud-Project-Overview.png?resize=880%2C521&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TTGO T-Call ESP32 SIM800L: Publish Data to Cloud without Wi-Fi diagram\" class=\"wp-image-89037\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-Publish-Data-to-Cloud-Project-Overview.png?w=880&amp;quality=100&amp;strip=all&amp;ssl=1 880w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-Publish-Data-to-Cloud-Project-Overview.png?resize=300%2C178&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-Publish-Data-to-Cloud-Project-Overview.png?resize=768%2C455&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 880px) 100vw, 880px\" \/><\/a><\/figure><\/div>\n\n\n<p><a href=\"https:\/\/randomnerdtutorials.com\/visualize-esp32-esp8266-sensor-readings-from-anywhere\/\">In a previous project<\/a>, we\u2019ve created our own server domain with a database to plot sensor readings in charts that you can access from anywhere in the world. <\/p>\n\n\n\n<p>In this project, we\u2019ll publish sensor readings to that server. You can publish your sensor readings to any other service, like ThingSpeak, IFTTT, etc\u2026<\/p>\n\n\n\n<p>If you want to follow this exact project, you should<a href=\"https:\/\/randomnerdtutorials.com\/visualize-esp32-esp8266-sensor-readings-from-anywhere\/\"> follow that previous tutorial first<\/a> to prepare your own server domain. Then, upload the code provided in this project to your ESP32 board.<\/p>\n\n\n\n<p>In summary, here\u2019s how the project works:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The T-Call ESP32 SIM800L board is in deep sleep mode. <\/li>\n\n\n\n<li>It wakes up and connects to the internet using your SIM card data plan.<\/li>\n\n\n\n<li>It publishes the sensor readings to the server and goes back to sleep. <\/li>\n<\/ol>\n\n\n\n<p>In our example, the sleep time is 60 minutes, but you can easily change it in the code.<\/p>\n\n\n\n<p>We\u2019ll be using a <a href=\"https:\/\/randomnerdtutorials.com\/esp32-bme280-arduino-ide-pressure-temperature-humidity\/\">BME280 senso<\/a>r, but you should be able to use any other sensor that best suits your needs. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Hosting Provider<\/h3>\n\n\n\n<p>If you don&#8217;t have a hosting account, I recommend <a href=\"https:\/\/randomnerdtutorials.com\/bluehost\">signing up for Bluehost<\/a>, because they can handle all the project requirements. If you don\u2019t have a hosting account, I would appreciate if you sign up for Bluehost using my link. Which doesn\u2019t cost you anything extra and helps support our work.<\/p>\n\n\n\n<p style=\"text-align:center\"><a href=\"https:\/\/randomnerdtutorials.com\/bluehost\" target=\"_blank\" class=\"button\" rel=\"noopener noreferrer\">Get Hosting and Domain Name with Bluehost \u00bb<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. ESP32 add-on Arduino IDE<\/h3>\n\n\n\n<p>We&#8217;ll program the ESP32 using Arduino IDE. So, you need to have the ESP32 add-on installed in your Arduino IDE. Follow the next tutorial, if you haven&#8217;t already.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-windows-instructions\/\">Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Preparing your Server Domain<\/h3>\n\n\n\n<p>In this project we&#8217;ll show you how to publish data to any cloud service. We&#8217;ll be using our own server domain with a database to publish all the data, but you can use any other service like ThingSpeak, IFTTT, etc&#8230;<\/p>\n\n\n\n<p>If you want to follow this exact project, you should follow the next tutorial to prepare your own server domain.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/visualize-esp32-esp8266-sensor-readings-from-anywhere\/\">Visualize Your Sensor Readings from Anywhere in the World (ESP32 + MySQL + PHP)<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. SIM Card with data plan<\/h3>\n\n\n\n<p>To use the TTGO T-Call ESP32 SIM800L board, you need a nano SIM card with a data plan. We recommend using a SIM card with a prepaid or monthly plan, so that you know exactly how much you&#8217;ll spend.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. APN Details<\/h3>\n\n\n\n<p>To connect your SIM card to the internet, you need to have your phone plan provider APN details. You need the domain name, username and a password.<\/p>\n\n\n\n<p>In my case, I\u2019m using vodafone Portugal. If you search for <strong>GPRS APN settings<\/strong> followed by your phone plan provider name, (in my case its: \u201c<strong>GPRS APN vodafone Portugal<\/strong>\u201d), you can usually find in a forum or in their website all the information that you need.<\/p>\n\n\n\n<p>I\u2019ve found <a rel=\"noreferrer noopener\" aria-label=\"this website (opens in a new tab)\" href=\"https:\/\/wiki.apnchanger.org\/Main_Page\" target=\"_blank\">this website<\/a> that can be very useful to find all the information you need.<\/p>\n\n\n\n<p>It might be a bit tricky to find the details if you don\u2019t use a well known provider. So, you might need to contact them directly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Libraries<\/h3>\n\n\n\n<p>You need to install these libraries to proceed with this project: <a rel=\"noreferrer noopener\" aria-label=\"Adafruit_BME280 (opens in a new tab)\" href=\"https:\/\/github.com\/adafruit\/Adafruit_BME280_Library\" target=\"_blank\">Adafruit_BME280<\/a>, <a rel=\"noreferrer noopener\" aria-label=\"Adafruit_Sensor (opens in a new tab)\" href=\"https:\/\/github.com\/adafruit\/Adafruit_Sensor\" target=\"_blank\">Adafruit_Sensor<\/a> and <a href=\"https:\/\/github.com\/vshymanskyy\/TinyGSM\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"TinyGSM (opens in a new tab)\">TinyGSM<\/a>. Follow the next instructions to install these libraries.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Installing the Adafruit BME280 Library<\/h4>\n\n\n\n<p>Open your Arduino IDE and go to&nbsp;<strong>Sketch&nbsp;<\/strong>&gt;&nbsp;<strong>Include Library<\/strong>&nbsp;&gt;&nbsp;<strong>Manage Libraries<\/strong>. The Library Manager should open.<\/p>\n\n\n\n<p>Search for \u201c<strong>adafruit bme280<\/strong> \u201d on the Search box and install the library.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"443\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/install-bme280.png?resize=786%2C443&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Installing BME280 library in Arduino IDE\" class=\"wp-image-70233\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/install-bme280.png?w=786&amp;quality=100&amp;strip=all&amp;ssl=1 786w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/install-bme280.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/08\/install-bme280.png?resize=768%2C433&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/figure><\/div>\n\n\n<h4 class=\"wp-block-heading\"> Installing the Adafruit Sensor Library <\/h4>\n\n\n\n<p>To use the BME280 library, you also need to install the <a href=\"https:\/\/github.com\/adafruit\/Adafruit_Sensor\" target=\"_blank\" rel=\"noreferrer noopener\">Adafruit_Sensor library<\/a>. Follow the next steps to install the library in your Arduino IDE:<\/p>\n\n\n\n<p>Go to <strong>Sketch&nbsp;<\/strong>&gt;&nbsp;<strong>Include Library<\/strong>&nbsp;&gt;&nbsp;<strong>Manage Libraries<\/strong> and type \u201c<strong>Adafruit Unified Sensor<\/strong>\u201d in the search box. Scroll all the way down to find the library and install it.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/04\/adafruit_unified_sensor_library.png?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Installing Adafruit Unified Sensor Driver library\" class=\"wp-image-84295\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/04\/adafruit_unified_sensor_library.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/04\/adafruit_unified_sensor_library.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h4 class=\"wp-block-heading\">Installing the TinyGSM Library <\/h4>\n\n\n\n<p>In the Arduino IDE Library Manager search for <strong>TinyGSM<\/strong>. Select the TinyGSM library by Volodymyr Shymanskyy.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"443\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/Install-TinyGSM-Library-Arduino-IDE.png?resize=786%2C443&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Installing TinyGSM library\" class=\"wp-image-88782\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/Install-TinyGSM-Library-Arduino-IDE.png?w=786&amp;quality=100&amp;strip=all&amp;ssl=1 786w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/Install-TinyGSM-Library-Arduino-IDE.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/Install-TinyGSM-Library-Arduino-IDE.png?resize=768%2C433&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/figure><\/div>\n\n\n<p>After installing the libraries, restart your Arduino IDE. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts Required<\/h2>\n\n\n\n<p>To build this project, you need the following parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/ttgo-t-call-esp32-sim800\/\" target=\"_blank\"><strong>TTGO T-Call ESP32 SIM800L<\/strong><\/a><\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" aria-label=\"USB-C cable\u2028 (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/usb-c-data-charging-cable\/\" target=\"_blank\">USB-C cable<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/rover.ebay.com\/rover\/1\/711-53200-19255-0\/1?ff3=2&amp;toolid=10044&amp;campid=5338179998&amp;customid=MakerAdvisorT&amp;lgeo=1&amp;vectorid=229466&amp;item=311649924872\" target=\"_blank\" rel=\"noreferrer noopener nofollow\" aria-label=\"Antenna  (opens in a new tab)\">Antenna <\/a>(optional)<\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/bme280-sensor-module\/\" target=\"_blank\">BME280 sensor module<\/a> (<a href=\"https:\/\/randomnerdtutorials.com\/esp32-bme280-arduino-ide-pressure-temperature-humidity\/\">Guide for BME280 with ESP32<\/a>) <\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" aria-label=\"Breadboard (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\">Breadboard<\/a><\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" aria-label=\"Jumper wires (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\">Jumper wires<\/a><\/li>\n<\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Schematic Diagram<\/h2>\n\n\n\n<p>Wire the BME280 to the T-Call ESP32 SIM800L board as shown in the following schematic diagram.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"841\" height=\"654\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/T-Call-ESP32-SIM800-with-BME280-schematic-diagram.jpg?resize=841%2C654&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TTGO T-Call ESP32 SIM800L with BME280 schematic diagram\" class=\"wp-image-88790\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/T-Call-ESP32-SIM800-with-BME280-schematic-diagram.jpg?w=841&amp;quality=100&amp;strip=all&amp;ssl=1 841w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/T-Call-ESP32-SIM800-with-BME280-schematic-diagram.jpg?resize=300%2C233&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/T-Call-ESP32-SIM800-with-BME280-schematic-diagram.jpg?resize=768%2C597&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 841px) 100vw, 841px\" \/><\/figure><\/div>\n\n\n<p>We&#8217;re connecting the SDA pin to <span class=\"rnthl rntclblue\">GPIO 18<\/span> and the SCL pin to <span class=\"rnthl rntclgreen\">GPIO 19<\/span>. We\u2019re not using the default I2C GPIOs because they are being used by the battery power management IC of the T-Call ESP32 SIM800L board.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Code<\/h2>\n\n\n\n<p>Copy the following code to your Arduino IDE but don&#8217;t upload it yet. First, you need to make some modifications to make it work.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\n  Rui Santos\n  Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-sim800l-publish-data-to-cloud\/\n  \n  Permission is hereby granted, free of charge, to any person obtaining a copy\n  of this software and associated documentation files.\n  \n  The above copyright notice and this permission notice shall be included in all\n  copies or substantial portions of the Software.\n*\/\n\n\/\/ Your GPRS credentials (leave empty, if not needed)\nconst char apn[]      = &quot;&quot;; \/\/ APN (example: internet.vodafone.pt) use https:\/\/wiki.apnchanger.org\nconst char gprsUser[] = &quot;&quot;; \/\/ GPRS User\nconst char gprsPass[] = &quot;&quot;; \/\/ GPRS Password\n\n\/\/ SIM card PIN (leave empty, if not defined)\nconst char simPIN[]   = &quot;&quot;; \n\n\/\/ Server details\n\/\/ The server variable can be just a domain name or it can have a subdomain. It depends on the service you are using\nconst char server[] = &quot;example.com&quot;; \/\/ domain name: example.com, maker.ifttt.com, etc\nconst char resource[] = &quot;\/post-data.php&quot;;         \/\/ resource path, for example: \/post-data.php\nconst int  port = 80;                             \/\/ server port number\n\n\/\/ Keep this API Key value to be compatible with the PHP code provided in the project page. \n\/\/ If you change the apiKeyValue value, the PHP file \/post-data.php also needs to have the same key \nString apiKeyValue = &quot;tPmAT5Ab3j7F9&quot;;\n\n\/\/ TTGO T-Call pins\n#define MODEM_RST            5\n#define MODEM_PWKEY          4\n#define MODEM_POWER_ON       23\n#define MODEM_TX             27\n#define MODEM_RX             26\n#define I2C_SDA              21\n#define I2C_SCL              22\n\/\/ BME280 pins\n#define I2C_SDA_2            18\n#define I2C_SCL_2            19\n\n\/\/ Set serial for debug console (to Serial Monitor, default speed 115200)\n#define SerialMon Serial\n\/\/ Set serial for AT commands (to SIM800 module)\n#define SerialAT Serial1\n\n\/\/ Configure TinyGSM library\n#define TINY_GSM_MODEM_SIM800      \/\/ Modem is SIM800\n#define TINY_GSM_RX_BUFFER   1024  \/\/ Set RX buffer to 1Kb\n\n\/\/ Define the serial console for debug prints, if needed\n\/\/#define DUMP_AT_COMMANDS\n\n#include &lt;Wire.h&gt;\n#include &lt;TinyGsmClient.h&gt;\n\n#ifdef DUMP_AT_COMMANDS\n  #include &lt;StreamDebugger.h&gt;\n  StreamDebugger debugger(SerialAT, SerialMon);\n  TinyGsm modem(debugger);\n#else\n  TinyGsm modem(SerialAT);\n#endif\n\n#include &lt;Adafruit_Sensor.h&gt;\n#include &lt;Adafruit_BME280.h&gt;\n\n\/\/ I2C for SIM800 (to keep it running when powered from battery)\nTwoWire I2CPower = TwoWire(0);\n\n\/\/ I2C for BME280 sensor\nTwoWire I2CBME = TwoWire(1);\nAdafruit_BME280 bme; \n\n\/\/ TinyGSM Client for Internet connection\nTinyGsmClient client(modem);\n\n#define uS_TO_S_FACTOR 1000000UL   \/* Conversion factor for micro seconds to seconds *\/\n#define TIME_TO_SLEEP  3600        \/* Time ESP32 will go to sleep (in seconds) 3600 seconds = 1 hour *\/\n\n#define IP5306_ADDR          0x75\n#define IP5306_REG_SYS_CTL0  0x00\n\nbool setPowerBoostKeepOn(int en){\n  I2CPower.beginTransmission(IP5306_ADDR);\n  I2CPower.write(IP5306_REG_SYS_CTL0);\n  if (en) {\n    I2CPower.write(0x37); \/\/ Set bit1: 1 enable 0 disable boost keep on\n  } else {\n    I2CPower.write(0x35); \/\/ 0x37 is default reg value\n  }\n  return I2CPower.endTransmission() == 0;\n}\n\nvoid setup() {\n  \/\/ Set serial monitor debugging window baud rate to 115200\n  SerialMon.begin(115200);\n\n  \/\/ Start I2C communication\n  I2CPower.begin(I2C_SDA, I2C_SCL, 400000);\n  I2CBME.begin(I2C_SDA_2, I2C_SCL_2, 400000);\n\n  \/\/ Keep power when running from battery\n  bool isOk = setPowerBoostKeepOn(1);\n  SerialMon.println(String(&quot;IP5306 KeepOn &quot;) + (isOk ? &quot;OK&quot; : &quot;FAIL&quot;));\n\n  \/\/ Set modem reset, enable, power pins\n  pinMode(MODEM_PWKEY, OUTPUT);\n  pinMode(MODEM_RST, OUTPUT);\n  pinMode(MODEM_POWER_ON, OUTPUT);\n  digitalWrite(MODEM_PWKEY, LOW);\n  digitalWrite(MODEM_RST, HIGH);\n  digitalWrite(MODEM_POWER_ON, HIGH);\n\n  \/\/ Set GSM module baud rate and UART pins\n  SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);\n  delay(3000);\n\n  \/\/ Restart SIM800 module, it takes quite some time\n  \/\/ To skip it, call init() instead of restart()\n  SerialMon.println(&quot;Initializing modem...&quot;);\n  modem.restart();\n  \/\/ use modem.init() if you don't need the complete restart\n\n  \/\/ Unlock your SIM card with a PIN if needed\n  if (strlen(simPIN) &amp;&amp; modem.getSimStatus() != 3 ) {\n    modem.simUnlock(simPIN);\n  }\n  \n  \/\/ You might need to change the BME280 I2C address, in our case it's 0x76\n  if (!bme.begin(0x76, &amp;I2CBME)) {\n    Serial.println(&quot;Could not find a valid BME280 sensor, check wiring!&quot;);\n    while (1);\n  }\n\n  \/\/ Configure the wake up source as timer wake up  \n  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);\n}\n\nvoid loop() {\n  SerialMon.print(&quot;Connecting to APN: &quot;);\n  SerialMon.print(apn);\n  if (!modem.gprsConnect(apn, gprsUser, gprsPass)) {\n    SerialMon.println(&quot; fail&quot;);\n  }\n  else {\n    SerialMon.println(&quot; OK&quot;);\n    \n    SerialMon.print(&quot;Connecting to &quot;);\n    SerialMon.print(server);\n    if (!client.connect(server, port)) {\n      SerialMon.println(&quot; fail&quot;);\n    }\n    else {\n      SerialMon.println(&quot; OK&quot;);\n    \n      \/\/ Making an HTTP POST request\n      SerialMon.println(&quot;Performing HTTP POST request...&quot;);\n      \/\/ Prepare your HTTP POST request data (Temperature in Celsius degrees)\n      String httpRequestData = &quot;api_key=&quot; + apiKeyValue + &quot;&amp;value1=&quot; + String(bme.readTemperature())\n                             + &quot;&amp;value2=&quot; + String(bme.readHumidity()) + &quot;&amp;value3=&quot; + String(bme.readPressure()\/100.0F) + &quot;&quot;;\n      \/\/ Prepare your HTTP POST request data (Temperature in Fahrenheit degrees)\n      \/\/String httpRequestData = &quot;api_key=&quot; + apiKeyValue + &quot;&amp;value1=&quot; + String(1.8 * bme.readTemperature() + 32)\n      \/\/                       + &quot;&amp;value2=&quot; + String(bme.readHumidity()) + &quot;&amp;value3=&quot; + String(bme.readPressure()\/100.0F) + &quot;&quot;;\n          \n      \/\/ You can comment the httpRequestData variable above\n      \/\/ then, use the httpRequestData variable below (for testing purposes without the BME280 sensor)\n      \/\/String httpRequestData = &quot;api_key=tPmAT5Ab3j7F9&amp;value1=24.75&amp;value2=49.54&amp;value3=1005.14&quot;;\n    \n      client.print(String(&quot;POST &quot;) + resource + &quot; HTTP\/1.1\\r\\n&quot;);\n      client.print(String(&quot;Host: &quot;) + server + &quot;\\r\\n&quot;);\n      client.println(&quot;Connection: close&quot;);\n      client.println(&quot;Content-Type: application\/x-www-form-urlencoded&quot;);\n      client.print(&quot;Content-Length: &quot;);\n      client.println(httpRequestData.length());\n      client.println();\n      client.println(httpRequestData);\n\n      unsigned long timeout = millis();\n      while (client.connected() &amp;&amp; millis() - timeout &lt; 10000L) {\n        \/\/ Print available data (HTTP response from server)\n        while (client.available()) {\n          char c = client.read();\n          SerialMon.print(c);\n          timeout = millis();\n        }\n      }\n      SerialMon.println();\n    \n      \/\/ Close client and disconnect\n      client.stop();\n      SerialMon.println(F(&quot;Server disconnected&quot;));\n      modem.gprsDisconnect();\n      SerialMon.println(F(&quot;GPRS disconnected&quot;));\n    }\n  }\n  \/\/ Put ESP32 into deep sleep mode (with timer wake up)\n  esp_deep_sleep_start();\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP32\/ESP32_SIM800L_Data_to_Cloud.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>Before uploading the code, you need to insert your APN details, SIM card PIN (if applicable) and your server domain.<\/p>\n\n\n\n<p class=\"rntbox rntcred\"><strong>Important: <\/strong> Most hosting services require you to make HTTPS requests. This code<strong> is not compatible with HTTPS.<\/strong> So, to make it work, you need to disable the HTTPS on your server or enable both HTTP and HTTPS(contact your hosting provider). Even though this board supports HTTPS requests, we couldn&#8217;t make it work. Nonetheless, you can try out this example sketch and see if it works for your board to make HTTPS requests: <a href=\"https:\/\/github.com\/vshymanskyy\/TinyGSM\/blob\/master\/examples\/HttpsClient\/HttpsClient.ino\" target=\"_blank\" rel=\"noopener\" title=\"\">SIM800L HTTPS Client<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How the Code Works<\/h2>\n\n\n\n<p>Insert your GPRS APN credentials in the following variables:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const char apn&#091;]      = \"\"; \/\/ APN (example: internet.vodafone.pt) use https:\/\/wiki.apnchanger.org\nconst char gprsUser&#091;] = \"\"; \/\/ GPRS User\nconst char gprsPass&#091;] = \"\"; \/\/ GPRS Password<\/code><\/pre>\n\n\n\n<p>In our case, the APN is <span class=\"rnthl rntliteral\">internet.vodafone.pt<\/span>. Yours should be different. We&#8217;ve explained previous in this tutorial how to get your APN details. <\/p>\n\n\n\n<p>Enter your SIM card PIN if applicable:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const char simPIN&#091;] = \"\"; <\/code><\/pre>\n\n\n\n<p>You also need to type the server details in the following variables. It can be your own server domain or any other server that you want to publish data to.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const char server&#091;] = \"example.com\"; \/\/ domain name: example.com, maker.ifttt.com, etc\nconst char resource&#091;] = \"\/post-data.php\";   \/\/ resource path, for example: \/post-data.php\nconst int port = 80;                        \/\/ server port number<\/code><\/pre>\n\n\n\n<p>If you&#8217;re using your own server domain as we&#8217;re doing in this tutorial, you also need an API key. In this case, the <span class=\"rnthl rntliteral\">apiKeyValue<\/span> is just a random string that you can modify. It\u2019s used for security reasons, so only anyone that knows your API key can publish data to your database.<\/p>\n\n\n\n<p>The code is heavily commented so that you understand the purpose of each line of code.<\/p>\n\n\n\n<p>The following lines define the pins used by the SIM800L module:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define MODEM_RST            5\n#define MODEM_PWKEY          4\n#define MODEM_POWER_ON       23\n#define MODEM_TX             27\n#define MODEM_RX             26\n#define I2C_SDA              21\n#define I2C_SCL              22<\/code><\/pre>\n\n\n\n<p>Define the BME280 I2C pins. In this example we&#8217;re not using the default pins because they are already being used by the battery power management IC of the T-Call ESP32 SIM800L board. So, we&#8217;re using <span class=\"rnthl rntclblue\">GPIO 18<\/span> and <span class=\"rnthl rntclgreen\">GPIO 19<\/span>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define I2C_SDA_2            18\n#define I2C_SCL_2            19<\/code><\/pre>\n\n\n\n<p>Define a serial communication for the Serial Monitor and another to communicate with the SIM800L module:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Set serial for debug console (to Serial Monitor, default speed 115200)\n#define SerialMon Serial\n\/\/ Set serial for AT commands (to SIM800 module)\n#define SerialAT Serial1<\/code><\/pre>\n\n\n\n<p>Configure the <span class=\"rnthl rntliteral\">TinyGSM<\/span> library to work with the SIM800L module.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Configure TinyGSM library\n#define TINY_GSM_MODEM_SIM800      \/\/ Modem is SIM800\n#define TINY_GSM_RX_BUFFER 1024    \/\/ Set RX buffer to 1Kb<\/code><\/pre>\n\n\n\n<p>Include the following libraries to communicate with the SIM800L.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#include &lt;Wire.h&gt;\n#include &lt;TinyGsmClient.h&gt;<\/code><\/pre>\n\n\n\n<p>And these libraries to use the BME280 sensor:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#include &lt;Adafruit_Sensor.h&gt;\n#include &lt;Adafruit_BME280.h&gt;<\/code><\/pre>\n\n\n\n<p>Instantiate an I2C communication for the SIM800L.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>TwoWire I2CPower = TwoWire(0);<\/code><\/pre>\n\n\n\n<p>And another I2C communication for the BME280 sensor.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>TwoWire I2CBME = TwoWire(1);\nAdafruit_BME280 bme; <\/code><\/pre>\n\n\n\n<p>Initialize a <span class=\"rnthl rntliteral\">TinyGSMClient<\/span> for internet connection.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>TinyGsmClient client(modem);<\/code><\/pre>\n\n\n\n<p>Define the deep sleep time in the <span class=\"rnthl rntliteral\">TIME_TO_SLEEP<\/span> variable in seconds.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define uS_TO_S_FACTOR 1000000     \/* Conversion factor for micro seconds to seconds *\/\n#define TIME_TO_SLEEP  3600        \/* Time ESP32 will go to sleep (in seconds) 3600 seconds = 1 hour *\/<\/code><\/pre>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">setup()<\/span>, initialize the Serial Monitor at a baud rate of 115200:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>SerialMon.begin(115200);<\/code><\/pre>\n\n\n\n<p>Start the I2C communication for the SIM800L module and for the BME280 sensor module:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>I2CPower.begin(I2C_SDA, I2C_SCL, 400000);\nI2CBME.begin(I2C_SDA_2, I2C_SCL_2, 400000);<\/code><\/pre>\n\n\n\n<p>Setup the SIM800L pins in a proper state to operate:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>pinMode(MODEM_PWKEY, OUTPUT);\npinMode(MODEM_RST, OUTPUT);\npinMode(MODEM_POWER_ON, OUTPUT);\ndigitalWrite(MODEM_PWKEY, LOW);\ndigitalWrite(MODEM_RST, HIGH);\ndigitalWrite(MODEM_POWER_ON, HIGH);<\/code><\/pre>\n\n\n\n<p>Initialize a serial communication with the SIM800L module<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);<\/code><\/pre>\n\n\n\n<p>Initialize the SIM800L module and unlock the SIM card PIN if needed<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>SerialMon.println(\"Initializing modem...\");\nmodem.restart();\n\/\/ use modem.init() if you don't need the complete restart\n\n\/\/ Unlock your SIM card with a PIN if needed\nif (strlen(simPIN) &amp;&amp; modem.getSimStatus() != 3 ) {\n  modem.simUnlock(simPIN);\n}<\/code><\/pre>\n\n\n\n<p>Initialize the BME280 sensor module:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (!bme.begin(0x76, &amp;I2CBME)) {\n  Serial.println(\"Could not find a valid BME280 sensor, check wiring!\");\n  while (1);\n}<\/code><\/pre>\n\n\n\n<p>Configure deep sleep as a wake up source:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);<\/code><\/pre>\n\n\n\n<p><strong>Recommended reading:<\/strong> <a rel=\"noreferrer noopener\" aria-label=\"ESP32 Deep Sleep and Wake Up sources (opens in a new tab)\" href=\"https:\/\/randomnerdtutorials.com\/esp32-deep-sleep-arduino-ide-wake-up-sources\/\" target=\"_blank\">ESP32 Deep Sleep and Wake Up Sources<\/a><\/p>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span> is where we&#8217;ll actually connect to the internet and make the HTTP POST request to publish sensor data. Because the ESP32 will go into deep sleep mode at the end of the <span class=\"rnthl rntliteral\">loop()<\/span>, it will only run once.<\/p>\n\n\n\n<p>The following lines connect the module to the internet:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>SerialMon.print(\"Connecting to APN: \");\nSerialMon.print(apn);\nif (!modem.gprsConnect(apn, gprsUser, gprsPass)) {\n  SerialMon.println(\" fail\");\n}\nelse {\n  SerialMon.println(\" OK\");\n   \n  SerialMon.print(\"Connecting to \");\n  SerialMon.print(server);\n  if (!client.connect(server, port)) {\n    SerialMon.println(\" fail\");\n  }\n  else {\n    SerialMon.println(\" OK\");<\/code><\/pre>\n\n\n\n<p>Prepare the message data to be sent by HTTP POST Request<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>String httpRequestData = \"api_key=\" + apiKeyValue + \"&amp;value1=\" + String(bme.readTemperature())\n+ \"&amp;value2=\" + String(bme.readHumidity()) + \"&amp;value3=\" + String(bme.readPressure()\/100.0F) + \"\";<\/code><\/pre>\n\n\n\n<p>Basically, we create a string with the API key value and all the sensor readings. You should modify this string depending on the data you want to send. <\/p>\n\n\n\n<p>The following lines make the POST request.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>client.print(String(\"POST \") + resource + \" HTTP\/1.1\\r\\n\");\nclient.print(String(\"Host: \") + server + \"\\r\\n\");\nclient.println(\"Connection: close\");\nclient.println(\"Content-Type: application\/x-www-form-urlencoded\");\nclient.print(\"Content-Length: \");\nclient.println(httpRequestData.length());\nclient.println();\nclient.println(httpRequestData);\n\nunsigned long timeout = millis();\nwhile (client.connected() &amp;&amp; millis() - timeout &lt; 10000L) {\n  \/\/ Print available data (HTTP response from server)\n  while (client.available()) {\n    char c = client.read();\n    SerialMon.print(c);\n    timeout = millis();\n  }\n}<\/code><\/pre>\n\n\n\n<p>Finally, close the connection, and disconnect from the internet.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>client.stop();\nSerialMon.println(F(\"Server disconnected\"));\nmodem.gprsDisconnect();\nSerialMon.println(F(\"GPRS disconnected\"));<\/code><\/pre>\n\n\n\n<p>In the end, put the ESP32 in deep sleep mode.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>esp_deep_sleep_start();<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Upload the Code<\/h2>\n\n\n\n<p>After inserting all the necessary details, you can upload the code to your board.<\/p>\n\n\n\n<p>To upload code to your board, go to <strong>Tools <\/strong>&gt; <strong>Board <\/strong>and select <strong>ESP32 Dev module<\/strong>. Go to <strong>Tools<\/strong> &gt; <strong>Port<\/strong> and select the COM port your board is connected to. Finally, press the upload button to upload the code to your board.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"34\" height=\"29\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2016\/12\/arduino-ide-upload-button.png?resize=34%2C29&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Upload Code to Arduino IDE\" class=\"wp-image-65439\"\/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclblue\"><strong>Note: <\/strong> at the moment, there isn&#8217;t a board for the T-Call ESP32 SIM800L, but we&#8217;ve selected the ESP32 Dev Module and it&#8217;s been working fine.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>Open the Serial Monitor at baud rate of 115200 and press the board RST button. <\/p>\n\n\n\n<p>First, the module initializes and then it tries to connect to the internet. Please note that this can take some time (in some cases it took almost 1 minute to complete the request). <\/p>\n\n\n\n<p>After connecting to the internet, it will connect to your server to make the HTTP POST request.<\/p>\n\n\n\n<p>Finally, it disconnects from the server, disconnects the internet and goes to sleep.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"488\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/Serial-Monitor-Publish-REadings-Internet.png?resize=750%2C488&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 SIM800L connect to the internet using SIM card data plan demonstration\" class=\"wp-image-88997\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/Serial-Monitor-Publish-REadings-Internet.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/Serial-Monitor-Publish-REadings-Internet.png?resize=300%2C195&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>In this example, it publishes new sensor readings every 60 minutes, but for testing purposes you can use a shorter delay. <\/p>\n\n\n\n<p>Then, open a browser and type your server domain on the <strong>\/esp-chart.php<\/strong> URL. You should see the charts with the latest sensor readings.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"1012\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-CHARTS-SIM800-demonstration.png?resize=1200%2C1012&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"TTGO T-Call ESP32 SIM800L: Publish Data to Cloud without Wi-Fi BME280 charts demonstration\" class=\"wp-image-88998\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-CHARTS-SIM800-demonstration.png?w=1233&amp;quality=100&amp;strip=all&amp;ssl=1 1233w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-CHARTS-SIM800-demonstration.png?resize=300%2C253&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-CHARTS-SIM800-demonstration.png?resize=768%2C648&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-CHARTS-SIM800-demonstration.png?resize=1024%2C864&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p>If at this point, you can\u2019t make your module connect to the internet, it can be caused by one of the following reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The APN credentials might not be correct;<\/li>\n\n\n\n<li>The antenna might not be working properly. In our case, we had to replace the antenna;<\/li>\n\n\n\n<li>You might need to go outside to get a better signal coverage;<\/li>\n\n\n\n<li>Or you might not be supplying enough current to the module. If you\u2019re connecting the module to your computer using a USB hub without external power supply, it might not provide enough current to operate.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you liked this project. In our opinion, the <a rel=\"noreferrer noopener\" aria-label=\"T-Call SIM800 ESP32 board (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/ttgo-t-call-esp32-sim800\/\" target=\"_blank\">T-Call SIM800 ESP32 board<\/a> can be very useful for IoT projects that don\u2019t have access to a nearby router via Wi-Fi. You can connect your board to the internet quite easily using a SIM card data plan.<\/p>\n\n\n\n<p>We\u2019ll be publishing more projects about this board soon (like sending SMS notifications, request data via SMS, etc.) so, stay tuned!<\/p>\n\n\n\n<p>You may also like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/makeradvisor.com\/ttgo-t-call-esp32-with-sim800l-gsm-gprs\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">$11 TTGO T-Call ESP32 with SIM800L GSM\/GPRS (in-depth review)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-mysql-database-php\/\">ESP32\/ESP8266 Insert Data into MySQL Database using PHP and Arduino IDE<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-plot-chart-web-server\/\">ESP32\/ESP8266 Plot Sensor Readings in Real Time Charts \u2013 Web Server<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-web-server-with-bme280-mini-weather-station\/\">ESP32 Web Server with BME280 \u2013 Advanced Weather Station<\/a><\/li>\n<\/ul>\n\n\n\n<p>Learn more about the ESP32 with our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">Learn ESP32 with Arduino IDE (Course)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\">MicroPython Programming with ESP32 and ESP8266 (eBook)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32\/\">More ESP32 Projects and Tutorials<\/a><\/li>\n<\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This project shows how to connect the TTGO T-Call ESP32 SIM800L board to the Internet using a SIM card data plan and publish data to the cloud without using Wi-Fi. &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32 Publish Data to Cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-sim800l-publish-data-to-cloud\/#more-88781\" aria-label=\"Read more about ESP32 Publish Data to Cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":89030,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[276,281,277,299,264,1],"tags":[],"class_list":["post-88781","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-esp32-project","category-esp32-arduino-ide","category-0-esp32","category-project","category-uncategorized"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/09\/ESP32-SIM800L-TTGO-T-Call-GPS-GPRS-f.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/88781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=88781"}],"version-history":[{"count":5,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/88781\/revisions"}],"predecessor-version":[{"id":129711,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/88781\/revisions\/129711"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/89030"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=88781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=88781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=88781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}