To send data from an Arduino to a smartphone via Bluetooth, you will need a Bluetooth module, such as the HC-06, and a smartphone with Bluetooth capabilities. Here is a general overview of the process:
To send temperature data measured by a DHT11 sensor from an Arduino to a smartphone via Bluetooth, you will need the following components:
Here is a general overview of the process:
In this tutorial we will see how to send the temperature value of the DTH11 sensor to the smarthpone via bluetooth.
This is why we are going to create two programs: a mobile application with App Inventor for the smartphone and a program for the Arduino board.
Arduino UNO
The Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button. It is commonly used for DIY electronics projects and for controlling a variety of devices. The board can be programmed with the Arduino IDE (Integrated Development Environment) software, which is a simple programming language based on C/C++.
The HC-06 Bluetooth module is a small, inexpensive device that allows for wireless communication between electronic devices using the Bluetooth protocol. It can be used to connect microcontrollers such as an Arduino to a smartphone or computer, allowing for wireless control or data transfer.
The HC-06 module operates as a slave device and can be configured to work with a wide range of baud rates. It can be powered by a voltage between 3.3V and 6V and consumes very low power. It supports both AT and transparent transmission mode.
It can be easily interfaced with microcontroller using UART communication. The HC-06 module can be used to implement wireless control and monitoring of various electronic projects, and it can be easily integrated into existing projects to add wireless functionality.
DTH11 sensor
The DHT11 is a low-cost temperature and humidity sensor that can be used to measure the ambient temperature and humidity in a given environment. It is commonly used in home automation and weather station projects.
The DHT11 sensor has three pins: Vcc, Gnd, and Data. The Vcc pin should be connected to a 3-5V power source, the Gnd pin should be connected to ground, and the Data pin should be connected to a digital input pin on a microcontroller such as the ESP32. The sensor uses a single-wire communication protocol to send the temperature and humidity data to the microcontroller.
The DHT11 sensor can measure temperature in the range of 0-50°C (32-122°F) with an accuracy of ±2°C (±4°F) and humidity in the range of 20-80% with an accuracy of ±5%. The sensor takes about 2 seconds to measure and update the data.
Test plate
A test plate is a type of device used in robotics to test the functionality and performance of various components or systems. It is typically a physical platform or structure that is designed to hold and support various test items or devices, such as sensors, actuators, motors, or other types of mechanical or electrical components. Test plates can be used to simulate different environments or conditions, such as temperature, humidity, vibration, or other factors, in order to evaluate the performance of the components or systems being tested. They can also be used to perform a variety of diagnostic or diagnostic tests, such as stress testing, endurance testing, or other types of evaluations.
Connecting wires
Wires are used to transmit electrical signals and power to various components such as motors, sensors, and microcontrollers. It’s important to properly route and secure the wires to prevent tangles and damage. There are several methods for doing this, including using cable ties, clamps, and wire looms. It’s also a good idea to use different colors or labeling to identify the different wires and their functions. When connecting wires in a robot, it’s important to follow proper safety procedures, such as using the correct wire stripper and connectors, and wearing protective equipment such as gloves and safety glasses.
Here is the program that allows you to connect the Arduino board to the smartphone and send a message containing the temperature value measured by the DHT11 sensor via bluetooth.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include <SoftwareSerial.h> #include <dht11.h> #define DHT11PIN 4 // broche DATA -> broche 4 dht11 DHT11; SoftwareSerial hc06(2,3); void setup(){ hc06.begin(9600); } void loop(){ DHT11.read(DHT11PIN); delay(1000); hc06.print((float)DHT11.temperature); //sends the temperature value to the smartphone } |
We will create a mobile application named ‘temperature_arduino’ with App Inventor which allows you to receive a message from the Arduino board.
We propose to create the design of the application, with the following visual:
To program the application, App Inventor offers us to use the Blocks space, which allows you to create a program in the form of a block diagram. Very easy to use but requiring a little programming logic.
Here is the program of the application created in the Blocks area of the Inventor App:
lee 08-11-2222
i've got " Compilation error: dht11.h: No such file or directory" . kindly help
Med Ali 08-11-2222
you need imorpt dht11 librairy from Internet
Wilma 22-10-2222
Excellent blog you have got here.. It's hard to find high-quality writing like yours nowadays. I really appreciate individuals like you! Take care!!