Danny van den Brande
Published © CC BY-SA

Arduino/Android - Bluetooth HC-06 Module - DHT11

Hello world! Today I made an app to read any text or value from the serial monitor to your Android phone, You can use any sensor.

BeginnerProtip1 hour14,081
Arduino/Android - Bluetooth HC-06 Module - DHT11

Things used in this project

Story

Read more

Schematics

Schematic

Code

Android_Arduino_DHT11_Temp_sensor_and_Android_APP.ino

Arduino
#include "DHT.h"

#define DHTPIN 2     // what digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  Serial.println("BlueCore Tech Temperature and Humidity");

  dht.begin();
}

void loop() {
  // Give it time to calibrate
  delay(20000);

  
  float h = dht.readHumidity();
  // Read Celsius
  float t = dht.readTemperature();
  // Read Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check errors
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  Serial.println("Humidity: ");
  Serial.print(h);
  Serial.println(" %.");
  Serial.println("  ");
  Serial.println("Temperature: ");
  Serial.print(t);
  Serial.println(" Degrees ");
}

Credits

Danny van den Brande

Danny van den Brande

36 projects • 108 followers
"Hello world."

Comments