0% found this document useful (0 votes)
51 views

University Institute of Engineering Department of Computer Science & Engineering

1. The student designed a cloud-based weather monitoring system using an ESP32 microcontroller, BMP280 sensor, and Ubidots IoT platform to measure and transmit temperature and pressure data. 2. The system uses an Arduino code to read sensor values and transmit them to Ubidots via WiFi. 3. The student learned about connecting IoT devices to the cloud, designing an app with Bluetooth/WiFi connectivity, programming ESP32 microcontrollers, and using the Ubidots IoT platform.

Uploaded by

Pragnya Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

University Institute of Engineering Department of Computer Science & Engineering

1. The student designed a cloud-based weather monitoring system using an ESP32 microcontroller, BMP280 sensor, and Ubidots IoT platform to measure and transmit temperature and pressure data. 2. The system uses an Arduino code to read sensor values and transmit them to Ubidots via WiFi. 3. The student learned about connecting IoT devices to the cloud, designing an app with Bluetooth/WiFi connectivity, programming ESP32 microcontrollers, and using the Ubidots IoT platform.

Uploaded by

Pragnya Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

University Institute of Engineering

Department of Computer Science & Engineering

Experiment: 2

Student Name: Errolla Pragnya UID: 22BAI71029


Branch: C.S.E AI&ML Section/Group:109-B

Semester:2nd

1. Aim of the practical: Design a Cloud based weather monitoring system using IoT platform
and relevant sensors.

2. Tool Used:BMP280, ESP32, UBIDOTS, Resistors, Breadboard, Arduino, Connecting wires,


capacitor

3. Basic Concept/ Command Description:

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

#define BMP_SDA 21 //Serial data pin


#define BMP_SCL 22 //Serial clock pin

#define TOKEN "…………………." // Your Ubidots TOKEN


A Token is a unique key that authorizes your device to interact with Ubidots API. A Device
Token is a unique key that is linked to a single device within Ubidots data base, with either one
or both of the following permissions: Send data: Publish to, or make POST requests to send
data to the device.

#define WIFISSID "……." // Your SSID


A service set identifier (SSID) is a sequence of characters that uniquely names a wireless local
area network. An SSID is sometimes referred to as a "network name." This name allows
stations to connect to the desired network when multiple independent networks operate in the
same physical area.
SSIDs are a sequence of alphanumeric characters (letters or numbers), are case sensitive and
can have a maximum length of 32 characters.

#define WIFIPASS "……….." // Your Wifi Pass


It is a user defined password.

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

* UBIDOTS MQTT Library - https://github.com/brendanvanbreda/ubidots-mqtt-esp


* PubSubClient - https://github.com/knolleary/pubsubclient
*
* CSB -> HIGH for configuring BMP280 to I2C communication mode.
*/

#include <Adafruit_BMP280.h>
#include <UbidotsESPMQTT.h>

#define BMP_SDA 21
#define BMP_SCL 22

#define TOKEN "BBFF-yBlMWYM4OtutrDuoyB9wx4jOv5Gf61" // Your Ubidots TOKEN


#define WIFISSID "JioFiber-718" // Your SSID
#define WIFIPASS "batish123" // Your Wifi Pass

Adafruit_BMP280 bmp280;
Ubidots client(TOKEN);

void callback(char* topic, byte* payload, unsigned int length) {


Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
Serial.print((char)payload[i]);
}
Serial.println();
}

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.print("Connecting to SSID: ");


Serial.print(WIFISSID);
Serial.print(", Password: ");
Serial.println(WIFIPASS);
client.wifiConnection(WIFISSID, WIFIPASS);
Serial.println("Done");

Serial.println(" Initializing Ubidots Connection...");


client.ubidotsSetBroker("industrial.api.ubidots.com"); // Sets the broker properly for the
business account
client.setDebug(true); // Pass a true or false bool value to activate debug
messages
client.begin(callback);
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");

// Establising connection with Ubidots


if (!client.connected()) {
client.reconnect();
}

// Publising data of both variable to Ubidots


client.add("temperature", temperature); // Insert your variable Labels and the value to be sent
client.add("pressure", pressure);
//client.add("altitude", altitude); // Insert your variable Labels and the value to be sent
//client.add("wbp", water_boiling_point);
client.ubidotsPublish("weather-monitoring"); // insert your device label here
client.loop();
delay(5000);
}

5. Observations, Simulation Screenshots and Discussions:

Subject Name: Disruptive Technologies-2. Subject Code: 22ECH-103


University Institute of Engineering
Department of Computer Science & Engineering

6. Result and Summary:


Using ESP32 and BMP280 we designed a circuit that tells about the weather. We named the
system Weathering Monitoring System. Program coding on hardware is done on Arduino and to
calculate the weather the code is connected to stem UBIDOTS. We designed a Cloud based
weather monitoring system using IoT platform and relevant sensors.We learnt connectivity of
IoT modules with cloud for sensor data collection and management and designed an appcessory
with Bluetooth/Wi-Fi connectivity using standard mobile application development tools.

Learning outcomes (What I have learnt):

1. connectivity of IoT modules with cloud for sensor data collection and management.

2. an appcessory with Bluetooth/Wi-Fi connectivity using standard mobile application


development tools.

3. ESP32 working

4. Programming using Arduino

5. Stem UBIDOTS application

Evaluation Grid (To be filled by Faculty):


Sr. Parameters Marks Obtained Maximum Marks
No.
1. Student Performance (task 12
implementation and result evaluation)
2. Viva-Voce 10
3. Worksheet Submission (Record) 8
Signature of Faculty (with Date): Total Marks Obtained: 30

Subject Name: Disruptive Technologies-2. Subject Code: 22ECH-103

You might also like