Send data to smartphone measured by DHT22 sensor connected to Arduino

Arduino UNO 02-01-24
129 0

Tutorial plan

1- How to send temperature and humidity measured by DHT22 sensor to smartphone via Bluetooth ?

2- The components required to use DHT22 sensor and HC-06 Bluetooth module by Arduino

3- Mounting the Arduino board with the DHT22 sensor and HC-06 Bluetooth module

4- Programming the Arduino UNO to display the data measured by the DHT22 sensor on the smartphone

 

 

How to send temperature and humidity measured by DHT22 sensor to smartphone via Bluetooth ?

The DHT22 sensor is a popular digital temperature and humidity sensor used in various electronic projects and applications. Also known as the AM2302, it’s capable of measuring both temperature and humidity with high accuracy and reliability.

To send temperature and humidity measured by DHT22 from an Arduino board to a smartphone via Bluetooth, you can use Bluetooth modules like HC-06 and establish a serial communication link between the Arduino and the smartphone.

Components Needed:

Arduino board (e.g., Arduino Uno)

DHT22 sensor

HC-05 or HC-06 Bluetooth module

Jumper wires

Smartphone with a Bluetooth terminal app (e.g., Arduino Bluetooth Terminal)

Hardware Setup: Connect the Bluetooth module and DHT22 sensor to the Arduino.

Arduino Setup: Upload the necessary program to the Arduino board for sending data

Smartphone Setup:

1- Create a mobile app with App Inventor to receive data from the Arduino board via Bluetooth

2- Install this application on your smartphone

Testing:

1- Upload the Arduino code to your board.

2- Open the serial monitor to see the sensor values (optional).

3- Open the Bluetooth terminal app on your smartphone and connect to the Bluetooth module.

4- You should start receiving temperature and humidity data on your smartphone from the Arduino.

The components required to use DHT22 sensor and HC-06 Bluetooth module by Arduino

To display the temperature and humidity readings from the DHT22 sensor on smartphone using an Arduino, you’ll need the following components:

Arduino UNO Board

Arduino Uno

The Arduino Uno board is a microcontroller board based on the ATmega328P microcontroller. It’s one of the most popular and widely used boards in the Arduino family due to its simplicity and versatility.

It is the central control unit for your project.

HC-06 module bluetooth

HC-06 Bluetooth Module

The HC-06 Bluetooth module is a commonly used serial communication module that enables Bluetooth connectivity for various projects, including Arduino-based systems. It acts as a serial port Bluetooth module, allowing wireless communication between devices.

This module is used for sending the temperature and humidity from the DHT22 sensor to smartphone.

DHT22 sensor:

DHT22

The DHT22 sensor is commonly used in weather stations, environmental monitoring systems, home automation projects, and wherever precise temperature and humidity measurements are required. Its relatively low cost and ease of use contribute to its popularity among hobbyists and professionals alike.

Jumper Wires:

Jumper wires

For making temporary connections and wiring between components.

Breadboard:

Test plate

A breadboard is a useful tool for creating temporary electronic circuits. It allows you to connect components without soldering .

Mounting the Arduino board with the DHT22 sensor and HC-06 Bluetooth module

To assemble the Arduino board with the DHT22 sensor and HC-06 Bluetooth module, follow these steps:

1- Connect the DHT22 Sensor to Arduino:

– (+) pin of DHT22 sensor to 3V3 pin of Arduino

– (-) pin of DHT22 sensor to GND pin of Arduino

– OUT pin of DHT22 sensor to digital pin 2 of Arduino

2- Connect the HC-06 Bluetooth Module to Arduino:

– VCC of HC-06 module to 5V pin of Arduino

– GND of HC-06 module to GND pin of Arduino

– TXD of HC-06 module to pin 6 of Arduino

– RXD of HC-06 to pin 7 of Arduino

Mounting the Arduino board with the DHT22 sensor and HC-06 Bluetooth moduleMounting the Arduino board with the DHT22 sensor and HC-06 Bluetooth module

Programming the Arduino UNO to display the data measured by the DHT22 sensor on the smartphone

Here’s an example Arduino code using the dhtlib library for the DHT22 sensor and SoftwareSerial library for Bluetooth communication:

Arduino Code (Using Arduino IDE):

Use this code to program the Arduino. This code reads data from the DHT22 sensor and sends it via Bluetooth using the HC-06 module.

App Inventor (MIT App Inventor):

MIT App Inventor is a web-based visual development environment that allows users to create mobile applications for Android devices. It uses a drag-and-drop interface, making it accessible for people without extensive programming experience.

Design the mobile application with App Inventor:

1- Open MIT App Inventor and create a new project.

2- Design your app interface. You might have labels to display temperature and humidity :

3- Connect to Bluetooth by adding a BluetoothClient1 component.

The “BluetoothClient1” component in MIT App Inventor allows you to create mobile applications that can connect to Bluetooth devices, such as serial Bluetooth modules (eg HC-06) connected to microcontrollers, Bluetooth audio devices, etc. . This extension facilitates communication with these devices using serial Bluetooth connections.

4- Add buttons or a timer to initiate the Bluetooth connection and data retrieval.

Programming part of the application with App Inventor 

Receive and Display Data:

1- Starting with Android 12, Bluetooth permissions have been enhanced to improve security and user data protection. This is why we must declare the authorizations that your application needs in the AndroidManifest.xml file. For Bluetooth, you’ll need to include ACCESS_FINE_LOCATION, BLUETOOTH_SCAN, and possibly BLUETOOTH_CONNECT permissions, depending on the features you’re using.

2- Add the the necessary blocks to connect the smartphone to the HC-06 Bluetooth module

3- Implement logic to receive data from the Arduino through Bluetooth.

Download project Download application

 

Testing:

1- Power on the Arduino and ensure it’s transmitting data via Bluetooth.

2- Install the app on your smartphone.

3- Open the app, establish a Bluetooth connection, and start receiving and displaying temperature and humidity data from the Arduino.

This integration between Arduino IDE for programming the board and App Inventor for developing the smartphone app allows for a straightforward means of displaying sensor data wirelessly on your phone. Adjustments might be needed based on your specific app design and Bluetooth communication requirements.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info