Overview

This tutorial will help you connect App Inventor with a temperature sensor on an Arduino controller.

Block Diagram:

Pins connection:

About Bluetooth module HC-05:

HC-05 is a Bluetooth module which is designed for wireless communication. It uses serial communication to communicate with devices. HC-05 has a red LED which indicates connection status, whether the Bluetooth is connected or not. Before connecting to the HC-05 module this red LED blinks continuously in a periodic manner. When it gets connected to any other Bluetooth device, its blinking slows down to two seconds.

Robocraze HC05 Bluetooth Transceiver Module with TTL Outputs : Amazon.in:  Computers & Accessories

It is used for many applications like wireless headsets, game controllers, wireless mice, wireless keyboards and many more consumer applications. To communicate smartphone with the HC-05 Bluetooth module, the smartphone requires a Bluetooth terminal application for transmitting and receiving data.

About serial communication:

If the data is sent in series i.e. one after the other then the communication protocol is known as Serial Communication Protocol. In serial communication, data is sent in the form of bits i.e. binary pulses and it is well known that binary one represents the logic HIGH and zero represents the logic LOW.

Serial communication is the most widely used approach to transfer information between data processing peripherals. The protocol is a secure and reliable form of communication having a set of rules addressed by the source host (sender) and destination host (receiver) similar to parallel communication. there are several examples of Serial Communication Protocols such as CAN, ETHERNET, I2C,  RS232, SPI, USB, 1-Wire, SATA etc.

LM-35 Temperature sensor:

   LM35 is a temperature sensor that outputs an analog signal which is proportional to the instantaneous temperature. The output voltage can easily be interpreted to obtain a temperature reading in Celsius. The coating also protects it from self-heating. Low cost and greater accuracy make it popular among hobbyists, DIY circuit makers, and students. Many low-end products take advantage of low cost, and greater accuracy and use LM35 in their products.

LM35 Temperature sensor Features

  • Calibrated Directly in Celsius (Centigrade)
  • Linear + 10-mV/°C Scale Factor
  • 0.5°C Ensured Accuracy (at 25°C)
  • Rated for Full −55°C to 150°C Range
  • Suitable for Remote Applications
  • Operates from 4 V to 30 V
  • Less than 60-µA Current Drain
  • Low Self-Heating
  • Non-Linearity Only ±¼°C Typical

Step by step execution process:

Step 1: Open the MIT app inventor website and click on “create apps”.

Step 2: Choose the option to start a new project, the window is shown below figure.

Step 3: In the designer section, start building the app interface.

Step 4: First select the “list picker” in the palette window and drag and drop in the mobile window and modify the interface by changing the properties in the window.

Step 5: Now select “layout” in the palette and drop them in the mobile window and modify them using properties.  

Step 6: Next drag and drop the buttons in the mobile window and modify them, by using the properties window.  

Step 7: In the blocks section, build the functional blocks of the app, the window is As shown below figure.

Step 8: Build and download the .apk file and install it on a mobile device.

Step 9: Now connect the Bluetooth module’s VCC to the +5v microcontroller and also the ground pins.  

Step 10: Connect the Bluetooth Tx pin to the Rx of the microcontroller and the Rx pin to the Tx pin of the microcontroller.  

Step 11: Connect the digital pins 0 and 1 to the Bluetooth module.

Step 12: Write the code in the Arduino.

Step 13: Upload the final code and open the app on mobile.

Step 14: Connect to the Bluetooth and verify the output by turning on and off the sensor through the app, the app interface will look as shown below figure.

Final code:

float temp;
int tempPin = 0;
char incomingvalue=0;

void setup() 
{
   Serial.begin(9600);
}

void loop()
{
   temp = analogRead(tempPin);
   // read analog volt from sensor and save to variable temp
   temp = temp * 0.48828125;
   // convert the analog volt to its temperature equivalent
   if(Serial.available()>0)
   incomingvalue=Serial.read();
  
   if(incomingvalue=='1')
   {
   Serial.print("TEMPERATURE = ");
   Serial.print(temp); // display temperature value
   Serial.print("*C");
   Serial.println();
   delay(1000); // update sensor reading each one second
   }
  else if(incomingvalue=='0')
    
   Serial.print(" ");
  }

Output images:

By Devilal

Leave a Reply

Your email address will not be published. Required fields are marked *