Project showcase
Temperature and humidity meter (iot)

Temperature and humidity meter (iot) © GPL3+

Measuring temperature and humidity with Arduino and uploading it to the server

  • 8,863 views
  • 1 comment
  • 16 respects

Components and supplies

Apps and online services

About this project

I wanted to check the temperature and humidity of the house on the internet anytime and anywhere.

IOT technology was used to measure the temperature and humidity values ​​of the temperature and humidity sensor and to design a device for uploading the internet through the WiFi module

Code

Temperature and humidity meter (iot) codeArduino
Temperature and humidity meter (iot) code
#include <SoftwareSerial.h>
#include <stdlib.h>
#include <DHT.h>
 
#define DHTPIN 4        // Set the SDA pin
#define DHTTYPE DHT11   // DHT22 (AM2302) Sensor type setting(I'm used dht11)
 
// Upload notification LED setting (Adunono On Board LED)
int ledPin = 13;
 
// Write API key for your own thingspeak channel
String apiKey = "your thingspeak channel Write API key";
 
SoftwareSerial ser(10,11 ); // Create RX / TX, create serial object
DHT dht(DHTPIN, DHTTYPE);
 
void setup() {
  dht.begin();
  // Notification LED output setting
  pinMode(ledPin, OUTPUT);
  // Serial communication speed 9600 baud rate setting
  Serial.begin(9600);
  // Start the software serial
  ser.begin(9600);
  //ESP8266 Reset
  ser.println("AT+RST");
}
 
void loop() {
  // blink LED on board
  digitalWrite(ledPin, HIGH);   
  delay(200);               
  digitalWrite(ledPin, LOW);
 
  // Read DHT11 value
  float temp = dht.readTemperature();
  float humi = dht.readHumidity();
 
  // Convert String
  char buf[16];
  String strTemp = dtostrf(temp, 4, 1, buf);
  String strHumi = dtostrf(humi, 4, 1, buf);
  
  Serial.println(strTemp);
  Serial.println(strHumi);
  
  // TCP connection
  String cmd = "AT+CIPSTART=\"TCP\",\"";
  cmd += "184.106.153.149"; // api.thingspeak.com connection IP
  cmd += "\",80";           // api.thingspeak.com connection port, 80
  ser.println(cmd);
   
  if(ser.find("Error")){
    Serial.println("AT+CIPSTART error");
    return;
  }
  
  // Set String, Data to send by GET method
  String getStr = "GET /update?api_key=";
  getStr += apiKey;
  getStr +="&field1=";
  getStr += String(strTemp);
  getStr +="&field2=";
  getStr += String(strHumi);
  getStr += "\r\n\r\n";
 
  // Send Data
  cmd = "AT+CIPSEND=";
  cmd += String(getStr.length());
  ser.println(cmd);
 
  if(ser.find(">")){
    ser.print(getStr);
  }
  else{
    ser.println("AT+CIPCLOSE");
    // alert user
    Serial.println("AT+CIPCLOSE");
  }
    
  // Thingspeak delay to meet minimum upload interval of 15 seconds
  delay(16000);  
}

Schematics

Temperature and humidity meter (iot)
Temperature and humidity meter (iot)
 schem szfv3pw3k4

Comments

Similar projects you might like

IOT Humidity And Temperature Display

Project tutorial by Patel Darshil

  • 8,004 views
  • 0 comments
  • 19 respects

Temperature and Humidity Data Logger

Project tutorial by Wimpie van den Berg

  • 30,126 views
  • 2 comments
  • 27 respects

Temperature Streaming with Arduino + Big Data Tools

Project showcase by Gabriel Rodriguez

  • 9,030 views
  • 1 comment
  • 34 respects

Air Meter Making #4: Complete

Project tutorial by 4 developers

  • 4,712 views
  • 2 comments
  • 9 respects

Temperature and Humidity Logger (Using Arduino)

Project showcase by lmsousa

  • 12,223 views
  • 8 comments
  • 38 respects
Add projectSign up / Login