how to upload data to thinkspeak using esp8266 and arduino uno
This project shows how to connect the TTGO T-Telephone call ESP32 SIM800L board to the Cyberspace using a SIM card data program and publish data to the cloud without using Wi-Fi. Nosotros'll plan this board with Arduino IDE.
Watch the Video Tutorial
You tin can watch the video tutorial or continue reading for the complete project instructions.
Introducing the TTGO T-Telephone call ESP32 SIM800L
The TTGO T-Phone call is a new ESP32 evolution lath that combines a SIM800L GSM/GPRS module. You lot tin can get if for approximately $11.
Besides Wi-Fi and Bluetooth, yous can communicate with this ESP32 lath using SMS or telephone calls and you lot tin connect it to the internet using your SIM card data plan. This is great for IoT projects that don't take access to a nearby router.
Important: the SIM800L works on 2G networks, so it will simply work in your country, if 2G networks are available. Check if yous have 2G network in your land, otherwise it won't piece of work.
To utilize the capabilities of this board you need to have a nano SIM card with data programme and a USB-C cable to upload code to the board.
The package includes some header pins, a battery connector, and an external antenna that you should connect to your board.
However, we had some issues with that antenna, and so we decided to switch to another type of antenna and all the problems were solved. The following effigy shows the new antenna.
Project Overview
The idea of this project is to publish sensor data from anywhere to whatever cloud service that you want. The ESP32 doesn't need to have admission to a router via Wi-Fi, because we'll connect to the cyberspace using a SIM carte du jour information program.
In a previous projection, we've created our own server domain with a database to plot sensor readings in charts that you can admission from anywhere in the world.
In this project, we'll publish sensor readings to that server. You lot tin publish your sensor readings to any other service, like ThingSpeak, IFTTT, etc…
If you want to follow this exact project, you should follow that previous tutorial first to prepare your ain server domain. Then, upload the code provided in this project to your ESP32 board.
In summary, here's how the project works:
- The T-Call ESP32 SIM800L lath is in deep sleep fashion.
- It wakes up and connects to the net using your SIM card data plan.
- It publishes the sensor readings to the server and goes back to sleep.
In our instance, the sleep time is lx minutes, but y'all tin can easily modify it in the code.
We'll be using a BME280 sensor, but you should be able to apply any other sensor that best suits your needs.
Hosting Provider
If you don't accept a hosting account, I recommend signing up for Bluehost, considering they can handle all the project requirements. If yous don't take a hosting account, I would appreciate if you sign upwards for Bluehost using my link. Which doesn't cost you anything extra and helps support our piece of work.
Get Hosting and Domain Proper noun with Bluehost »
Prerequisites
1. ESP32 add-on Arduino IDE
We'll program the ESP32 using Arduino IDE. So, you need to accept the ESP32 improver installed in your Arduino IDE. Follow the next tutorial, if you oasis't already.
- Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)
2. Preparing your Server Domain
In this projection we'll show you how to publish information to whatsoever cloud service. We'll be using our own server domain with a database to publish all the information, but you can use any other service like ThingSpeak, IFTTT, etc…
If you want to follow this exact project, you should follow the adjacent tutorial to prepare your own server domain.
- Visualize Your Sensor Readings from Anywhere in the World (ESP32 + MySQL + PHP)
3. SIM Card with data plan
To employ the TTGO T-Phone call ESP32 SIM800L lath, you need a nano SIM card with a data program. We recommend using a SIM menu with a prepaid or monthly programme, then that you know exactly how much you'll spend.
4. APN Details
To connect your SIM carte du jour to the internet, yous need to have your telephone plan provider APN details. Yous need the domain name, username and a password.
In my case, I'yard using vodafone Portugal. If you search for GPRS APN settings followed by your phone program provider name, (in my case its: "GPRS APN vodafone Portugal"), you can usually find in a forum or in their website all the information that you demand.
I've establish this website that tin can be very useful to find all the information y'all need.
It might be a scrap tricky to find the details if y'all don't apply a well known provider. So, you might need to contact them straight.
5. Libraries
You lot need to install these libraries to proceed with this project: Adafruit_BME280, Adafruit_Sensor and TinyGSM. Follow the adjacent instructions to install these libraries.
Installing the Adafruit BME280 Library
Open your Arduino IDE and go toSketch>Include Library >Manage Libraries. The Library Director should open up.
Search for "adafruit bme280 " on the Search box and install the library.
Installing the Adafruit Sensor Library
To utilise the BME280 library, you too need to install the Adafruit_Sensor library. Follow the next steps to install the library in your Arduino IDE:
Go to Sketch>Include Library >Manage Libraries and type "Adafruit Unified Sensor" in the search box. Scroll all the way down to notice the library and install it.
Installing the TinyGSM Library
In the Arduino IDE Library Manager search for TinyGSM. Select the TinyGSM library by Volodymyr Shymanskyy.
Afterwards installing the libraries, restart your Arduino IDE.
Parts Required
To build this project, you demand the following parts:
- TTGO T-Call ESP32 SIM800L
- USB-C cablevision
- Antenna (optional)
- BME280 sensor module (Guide for BME280 with ESP32)
- Breadboard
- Jumper wires
You lot tin use the preceding links or go directly to MakerAdvisor.com/tools to discover all the parts for your projects at the best price!
Schematic Diagram
Wire the BME280 to the T-Call ESP32 SIM800L board equally shown in the following schematic diagram.
We're connecting the SDA pivot to GPIO eighteen and the SCL pivot to GPIO 19. We're not using the default I2C GPIOs because they are beingness used past the battery power management IC of the T-Telephone call ESP32 SIM800L lath.
Code
Re-create the following lawmaking to your Arduino IDE but don't upload it withal. First, you demand to make some modifications to make it work.
/* Rui Santos Complete projection details at https://RandomNerdTutorials.com/esp32-sim800l-publish-data-to-deject/ Permission is hereby granted, costless of charge, to any person obtaining a copy of this software and associated documentation files. The above copyright discover and this permission discover shall be included in all copies or substantial portions of the Software. */ // Your GPRS credentials (go out empty, if non needed) const char apn[] = ""; // APN (example: internet.vodafone.pt) use https://wiki.apnchanger.org const char gprsUser[] = ""; // GPRS User const char gprsPass[] = ""; // GPRS Password // SIM card Pin (leave empty, if not defined) const char simPIN[] = ""; // Server details // The server variable tin can exist just a domain name or it can accept a subdomain. Information technology depends on the service you are using const char server[] = "example.com"; // domain name: instance.com, maker.ifttt.com, etc const char resource[] = "/post-data.php"; // resources path, for example: /post-data.php const int port = 80; // server port number // Proceed this API Central value to exist compatible with the PHP code provided in the projection page. // If you alter the apiKeyValue value, the PHP file /post-data.php as well needs to have the same key String apiKeyValue = "tPmAT5Ab3j7F9"; // TTGO T-Call pins #define MODEM_RST five #ascertain MODEM_PWKEY iv #define MODEM_POWER_ON 23 #define MODEM_TX 27 #define MODEM_RX 26 #define I2C_SDA 21 #define I2C_SCL 22 // BME280 pins #ascertain I2C_SDA_2 xviii #define I2C_SCL_2 19 // Set up series for debug panel (to Serial Monitor, default speed 115200) #define SerialMon Serial // Set up serial for AT commands (to SIM800 module) #define SerialAT Serial1 // Configure TinyGSM library #define TINY_GSM_MODEM_SIM800 // Modem is SIM800 #ascertain TINY_GSM_RX_BUFFER 1024 // Fix RX buffer to 1Kb // Define the serial console for debug prints, if needed //#ascertain DUMP_AT_COMMANDS #include <Wire.h> #include <TinyGsmClient.h> #ifdef DUMP_AT_COMMANDS #include <StreamDebugger.h> StreamDebugger debugger(SerialAT, SerialMon); TinyGsm modem(debugger); #else TinyGsm modem(SerialAT);
0 Response to "how to upload data to thinkspeak using esp8266 and arduino uno"
Post a Comment