Salil Abrol
Published © GPL3+

Sense Temperature And Humidity Around You On Just A Click

There is a first short project from my side, which assists you to sense the humidity and temperature around you through the Bluetooth.

BeginnerShowcase (no instructions)30 minutes1,342
Sense Temperature And Humidity Around You On Just A Click

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×10
Bluetooth module
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
LED (generic)
LED (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Bluetooth Terminal

Story

Read more

Schematics

IMG-20160922-WA0001.jpg

Circuit Assembly

Code

Code for the project

C/C++
#include <dht.h>

dht DHT;
#define DHT11_PIN 12 
char junk;
String inputString="";

void setup()                    // run once, when the sketch starts
{
 Serial.begin(9600);            // set the baud rate to 9600, same should be of your Serial Monitor
 pinMode(13, OUTPUT);
}

void loop()
{
  if(Serial.available()){
  while(Serial.available())
    {
      char inChar = (char)Serial.read(); //read the input
      inputString += inChar;        //make a string of the characters coming on serial
    }
    Serial.println(inputString);
    while (Serial.available() > 0)  
    { junk = Serial.read() ; }      // clear the serial buffer
    if(inputString == "a"){         //in case of 'a' turn the LED on
      digitalWrite(13, HIGH); 
      


int chk=DHT.read11(DHT11_PIN);
Serial.print("TEMPERATURE = ");
Serial.println(DHT.temperature);  
Serial.print("HUMIDITY = ");
Serial.println(DHT.humidity);
delay(750);
      
    }else if(inputString == "b"){   //incase of 'b' turn the LED off
      digitalWrite(13, LOW);
    }
    inputString = "";
  }
}

Credits

Salil Abrol
1 project • 0 followers

Comments