University Institute of Engineering Department of Computer Science & Engineering
University Institute of Engineering Department of Computer Science & Engineering
Experiment: 2
Semester:2nd
1. Aim of the practical: Design a Cloud based weather monitoring system using IoT platform
and relevant sensors.
The BMP280 sensor integrates atmospheric pressure, temperature and relative humidity sensors
in a single device, with great precision, low energy consumption and an ultra compact format.
Based on BOSCH piezo-resistive technology with great EMC robustness, high precision and
linearity, as well as long-term stability.
Ubidots is a codeless IoT Platform designed to empower us to prototype and scale IoT projects
to production, whilst improving and economizing the world around us with sensor data. It is a
virtual representation of a data-source or simply, an asset taking sensor data and transmitting
said data through a connection protocol to Ubidots' cloud.
#include <Adafruit_BMP280.h>
Arduino library for BMP280 sensors.
#include <UbidotsESPMQTT.h>
MQTT library for connecting to Ubidots using MQTT protocol and an ESP32 board.
MQTT(Message Queuing Telemetry Transport) is a standard messaging protocol for the
Internet of Things(IOT). It is ideal for connecting remote devices with a small code footprint
and minimal network bandwidth.
Subject Name: Disruptive Technologies-2. Subject Code: 22ECH-103
University Institute of Engineering
Department of Computer Science & Engineering
Adafruit_BMP280 bmp280;
Creating on object BMP for Adafruit_BMP280. An object file is created to access special
functions.
Ubidots client(TOKEN);
Initialize the instance.
4. Code:
/*
* Board: DOIT ESP32 DEVKIT v1
*
* BMP280 - https://components101.com/sensors/gy-bmp280-module
* BMP280 Library - https://github.com/adafruit/Adafruit_BMP280_Library
* ArduinoSensor Library - https://github.com/adafruit/Adafruit_Sensor
Subject Name: Disruptive Technologies-2. Subject Code: 22ECH-103
University Institute of Engineering
Department of Computer Science & Engineering
#include <Adafruit_BMP280.h>
#include <UbidotsESPMQTT.h>
#define BMP_SDA 21
#define BMP_SCL 22
Adafruit_BMP280 bmp280;
Ubidots client(TOKEN);
void setup() {
Serial.begin(9600);
Serial.println("Init... T2_Weather");
Serial.println("Initializing BMP280");
boolean status = bmp280.begin(0x76);
Subject Name: Disruptive Technologies-2. Subject Code: 22ECH-103
University Institute of Engineering
Department of Computer Science & Engineering
if (!status) {
Serial.println("BMP280 Not connected!");
}
Serial.println("Done");
Serial.println("DONE");
}
void loop() {
// Acquiring data from BMP280
float temperature = bmp280.readTemperature();
float pressure = bmp280.readPressure();
//float altitude = bmp280.readAltitude();
//float water_boiling_point = bmp280.waterBoilingPoint(pressure);
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" Pa");
//Serial.print("Altitude: ");
//Serial.print(altitude);
Subject Name: Disruptive Technologies-2. Subject Code: 22ECH-103
University Institute of Engineering
Department of Computer Science & Engineering
//Serial.println(" m");
//Serial.print("Water Boiling Point: ");
//Serial.print(water_boiling_point);
//Serial.println(" F");
1. connectivity of IoT modules with cloud for sensor data collection and management.
3. ESP32 working