Header Ads Widget

HOW SEND ESP32 DATA TO THINGSPEAK WEBSITE IN TELUGU

 Hi guys, in this section we know about how to send ESP32  data to thingsepak website in Telugu

for more details about this project, watch below video 



BUY ESP32 :

ESP32-WROOM    BUYNOW

ESP32 DEVKIT     BUYNOW

 ESP32 DHT11 TO THINGSPEAK  CODE:


 #include <WiFi.h>

#include "ThingSpeak.h"

#include <DHT.h> 


const char* ssid = "your ssid";     

const char* password = "your password";  


WiFiClient  client;


unsigned long Channel_ID = enter your channel number;

const char * API_Key = "your api key "; 


unsigned long last_time = 0;

unsigned long Delay = 10000;


// Variables to store sensor readings

float temperature;

float temperaturef;

float humidity;

#define DHTPIN 13          

DHT dht(DHTPIN, DHT11);

 void initBME(){

    if (isnan(temperature) || isnan(humidity))  {

   Serial.println("Failed to read from DHT sensor!");

    while (1);

  }

}


void setup() {

  Serial.begin(115200);  

       dht.begin();

  

  WiFi.mode(WIFI_STA);   

  

  ThingSpeak.begin(client); 

}


void loop() {

  if ((millis() - last_time) > Delay) {

    

    // Connect or reconnect to WiFi

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

      Serial.print("Connecting...");

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

        WiFi.begin(ssid, password); 

        delay(5000);     

      } 

      Serial.println("\nConnected.");

    }


    // Obtaining a new sensor reading for all fields

    temperature = dht.readTemperature();

    Serial.print("Temperature (ºC): ");

    Serial.println(temperature);

    humidity = dht.readHumidity();

    Serial.print("Humidity (%): ");

    Serial.println(humidity);

  

    

    ThingSpeak.setField(1, temperature);

    ThingSpeak.setField(2,humidity );

    

   int Data = ThingSpeak.writeFields(Channel_ID, API_Key);


    if(Data == 200){

      Serial.println("Channel updated successfully!");

    }

    else{

      Serial.println("Problem updating channel. HTTP error code " + String(Data));

    }

    last_time = millis();

  }

}

DOWNLOAD ESP32 DHT11 TO THINGSPEAK  CODE BY  CLICK HERE 

ESP32 HALLSENSOR TO THINGSPEAK  CODE:

#include <WiFi.h>
#include "ThingSpeak.h"


const char* ssid = "your ssid";     
const char* password = "your password";  

WiFiClient  client;

unsigned long Channel_ID = enter your channel number;
const char * API_Key = "your api key "; 

unsigned long last_time = 0;
unsigned long Delay = 10000;
float hval;

void setup() {
  Serial.begin(115200);  
      
  
  WiFi.mode(WIFI_STA);   
  
  ThingSpeak.begin(client); 
}

void loop() {
  if ((millis() - last_time) > Delay) {
    
    // Connect or reconnect to WiFi
    if(WiFi.status() != WL_CONNECTED){
      Serial.print("Connecting...");
      while(WiFi.status() != WL_CONNECTED){
        WiFi.begin(ssid, password); 
        delay(5000);     
      } 
      Serial.println("\nConnected.");
    }

    // Obtaining a new sensor reading for all fields
    hval = hallRead();
    Serial.print("hall sensor value = ");
    Serial.println( hval);
    ThingSpeak.setField(1,  hval);
  
    
   int Data = ThingSpeak.writeFields(Channel_ID, API_Key);

    if(Data == 200){
      Serial.println("Channel updated successfully!");
    }
    else{
      Serial.println("Problem updating channel. HTTP error code " + String(Data));
    }
    last_time = millis();
  }
}
DOWNLOAD ESP32 HALLSENSOR TO THINGSPEAK  CODE BY CLICK HERE 

If you have any doubts regarding to this project, contact me on Instagram or comment on YouTube video. I will help with my best.

Post a Comment

0 Comments