Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Temperature and Humidity Monitoring On Android Phone Over Bluetooth

By Venu Gopal

In lots of projects, the sensor data has been displayed on LCD modules. In many of them, the data was transferred wirelessly where the receiver section connected with a transmitter section through RF module. The transmitter section had the sensor interfaced to it while the receiver section had the LCD screen interfaced for display and monitoring of the sensor data.
 
This project is a demonstration of monitoring sensor data on the Android phone. The android phone connects via Bluetooth interface with a transmitter section having the sensor circuit. For this purpose, HC-05 Bluetooth module is being used. The sensor used in the project is DHT-11 which relays ambient temperature and humidity values to the microcontroller. The microcontroller digitizes the sensor readings using inbuilt ADC and send them to Android phone via Bluetooth. 
 
On the Android phone, an app Bluetooth Serial Control is used. This app can read data over the Bluetooth interface like a serial monitor application on the desktop computer. The serially read data is displayed within the main activity of the app. 
 
On the transmitter side, the DHT 11 temperature and humidity sensor are interfaced to an Arduino Pro Mini. The Arduino board reads data from the temperature sensor, digitize it and transmit it through the Bluetooth module. The Arduino sketch is written on Arduino IDE and burnt to the board using AVR Dude. 

Components Required – 

1. Arduino Pro Mini
2. DHT-11 Temperature and Humidity Sensor
3. HC-05 Bluetooth Module
4. Breadboard
5. Connecting Wires
6. Android Phone

Software Tools Required – 

1. Arduino IDE
2. AVR Dude
3. Bluetooth Serial Control App

Block Diagram – 

Block Diagram of Arduino Android and Bluetooth Module based Wireless Temperature and Humidity Monitor
 
Fig. 1: Block Diagram of Arduino Android and Bluetooth Module based Wireless Temperature and Humidity Monitor
 

Circuit Connections – 

Prototype of Arduino Android and Bluetooth Module based Wireless Temperature and Humidity Monitor

Fig. 2: Prototype of Arduino Android and Bluetooth Module based Wireless Temperature and Humidity Monitor

The Arduino Pro Mini is the heart of the circuit and controls other modules in the circuit. The different modules are connected to the Arduino Pro Mini in the following manner – 

Power Supply – The circuit is powered by a battery which directly supplies to the Arduino board and the other modules. 
 
DHT-11 Temperature and Humidity Sensor – The DHT -11 sensor reads the ambient temperature and humidity and relays the data to the microcontroller as digital data. The data pin of temperature and humidity sensor DHT11 is connected to pin 5 of the Arduino Pro Mini and VCC and ground are connected to the common VCC and ground. 
 
HC-05 Bluetooth Module – HC-05 Bluetooth module is serial port protocol module. It operates on ISM band 2.4GHz with V2.0+EDR (Enhanced data rate). It can work in both Master and slave modes.  The Bluetooth module has six pins – Enable, VCC, Ground, Transmit Data (TxD), Receive Data (RxD) and State. The Enable and State pin are unused and so not connected in the circuit. The VCC and Ground pins are connected to the common VCC and Ground. The TxD and RxD pins of the module are connected to the Rxd and Txd pins of the Arduino Pro Mini respectively. 

How the circuit works – 

Image showing demonstration of Arduino Android and Bluetooth Module based Wireless Temperature and Humidity Monitor

Fig. 3: Image showing demonstration of Arduino Android and Bluetooth Module based Wireless Temperature and Humidity Monitor

When the circuit is powered on, the Arduino board loads the required libraries and start fetching data from the DHT-11 temperature and humidity sensor. DHT11 Temperature and Humidity Sensor is a digital sensor with inbuilt capacitive humidity sensor and Thermistor. It relays a real-time temperature and humidity reading every 2 seconds. The sensor operates on 3.5 to 5.5 V supply and can read temperature between 0° C and 50° C and relative humidity between 20% and 95%. 

 
The sensor cannot be directly interfaced to a digital pin of the board as it operates on a 1-wire protocol which must be implemented only in the firmware. First, the data pin is configured to input and a start signal is sent to it. The start signal comprises of a LOW for 18 milliseconds followed by a HIGH for 20 to 40 microseconds followed by a LOW again for 80 microseconds and a HIGH for 80 microseconds. After sending the start signal, the pin is configured to digital output and 40-bit data comprising of the temperature and humidity reading is latched out. Of the 5-byte data, the first two bytes are the integer and decimal part of reading for relative humidity respectively, third and fourth bytes are integer and decimal part of reading for temperature and the last one is checksum byte. 
 
For Arduino, standard library for the DHT-11 sensor is already available. The data from the sensor can be easily ready by calling read11() method of the DHT class.
 
The Arduino sketch stores the sensor data in a set of global variables and transfers it to the Bluetooth module in a formatted string via serial communication. The Bluetooth Serial Control app on the android phone must be paired with the Bluetooth module. The Bluetooth module used in the project had a Mac address 05 20:15:01:30:17:25 for its unique identification and a password 1234 for pairing. Other Bluetooth modules also have Mac addresses and password for identification and pairing with other devices respectively. Once the Android phone is paired with the Bluetooth module on the circuit, the serially transmitted data from it is displayed on the main activity of the app.
 
The transmission of sensor data is kept uninterrupted in the project and displays as formatted in the table on the app’s main activity. The project code can also be modified to transmit data on the press of a switch or other event.
 
Check out the program code to learn how the Arduino reads data from the temperature and humidity sensor and transmits it serially through Bluetooth module. 

Programming Guide –

First of all, the Arduino sketch imports the DHT.h library for easy coding the temperature sensor. The library has the functions and methods to deal with the sensor which can be called on an object. An object of DHT type is declared and it is assigned to pin 5 of the Arduino where the data pin of the sensor is connected.
 
#include <dht.h>
dht DHT;
#define DHT11_PIN 5
 
A setup() function is called in which the baud rate for serial communication with the Bluetooth module is set to 9600 bits per second and some initial text strings are passed to the Bluetooth module for testing. If the Bluetooth module and android phone are correctly paired, these messages should be displayed on the main activity of the Bluetooth Serial Control app.
 
The loop() function is called in which the data from the DHT-11 sensor is read by calling read11() method on the DHT object and the sensor data is saved in a variable chk. The read data is checked for error messages in a switch statement. The sensor transmits last byte as the checksum byte. The DHT library has a feature to cross-check the checksum byte with defined string constants. These constants are compared in the switch statement and accordingly error strings are serially transmitted to the Bluetooth module. Finally, the humidity value and the temperature value read by the sensor are serially transmitted to the Bluetooth module. The humidity and temperature values are separated by multiple tabs to give the data a tabular form.
 
The serially transmitted data is received by the Bluetooth Serial Monitor app and displayed on the main activity as it is. 
 
Note: For complete programming details, refer to the code section.
 
This completes the Arduino Sketch for Temperature and Humidity Monitoring On Android Phone Over Bluetooth Project.

Project Source Code

###


#include <dht.h>

dht DHT;

#define DHT11_PIN 5

void setup()

{

  Serial.begin(9600);

  Serial.println(" Engineers Garage ");

  Serial.println("  ");

  Serial.println(" Humidity and Temperature Wireless monitoring using Bluetooth ");

  Serial.println("  ");

  Serial.println("status,tHumidity (%),tTemperature (C)");

}


void loop()

{

  int chk = DHT.read11(DHT11_PIN);

  switch (chk)

  {

    case DHTLIB_OK:  

Serial.print("OK,t t t"); 

break;

    case DHTLIB_ERROR_CHECKSUM: 

Serial.print("Checksum error,t"); 

break;

    case DHTLIB_ERROR_TIMEOUT: 

Serial.print("Time out error,t"); 

break;

    case DHTLIB_ERROR_CONNECT:

        Serial.print("Connect error,t");

        break;

    case DHTLIB_ERROR_ACK_L:

        Serial.print("Ack Low error,t");

        break;

    case DHTLIB_ERROR_ACK_H:

        Serial.print("Ack High error,t");

        break;

    default: 

Serial.print("Unknown error,t"); 

break;

  }


  Serial.print(DHT.humidity, 1);

  Serial.print(",t t t t t t");

  Serial.println(DHT.temperature, 1);

  delay(2000);

}

###


Project Video


Filed Under: Electronic Projects

 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas delivers intelligent sensor solutions for IoT applications
  • Microchip Technology releases AVR-IoT Cellular Mini Development Board
  • Qualcomm acquires Cellwize to accelerate 5G adoption and spur infrastructure innovation
  • MediaTek’s chipset offers high-performance option for 5G smartphones
  • Nexperia’s new level translators support legacy and future mobile SIM cards

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • about ATmega328 ADC pins
  • Tuning the antenna to be conjugately matched to input impedance of the die
  • Netlist physical name update
  • nt1065_USB3 gnss receiver
  • LLC HB with synchronous rectifiers can be very dodgy?

RSS Electro-Tech-Online.com Discussions

  • undefined reference header file in proteus
  • Capacitor to eliminate speaker hum
  • Decapped Chip On Board
  • Sony KV-A2913E (chassis AE1C) auto shuts off after one minute
  • CRT TV repair
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering