Skip to main content

Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad

  Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad Circuit diagram: Arduino Sketch: // C++ code // int moisture_data = 0; void setup() {   pinMode(A0, INPUT);   Serial.begin(9600);   pinMode(12, OUTPUT);   pinMode(6, OUTPUT); } void loop() {   moisture_data = analogRead(A0);   Serial.println(moisture_data);   if (moisture_data < 21) {     digitalWrite(12, HIGH);     digitalWrite(6, HIGH);   } else {     digitalWrite(12, LOW);     digitalWrite(6, LOW);   }   delay(10); // Delay a little bit to improve simulation performance }

Sending sensor data to google sheet using esp32 | How to send sensor data to google sheet

 

ESP32 Publish Sensor Readings to Google Sheets 

In this tutorial, we’re going to learn about how to publish sensor data to Google Sheets using the ESP32 board. As an example, we’ll publish temperature, humidity, readings using the DHT11 sensor to a Google Sheets spreadsheet we’ll be using IFTTT.

Project Overview

  • First, the ESP32 connects to your Wi-Fi network
  • Then, the DHT11 takes the temperature and humidity readings;
  • ESP32 communicates with the IFTTT Webhooks service that publishes the readings to a spreadsheet on Google Sheets that is saved in your Google Drive’s folder

Creating Your IFTTT Account

This project is created by using IFTTT.IFTTT  integrates with Google Sheets. So, the first step is creating an account on IFTTT if you don’t have one. Creating an account on IFTTT is free!

Go to the official site: ifttt.com and enter your email to get started.


Creating an Applet

Now let's see how to create a new applet. Follow the next simple steps to create a new applet:

1. Go to “My Applets” and create a new applet by clicking the “New Applet” button.

2. Click on the “this” word that is in a blue color

3. Search for the “Webhooks” service and select the Webhooks icon.

4. Select the “Receive a web request” trigger.

5. Give a name to the event. Then, click the “Create trigger” button.

6. Click the “that” word to proceed.

7. Now Search for the “Google Sheets”, and select the Google Sheets icon.

8. You need to click the “Connect” button.

9. Select the “Add a row to spreadsheet” action.

10. Rename the spreadsheet. leave the “Formatted row” field as default, and then, choose a Google Drive folder path. If we leave this field empty, IFTTT will create a folder called “IFTTT” in your Google Drive folder to save the spreadsheet. And last click the “Create action” button.


Parts Required

For this project, we’ll use DHT11 sensor readings. Following is the list of parts is needed to build the project.

1.Esp32

2.DHT11

3. Jumper wires

4. Breadboard


Schematics

DHT11 with ESP32

 

Use the Following schematic diagram to connect the DHT11 to the Esp32





Watch the Complete tutorial on Youtube:





Code
After making sure you have the ESP32 board installed on your arduino, you can copy the following Sketch to Arduino IDE.

//This code is edited by Yogesh Bawane  

//for impulsetech Youtube channel https://youtu.be/RpQxJkEZ-fA

//For complete video tutorial visit https://youtu.be/RpQxJkEZ-fA 


#include <WiFi.h>

#include <HTTPClient.h>

#include "DHT.h"


#define LDR_PIN   34

#define DHTPIN    23


//our sensor is DHT11 type

#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);


const char * ssid = "impulsetech";

const char * password = "impulse567";


String server = "http://maker.ifttt.com";

String eventName = "sensor_data";

String IFTTT_Key = "drlqzriADlETJtD04KV_NfpVmzvtAVhrEhUSGNRNnN7";

String IFTTTUrl="https://maker.ifttt.com/trigger/sensor_data/with/key/drlqzriADlETJtD04KV_NfpVmzvtAVhrEhUSGNRNnN7";


int value1;

int value2;

int value3;


void setup() {

  Serial.begin(115200);

  dht.begin();

  WiFi.mode(WIFI_STA);

  WiFi.begin(ssid, password);


  while (WiFi.status() != WL_CONNECTED) {

    delay(500);

    Serial.print(".");

  }

  Serial.println("Viola, Connected !!!");

}


float getLightPercentage(void)

{

  int ldrRawVal;

  float percentage;

  ldrRawVal = analogRead(LDR_PIN);    

  percentage = ((float)((ldrRawVal*100)/4096));

  return percentage;

}


void sendDataToSheet(void)

{

  String url = server + "/trigger/" + eventName + "/with/key/" + IFTTT_Key + "?value1=" + String((int)value1) + "&value2="+String((int)value2) +"&value3=" + String((int)value3);  

  Serial.println(url);

  //Start to send data to IFTTT

  HTTPClient http;

  Serial.print("[HTTP] begin...\n");

  http.begin(url); //HTTP


  Serial.print("[HTTP] GET...\n");

  // start connection and send HTTP header

  int httpCode = http.GET();

  // httpCode will be negative on error

  if(httpCode > 0) {

    // HTTP header has been send and Server response header has been handled

    Serial.printf("[HTTP] GET... code: %d\n", httpCode);

    // file found at server

    if(httpCode == HTTP_CODE_OK) {

      String payload = http.getString();

      Serial.println(payload);

    }

  } else {

    Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());

  }

  http.end();


}


void loop() {

  value1 = dht.readHumidity();

  value2 = dht.readTemperature();

  value3 = getLightPercentage(); 


  Serial.print("Values are ");

  Serial.print(value1);

  Serial.print(' ');

  Serial.print(value2);

  Serial.print(' ');

  Serial.println(value3);

  Serial.print(' '); 


  sendDataToSheet();

  delay(10000);

}



Like share and comment :

                                                     Our FaceBook Page                                                           







For any queries please contact:

impulseTech101@gmail.com


Comments

Popular posts from this blog

Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32

Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32 Hello Everyone! I have come up with new tutorial Water level monitoring system using IoT | IoT based water level using Nodemcu ESP8266 & ESP32 For Code & Circuit Diragram: In this video what you will learn about? 1. How to configure the new Blynk IoT Platform. 2. How to setup web dashboard 3. How to create template in blynk iot 4. How to interface ultrasonic sensor with node mcu esp8266. 5. How to read ultrasonic sensor with esp8266 1.You can Watch Playlist on New Blynk IoT Platfom New Blynk IoT platform with esp32 | how to setup automation in Blynk IoT app https://youtu.be/O2HZuu4KtIc 2.How to create events in blynk IoT platform | events in new Blynk IoT platform 🔥🔥 https://youtu.be/X5zVaGk8QV0 3.IoT Based smart garden monitoring system | Smart plant monitoring using Blynk IoT https://youtu.be/GTdxD5vQwy0 4.Water level monitoring system using IoT | IoT based

Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad

  Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad Circuit diagram: Arduino Sketch: // C++ code // int moisture_data = 0; void setup() {   pinMode(A0, INPUT);   Serial.begin(9600);   pinMode(12, OUTPUT);   pinMode(6, OUTPUT); } void loop() {   moisture_data = analogRead(A0);   Serial.println(moisture_data);   if (moisture_data < 21) {     digitalWrite(12, HIGH);     digitalWrite(6, HIGH);   } else {     digitalWrite(12, LOW);     digitalWrite(6, LOW);   }   delay(10); // Delay a little bit to improve simulation performance }

DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud

DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud   Hello Everyone! I have come up with new tutorial based on the all new Blynk IoT platform. which is DS18B20 Temperature sensor with new Blynk IOT Platform | DS18B20 with Esp32 & Blynk IoT Cloud #iot #blynk In this video what you will learn about? 1. How to configure the new Blynk IoT Platform. 2. How to interface DS18B20 sensor with esp32 4. How to configure mobile blynk IoT platform 5. How to setup Automation in Blynk IoT 1.You can Watch Playlist on New Blynk IoT Platfom New Blynk IoT platform with esp32 | how to setup automation in Blynk IoT app | #iot #blynk #esp32 https://youtu.be/O2HZuu4KtIc 2.How to create events in blynk IoT platform | events in new Blynk IoT platform 🔥🔥 #blynk #esp32 #iot https://youtu.be/X5zVaGk8QV0 3.IoT Based smart garden monitoring system | Smart plant monitoring using Blynk IoT #iot #blynk #esp32 https://youtu.be/GTdxD5vQwy0 4.Water