top of page
Writer's pictureRamesh G

Arduino Nano Based Weather Monitor with Bluetooth HC-05

Updated: Nov 27, 2021


In this tutorial shows how to connect BMP280 barometric pressure, temperature and altitude sensor interface to Arduino Nano board with Bluetooth HC-05 and android application for output monitor.





Circuit Diagram

Components Required

Arduino Nano - 1 no

Bluetooth module HC-05 - 1no

BMP 280 - 1no


BMP280 Pressure Sensor Module:

The GY-BMP280 Barometer Sensor is a breakout board for Bosch BMP280 high-precision and low-power digital barometer. It can be used to measure temperature and atmospheric pressure accurately. It can be connected to a microcontroller with I2C.


Applications of GY-BMP280 Module


  • Enhancement of GPS navigation (e.g. time-to-first-fix improvement, dead-reckoning, slope detection)

  • Indoor navigation (floor detection, elevator detection)

  • Outdoor navigation, leisure and sports applications

  • Weather forecast, Home weather stations

  • Health care application (e.g. sirometry)

  • Vertical velocity indication (e.g. risk/sink speed)

  • Handsets such as mobile phones, tablet PCs, GPS devices

  • Flying toys

  • Watches

Bluetooth HC-05 Module

HC-05 is a Bluetooth module which is designed for wireless communication. This module can be used in a master or slave configuration. Bluetooth serial modules allow all serial enabled devices to communicate with each other using Bluetooth.


It has 6 pins,


1.Key/EN: It is used to bring Bluetooth module in AT commands mode. If Key/EN pin is set to high, then this module will work in command mode. Otherwise by default it is in data mode. The default baud rate of HC-05 in command mode is 38400bps and 9600 in data mode.

HC-05 module has two modes,

Data mode: Exchange of data between devices.

Command mode: It uses AT commands which are used to change setting of HC-05. To send these commands to module serial (USART) port is used.

2. VCC: Connect 5 V or 3.3 V to this Pin.

3. GND: Ground Pin of module.

4. TXD: Transmit Serial data (wirelessly received data by Bluetooth module transmitted out serially on TXD pin)

5. RXD: Receive data serially (received data will be transmitted wirelessly by Bluetooth module).

6. State: It tells whether module is connected or not.


HC-05 module Information

HC-05 has red LED which indicates connection status, whether the Bluetooth is connected or not. Before connecting to 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.


This module works on 3.3 V. We can connect 5V supply voltage as well since the module has on board 5 to 3.3 V regulator.


As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V level, so, no need to shift transmit level of HC-05 module. But we need to shift the transmit voltage level from microcontroller to RX of HC-05 module.


HC-05 Default Settings

  • Default Bluetooth Name: “HC-05”

  • Default Password: 1234 or 0000

  • Default Communication: Slave

  • Default Mode: Data Mode

  • Data Mode Baud Rate: 9600, 8, N, 1

  • Command Mode Baud Rate: 38400, 8, N, 1

  • Default firmware: LINVOR


Installing the Arduino Library

Download Adafruit_BMP280_Library , we need to use this library.

Follow the next steps to install those libraries.


In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded.


After installing the required libraries, copy the following code to your Arduino IDE.


Subscribe and Download code.

Download Android application.


Mobile Output

First open Mobile application BMP280 and select Bluetooth image, after that select bluetooth HC-05 device to connect and enter Password as mentioned above (0000 or 1234).



Arduino Code

#include <Wire.h>

#include <SPI.h>

#include <Adafruit_BMP280.h>


Adafruit_BMP280 bmp; // I2C

Adafruit_Sensor *bmp_temp = bmp.getTemperatureSensor();

Adafruit_Sensor *bmp_pressure = bmp.getPressureSensor();

//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI

//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);


void setup() {

Serial.begin(9600);

Serial.println(F("BMP280 test"));


//if (!bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID)) {

if (!bmp.begin()) {

Serial.println(F("Could not find a valid BMP280 sensor, check wiring or "

"try a different address!"));

while (1) delay(10);

}


/* Default settings from datasheet. */

bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */

Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */

Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */

Adafruit_BMP280::FILTER_X16, /* Filtering. */

Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */

bmp_temp->printSensorDetails();

}


void loop() {

sensors_event_t temp_event, pressure_event;

bmp_temp->getEvent(&temp_event);

bmp_pressure->getEvent(&pressure_event);

// Serial.print(F("Temperature = "));

Serial.print(bmp.readTemperature());

// Serial.println("°C");

Serial.print("|");

// Serial.print(F("Pressure = "));

Serial.print(pressure_event.pressure);

// Serial.println(" hPa");

Serial.print("|");

// Serial.print(F("Approx altitude = "));

Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */

// Serial.println(" m");

Serial.print("\n");

delay(1000);

}

Recent Posts

See All

1 comentario


qminor
09 feb 2023

Hello. Would this work wirelessly if I were to put it inside a say a balloon or rocket for instance? All I would need is a battery to go with the system correct? 5v or 12 v?

Me gusta
bottom of page