UPLOAD DATA USING ESP8266-01 - Mangihin.com
Skip to content


Thank you for visiting our blog, hopefully what we provide can be useful for all of you. This time we will share how to upload measurement data using the help of the ESP8266-01 module? Surely many of you have tried or even just started playing in the world of microcontrollers and IoT. But you have followed various programs through the help of other people’s YouTube videos but it doesn’t work? If it’s true what we mean, I hope you get the answer here.
Internet of Things (IoT) is currently starting to trend in Indonesia, because this IoT technology provides convenience in providing information or other needs. IoT technology in Indonesia itself is very much, but the need for new ideas that can be developed for you lovers of microcontrollers or the coolest is usually called Arduino.
In our opinion, the presence of IoT makes it very easy to access measurement data for a tool with the help of a microcontroller that can be accessed through the website thingspeak.com with the help of the WiFi module namely ESP8266-01.
There are many types of WiFi modules for Arduino, one of the low cost WiFi modules is the ESP8266-01. With this type of module, you can monitor your measuring instruments by uploading measurement data to your account that has previously registered on the tingspeak website. How to register/create an account is very easy and easy, just register using your e-mail and create a new password for your account on thingspeak. For those of you who don’t know how to create an account, please follow the video we provide on this page at the bottom.

Figure 1. Mosul WiFi ESP8266-01(source Google Images)

Figure 1 is a physical form consisting of 8 pins, a WiFi chip, and can be operated on a 3.3V voltage source given from the reference. But in fact this Wifi module can operate when given a voltage of 5V, we have done it and it works. The following is a schematic drawing of the pins for the ESP8266-01 module.

Figure 2. ESP8266-01 pin out schematic (source Google Image)

In Figure 2 is the pin out scheme of the ESP8266-01 module which can make it easier for you to use the microcontroller later.
This time we will make a temperature and humidity measurement tool using DHT11 which is connected via a microcontroller and ESP of course. Please prepare some of the tools used by us:

  1. ESP8266-01 . Module
  2. Arduino Nano/UNO/minimum system
  3. DHT11
  4. Breadboard
  5. Female and male connecting cable
If you already have all 5 of these tools, we suggest as soon as possible to make a series like the picture below.

Figure 3. Circuit schematic

Figure 3 is a schematic of the circuit we are using. For the blue cable, it is connected to the Arduino D4 pin, while the Arduino D2 and D3 pins will be used as pins (RX, TX). It is hoped that those of you who follow please carefully so that there are no failures in learning. What we provide has been proven that the scheme works.
Note: to connect the ESP board to the arduino please follow the instructions b
Arduino NANO PIN
If you have connected the DHT11 and ESP8266-01 sensors to the arduino nano board, the next step is to make a program on the arduino nano using software Sketch IDE. Our advice for those of you who already have a sketch IDE, please update to version 1.8.7 to make it easier for you in this project. Please download on the official website arduino.cc software is open source.
Please follow or you can download the program at the link we have provided at the bottom.
//project IoT
#include //Library esp8266
#include //Library DHT11
//initialize digital pin
#define RX 2 //arduino D2 pin as RX
#define TX 3 //arduino D3 pin as TX
String AP = “********”; //please enter WiFi name
String PASS = “********”; //please enter the WiFi password
API String = “CD9A8TNHK4MTVII6”;   // Api key on thingspeak account
String HOST = “api.thingspeak.com”; //Tingspeak website
String PORT = “80”; //PORT thingspeak
//initialize sending data
String field1 = “field1”;  //address for sending data Temperature DH11
String field2 = “field2”; //address for sending humidity data DH11
int countTrueCommand;
int countTimeCommand;
boolean found = false;
//declare a variable of a value
int valSensor1 = 1;
int valSensor2 = 1;
SoftwareSerial esp8266(RX,TX); //calling the RX and TX pins
#define DHTPIN 4 //input DHT sensor
#define DHTTYPE DHT11 //type of DHT type used
DHT dht(DHTPIN, DHTTYPE); // dht dialing (D4 pin, DHT type)
void setup()
  Serial.begin(9600);  ///9600 is the serial address for Arduino Nano
  esp8266.begin(115200);//115200 is the serial address for ESP8266-01
  sendCommand(“AT+CWJAP=””+ AP +””,””+ PASS +”””,20,”OK”);
void loop()
  // program uploads each data
  valSensor1 = getSensorData1(); //DHT temperature delivery
  valSensor2 = getSensorData2(); //DHT delivery of kebabs
  // send orders to the thingspeak website account
  String getData = “GET /update?api_key=”+ API +
  “&”+ field1 +”=”+String(valSensor1)+
  “&”+ field2 +”=”+String(valSensor2);
  sendCommand(“AT+CIPSTART=0,”TCP”,””+ HOS
T +””,”+ PORT,15,”OK”);
  sendCommand(“AT+CIPSEND=0,” +String(getData.length()+4),4,”>”);
//DHT11 temperature
int getSensorData1()
  // Read sensor values
   float t = dht.readTemperature();
   //float h = dht.readHumidity();

Mangihin.com is a website that provides useful information, please share if there is interesting information that can help you. Thank you