Soil moisure + E-Mail | ESP8266 | IFTT - Black keyhole

welcome to our keyhole, we provide you various knowledge from various sources such as Electric&Electronic, Health, Arduino, IOT, Diy projects, A/l past paper and model paper, Even though you can keep in touch with current technology

Soil moisure + E-Mail | ESP8266 | IFTT

Share This

In this project, We will learn how to make HTTP POST request using ESP8266 NodeMCU with Arduino IDE. Here will use IFTT as Server side. If you didn't see my previous tutorial about how to make voice controll home automation using IFTT, can check from above link.

Components that I have used
      1. Soil moisture sensor

      3.Jumper wires

You can make Bussiness queries by using the business queries section. You can find that at the bottom of this page

  • You can make queries related to place ads, product placement, and advertising
  • make project queries related to DIY project section (college and school students for their projects) 


      NodeMCU  ___________  Soil moisture sensor

           VV ______________  VCC

           GND _____________ GND

            A0  _______________ A0

Creating an IFTTT Account

If you don’t have an IFTTT account, go the IFTTT website: and enter your email address to create an account and get started.

Next you need to create a new applet. follow my steps bellow that I have given.
     1. Open the left menu in the IFTT website and click the “Create” button

      2. Then Click on this word. Search for webhooks service and select it.

        3. Choose the “Receive a web request” trigger and give a name to the event.
In this case, I’ve typed “soil_moisture”. Then, click the “Create trigger” button.

4. Click the “that” word to proceed. Now, define what happens when the event you’ve defined is triggered. Search for the “Email” service and select it. In my case I have used Soil moisture sensor to get the data. So I used three values to determine the Soil moisture. In the first value box will show the current state of soil moisture and another two box will show threshold value of soil moisture.

5. Press the “Finish” button to create your Applet.

 Before proceed with  another step, make sure to verify that your applet is working proper.
            1.  Search for Webhooks service or open this link:

            2.  Click the Documentation button of Webhooks service

            3. you can see a web page with the API key. keep that API key as secret. You will have that in the future steps.

            4. Fill the “To trigger an Event” section. Then, click the “Test it” button.

            5. The event, when it should be sucessfully triggered you will see a message with the caption of “Event has been triggered".

Click here to see the soil moisture using blynk
           6. Go to your Email account. You should have a new email in your inbox from the IFTTT service with the values you’ve defined in the previous step.

Download the code from bellow image

  Code Explanation
     After finish the above steps, Download the code from above image.Before upload the code You need to do some change in your code. Also you have to check that you already installed the ESP8266 board in your Arduino IDE.

Setting your network credentials

     Modifiy with your correct WIFI name and password

const char* ssid = "wifi name";
const char* password = "password";


Setting your API Key

   Insert your event name and API key in the following line of code. The API key where you copied from previous steps.

const char* serverName = "

 Pin declaration

   Here I have defined the pin and output variable 
 int sensorpin=A0;
int sensorvalue=0;
int outputvalue=0;


In the loop() is where you make the HTTP POST request every 10 seconds with sample data


      // Data to send with HTTP POST
      String httpRequestData = "value1=" + String(outputvalue) + "&value1=" + 
String(74)  + "&value1=" + String(40);        //these last two values will
 indicate the dry and moisure threshe hold values   
      // Send HTTP POST request
      int httpResponseCode = http.POST(httpRequestData);

 if you want to check my previous tutorial with ESP8266Asynchronous webserver click here

Measure the soil moisture 
    following line of codes explain the sensor reading from soil.

  outputvalue=map(sensorvalue,0,1023,0,100); //100,0 pottupaaru

The ESP8266 makes a new URL encoded request to publish value of Soil moisure. The first value box is representing the Current moisture level of Soil. and another two box are representing thresh hold value between dry and moisure.

String httpRequestData = "value1=" + String(outputvalue) + "&value1=" + String(74)  
"&value1=" + String(40);

Finally select the correct COM port and select your board type then click the upload  button. when upload procces finish open your Serial monitor, you will find message printing the HTTP response code 200 indicating that the request has succeeded.

Now you check your Email, you will have mail as bellow

watch the tutorial from You Tube


  1. I'm unable to access the code via the image provided. Please help!

  2. Do you appreciate working with new Mail Order vendors and opportunity searchers? In the event that your answer is "YES" to these inquiries, it would presumably be beneficial and pleasurable for you to begin a "Major Mail" administration. email marketing


business queries