Send plant data to the internet with esp8266

Its yours plant data sending to internet

 

Send plant data to the internet with esp8266

Things used in this project

 

Hardware components

HARDWARE LIST
1 DFRobot Gravity: Analog Soil Moisture Sensor For Arduino
1 Arduino UNO
1 Breadboard (generic)
1 Jumper wires (generic)
1 DHT11 Temperature & Humidity Sensor (3 pins)
1 Espressif ESP8266 ESP-01

Software apps and online services

 

Arduino IDE

 

Arduino Web Editor

Story

 

Hello friends ! In this article, we will talk about what is ESP8266, how this wifi module works. We will also measure temperature and humidity with Arduino using this module and send the data to ThingSpeak. Let's have fun and learn 🙂

 

What's in the article? What is ESP8266 Wifi Module? What kind of projects can I do using this module? Is it possible to directly encode the processor inside the ESP8266 without using Arduino? Let's Learn How To Adjust Our Data To See Anywhere You Have Internet Using Arduino Using ESP8266 

What is ESP8266 Wifi Module? What kind of projects can I do using this module?

 

ESP8266 is a WiFi module. With this module, it is possible to connect to wireless networks and to set up a wireless access point. Since the module has its own processor, I / O (input / output) pins on it can be used. This means that we can do projects with the module without Arduino and any similar microcontroller 🙂

 

Materials needed:

Arduino UNObreadboardESP8266 Wifi ModuleDHT11 Temperature and Humidity SensorSoil Moisture sensorMale-to-male jumper cable 

After determining the materials we will use in the application, let's set up our circuit as follows:

 

 

We can write the required Arduino code. You can access the DHT11 library here.

 

I explained how to use thingspeak in my previous article, but now we need to open field 1 field2 and field 3, we opened field 1 and field 2 in my previous article, now let's go to the settings and activate field 3 then copy our write api key from the api keys.

 

 

Schematics

 

schematic

 

 

shematic file

icon esp8266_project_JEFLv34nHP.zip 37KB Download(2)

Code

 

CODE
#include <SoftwareSerial.h>
#include <dht11.h>                                            
#define ldrPIN 1
String agAdi = "Your network name";                 
String agSifresi = "Your network password ";

const int prob = A0;
int rxPin = 10;                                               
int txPin = 11;                                              
int dht11Pin = 2;
int olcum_sonucu;
int light = 0;

String ip = "184.106.153.149";                               //please dont change ip 
float sicaklik, nem;

dht11 DHT11;

SoftwareSerial esp(rxPin, txPin);                             

void setup() {

  Serial.begin(9600);  
  Serial.println("Started");
  esp.begin(115200);                                          
  esp.println("AT");                                          
  Serial.println("AT send ");
  while (!esp.find("OK")) {                                 
    esp.println("AT");
    Serial.println("ESP8266 Not find.");
  }
  Serial.println("ok command received");
  esp.println("AT+CWMODE=1");                                 
  while (!esp.find("OK")) {                                   
    esp.println("AT+CWMODE=1");
    Serial.println("setting ...");
  }
  Serial.println("Set as client");
  Serial.println("connecting to network");
  esp.println("AT+CWJAP=\"" + agAdi + "\",\"" + agSifresi + "\""); 
  while (!esp.find("OK"));                                    
  Serial.println("Connected to the Network.");
  delay(1000);
}
void loop() {
  esp.println("AT+CIPSTART=\"TCP\",\"" + ip + "\",80");       
  if (esp.find("Error")) {                                    
    Serial.println("AT+CIPSTART Error");
  }
  DHT11.read(dht11Pin);
  sicaklik = (float)DHT11.temperature;
  nem = (float)DHT11.humidity;
  olcum_sonucu = (float)analogRead(prob);
  light = map(analogRead(ldrPIN), 1023, 0, 0, 100);
  String veri = "GET https://api.thingspeak.com/update?api_key=YOUR Api Key here";   
  veri += "&field1=";
  veri += String(sicaklik);                                               
  veri += "&field2=";
  veri += String(nem);                                                 
  veri += "&field3=";
  veri += String(olcum_sonucu);
  veri += "\r\n\r\n";
  esp.print("AT+CIPSEND=");                                   
  esp.println(veri.length() + 2);
  delay(2000);
  if (esp.find(">")) {                                        
    esp.print(veri);                                          
    Serial.println(veri);
    Serial.println("data send.");
    delay(1000);
  }
  Serial.println("Connection Closed.");
  esp.println("AT+CIPCLOSE");                                
  delay(1000);                                              
}

The article was first published in hackster, January 1,  2021

cr: https://www.hackster.io/seyyidahmedtopbas/send-plant-data-to-the-internet-with-esp8266-2a9147

author: seyyidahmedtopbas

License
All Rights
Reserved
licensBg
0