Lesson 10 - The Measurment of Temperature and Humidty with Android Phone

In this lesson, I've explained The Measurment of  Temperature and Humidty with Android Phone. Temperature and humidty datas are tranfered to Android Phone with Bluetooth module (HC-07). I display data with BlueSay2.0 Programs which is programed with Basic for Android (B4A) compailer on Android Phone screen.


Figure 1 - The Measurment of  Temperature and Humidty Circuit and Android Phone

HC Bluetooth Module
HC Bluetooth module has 4 pins to be connected to arduino, they are:
  • RXD : RXD will receive data from arduino
  • TXD : TXD will send data to arduino
  • VCC : VCC is the power supply (3.3V 6.6V)
  • GND : GND is the ground

Figure 2 - HC 07 Bluetooth Module

On my module, as you can see from the photo above, the TX line is rated at 3.3V. This means that even though we can power the module with 5 volts from the Arduino, the communication lines from and to the module are supposed to be at 3.3 volts. Sending data from the Bluetooth module (via the module’s TX pin) will not be an issue, as the Arduino’s RX line will interpret the 3.3V signal from the Bluetooth module correctly. Receiving data from the Arduino is where we need to do more work. The RX line of the Arduino Uno is running at 5V, so we will be sending a higher voltage on the Bluetooth’s module RX line, than suggested by the label. This may damage the Bluetooth module permanently!

You have to pay attention about the RXD level, some modules work with 5V, but this one works with 3.3V, and arduino TX will send a 5V signal, then it needs a voltage divider.


The formula above we have R1 = 1,2 K  R2 = 2,2 K   Vin = 5v. 
Solving for Vout we get: Vout = 5 x 2,2 K / (2,2 K + 1,2 K ) = 5v x 2,2 K / 3,4 K = 3.24 V
Essentially, you can use any combination of resistors, as long as R2 is twice the value of R1.

If you do not have resistors handy, you can use a positive 3.3v voltage regulator. Connect the Input pin of the voltage regulator to the Arduino TX line, the Ground pin to the Arduino Ground and the output pin of the voltage regulator to the JY-MCU RX line.

DHT11 Sensor
DHT11 (Figure 3) digital temperature and humidity sensor is a composite Sensor contains a calibrated digital signal output of the temperature and humidity. Application of a dedicated digital modules collection technology and the temperature and humidity sensing technology, to ensure that the product has high reliability and excellent long-term stability. The sensor includes a resistive sense of wet components and an NTC temperature measurement devices, and connected with a high-performance 8-bit microcontroller.

Figure 3 - DHT 11 Temperature and Humidty Module

Pin Description
1 - the VDD power supply 3.5~5.5V DC
2 - DATA serial data, a single bus
3 - NC, empty pin
4 - GND ground, the negative power

Figure 4 - The Measurment of  Temperature and Humidty Circuit

ARDUINO UNO Program

#include <DHT11.h> //DHT11 library
//Digital Pin defitantion
int pin=2;
DHT11 dht11(pin);
void setup()
{
  Serial.begin(9600);//Serial Communication
}
void loop()
{
  float nem,sicaklik;
  int oku = dht11.read(nem,sicaklik); //reading datas on sensor
  //Read Humidty and send to serial port
  Serial.print(nem, 2);
  Serial.print(",");
  //Read Temperature and send to serial port
  Serial.print(sicaklik, 2);
  Serial.println();
  delay(2000); // Wait 2 Second
}


Basic For Android (B4A)

Android phone program is programing with the compiler "Basic For Android" . The android program name is BlueSay. BluSay 2.0 use the Bluetooth port for reading sensor datas.


Figure 5 - BlueSay 2.0 Program

Program Files
Video of Lesson






Hiç yorum yok:

Yorum Gönder